Add the route to update a relay

This commit is contained in:
2024-08-31 20:26:16 +02:00
parent b0023a5167
commit bbe128e055
6 changed files with 88 additions and 15 deletions

View File

@ -213,6 +213,19 @@ impl Handler<GetSingleRelay> for EnergyActor {
}
}
/// Update a device relay
#[derive(Message)]
#[rtype(result = "anyhow::Result<()>")]
pub struct UpdateDeviceRelay(pub DeviceRelay);
impl Handler<UpdateDeviceRelay> for EnergyActor {
type Result = anyhow::Result<()>;
fn handle(&mut self, msg: UpdateDeviceRelay, _ctx: &mut Context<Self>) -> Self::Result {
self.devices.relay_update(msg.0)
}
}
/// Delete a device relay
#[derive(Message)]
#[rtype(result = "anyhow::Result<()>")]