Hi, Im doing an automation where a trigger of light should be above 500 lux to kick off the automation.
I get that to work with no problem when I in the automation use -above: 500 hardcoded, see example below. But as soon as I try to use my helper i created, and exchange 500 to the name of the helper I only get errors when trying to save. I used all formats I could find in different forums for variables but I don’t crack this. I get a constant float error in most cases.
Can anyone educate me on the correct template to use for exchanging 500 to my variable, including correct parentheses and spaces needed. Or s this not possible in a trigger……
///////
alias: egen ljus sensor - test
description: “”
trigger:
Thanks! I tried to change so I get the entity ID instead, the same Philips light sensor. I get that but I hav no luck in making this trigger work. In the automation it ask for For and TO values instead of “Above”. Maybe I don’t understand the settings here….
I have tried all combination of From and To, like 500, <500, >500 but no luck to kick of the automation.
alias: egen ljus sensor tillstånd - test
description: “”
trigger:
platform: state
entity_id:
sensor.hue_motion_sensor_2_light_level
for:
hours: 0
minutes: 0
seconds: 10
to: “>500”
In the future, instead of trying all combinations, I recommend you check the trigger’s documentation. For example, the documentation for State Trigger doesn’t mention that symbols, like >, can be used in a value nor does it show an example with it. Generally speaking, when something is not explicitly mentioned then it’s usually unsupported.
The Numeric State Trigger also doesn’t support the use of symbols. However it does support above and below instead of to and from.
For example, the following Numeric State Trigger will trigger at the moment when the sensor’s value increases and crosses the threshold of 500 and remains above 500 for at least 10 seconds.
It’s important to keep in mind that a Numeric State Trigger is triggered only when the entity’s value crosses the threshold value. If the entity’s value is already above the threshold, it will not trigger.
The documentation also explains you can use an Input Number entity to supply the threshold value.
@123 , great lesson given!! I love it. That was what I of course should have found and read by myself. I have used HA quite a while but recently tried to leave Nod-Red to use HA Automations instead. Much more to learn, and this was a really good practice. The logic as asked for above is now working and Im going to add Sun elevation/azimuth as Conditions. Great help from both you and @Stiltjack
Highly appreciated!