v0.15.15
This commit is contained in:
1 parent
3b969c8754
commit
d80005de33
33 files changed
+722
-94
No files matched your search
@@ -13,6 +13,9 @@ fn device_has_thermostat_zone(device_id: &str, zones: &[Zone]) -> bool {
|
||||
}
|
||||
|
||||
async fn run_automations(state: &AppState) -> Result<()> {
|
||||
if state.settings.read().await.emergency_stop_enabled {
|
||||
return Ok(());
|
||||
}
|
||||
let devices = state.db.list_devices()?;
|
||||
let mut automations = state.db.list_automations()?;
|
||||
// Stable arbitration for same-cycle conflicts: the oldest configured rule wins, then ID.
|
||||
@@ -51,6 +54,11 @@ async fn run_automations(state: &AppState) -> Result<()> {
|
||||
// changed since this cycle snapshot was taken, skip it now and evaluate the new
|
||||
// definition on the next cycle instead of firing stale configuration.
|
||||
let _automation_guard = state.lock_automation_operation().await;
|
||||
// The emergency-stop handler takes the same lock before persisting its safety flag.
|
||||
// Re-check here so a rule evaluated immediately before STOP can never execute after it.
|
||||
if state.settings.read().await.emergency_stop_enabled {
|
||||
continue;
|
||||
}
|
||||
let Some(latest_item) = state.db.get_automation(&item.id)? else { continue; };
|
||||
if latest_item.updated_at != item.updated_at { continue; }
|
||||
item = latest_item;
|
||||
|
||||
Reference in new issue
Block a user