Can get the full list of relays through the API
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
use crate::constants;
|
||||
use crate::devices::device::{Device, DeviceGeneralInfo, DeviceId, DeviceInfo};
|
||||
use crate::devices::device::{Device, DeviceGeneralInfo, DeviceId, DeviceInfo, DeviceRelay};
|
||||
use crate::devices::devices_list::DevicesList;
|
||||
use crate::energy::consumption;
|
||||
use crate::energy::consumption::EnergyConsumption;
|
||||
@ -171,3 +171,16 @@ impl Handler<GetSingleDevice> for EnergyActor {
|
||||
self.devices.get_single(&msg.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the full list of relays
|
||||
#[derive(Message)]
|
||||
#[rtype(result = "Vec<DeviceRelay>")]
|
||||
pub struct GetRelaysList;
|
||||
|
||||
impl Handler<GetRelaysList> for EnergyActor {
|
||||
type Result = Vec<DeviceRelay>;
|
||||
|
||||
fn handle(&mut self, _msg: GetRelaysList, _ctx: &mut Context<Self>) -> Self::Result {
|
||||
self.devices.relays_list()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user