binary_sensor:
- platform: tod # TIME OF DAY - On if it's dark outside
name: nuit
after: sunset
after_offset: '00:30:00'
before: sunrise
before_offset: '-00:30:00'
that started to misbehave lately. I think it’s since I upgraded to 114.4 but I’ve really only noticed it in the last few days. It is correctly set at 30 minutes after sunset but the 30 minutes before sunrise isn’t triggered. Like now, it’s 10:17 am and the sensor still thinks it’s night. It, of course, creates havoc with all my automation that requires it.
The ‘sun’ sensor is working fine, like for now, it’s says ‘Sun’, but not that binary sensor.
Has something changed in 114.4 that created that problem? A reboot ‘fixes’ it until the following night.
Quick update, I removed the before_offset: '-00:30:00' from the sensor and now it works correctly (albeit not at the time I want) so is there something wrong with assigning a negative offset now? I want the sensor to be ‘on’ up to 30 minutes before sunrise.
This is what I had to do to get them to fire “correctly”. If I set both before_offset and after_offset, then it usually fails to update properly with nothing showing up in the logs.
Thanks, since it’s just one and only 30 minutes before sunrise, I’ve took it off and wait for the code to be fixed. Since in a unsupported configuration (running on Raspbian), I can’t really open an incident on github. Are you using a supported configuration?
binary_sensor stayed ‘stuck’ this morning, even without an offset So I did something similar to you but didn’t want to adjust all the automations that rely on that ‘nuit’ (night) binary_sensor. So here’s what I did:
- platform: tod # TIME OF DAY - On if it's dark outside
name: everning_dark
after: sunset
after_offset: '00:30:00'
before: '3:00:00'
- platform: tod # TIME OF DAY - On if it's dark outside
name: morning_dark
after: '2:00:00'
before: sunrise
before_offset: '-00:30:00'
- platform: template
sensors:
nuit:
value_template: "{{ is_state('everning_dark', 'on') or is_state('morning_dark', 'on') }}"
Same behavior on my side with tod, it remain now always in “on” state. It had worked without issue since it was first introduced a couple of months back.
Running latest version 0.115.2. Just found out the problem yesterday when I saw my exterior lights still open in the middle of the day. Cannot confirm exactly when (which version) it stopped working.
Very simple config
binary_sensor:
- platform: tod
name: Night
after: sunset
after_offset: '-00:02:00'
before: sunrise
before_offset: '00:02:00'
Will get a look if an Issue have officially been open in HA Core Tracker.