Sun sunset offset not working

Hello, i am trying to make an automation where i need to do something before sunset. I did make an automation that should turn on a helper “tma” when its two hours before sunset and another one that turns the “tma” off on sunrise.

The problem for me is that the offset doesn’t matter. It is ignored. For me is the offset important. How to solve this? Or how you would do it?

Thanks.

My Automation:
alias: Turn on tma
description: ''
trigger:
  - platform: sun
    event: sunset
    offset: '-2'
condition: []
action:
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.tma
mode: single
1 Like

You might need to put the full HH:MM:SS format for the time. Here’s my automation that works reliably:

alias: 'Timed Lights: Hallway'
description: ''
trigger:
  - platform: sun
    event: sunset
    offset: '-00:50:00'
condition: []
action:
  - service: scene.turn_on
    target:
      entity_id:
        - scene.hallway_full_bright
    data:
      transition: 5
mode: single

2 Likes

I am going to try it. Thanks.
I will post the status here afterwards.

Yes it works. The format was my fault.

No worries! Happy you got it working :slight_smile: