Condition via template; Sunrise later then 7:00 then true

Although HA user from the start I still struggle with templates.

As part of a condition I want to validate if “sunrise time”+30 mins is after 7:00 then return true. It’s not important that this is tomorrows or todays sunrise. Difference is minimal.

Prefer to do this as a template vs multiple automatons. Any suggestions?

Use case:
I use Occusim Appdeamon app to run simulated lights when on holiday. However there are no conditional parameters; It runs in it completeness when a particular boolean is “on”. This means that my morning light routine also runs when it is not needed (eg when sunrise is before 7:00) . I’m splitting my Occusim in 2 parts so I can set another boolean to ‘on’ when sunrise is indeed after 7:00 causing the simulation also to run in the morning but only when it is needed.

Template is one thing but I’d like to understand the use case behind this condition too :slight_smile:

added use case.

Maybe I should not have asked :slight_smile:
Some idea, sun_next rising vs. 07:00… you could skip the 2nd timedetla if you are only checking before sunrise ‘today’…the idea is that the template returns true of false

{{ as_local(as_datetime(state_attr('sun.sun', 'next_rising'))) - timedelta(hours=6,minutes=30) < (today_at("07:00:00")+ timedelta(hours=24)) }}

possibly there are more efficient ways…others may chime in

For the standard Sun integration (AKA sun.sun):

{% set rise30 = 
(state_attr('sun.sun', 'next_rising') | as_datetime | as_local
+ timedelta(minutes=30)).strftime('%H:%M') %}
{{ today_at(rise30) > today_at('07:00:00')}}

If you use the HA Sun2 integration you can use a slightly more compact template:

{% set rise_30 = state_attr('sensor.sunrise', 'today') + timedelta(minutes=30) %}
{{ rise_30 > today_at('07:00:00')}}

Thanks @vingerha @Didgeridrew