i am ok with setting up simple automations. but having a hard time wrapping my head around much more complex involving multiple entities.
right now, i have the envisalink connected to my home alarm sys so i can see which windows are opened or closed. example of 2 front windows where 1 is opened and _2 is closed
entity state
binary_sensor.front_window on
binary_sensor.front_window_2 off
when YR symbol is 10 (heavy rain) AND windows’ states are ON, then send me a PushBullet notification with message of “it is raining and the windows are opened!”
how do i set this up using the automation GUI in HA?
thank you!
First of all Automation GUI and “complex” automation don’t work that well imho. If you are willing to do it the old fashioned way I’d be glad to help out where you need help. Also depending on HOW complex you want it to be, it might be reasonable to think about calling a python script with the new component.
yes, im willing to learn! please help.
here’s a simple example in my automations.yaml file
- action:
- data:
message: The temp is above 85F!
service: notify.fib_3flr_push
alias: 3rd flr too hot
id: ‘1498660043762’
trigger:
- above: ‘85’
entity_id: sensor.fibaro_3flr_temperature
platform: numeric_state
i notice the ID is very long…can i make something shorter myself or is this something HA auto generate?
when YR is 10, is that a numeric state because i dont see an “equal” option…
i would imagine something like this
- action:
- data:
message: It is raining and the windows are opened!
service: notify.fib_3flr_push
alias: raining and windows opened
id: ‘1’
trigger:
- equal: ‘10’
entity_id: sensor.yr_symbol
platform: numeric_state
trigger:
- equal: ‘on’
entity_id: binary_sensor.front_window
entity_id: binary_sensor.front_window_2
entity_id: binary_sensor.front_window_3
platform: binary
but that’s very wrong because i have no idea which “states” and “platform” i need to be using.
Hey please use the preformatted text option for pasting your config. That way the spaces wont get removes. You can do that by simply wrapping your code in 3 like this```
YOUR CONFIG
```
currently working for a simple automation
‘’’- action:
- data:
message: The temp is above 85F!
service: notify.fib_3flr_push
alias: 3rd flr too hot
id: ‘1498660043762’
trigger:
- above: ‘85’
entity_id: sensor.fibaro_3flr_temperature
platform: numeric_state
‘’’
i would imagine something like this for the complex
‘’’
- action:
- data:
message: It is raining and the windows are opened!
service: notify.fib_3flr_push
alias: raining and windows opened
id: ‘1’
trigger:
- equal: ‘10’
entity_id: sensor.yr_symbol
platform: numeric_state
trigger:
- equal: ‘on’
entity_id: binary_sensor.front_window
entity_id: binary_sensor.front_window_2
entity_id: binary_sensor.front_window_3
platform: binary
‘’’
i tried preformat and it didnt work. very strange.
here’s an image of it
automation:
- alias: "3rd Floor too hot"
id: '1498660043762'
trigger:
platform: numeric_state
entity_id: sensor.fibaro_3flr_temperature
above: 85
action:
service: notify.fib_3flr_push
data:
message: "The temp is above 85F!"
here is one of your automations properly formatted and setup. Use this and the docs posted below to develop your next one on your own. If you get stuck post up what you have and we can help.
Select a trigger for what you want to intiate your automation
Use conditions (for example check if windows are open after the trigger has initiated the automation)
Then use action to notify you or perform some other action.
Reviewing other peoples automations is also very helpful to have a starting point with the proper framework and formatting.
thank you for the reformatting. this looks more logical and easier to read! all my automations.yaml so far are from the Automation GUI in HA.
looking at the links you shared now.
after reading through, this is the best i have come up with
automation:
- alias: 'Raining and windows are opened'
trigger:
- platform: yr
entity_id: sensor.yr_symbol
to: 10
condition:
- platform: state
entity_id: group.windows
state: 'on'
action:
service: notify.fib_3flr_push
data:
message: "raining and the windows are opened"
so i have combined all my windows into 1 group: group.windows
if any of the windows are “on,” meaning if any one of them is opened, i will get an alert via push bullet when it is raining.
i dont think my syntax is correct. but that’s the best i can come up with. also, i notice YR has many values for rain, such as 9,30, 40 and 46 as well. so can i do this:
- alias: 'Raining and windows are opened'
trigger:
- platform: yr
entity_id: sensor.yr_symbol
to: 9,10,30,40,46
The platform for your trigger should be ‘state’ not yr. For those multiple values you can add multiple triggers by simply coping the whole part after ‘trigger:’ to add another element to the trigger list. Including the ‘-’ prefix.
automation:
- alias: 'Raining and windows are opened'
trigger:
- platform: state
entity_id: sensor.yr_symbol
to: 10
- platform: state
entity_id: sensor.yr_symbol
to: 46
condition:
- platform: state
entity_id: group.windows
state: 'on'
action:
service: notify.fib_3flr_push
data:
message: "raining and the windows are opened"
im not sure how group.windows work. does all of the windows have to be opened for the state to be ON?
because i dont always have all the windows open. if 1 window is open, thats good enough to be ON and then send me the alert…
I have a very similar requirement, but I used binary sensor template for each window. Since I wanted to capture most kind of precipitation, I looked for the string description provided by WU. Here is an example of my binary sensor:
precipitating:
value_template: >-
{%- if 'Drizzle' in states.sensor.pws_weather.state
or 'Rain' in states.sensor.pws_weather.state
or 'Snow' in states.sensor.pws_weather.state
or 'Ice' in states.sensor.pws_weather.state
or 'Hail' in states.sensor.pws_weather.state
or 'Mist' in states.sensor.pws_weather.state
or 'Fog' in states.sensor.pws_weather.state
or 'Spray' in states.sensor.pws_weather.state
or 'Thunderstorm' in states.sensor.pws_weather.state -%}
true
{%- else -%}
false
{%- endif -%}
friendly_name: 'Precipitation'
device_class: moisture
entity_id:
- sensor.pws_weather
family_room_window_open_during_precipitation:
value_template: >-
{%- if states.binary_sensor.precipitating.state == 'on'
and states.binary_sensor.family_room_window.state == 'on' -%}
true
{%- else -%}
false
{%- endif %}
friendly_name: 'Family Room Window Is Open During Precipitation'
device_class: opening
entity_id:
- binary_sensor.precipitating
- binary_sensor.family_room_window
automation:
- alias: "3rd Floor too hot"
id: '1498660043762'
i see it assigned the id with a very long number: 1498660043762. so if i manually insert codes into my automations.yaml file, do i assign it any number i want? or how to know which numbers to use?
A unique ID is required to use the editor, doesn’t matter what it is or how long it is. From what I gather if you want to use the editor once you have to convert your ‘old’ automations.