This commit is contained in:
Mateusz Gruszczyński committed 2026-09-01 22:20:10 +02:00
1 parent 1cb62c8d0b
commit 16e0d94564
47 files changed
+2565 -117

No files matched your search

+19 -1
View File
@@ -17,6 +17,12 @@ pub struct Schedule {
pub setpoint: f64,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
/// Present for records generated by the visual Flow editor. Generated records are read-only
/// in the legacy schedule/automation editors; the Flow remains the source of truth.
#[serde(default)]
pub flow_id: Option<String>,
#[serde(default)]
pub flow_node_id: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -25,7 +31,7 @@ pub struct Automation {
pub name: String,
#[serde(default = "default_true")]
pub enabled: bool,
/// temperature_above, temperature_below, time
/// temperature_above, temperature_below, time, flow
pub trigger_kind: String,
#[serde(default)]
pub trigger_device_id: Option<String>,
@@ -48,6 +54,18 @@ pub struct Automation {
pub cooldown_seconds: u64,
#[serde(default)]
pub last_fired_at: Option<DateTime<Utc>>,
/// Optional Flow-owned thermostat zone target.
#[serde(default)]
pub action_zone_id: Option<String>,
#[serde(default)]
pub action_zone_preset: Option<String>,
/// Topologically ordered condition/logic program compiled from the visual Flow graph.
#[serde(default)]
pub flow_conditions: Vec<FlowCondition>,
#[serde(default)]
pub flow_id: Option<String>,
#[serde(default)]
pub flow_node_id: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
+2
View File
@@ -9,6 +9,8 @@ pub struct ConfigurationExport {
pub groups: Vec<ClimateGroup>,
pub schedules: Vec<Schedule>,
pub automations: Vec<Automation>,
#[serde(default)]
pub flows: Vec<Flow>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
+57
View File
@@ -0,0 +1,57 @@
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FlowNode {
pub id: String,
pub kind: String,
#[serde(default)]
pub x: f64,
#[serde(default)]
pub y: f64,
#[serde(default)]
pub config: Value,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FlowEdge {
pub id: String,
pub from: String,
pub to: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FlowCondition {
/// Stable block ID used by the compiled Flow program.
#[serde(default)]
pub id: String,
pub kind: String,
#[serde(default)]
pub config: Value,
/// IDs of predecessor blocks. Condition blocks implicitly AND their own predicate with
/// predecessor results; logic blocks combine predecessors according to their kind.
#[serde(default)]
pub inputs: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Flow {
pub id: String,
pub name: String,
#[serde(default = "default_true")]
pub enabled: bool,
#[serde(default)]
pub description: String,
#[serde(default)]
pub nodes: Vec<FlowNode>,
#[serde(default)]
pub edges: Vec<FlowEdge>,
#[serde(default)]
pub summary: String,
#[serde(default)]
pub compiled_schedule_ids: Vec<String>,
#[serde(default)]
pub compiled_automation_ids: Vec<String>,
/// Optimistic concurrency token for visual-editor saves. Legacy flows deserialize as 0.
#[serde(default)]
pub revision: u64,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}