core: Errors when calling turn_on service for switch/flux with HA 0.94
Home Assistant release with the issue: 0.94
Last working Home Assistant release (if known): 0.93.2
Operating environment (Hass.io/Docker/Windows/etc.): Raspbian/Python 3.7.2/venv
Component/platform: switch/flux
Description of problem:
When calling service switch.turn_on
for switch.flux
entity there is error in log:
2019-06-06 08:38:45 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/flux/switch.py", line 209, in async_flux_update
if stop_time <= start_time:
TypeError: '<=' not supported between instances of 'NoneType' and 'datetime.datetime'
Problem-relevant configuration.yaml
entries and (fill out even if it seems unimportant):
- platform: flux
lights:
- light.bulbs_salon
- light.lamp_salon
name: 'Flux'
start_colortemp: 4400
sunset_colortemp: 3850
stop_colortemp: 3300
mode: mired
brightness: 255
transition: 30
interval: 600
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 20 (15 by maintainers)
Commits related to this issue
- Quiet the chatty sun.sun (#23832) * Split up method to allow caching event * Lower frequency of updates. * Code review patches. * Minor changes to test * Skip end of period at fixed multi... — committed to home-assistant/core by Swamp-Ig 5 years ago
- Fixed issue #24335 — committed to Swamp-Ig/home-assistant by Swamp-Ig 5 years ago
- Fixed issue #24335 (#24612) — committed to home-assistant/core by Swamp-Ig 5 years ago
- Fixed issue #24335 (#24612) — committed to home-assistant/core by Swamp-Ig 5 years ago
OK have figured it out. Pushed a PR that fixes the issue.
This has uncovered an issue in flux, it won’t properly handle latitudes where the Sun either doesn’t set, or doesn’t reach twilight. An elevation based approach where the colour temp is based on the elevation of the sun would be more appropriate.
If anyone needs a temporary fix in the meantime, here is an automation I’ve made that does the legwork of the flux switch - however, you need one automation per device to flux. Edit values as needed:
I got what appears to be the same error. Added below over multiple lines so we have one that is easier to read 😃