This commit is contained in:
Mateusz Gruszczyński
2026-09-03 13:16:32 +02:00
parent b8ff31f205
commit abcd84f5ef
6 changed files with 17 additions and 17 deletions
+2 -2
View File
@@ -140,7 +140,7 @@ async fn create_zone(State(state): State<AppState>, Json(input): Json<ZoneInput>
let _device_guard = state.lock_device_operation(&input.device_id).await;
let mut zone = input.into_zone(Uuid::new_v4().to_string(), Utc::now());
let settings = state.settings.read().await.clone();
canonicalize_zone_ha_entity(&mut zone, &settings);
canonicalize_zone_ha_entity(&mut zone, &settings.home_assistant);
state.db.save_zone(&zone)?;
state.broadcast("zone.created", serde_json::to_value(&zone)?);
state.wake_zone_control();
@@ -227,7 +227,7 @@ async fn update_zone(State(state): State<AppState>, Path(id): Path<String>, Json
zone.revision = existing.revision.saturating_add(1);
}
let settings = state.settings.read().await.clone();
canonicalize_zone_ha_entity(&mut zone, &settings);
canonicalize_zone_ha_entity(&mut zone, &settings.home_assistant);
let power_off_device = !device_changed && existing.enabled && !zone.enabled;
if power_off_device {
// Full configuration PUT and quick-control disable use the same ownership cleanup.