From 66ddee0043c1da5d526bc868c4a48ccfc736862d Mon Sep 17 00:00:00 2001 From: andreas Date: Fri, 5 Dec 2025 11:41:33 +0100 Subject: [PATCH] Update ha-smart-thermostat-control.yaml support on error from Google Gemini --- ha-smart-thermostat-control.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ha-smart-thermostat-control.yaml b/ha-smart-thermostat-control.yaml index 965dc87..454d7eb 100644 --- a/ha-smart-thermostat-control.yaml +++ b/ha-smart-thermostat-control.yaml @@ -3,7 +3,7 @@ blueprint: author: Andreas Gammelgaard Damsbo description: | Advanced thermostat automation with window/door sensors, presence detection, time schedules, and holiday calendar integration. - + SETUP REQUIRED: 1. Create an input_boolean helper (Settings > Devices & Services > Helpers > Toggle) for manual override tracking 2. Create a timer helper (Settings > Devices & Services > Helpers > Timer) for override duration @@ -204,9 +204,13 @@ trigger: variables: thermostat_entities: !input thermostat - triggered_thermostat: "{{ trigger.entity_id }}" - new_temperature: "{{ trigger.to_state.attributes.temperature | float(0) }}" - old_temperature: "{{ trigger.from_state.attributes.temperature | float(0) }}" + triggered_thermostat: "{{ trigger.entity_id | default('none') }}" + # FIX: Safely retrieve state objects for non-state triggers (e.g., calendar, numeric_state) + safe_to_state: "{{ trigger.to_state | default({}) }}" + safe_from_state: "{{ trigger.from_state | default({}) }}" + # Use the safe state objects to get temperatures + new_temperature: "{{ safe_to_state.attributes.temperature | float(0) }}" + old_temperature: "{{ safe_from_state.attributes.temperature | float(0) }}" override_helper: !input manual_override_helper day_temp_input: !input day_temp night_temp_input: !input night_temp