core: Platform TOD is not updating properly on sunset

The problem

I’ve configured a binary sensor based on sunset / sunrise to color my graphs. For at least 15 days the sunset is only being triggered around midnight, and not at 18h50 as it should. Sunrise is triggered correctly.

Environment

Home Assistant 0.105.4

  • Home Assistant release with the issue:
  • Last working Home Assistant release (if known): NA
  • Operating environment (Hass.io/Docker/Windows/etc.): Docker
  • Integration causing this issue: TOD
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/tod/

Problem-relevant configuration.yaml

- platform: tod
  name: Night
  after: sunset
  before: sunrise

Additional information

This has worked correctly previously.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 22 (2 by maintainers)

Most upvoted comments

Not sure if I have a duplicate of this issue, or just a similar problem. I recently (last week) configured the TOD platform and most of them seem to be working as expected, except for my night sensor:

binary_sensor time_of_day:
  - platform: tod
    name: Night
    after: sunset
    before: sunrise

It seems like the issue is that the before attribute of the sensor isn’t being correctly calculated (advanced to the next day, as described in the documentation) and that is why it’s not working.

image