Hi everybody,
I am fairly new to home assistant
(started out a few days ago with no previous knowledge), but I already like it that much that I am planning on replacing my current node-red
in combination with ioBroker
setup with hass.
I wrote the following automations/livingroom.yaml
trying to
- check whether the living room door has been opened
- if so, check whether or not it is warmer than 18 °C at home
- if so, turn on living room fan
The entire automation is supposed to also turn off the fan once the door has been closed (regardless of temperature value), but I wanted to get this working first.
This is my script
# Ventilator ein/aus
- id: '1564142473150'
alias: "Ventilator ein/aus"
trigger:
- entity_id: binary_sensor.wohnzimmer_tur
from: 'false'
to: 'true'
platform: state
condition:
- above: 18
condition: numeric_state
entity_id: weather.home
action:
- alias: 'Ventilator an'
service: switch.turn_on
entity_id: switch.ventilator
When I go to development tools => states
(or similar; I am using German UI, but I’m sure you’ll know what I mean…), I can see the current living room door state ("{{ states.binary_sensor.wohnzimmer_tur.state }}
") however, when I create this automation via webGUI, it only chooses binary_sensor.wohnzimmer_tur
(I assume this is because I am grabbing the inital status anyway instead of other attributes…?).
I assumed that this would watch the door status changing from ‘false’ (which is the isOpen
state) to ‘true’, and then continue. It is currently over 30°C here and hass displays this accordingly. However, I still cannot get the fan to turn on upon opening the living room door.
What do I need to change to fix this? Playing trial and error is a big difficult because hass requires a restart whenever the config has been changed, so I’m hoping to find some help here. I am just a hobbyist with no professional background in programming; please keep that in mind if this is a stupid question… I have tried multiple attempts but just can’t figure out what those lines need to be.
And one last question: can I create something like an “anti-automation”? By this I mean that the above automation will turn ON the fan if it is above 18°C and the door opens. Do I need to create another automation for the opposite (door closes or temperature below 18°C), or can I somehow define that “if this and if this2, then do that; if not this and/or if not this2, then do opposite”?
Thanks in advance for your help