Trying to get my first automation working from the front end so I can see how the automations.yaml gets formatted.
I have two entities sensor.4_in_1_sensor_light_11
and light.hall_26
I want to turn the light on when the lux level goes below a value of 5 and off when the lux level goes above 20. Any assistance would be appreciated. I’ve read over the templating section but you need an engineering degree to wade through that
Of course, if your light causes the light level to rise above 20, then you’re likely end up strobing the light on and off at night. I’d advise that you check the light level when the hall light is on, and then set the level to say 5 above that.
Not having too much joy unfortunately. Struggling with the new format for the automations.yaml available from the front end. Can’t get that basic automation to save from the front end (using Chrome) under any circumstances. Pasted the following into automations.yaml and now they show up under the “automations” side bar but clicking on them (to edit) produces a blank page but at least it works! Thank you.
- id: ID1
alias: Hall Light Auto On
trigger:
- platform: numeric_state
entity_id: sensor.4_in_1_sensor_light_11
below: 5
action:
- service: homeassistant.turn_on
entity_id: light.hall_26
- id: ID2
alias: Hall Light Auto Off
trigger:
- platform: numeric_state
entity_id: sensor.4_in_1_sensor_light_11
above: 20
action:
- service: homeassistant.turn_off
entity_id: light.hall_26
I was having issues with an almost identical automation myself, and contacted another forum member (@fanaticDavid) who had a working solution that was similar to what I was looking for. This is how I achieve it, works faultlessly. Credit to David for his help.
Firstly, create a Binary Sensor for each instance;
Then, this is the automation based on Low Light Level;
# LIGHT LEVEL IS LOW - SWITCH ON #
- id: Light Level is Low - Switch On
alias: Light Level is Low - Switch On
trigger:
platform: state
entity_id: binary_sensor.low_lux
to: 'on'
for:
minutes: 2
condition:
condition: and
conditions:
- condition: time
after: "08:00:00"
- condition: sun
before: sunset
before_offset: "00:45:05"
- condition: state
entity_id: group.family
state: 'home'
action:
- service: light.turn_on
# Yeelight RGB Bulb
entity_id: light.steps
data:
brightness: 60
color_temp: 222
transition: 3
- service: light.turn_on
# LIFX RGB Bulb
entity_id: light.lounge
data:
brightness: 110
color_temp: 222
transition: 5
and High Light Level;
# LIGHT LEVEL IS HIGH - SWITCH OFF #
- id: Light Level is High - Switch Off
alias: "Light Level is High - Switch Off"
trigger:
platform: state
entity_id: binary_sensor.high_lux
to: 'on'
for:
minutes: 3
condition:
condition: and
conditions:
- condition: time
after: "08:00:00"
- condition: sun
before: sunset
before_offset: "00:45:05"
- condition: state
entity_id: group.family
state: 'home'
action:
service: light.turn_off
entity_id:
- light.steps
- light.lounge
I’m making another video in my Hass.io series and wanted to show noobs how to create a simple automation (turn a light on when it’s dark) but can’t get the front end to work at all. I use NP++ too but wanted to see how much easier it was from the front end as I’ve struggled with yaml formatting (and the ever changing formatting requirements) for the last year. I took me four goes to get HA to start with one simple automation file even though I’d checked the file with four different online yaml checkers!
I have had similar issues, being new to HASS, it has changed about twice already in a few months, hard to learn the right way when things change regularly!
I should have mentioned also that I’m using Bens (@bruhautomation) DIY Multisensor in conjuction with this automation. I have made 3 of them now for around my house, bloody great bit of kit for very little money.
had the same idea, tested a bit and made this little package, maybe useful for others too, adjust to your own situation (automations don’t use the template sensor yet, might be even easier to do so):
You need to format it correctly (see the big blue box at the top) before we can tell what your automation looks like. Then you need to tell us what does not work for me means.