v0.9.7
This commit is contained in:
@@ -285,9 +285,19 @@ async fn flow_leaf_observation(
|
||||
settings: &crate::models::RuntimeSettings,
|
||||
overrides: &HashMap<String, Value>,
|
||||
) -> Result<(bool, Value), AppError> {
|
||||
let c = &condition.config;
|
||||
let mut resolved_kind = condition.kind.as_str();
|
||||
let mut resolved_config: Option<&Value> = None;
|
||||
if condition.kind == "shared_input" {
|
||||
let input_id = condition.config.get("input_id").and_then(Value::as_str).unwrap_or("");
|
||||
let Some(shared) = settings.home_assistant.flow_inputs.iter().find(|item| item.id == input_id) else {
|
||||
return Ok((false, json!({"error": "missing_shared_input", "input_id": input_id})));
|
||||
};
|
||||
resolved_kind = shared.kind.as_str();
|
||||
resolved_config = Some(&shared.config);
|
||||
}
|
||||
let c = resolved_config.unwrap_or(&condition.config);
|
||||
let override_value = overrides.get(&condition.id).cloned();
|
||||
let (matched, actual) = match condition.kind.as_str() {
|
||||
let (matched, actual) = match resolved_kind {
|
||||
"weekday" => {
|
||||
let actual = override_value.unwrap_or_else(|| json!(now.weekday().number_from_monday()));
|
||||
let day = actual.as_u64().unwrap_or(now.weekday().number_from_monday() as u64);
|
||||
@@ -508,7 +518,7 @@ fn flow_condition_kind_runtime(kind: &str) -> bool {
|
||||
matches!(kind,
|
||||
"weekday" | "time_range" | "date_range" | "outdoor_temperature" | "device_temperature" |
|
||||
"zone_temperature" | "ha_state" | "ha_numeric" | "ha_attribute" | "ha_available" | "house_mode" |
|
||||
"device_state" | "zone_state" | "group_state" | "night_mode" | "constant"
|
||||
"device_state" | "zone_state" | "group_state" | "night_mode" | "constant" | "shared_input"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user