Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Trigger for Solar Noon #742

Answered by craigbarratt
AlexHuebi asked this question in Q&A
Discussion options

Hi there,
I was wondering if anyone has already figured out how to get a trigger, which, well, triggers at Solar Noon which is when the Sun passes the south, instead of the current Noon Trigger @time_trigger("once(noon)") which triggers at exactly 12:00.

You must be logged in to vote

The problem is those are ISO format timestamps, which as you noticed pyscript can't parse, unless you extract just the time of day. @dbsdbs93 proposed a good solution. To trigger once when the azimuth crosses 180 you could do this (untested):

@state_trigger("float(sun.sun.old.azimuth) < 180 <= float(sun.sun.azimuth)")

azimuth only updates every couple of minutes, so it won't be exact.

Replies: 1 comment 4 replies

Comment options

The sun.sun entity has an azimuth attribute. Solar noon happens just around an azimuth of 180 every day. So you can do a trigger based on that.

You must be logged in to vote
4 replies
Comment options

I second this. You can rely on sun.sun attributes or at most you can try find an integration that provides the "solar noon" sensor.

Comment options

There is also a sensor.sun_next_noon available which is a timestamp: '2025-07-06T11:07:17+00:00'. But I couldn't figure out, how to use that timestamp to trigger the function. Or at least my naive implementation wouldn't work.

I tried @time_trigger(sensor.sun_next_noon) which resulted in Can't parse 2025年07月29日T11:09:02+00:00 in time_trigger check
And @time_trigger(f"once({sensor.sun_next_noon})") results in can't parse time offset t11:09:02+00:00

Comment options

The problem is those are ISO format timestamps, which as you noticed pyscript can't parse, unless you extract just the time of day. @dbsdbs93 proposed a good solution. To trigger once when the azimuth crosses 180 you could do this (untested):

@state_trigger("float(sun.sun.old.azimuth) < 180 <= float(sun.sun.azimuth)")

azimuth only updates every couple of minutes, so it won't be exact.

Answer selected by AlexHuebi
Comment options

I tried that for today, and it worked like a charm. Thank you!

Although, might it be a possibility to get like a once(solarnoon) or similar trigger in the future?

In any case, thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /