Display relay consumption history
This commit is contained in:
@@ -53,7 +53,7 @@ impl EnergyActor {
|
||||
});
|
||||
self.consumption_cache.add_value(latest_consumption);
|
||||
|
||||
let devices_list = self.devices.full_list();
|
||||
let devices_list = self.devices.full_list_ref();
|
||||
|
||||
let mut history =
|
||||
ConsumptionHistoryFile::open(time_secs(), ConsumptionHistoryType::GridConsumption)?;
|
||||
@@ -119,7 +119,21 @@ impl Handler<GetCurrConsumption> for EnergyActor {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get current consumption
|
||||
/// Get relays consumption
|
||||
#[derive(Message)]
|
||||
#[rtype(result = "usize")]
|
||||
pub struct RelaysConsumption;
|
||||
|
||||
impl Handler<RelaysConsumption> for EnergyActor {
|
||||
type Result = usize;
|
||||
|
||||
fn handle(&mut self, _msg: RelaysConsumption, _ctx: &mut Context<Self>) -> Self::Result {
|
||||
self.engine
|
||||
.sum_relays_consumption(&self.devices.full_list_ref())
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if device exists
|
||||
#[derive(Message)]
|
||||
#[rtype(result = "bool")]
|
||||
pub struct CheckDeviceExists(pub DeviceId);
|
||||
|
Reference in New Issue
Block a user