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

1
.gitignore vendored
View File

@@ -7,3 +7,4 @@ themes/*
.storage/core.entity_registry .storage/core.entity_registry
.storage/core.restore_state .storage/core.restore_state
.storage/repairs.issue_registry .storage/repairs.issue_registry
home-assistant.log*

View File

@@ -117,12 +117,17 @@
entity_id: ebae111d5248a4a919571b66f79824d3 entity_id: ebae111d5248a4a919571b66f79824d3
domain: binary_sensor domain: binary_sensor
trigger: device trigger: device
- type: not_opened
device_id: d9e47be4d9369f77ee2c07273324bc46
entity_id: ebae111d5248a4a919571b66f79824d3
domain: binary_sensor
trigger: device
actions: actions:
- choose: - choose:
# if finestra is open # if finestra is open
- conditions: > - conditions: >
{{ is_state('binary_sensor.salottopt_finestra_contact', 'off ') }} {{ is_state('binary_sensor.salottopt_finestra_contact', 'on') }}
# - condition: state # - condition: state
# entity_id: binary_sensor.salottopt_finestra_contact # entity_id: binary_sensor.salottopt_finestra_contact
# state: "on" # state: "on"
@@ -131,6 +136,12 @@
# minutes: 0 # minutes: 0
# seconds: 3 # seconds: 3
sequence: sequence:
- action: climate.set_hvac_mode
metadata: {}
data:
hvac_mode: "off"
target:
entity_id: climate.soggiornopt_termosifonesud
- action: switch.turn_off - action: switch.turn_off
metadata: {} metadata: {}
data: {} data: {}
@@ -140,14 +151,20 @@
metadata: {} metadata: {}
data: data:
message: Home Assistant DEBUG message: Home Assistant DEBUG
title: Dovrebbe essere finestra aperta title: Aperta {{ states('binary_sensor.salottopt_finestra_contact') }}
# if finestra is closed # if finestra is closed
- conditions: > - conditions: >
{{ is_state('binary_sensor.salottopt_finestra_contact', 'on ') }} {{ is_state('binary_sensor.salottopt_finestra_contact', 'off') }}
# - condition: state # - condition: state
# entity_id: binary_sensor.salottopt_finestra_contact # entity_id: binary_sensor.salottopt_finestra_contact
# state: "off" # state: "off"
sequence: sequence:
- action: climate.set_hvac_mode
metadata: {}
data:
hvac_mode: "heat"
target:
entity_id: climate.soggiornopt_termosifonesud
- action: switch.turn_on - action: switch.turn_on
metadata: {} metadata: {}
data: {} data: {}
@@ -157,7 +174,7 @@
metadata: {} metadata: {}
data: data:
message: Home Assistant DEBUG message: Home Assistant DEBUG
title: Dovrebbe essere finestra chiusa title: Chiusa {{ states('binary_sensor.salottopt_finestra_contact') }}
default: default:
- action: notify.mobile_app_ttrabatt_iphone15pro - action: notify.mobile_app_ttrabatt_iphone15pro
metadata: {} metadata: {}

View File

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