Display relays status

This commit is contained in:
2024-09-25 19:35:39 +02:00
parent 78ace02d15
commit 3c2fa18d9a
6 changed files with 101 additions and 8 deletions
central_backend/src
central_frontend/src

@ -39,6 +39,10 @@ impl RelayState {
fn is_off(&self) -> bool {
!self.on
}
pub fn state_for(&self) -> usize {
(time_secs() - self.since as u64) as usize
}
}
type RelaysState = HashMap<DeviceRelayID, RelayState>;