#Turn on 1 hour after sunrise

1 messages · Page 1 of 1 (latest)

slow moss
#

I for the life of me cannot seem to get this working. If I set it to -01:00:00 it turns on a hour early, but I can't get it to turn on a hour late..

triggers:
  - event: sunrise
    offset: "+01:00:00"
    trigger: sun
#

Turn on 1 hour after sunrise

slim burrow
#

I'm not sure if a + is recognized syntax

#

perhaps try offset: "01:00:00"

#

Maybe + works, IDK

slow moss
#

That was the first thing I tried and that didn't work either.

slim burrow
#

Hmm seems fine to me 😕

slow moss
#

Hmm, I'll set it back up that way and see tomorrow am..

slow moss
#

Yea, not working.

slim burrow
#

Can you share the entirety of your automation, you're positive it didn't trigger?

sterile stone
#

It does work, I have a post-sunrise trigger that works fine.
Do you have your location set correctly? I'd assume so if you can get pre-sunrise triggers working but worth checking

slim burrow
#

plusone that it works for me. (With or without +)

slow moss
#

Here is my automation.

alias: WLED On at sunrise
description: ""
triggers:
  - event: sunrise
    offset: "01:00:00"
    trigger: sun
conditions: []
actions:
  - type: turn_on
    device_id: <redacted>
    entity_id: <redacted>
    domain: light
mode: single
sterile stone
#

I gotta ask... Why redact the device/entity id? It's not like they're ip addresses...
Anyway

alias: Sunrise test
description: ""
triggers:
  - trigger: sun
    event: sunrise
    offset: "01:00:00"
conditions: []
actions:
  - action: persistent_notification.create
    metadata: {}
    data:
      message: Sunrise + 1hr
mode: single

Works fine for me
Can you check the traces for the automation?

radiant kiln
#

If your trigger sunstill exist after sunrise ?
See the "important" note

slim burrow
#

That note is for time trigger, not sun trigger.

slow moss
#

nvm, I found the traces

#

Is this what you are asking for ?

#

Seems like its firing off "realtime" earlier than it thinks it is..

#

I'd say 2 hours-ish early.

#

I set to 03:00:00 and will see tomorrow.

sterile stone
#

Yeah that's the one, that's weird...

slow moss
#

So still coming on around 6am PST even with 03:00:00..

#

I'm just gonna change it to a fixed time that it turns on I guess..

sterile stone
#

Is that sunrise for you then? Because the previous screenshot you shared has it going off at nearly 8am

slow moss
#

6amish is sunrise

#

Ok. So it came on before 6am I think, and sunrise was 6:48am PST.

sterile stone
#

You can check the traces to find out when it actually went off

sterile stone
slow moss
#

Yea, I'm not sure what is going on.

sterile stone
#

Can you go into the template editor in developer tools and type in {{now()}} - that will let us see what time your home assistant thinks it is, and so can work out if it's wrong

slow moss
#

@sterile stone Sorry just saw this. Where do I find that ?

#

I think I found it.. This is what is currently in there..

{## Imitate available variables: ##}
{% set my_test_json = {
  "temperature": 25,
  "unit": "°C"
} %}

The temperature is {{ my_test_json.temperature }} {{ my_test_json.unit }}.

{% if is_state("sun.sun", "above_horizon") -%}
  The sun rose {{ relative_time(states.sun.sun.last_changed) }} ago.
{%- else -%}
  The sun will rise at {{ as_timestamp(state_attr("sun.sun", "next_rising")) | timestamp_local }}.
{%- endif %}

For loop example getting entity values in the weather domain:

{% for state in states.weather -%}
  {%- if loop.first %}The {% elif loop.last %} and the {% else %}, the {% endif -%}
  {{ state.name | lower }} is {{state.state_with_unit}}
{%- endfor %}.
#

Adding that to bottom, I get this in results

The temperature is 25 °C.

The sun will rise at 2025-02-01T06:43:04.199010-08:00.

For loop example getting entity values in the weather domain:

The forecast home is cloudy.
2025-01-31 18:43:00.421768-08:00
#

its 18:43 right now