Add the route to delete a relay

This commit is contained in:
2024-08-31 20:00:40 +02:00
parent 871d5109bf
commit f35aac04f6
5 changed files with 81 additions and 4 deletions

View File

@ -212,3 +212,16 @@ impl Handler<GetSingleRelay> for EnergyActor {
self.devices.relay_get_single(msg.0)
}
}
/// Delete a device relay
#[derive(Message)]
#[rtype(result = "anyhow::Result<()>")]
pub struct DeleteDeviceRelay(pub DeviceRelayID);
impl Handler<DeleteDeviceRelay> for EnergyActor {
type Result = anyhow::Result<()>;
fn handle(&mut self, msg: DeleteDeviceRelay, _ctx: &mut Context<Self>) -> Self::Result {
self.devices.relay_delete(msg.0)
}
}