v0.12.0
This commit is contained in:
+5
-26
@@ -34,7 +34,7 @@ async fn set_all_thermostat_power_state(state: &AppState, power: bool) -> Result
|
||||
let Some(mut zone) = state.db.get_zone(&zone_id)? else { continue; };
|
||||
engine::rearm_compressor_queue(&mut zone);
|
||||
if engine::set_house_bulk_thermostat_power(&mut zone, power) { changed += 1; }
|
||||
engine::refresh_control_ownership(&mut zone, true);
|
||||
engine::refresh_control_ownership(&mut zone);
|
||||
zone.revision = zone.revision.saturating_add(1);
|
||||
zone.updated_at = Utc::now();
|
||||
state.db.save_zone(&zone)?;
|
||||
@@ -82,14 +82,13 @@ async fn update_house_control(State(state): State<AppState>, Json(input): Json<H
|
||||
}
|
||||
let mode = input.mode;
|
||||
let activate_all = mode != "off";
|
||||
let payload = {
|
||||
{
|
||||
let mut settings = state.settings.write().await;
|
||||
settings.house_mode = mode.clone();
|
||||
settings.house_power_enabled = true;
|
||||
state.db.save_runtime_settings(&settings)?;
|
||||
public_settings(&settings)
|
||||
};
|
||||
state.broadcast("settings.updated", payload.clone());
|
||||
}
|
||||
let payload = json!({"mode": mode});
|
||||
state.broadcast("house.mode_changed", payload.clone());
|
||||
// House rules do not steal explicit local/group/manual ownership. Free zones follow the
|
||||
// new mode immediately; scoped manual controls continue independently.
|
||||
rearm_house_automation_compressor_queues(&state).await?;
|
||||
@@ -118,15 +117,6 @@ async fn update_house_power(State(state): State<AppState>, Json(input): Json<Hou
|
||||
// resurrect demand. ON releases that OFF state and records an explicit automatic house-power
|
||||
// intent for otherwise-free zones. Later explicit local/group/manual actions remain
|
||||
// independent and can take over only the selected scope.
|
||||
{
|
||||
let mut settings = state.settings.write().await;
|
||||
if !settings.house_power_enabled {
|
||||
settings.house_power_enabled = true;
|
||||
state.db.save_runtime_settings(&settings)?;
|
||||
state.broadcast("settings.updated", public_settings(&settings));
|
||||
}
|
||||
}
|
||||
|
||||
// Persist the thermostat power intent before touching devices. The cycle lock held by this
|
||||
// handler guarantees that no setpoint-modulation cycle can race between the marker and OFF.
|
||||
let changed_zones = set_all_thermostat_power_state(&state, input.power).await?;
|
||||
@@ -135,9 +125,6 @@ async fn update_house_power(State(state): State<AppState>, Json(input): Json<Hou
|
||||
|
||||
let devices = state.db.list_devices()?;
|
||||
let groups = state.db.list_groups()?;
|
||||
let settings = state.settings.read().await;
|
||||
let settings_payload = public_settings(&settings);
|
||||
drop(settings);
|
||||
state.log("info", "house.power_all", if input.power {
|
||||
"Whole-house ON sent; local OFF state released and house thermostat intent armed"
|
||||
} else {
|
||||
@@ -154,7 +141,6 @@ async fn update_house_power(State(state): State<AppState>, Json(input): Json<Hou
|
||||
"one_shot": true,
|
||||
"devices": devices,
|
||||
"groups": groups,
|
||||
"settings": settings_payload,
|
||||
"failed": failed,
|
||||
})))
|
||||
}
|
||||
@@ -169,13 +155,6 @@ async fn update_house_preset(State(state): State<AppState>, Json(input): Json<Ho
|
||||
return Err(AppError::BadRequest("house preset must be auto, comfort, sleep or away".into()));
|
||||
}
|
||||
|
||||
let settings_payload = {
|
||||
let mut settings = state.settings.write().await;
|
||||
settings.house_power_enabled = true;
|
||||
state.db.save_runtime_settings(&settings)?;
|
||||
public_settings(&settings)
|
||||
};
|
||||
state.broadcast("settings.updated", settings_payload.clone());
|
||||
// A house profile applies to free house-controlled zones. Explicit local/group/direct
|
||||
// owners remain higher priority and are not cleared or re-armed by changing house rules.
|
||||
rearm_house_automation_compressor_queues(&state).await?;
|
||||
|
||||
Reference in New Issue
Block a user