Automation OK, templating wrong condition

This commit is contained in:
2024-10-26 12:35:27 +02:00
parent 9777cf0ce8
commit 1971490dc8
3 changed files with 47 additions and 37 deletions

View File

@@ -35,6 +35,9 @@ triggers:
- trigger: state
entity_id: !input window_sensor
trigger_variables:
sensor_status: !input window_sensor
conditions:
- condition: numeric_state
entity_id: sensor.esterno_temperature
@@ -42,10 +45,9 @@ conditions:
actions:
- choose:
- conditions:
- condition: state
entity_id: !input window_sensor
state: "Open"
# if finestra is open
- conditions: >
{{ is_state('sensor_status', 'on') }}
sequence:
- action: climate.set_hvac_mode
metadata: {}
@@ -53,21 +55,15 @@ actions:
hvac_mode: "off"
target:
entity_id: !input climate_target
- action: switch.turn_on
metadata: {}
data: {}
target:
device_id: 62352ecf274ff68e3ddfbc979406d49d
- action: notify.mobile_app_ttrabatt_iphone15pro
metadata: {}
data:
message: Home Assistant DEBUG
title: Dovrebbe essere finestra aperta
- conditions:
- condition: state
entity_id: !input window_sensor
state: "Closed"
message: >
Climate {{ states('sensor_status') }} OFF
title: HA template 'heat_save' DEBUG
# if finestra is closed
- conditions: >
{{ is_state('sensor_status', 'off') }}
sequence:
- action: climate.set_hvac_mode
metadata: {}
@@ -75,24 +71,20 @@ actions:
hvac_mode: "heat"
target:
entity_id: !input climate_target
- action: switch.turn_off
metadata: {}
data: {}
target:
device_id: 62352ecf274ff68e3ddfbc979406d49d
- action: notify.mobile_app_ttrabatt_iphone15pro
metadata: {}
data:
message: Home Assistant DEBUG
title: Dovrebbe essere finestra chiusa
message: >
Climate {{ states('sensor_status') }} HEAT
title: HA template 'heat_save' DEBUG
default:
- action: notify.mobile_app_ttrabatt_iphone15pro
metadata: {}
data:
title: HA script error
title: HA template 'heat_save' ERROR
message: >
le condizioni non vanno cazzo: state: {{ states('binary_sensor.salottopt_finestra_contact') }}
Bad Conditions state {{ states('sensor_status') }}
# - if:
# - condition: state