Add missing device information synchronization
This commit is contained in:
parent
9c45e541dd
commit
79b2ad12d8
@ -143,6 +143,23 @@ impl DevicesList {
|
||||
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
|
||||
pub fn update_general_info(
|
||||
&mut self,
|
||||
|
@ -260,6 +260,7 @@ impl Handler<SynchronizeDevice> for EnergyActor {
|
||||
type Result = anyhow::Result<Vec<RelaySyncStatus>>;
|
||||
|
||||
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();
|
||||
|
||||
// TODO : implement real code
|
||||
|
@ -36,7 +36,7 @@ export function EditDeviceRelaysDialog(p: {
|
||||
p.relay ?? {
|
||||
id: "",
|
||||
name: "relay",
|
||||
enabled: false,
|
||||
enabled: true,
|
||||
priority: 1,
|
||||
consumption: 500,
|
||||
minimal_downtime: 60 * 5,
|
||||
|
Loading…
Reference in New Issue
Block a user