Add the route to update a relay
This commit is contained in:
@ -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<()>")]
|
||||
|
Reference in New Issue
Block a user