smart-house-web: в работе

This commit is contained in:
5 changed files with 49 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
use std::collections::HashMap;
use axum::{Json, extract::State};
use crate::{Device, PowerSocket, Room, Thermometer};
pub async fn debug(State(_server_state): State<super::ServerState>) -> Json<Room> {
let mut map = HashMap::<String, Device>::with_capacity(16);
map.insert("therm_0".into(), Thermometer::new(22.5).into());
map.insert("psock_0".into(), PowerSocket::new(12.1, false).into());
Room::new(map).into()
}