[SOLVED] Trigger based on sun elevation not working. What do you think is wrong with it?

According to suncalc.org, the altitude of the sun at my location was -3.99 at 06:30 this morning. I have this automation to turn off some lights when it’s above -4.0 when the sun is rising. It didn’t trigger this morning. Here it is:

You actually mean “not trigger”, ie. you have no automation traces for today?

1 Like

The problem is the State Condition.

The rising attribute is a boolean value, meaning true or false. However, the moment you put quotes around the word true it changes its type from boolean to string. As a result, the State Condition can never find a match because it’s looking for a string value containing the word “true” as opposed to what the rising attribute contains which is a boolean true value.

Remove the quotes and it should work. However, if you are using the Automation Editor, it has a bad habit of automatically adding the quotes … and so the problem will return. If you are using a text editor, and the automation is separate from any created with the Automation Editor, the changes you make will not be undone by the Automation Editor.

2 Likes

Good call, @koying, about checking the trace. I’m still new to automations and didn’t even think about it.

@123, you are 100% correct about everything.
I did use the UI to create the automation and it got translated into Yaml automatically.
I see it now how it was looking for a string instead of a boolean.

Thanks a lot both for your quick support!