Sunrise Trigger not firing HELP!

'My sunset trigger has stopped working and I don’t understand why. YAML code is below I don’t understand why the trigger isn’t firing like it should. Any help is greatly appreciated.

Trigger looks fine (1 hour before sunset).

Is your location still correct?

Is your system OS time correct?

Is your time zone correct?

Did the automation trigger but a condition stopped it from running?

See here to check the trace: Troubleshooting automations - Home Assistant

Also in future, please post your config as text rather than an image of text. You can find out how to format it correctly for the forum here: How to help us help you - or How to ask a good question This will help us help you as we can copy/paste/edit your config to show you what may need changing.

I have similar issue:

alias: "#19-14 Salon Evening Blue ON"
description: ""
trigger:
  - platform: sun
    event: sunset
    offset: "-00:15:00"
condition:
  - condition: state
    entity_id: calendar.18_trips
    state: "off"
  - condition: state
    entity_id: switch.19_11_salon_all
    state: "off"
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - service: light.turn_on
    data:
      color_name: blue
      brightness_pct: 100
    target:
      entity_id:
        - light.19_19a_salon_lamp_1_kasa_2
        - light.19_19b_salon_lamp_2_kasa
  - type: turn_on
    device_id: e504c3bd107c32758e1a1c4484f78b24
    entity_id: switch.13_2
    domain: switch
mode: single

Any suggestion ?

Exactly the same suggestions as I wrote in my previous post.

There are important nuances regarding the exact behavior of the sunrise/sunset trigger and condition, and the sun state condition. Your best bet is start off tom_I’s suggestions and a careful read of the docs.

Thank you all for the help and suggestions, here are the answers to the above questions.

Full code post below:

alias: Lights on @ sunset
description: Turn lights on depending on if XX or YY are Home
trigger:
  - platform: sun
    event: sunset
    offset: "-01:00:00"
  - platform: state
    entity_id:
      - sun.sun
    from: above_horizon
    to: below_horizon
condition: []
action:
  - alias: If XX or YY are Home
    if:
      - condition: or
        conditions:
          - condition: device
            device_id: XXDevice
            domain: device_tracker
            entity_id: XXDeviceID
            type: is_home
          - condition: device
            device_id: YYDevice
            domain: device_tracker
            entity_id: YYDeviceID
            type: is_home
        alias: If XX or YY are home
    then:
      - service: scene.turn_on
        data: {}
        target:
          entity_id: scene.lights_sunset
      - service: switch.turn_on
        data: {}
        target:
          device_id:
            - FakeDeviceID
      - alias: Turn on strip lights if TV is on
        if:
          - condition: state
            entity_id: binary_sensor.living_room_tv_power_state
            state: "on"
        then:
          - service: scene.turn_on
            data: {}
            target:
              entity_id: scene.livingroomledstriplightdefault
      - if:
          - condition: device
            type: is_off
            device_id: FakeDeviceID
            entity_id: FakeDeviceID
            domain: switch
        then:
          - service: light.turn_on
            data: {}
            target:
              entity_id: light.kitchen_bar_light
        alias: Turn on Bar light if overhead lights off
    else:
      - service: light.turn_on
        data: {}
        target:
          entity_id:
            - light.front_door_lamp
            - light.kitchen_bar_light
      - service: switch.turn_on
        data: {}
        target:
          device_id:
            - FakeDeviceID
          entity_id:
            - switch.living_room_nightlight
            - switch.sunroom_lamp
mode: single

1 Like

Is the trace reporting any error for the trigger? Does the same trigger work in other automations?

Did you set your elevation? That can alter your time upwards of 30 to 60 minutes. If you really put in a wrong elevation, it can alter it by hours.

If you’re in EST, your sun times should be close to (also in EST):

Developer tools → states page.

I went back and double checked, the trace is not reporting any errors at all. I do have my elevation set, and my times are within reason of the ones posted.

I do not have another automation based solely on sunset so I did just create a test automation to send a notification at sunset. I will see if it triggers correctly tonight.

Yeah, just keep in mind that the times in the states page are UTC. So they may look a bit odd, but they are accurate to your timezone.

Last night everything worked as expected. Not sure what I did that fixed the problem. I did restart both the VM and the actual host computer as well as check everything everyone posted above.

Thanks all for the support!