Store last ping of devices

This commit is contained in:
2024-09-09 21:05:52 +02:00
parent 6bdebe6932
commit 7cac6aeb35
4 changed files with 80 additions and 0 deletions

View File

@ -28,6 +28,13 @@ pub async fn list_validated(actor: WebEnergyActor) -> HttpResult {
Ok(HttpResponse::Ok().json(list))
}
/// Get the state of devices
pub async fn devices_state(actor: WebEnergyActor) -> HttpResult {
let states = actor.send(energy_actor::GetDevicesState).await?;
Ok(HttpResponse::Ok().json(states))
}
#[derive(serde::Deserialize)]
pub struct DeviceInPath {
id: DeviceId,