No, not really. How would you then get it to resume the circadian adjustments if the switch is already on? The only real solution is to disable the switch when you want to adjust lights. One proposal that I’d like to implement is to have the CL switch turn itself off if lights are adjusted too far outside of a “threshold.” So if you change the lights to blue, it would be outside of a threshold and CL would disable itself for that light and remain off until you switch it back on.
You have a couple options now - one would be to expose the CL switches to Google Assistant so you could tell it to turn off CL and set the light to blue. I believe Google Assistant commands to Home Assistant show up as events, so another option would be to write an automation that turns off the CL switch if Home Assistant gets a command from Google to adjust a light - this assumes that you have your lights exposed to Google Assistant through Home Assistant and not with a native integration.
Does it revert immediately, every single time? The interval starts when the CL switch is turned on, not when the light is turned on, so it’s possible you’re turning on the light just before the next interval.
The threshold idea was neat, maybe it can be implemented. I really don’t want to have to first tell GA to turn off the CL switches and then change color.
Yes, it does revert immediately all the time. Nope I’ve tried to do this many times without success. Maybe I got a bug.
Thank you so much for the great ideas, I’ll try to make an automation to turn off the CL switches when GA gets a light command.
I wanted to customize the way the component runs and so I decided to port the logic for getting the percent and getting the color temp to JavaScript and included them into a function node, in Node-Red. The way that I have my flows configured now is not easily shareable, however I created a gist with the code I used for getting the color temperature in my function nodes, so that others may use it at their desire.
Basically, the code expects a darksky weather API response object (you can easily refactor this out; I will likely remove this dependency myself before long) to be passed in, which is where the sunrise/sunset time values come from. Beyond that, this port is a consolidated lite-version of @claytonjn’s component.
Very cool! this is just exactly what I was lookin for… but I just don’t get this to work! maybe somebody can help me. What I did:
I copied the five files frome here (not just the three mentionied in the this thread) to the custom_components folder.
this is my configuraion yaml:
So as far as I understand there are no more steps to do… The lights “esstisch” and “kommode” should from now on have the same coulour as the sun;-) Whenever turned on. But nothing happens at all.
this is my log after a fresh reboot:
2020-02-09 16:59:12 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for circadian_lighting which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2020-02-09 16:59:17 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/helpers/entity_platform.py", line 399, in _async_add_entity
raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: sensor.circadian_values
Am I doing something wrong?
Any Help is appreciated! Thanks!
If you comment out the circadian_lighting: line from your configuration.yaml and reboot does the sensor.circadian_values entity still exist, and does the error still occur?
2020-02-09 18:31:28 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for circadian_lighting which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2020-02-09 18:31:28 ERROR (MainThread) [homeassistant.setup] Error during setup of component circadian_lighting
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/setup.py", line 176, in _async_setup_component
component.setup, hass, processed_config # type: ignore
File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/circadian_lighting/__init__.py", line 92, in setup
conf = config[DOMAIN]
KeyError: 'circadian_lighting'
2020-02-09 18:31:28 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Unable to set up component.
Look under Developer Tools --> States. The switches will be on that page. You can switch them on by clicking on the circle-i icon, toggle the switch to on, on the card that pops up.
If you want to show them on the Lovelace UI, you will have to make that happen yourself.
OK. Thanks for the information. The switch configured does not show up on the States Page.
Isn’t there something going wrong on my install? Should I reinstall? Or can somebody find a mistake in my setup…
If i try a reinstall: Should I use just the three files from here, oder all five from here?
Sorry, the first post was out of date; I have updated it. The instructions in the Wiki are correct (all 5 files). I would strongly suggest using HACS because it should ensure no installation issues, will make it easier to stay up-to-date, and you’ll likely find other custom integrations you want to use.
The CL switch(es) won’t work if there’s an issue with the sensor. I would comment out everything related to CL and make sure nothing is showing up in the logs. Then uncomment only the circadian_lighting: line of configuration.yaml and make sure no errors are showing up. The fact that the original error was that the entity sensor.circadian_values already exists make it seem as though HA is trying to load CL twice for some reason and we need to figure that out before we can get the light adjustment working.
Thanks very much for your help. In Fact something went wrong with the installation.
I deleted the old installation, then installed hacs (I didnt know it before).
I then reinstalled CL via HACS and uncommented my config. now everything is working.
Thanks everybody trying to help me!
Great custom component, I’ve just installed it and it works great. I have two questions though.
1/ All my bulbs are Philips hue RGB (color ambiance) except for two that are Philips hue White Ambiance (warm/cold white). How should I configure the circadian switch ? For now, I’ve put all my light entities under lights_ct but don’t know if I should user lights_rgb instead (sorry I haven’t clearly understood the difference regarding what CL does)
2/ For now, when I’m turning the lights on, there is a small delay (one or two seconds) when the light temperature is still in its previous state before fading to the temperature set by CL. Is there any way to get rid of that small delay ?
lights_ct is correct if your lights support it (yours do).
It depends how you turn your lights on. If you’re using an automation you can use the attributes of the switch to send the correct values in the turn_on service call. If you’re using a Hue switch you could create a Hue scene to have the switch activate, and write an automation to update that scene when CL values are updated. If you’re turning the lights on from the frontend you might be able to find a way in lovelace to have the switch send the correct values, I’ve not really looked into that. If you’re controlling the lights outside of HA (using the Hue or another 3rd party app, or using a voice assistant directly connected to Hue, etc) then there’s probably nothing that can be done to improve the delay.
Hi All - I think something broke this integration in HA… I don’t see anything in my logs.
I just don’t see the lights changing their color / brightness as of today
any thoughts would be helpful - thanks!
config $ more home-assistant.log|grep circadian
2020-02-10 14:26:06 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for circadian_lighting which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2020-02-10 14:26:21 INFO (MainThread) [homeassistant.setup] Setting up circadian_lighting
2020-02-10 14:26:23 INFO (MainThread) [homeassistant.setup] Setup of domain circadian_lighting took 2.3 seconds.
2020-02-10 14:26:23 INFO (MainThread) [homeassistant.components.switch] Setting up switch.circadian_lighting
2020-02-10 14:26:24 INFO (MainThread) [homeassistant.components.switch] Setting up switch.circadian_lighting
2020-02-10 14:26:24 INFO (MainThread) [homeassistant.components.switch] Setting up switch.circadian_lighting
2020-02-10 14:27:05 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.circadian_lighting
config $