Add missing device information synchronization
This commit is contained in:
		@@ -143,6 +143,23 @@ impl DevicesList {
 | 
				
			|||||||
        Ok(())
 | 
					        Ok(())
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /// Update a device general information
 | 
				
			||||||
 | 
					    pub fn synchronise_dev_info(
 | 
				
			||||||
 | 
					        &mut self,
 | 
				
			||||||
 | 
					        id: &DeviceId,
 | 
				
			||||||
 | 
					        general_info: DeviceInfo,
 | 
				
			||||||
 | 
					    ) -> anyhow::Result<()> {
 | 
				
			||||||
 | 
					        let dev = self
 | 
				
			||||||
 | 
					            .0
 | 
				
			||||||
 | 
					            .get_mut(id)
 | 
				
			||||||
 | 
					            .ok_or(DevicesListError::UpdateDeviceFailedDeviceNotFound)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        dev.info = general_info;
 | 
				
			||||||
 | 
					        self.persist_dev_config(id)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Ok(())
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Update a device general information
 | 
					    /// Update a device general information
 | 
				
			||||||
    pub fn update_general_info(
 | 
					    pub fn update_general_info(
 | 
				
			||||||
        &mut self,
 | 
					        &mut self,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -260,6 +260,7 @@ impl Handler<SynchronizeDevice> for EnergyActor {
 | 
				
			|||||||
    type Result = anyhow::Result<Vec<RelaySyncStatus>>;
 | 
					    type Result = anyhow::Result<Vec<RelaySyncStatus>>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn handle(&mut self, msg: SynchronizeDevice, _ctx: &mut Context<Self>) -> Self::Result {
 | 
					    fn handle(&mut self, msg: SynchronizeDevice, _ctx: &mut Context<Self>) -> Self::Result {
 | 
				
			||||||
 | 
					        self.devices.synchronise_dev_info(&msg.0, msg.1.clone())?;
 | 
				
			||||||
        self.engine.device_state(&msg.0).record_ping();
 | 
					        self.engine.device_state(&msg.0).record_ping();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // TODO : implement real code
 | 
					        // TODO : implement real code
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,7 +36,7 @@ export function EditDeviceRelaysDialog(p: {
 | 
				
			|||||||
    p.relay ?? {
 | 
					    p.relay ?? {
 | 
				
			||||||
      id: "",
 | 
					      id: "",
 | 
				
			||||||
      name: "relay",
 | 
					      name: "relay",
 | 
				
			||||||
      enabled: false,
 | 
					      enabled: true,
 | 
				
			||||||
      priority: 1,
 | 
					      priority: 1,
 | 
				
			||||||
      consumption: 500,
 | 
					      consumption: 500,
 | 
				
			||||||
      minimal_downtime: 60 * 5,
 | 
					      minimal_downtime: 60 * 5,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user