I’m new to Homeassistant and am not comfortable yet with how templates, triggers, and conditions all fit together. Here is what I want to do in pseudocode:
Trigger on change of brightness level of light.art
If brightness level of light.art is > 40 take action light.lamp.turn_on
Else if brightness level of light.art <= 40 take action light.lamp.turn_off
How would I write this for a Homeassistant automation?
Thanks, I rewatched it to make sure I didn’t miss something. I am still not sure how to get a brightness level to trigger the automation. Here is the most recent automation.yaml section that I have tried:
This compiles fine but never triggers. I suspect that there is nothing to cause a “query” to the z-wave control (light.painting_light_level), so it never sees a value to act on. In my previous ISY994iz controller I had to set up a polling loop to read and save the current brightness to act on.
Will this automation do it’s own polling/query of the control or do I need to first create some sort of sensor to do that and then trigger off of the sensor?
You can test your value template on the front end, under dev tools, on the “templates” tab.
I think it actually needs to be value_template: ‘{{ state.attributes.brightness }}’
When testing the template, you’ll have to specify the entity_id, so on the templating page you’ll have to try {{ state.light.painting_light_level.attributes.brightness }}