This commit is contained in:
Mateusz Gruszczyński
2026-09-02 22:41:27 +02:00
parent 8004be0841
commit db6d2f09db
20 changed files with 945 additions and 59 deletions
+26
View File
@@ -25,6 +25,21 @@ pub struct Schedule {
pub flow_node_id: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
pub struct FlowRuntimeNodeState {
#[serde(default)]
pub since: Option<DateTime<Utc>>,
#[serde(default)]
pub samples: Vec<FlowRuntimeSample>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct FlowRuntimeSample {
pub at: DateTime<Utc>,
pub value: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Automation {
pub id: String,
@@ -59,6 +74,14 @@ pub struct Automation {
pub action_zone_id: Option<String>,
#[serde(default)]
pub action_zone_preset: Option<String>,
#[serde(default)]
pub action_ha_domain: Option<String>,
#[serde(default)]
pub action_ha_service: Option<String>,
#[serde(default)]
pub action_ha_entity_id: Option<String>,
#[serde(default)]
pub action_ha_data: Value,
/// Topologically ordered condition/logic program compiled from the visual Flow graph.
#[serde(default)]
pub flow_conditions: Vec<FlowCondition>,
@@ -66,6 +89,9 @@ pub struct Automation {
pub flow_id: Option<String>,
#[serde(default)]
pub flow_node_id: Option<String>,
/// Durable state for stateful Flow blocks (stable-for and rolling statistics).
#[serde(default)]
pub flow_runtime: BTreeMap<String, FlowRuntimeNodeState>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}