Hi,
I’m trying to create a automation which should do the following:
- if kitchen window is opened:
- save the current state of kitchen heater, then turn it off
- if window is closed:
- set kitchen heater to saved state
I found this example here in the HASSIO docs and adjusted it to my needs: Scenes - Home Assistant
My current automation has the problem, that when the window is closed, the state of the heater is always set to ‘heat’, even if the state before was ‘auto’ or ‘off’.
Here are my automations as yaml:
Automation for ‘Window open’:
alias: "Kitchen: Window open - Heater off"
description: ""
trigger:
- platform: state
entity_id:
# my kitchen window sensor
- binary_sensor.lumi_lumi_sensor_magnet_aq2_opening_5
from: "off"
to: "on"
for:
hours: 0
minutes: 0
seconds: 5
condition: []
action:
- service: scene.create
data:
scene_id: kitchen_heater_before
snapshot_entities:
- climate.kitchen
- service: climate.set_hvac_mode
target:
entity_id: climate.kitchen
data:
hvac_mode: "off"
mode: single
Automation for ‘Window closed’:
alias: "Kitchen: Window closed - Heater to last state"
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.lumi_lumi_sensor_magnet_aq2_opening_5
from: "on"
to: "off"
for:
hours: 0
minutes: 0
seconds: 5
condition: []
action:
- service: scene.turn_on
target:
entity_id: scene.kitchen_heater_before
data: {}
mode: single
Does anyone know how to get it working correctly?