Hey fellow automaters!
I need a little help with some Yaml code I made in automations. I have automated heat system (wiser) in all rooms and in all rooms I have a window sensor to detect when we open a window to shut off the heating. I built it up like this:
4 triggers (opened, closed, increase in temp and decrease in temp.)
When window is opened it saves the current scene as a snapshot and turns down temperature. When window is close it activated the saved snapshop scene. When temperature is increased or decreased (ie. auto heat system turns down temp in the evening or up in the morning) while window is open, it overwrites the snapshot scene with the changed temperature and turns down heat again. This ensures both the new auto temp change is saved if it changes while window is open, but also the temperature is not set back to something high and set off heat while opened.
The problem is when the latter two triggers get triggered it then triggers itself a second time and makes a snapshot scene with the low temperature set byt itself making the automation in increase and decrease useless. I tried all kind of conditions but something keeps breaking or I get funky results. Any possible way to make a condition that fits, like ‘dont trigger if triggered by itself’?
Code:
alias: Living room open window
description: ""
trigger:
- type: opened
platform: device
device_id: 177ffbb82bde08b3014c9f846b45fe31
entity_id: a5fc2fe0cbb75a9b034c6876f485b96f
domain: binary_sensor
id: opened
- type: not_opened
platform: device
device_id: 177ffbb82bde08b3014c9f846b45fe31
entity_id: a5fc2fe0cbb75a9b034c6876f485b96f
domain: binary_sensor
id: closed
- platform: device
device_id: ea20c20643849e5a4a810cceda4c8160
domain: wiser
entity_id: climate.wiser_living_room
type: target_temperature_increased
id: changed
- platform: device
device_id: ea20c20643849e5a4a810cceda4c8160
domain: wiser
entity_id: climate.wiser_living_room
type: target_temperature_decreased
id: changed
condition: []
action:
- alias: Opening window
if:
- condition: trigger
id:
- opened
then:
- service: scene.create
data:
scene_id: living_room_scene
snapshot_entities: climate.wiser_living_room
- service: climate.set_temperature
data:
temperature: 5
target:
entity_id: climate.wiser_living_room
- if:
- condition: trigger
id:
- closed
then:
- service: scene.turn_on
data: {}
target:
entity_id: scene.living_room_scene
alias: Closing window
- alias: Schedule fix when opened
if:
- condition: and
conditions:
- condition: trigger
id:
- changed
- type: is_open
condition: device
device_id: 177ffbb82bde08b3014c9f846b45fe31
entity_id: a5fc2fe0cbb75a9b034c6876f485b96f
domain: binary_sensor
for:
hours: 0
minutes: 0
seconds: 2
then:
- service: scene.create
data:
scene_id: living_room_scene
snapshot_entities: climate.wiser_living_room
- service: climate.set_temperature
data:
temperature: 5
target:
entity_id: climate.wiser_living_room
mode: queued
max: 10