Thanks for the component, I’m currently testing it to replace flux in my setup
Do you have plans to get this mainlined at some point?
Btw, with embedded platforms it is now possible to contain the code inside a single directory (which would allow it to be easily pulled from a git repository), here’s the structure under ~/.homeassistant:
hi all,
i may have a stupid question, can anyone tell me when the lights should be brightest?
it’s pitch dark outside here (around 10 pm) and the lights are at around 30% (which is just a little bit above my min_brightness
Is my assumption correct that it will go darker the later it is in the day?
Yes, they start at max_brightness at sunset, dim down to min_brightness (half way between sunset and sunrise) then brighten back to max_brightness at sunrise.
I had an idea: during evening, I want my kitchen lights to be on low brightness when nobody is in the kitchen.And turn to a higher brightness when somebody enters the kitchen.
I made something that works, kind off. My config for this, looks like this:
in the HA log I see 10 errors after a restart (all the same as shown below), they must be linked to the above configuration.
Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/switch/circadian_lighting.py", line 332, in light_state_changed
self.adjust_lights([entity_id], 1)
File "/config/custom_components/switch/circadian_lighting.py", line 266, in adjust_lights
if self.should_adjust():
File "/config/custom_components/switch/circadian_lighting.py", line 259, in should_adjust
elif self._attributes['disable_entity'] is not None and self.hass.states.get(self._attributes['disable_entity']).state == self._attributes['disable_state']:
AttributeError: 'NoneType' object has no attribute 'state'
So I must be doing something that’s not correct.
Can maybe someone provide some help? Is there a better way to implement this?
Basically what’s happening is that the Circadian Lighting switches are being initialized before your motion_sensor_xyz, so when CL tries to check the state there’s nothing there.
I think there’s a way with async to have CL wait until the disable_entity exists before trying to query the state…I’ve been wanting to implement async but I have no experience with it and haven’t had the time to learn.
In the mean time I should probably have it check if the entity exists yet before checking its state, but for now you should be able to just ignore the error.
OK, thank you for the explanation.I will ignore the errors
Can I ask you about advice regarding my implementation?
Right now, the switch from low brightness to high brightness is not instantaneous. It takes at least 20 seconds.
I can decrease the numbers even more, but I wonder, is there another way to implement this?
I tried something with the “circadian_lighting.values_update” service, but that did no do anything.
Not sure if this is quite what you want but I have my lights set up for 3 modes:ON, OFF, AUTO (motion controlled) where in AUTO I have Circadian Lighting turned ON, but in ON mode I have CL OFF. This way if I want the kitchen light ON for cooking etc, I’m not trying to do so in low, orange light. This is all done with automations, CL switches and Xiaomi wireless buttons. I have the same for the ensuite light so my girlfriend can do her make-up in decent light for example, but later at night the light would generally be in AUTO mode so it turns ON with motion and is set low and reddish.
As I say, I’m not sure that it is quite what you are chasing but maybe an idea to think about.
I just upgraded to version 0.86.4 and now get errors that circadian_lighting cannot load anymore. From the log file:;
2019-01-31 08:03:41 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.switch.circadian_lighting. Make sure all dependencies are installed
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 117, in _load_file
module = importlib.import_module(path)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 673, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/homeassistant/.homeassistant/custom_components/switch/circadian_lighting.py", line 16, in <module>
from homeassistant.helpers.restore_state import async_get_last_state
ImportError: cannot import name 'async_get_last_state'
2019-01-31 08:03:41 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.circadian_lighting.switch. Make sure all dependencies are installed
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 117, in _load_file
module = importlib.import_module(path)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ImportError: No module named 'custom_components.circadian_lighting.switch'; 'custom_components.circadian_lighting' is not a package
2019-01-31 08:03:41 ERROR (MainThread) [homeassistant.loader] Unable to find platform circadian_lighting
This line is interesting: ImportError: No module named 'custom_components.circadian_lighting.switch'; 'custom_components.circadian_lighting' is not a package
I am not sure which version I have. The date stamp is from Dec 6.What is the latest version?
Setting the file up as tepprr proposes does not change the issue. It did work for 0.85 and before so maybe I should report an issues at home assistant.
For some reason the component ignores the transition time. It seems to fire non stop and changes the lights instantly. I’m not entirely sure why this happens. I’ve added the transition time to the configuration file after not including it and altered the value, but this seems to make no difference. I’m using Philips Hue lights with the 2nd generation Hue Hub.
The way I found out is trying to change the lights manually but they only budge for like half a second, before it’s back to the circadian setting. I see absolutely no errors at all. When I focus on the lights when they’re scheduled to change, I notice they too change instantly.
What could cause this behavior?
Edit: Setting the interval and transition doesn’t change anything. I’m currently on 300/30 but tried several options.
It will however respond immediately if a light is adjusted because it listens for lights to turn on so they can be immediately set to the correct values. In this case it also ignores the transition time.
That being said, I do think something isn’t working properly. I also have almost exclusively Hue lights and the second generation bridge - I recently installed a Hue fixture in the kitchen where a lot of time is spent throughout the day on weekends, and I noticed that transitions in color temperature were quite noticeable when they should be gradual and imperceptible with the default transition and interval settings. I plan on troubleshooting when I have the time.