Store last ping of devices
This commit is contained in:
@ -144,6 +144,10 @@ pub async fn secure_server(energy_actor: EnergyActorAddr) -> anyhow::Result<()>
|
||||
"/web_api/devices/list_validated",
|
||||
web::get().to(devices_controller::list_validated),
|
||||
)
|
||||
.route(
|
||||
"/web_api/devices/state",
|
||||
web::get().to(devices_controller::devices_state),
|
||||
)
|
||||
.route(
|
||||
"/web_api/device/{id}",
|
||||
web::get().to(devices_controller::get_single),
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user