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
-1
View File
@@ -217,7 +217,6 @@ async fn update_house_preset(State(state): State<AppState>, Json(input): Json<Ho
"preset": input.preset,
"zones": zones,
"devices": devices,
"settings": settings_payload,
"failed": failed,
})))
}
+6 -6
View File
@@ -69,7 +69,7 @@ fn home_assistant_settings(settings: &RuntimeSettings) -> HomeAssistantSettingsV
}
async fn get_application_settings(State(state): State<AppState>) -> Json<ApplicationSettings> {
Json(application_settings(&state.settings.read().await))
Json(application_settings(&*state.settings.read().await))
}
async fn update_application_settings(
@@ -89,7 +89,7 @@ async fn update_application_settings(
}
async fn get_gree_settings(State(state): State<AppState>) -> Json<GreeSettings> {
Json(gree_settings(&state.settings.read().await))
Json(gree_settings(&*state.settings.read().await))
}
fn normalize_gree_settings(mut input: GreeSettings) -> Result<GreeSettings, AppError> {
@@ -169,7 +169,7 @@ async fn update_gree_settings(
}
async fn get_history_settings(State(state): State<AppState>) -> Json<HistorySettings> {
Json(history_settings(&state.settings.read().await))
Json(history_settings(&*state.settings.read().await))
}
async fn update_history_settings(
@@ -198,7 +198,7 @@ async fn update_history_settings(
}
async fn get_influxdb_settings(State(state): State<AppState>) -> Json<InfluxDbSettingsView> {
Json(influxdb_settings(&state.settings.read().await))
Json(influxdb_settings(&*state.settings.read().await))
}
fn apply_influxdb_update(current: &InfluxDbSettings, input: InfluxDbSettingsUpdate) -> Result<InfluxDbSettings, AppError> {
@@ -238,7 +238,7 @@ async fn update_influxdb_settings(
}
async fn get_notification_settings(State(state): State<AppState>) -> Json<NotificationSettingsView> {
Json(notification_settings(&state.settings.read().await))
Json(notification_settings(&*state.settings.read().await))
}
fn apply_notification_update(current: &NotificationSettings, mut input: NotificationSettingsUpdate) -> Result<NotificationSettings, AppError> {
@@ -320,7 +320,7 @@ async fn update_night_settings(
}
async fn get_home_assistant_settings(State(state): State<AppState>) -> Json<HomeAssistantSettingsView> {
Json(home_assistant_settings(&state.settings.read().await))
Json(home_assistant_settings(&*state.settings.read().await))
}
fn normalize_sensor_aliases(settings: &mut HomeAssistantSettings) {
+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.
+1 -1
View File
@@ -461,7 +461,7 @@ async fn control_zones(state: &AppState) -> Result<()> {
zone.active_preset = preset;
zone.effective_setpoint = Some(target);
let Some(temp) = temperature else {
let Some(temp) = zone.current_temperature else {
record_zone_history(state, &zone, outdoor_temperature, settings.poll_interval_seconds);
let persisted_zone = persist_zone_cycle(state, &zone, cycle_started_at)?;
state.broadcast("zone.updated", serde_json::to_value(&persisted_zone)?);