v0.13.2
This commit is contained in:
@@ -161,9 +161,9 @@ async fn run_automations(state: &AppState) -> Result<()> {
|
||||
item.last_fired_at = Some(fired_at);
|
||||
item.updated_at = Utc::now();
|
||||
state.db.save_automation(&item)?;
|
||||
// last_fired_at/next_ready_at are part of ControlPlan.rules. Runtime execution
|
||||
// does not emit automation.updated, so invalidate the plan directly.
|
||||
state.invalidate_control_plan();
|
||||
// Keep connected clients in sync with runtime metadata such as last_fired_at.
|
||||
// automation.updated also invalidates the materialized control plan.
|
||||
state.broadcast("automation.updated", serde_json::to_value(&item)?);
|
||||
state.log("info", "automation.fired", &format!("Automation {} fired", item.name), json!({
|
||||
"automation_id": item.id, "flow_id": item.flow_id, "flow_node_id": item.flow_node_id, "group_id": item.action_group_id, "device_id": item.action_device_id
|
||||
}));
|
||||
@@ -184,7 +184,7 @@ async fn run_automations(state: &AppState) -> Result<()> {
|
||||
item.last_fired_at = Some(Utc::now());
|
||||
item.updated_at = Utc::now();
|
||||
state.db.save_automation(&item)?;
|
||||
state.invalidate_control_plan();
|
||||
state.broadcast("automation.updated", serde_json::to_value(&item)?);
|
||||
state.log("error", "automation.error", &err.to_string(), json!({"automation_id": item.id, "flow_id": item.flow_id, "flow_node_id": item.flow_node_id}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user