2021.5: Stability, performance, triggers, color modes!

Yes, I used the wrong call. This should work.

template:
- binary_sensor:
  - name: Night Time
    unique_id: night_time
    state: >
      {{ not '06:30' <= as_timestamp(now()) | timestamp_custom('%H:%M') <= '23:00' }}

Anwyas to explain the code…

'06:30' <= as_timestamp(now()) | timestamp_custom('%H:%M') <= '23:00' verifies the time is between 630 and 2300.

the not in front of that chooses the opposite time… I.e. night.

1 Like