diff --git a/.gitignore b/.gitignore index 6ba029c..ac64287 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ themes/* .storage/core.entity_registry .storage/core.restore_state .storage/repairs.issue_registry +home-assistant.log* diff --git a/automations.yaml b/automations.yaml index a4f207c..8eef173 100644 --- a/automations.yaml +++ b/automations.yaml @@ -117,20 +117,31 @@ entity_id: ebae111d5248a4a919571b66f79824d3 domain: binary_sensor trigger: device - + - type: not_opened + device_id: d9e47be4d9369f77ee2c07273324bc46 + entity_id: ebae111d5248a4a919571b66f79824d3 + domain: binary_sensor + trigger: device + actions: - choose: # if finestra is open - conditions: > - {{ is_state('binary_sensor.salottopt_finestra_contact', 'off ') }} - # - condition: state - # entity_id: binary_sensor.salottopt_finestra_contact - # state: "on" - # for: - # hours: 0 - # minutes: 0 - # seconds: 3 + {{ is_state('binary_sensor.salottopt_finestra_contact', 'on') }} + # - condition: state + # entity_id: binary_sensor.salottopt_finestra_contact + # state: "on" + # for: + # hours: 0 + # minutes: 0 + # seconds: 3 sequence: + - action: climate.set_hvac_mode + metadata: {} + data: + hvac_mode: "off" + target: + entity_id: climate.soggiornopt_termosifonesud - action: switch.turn_off metadata: {} data: {} @@ -140,14 +151,20 @@ metadata: {} data: message: Home Assistant DEBUG - title: Dovrebbe essere finestra aperta + title: Aperta {{ states('binary_sensor.salottopt_finestra_contact') }} # if finestra is closed - conditions: > - {{ is_state('binary_sensor.salottopt_finestra_contact', 'on ') }} + {{ is_state('binary_sensor.salottopt_finestra_contact', 'off') }} # - condition: state # entity_id: binary_sensor.salottopt_finestra_contact # state: "off" sequence: + - action: climate.set_hvac_mode + metadata: {} + data: + hvac_mode: "heat" + target: + entity_id: climate.soggiornopt_termosifonesud - action: switch.turn_on metadata: {} data: {} @@ -157,7 +174,7 @@ metadata: {} data: message: Home Assistant DEBUG - title: Dovrebbe essere finestra chiusa + title: Chiusa {{ states('binary_sensor.salottopt_finestra_contact') }} default: - action: notify.mobile_app_ttrabatt_iphone15pro metadata: {} diff --git a/blueprints/automation/homeassistant/heat_save.yaml b/blueprints/automation/homeassistant/heat_save.yaml index 33a50b5..3437b99 100644 --- a/blueprints/automation/homeassistant/heat_save.yaml +++ b/blueprints/automation/homeassistant/heat_save.yaml @@ -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