Circadian Lighting [Custom Component]

So installed, restarted HA, then error?

That’s correct.

  • Installed HACS into HA v0.114.3.
  • Restarted HA.
  • Waited the requisite hour.
  • Installed CL v1.0.13 via HACS. Restarted HA, got the error message plus one about timezonefinder. Spent some time researching and reading in this forum.
  • Uninstalled CL v1.0.13.
  • Restarted HA
  • Installed CL v1.0.11 via HACS
  • Restarted HA. Got the error message posted above. (But I did not see one about timezonefinder this time.)

Odd
 I think I better leave this one for @claytonjn as I’m not sure what the issue is. Sorry I can’t help

No worries. Thanks anyway!

by “far from optimal” I meant a need of creating additional switches for each light.

minor but visible especially durring ‘darker’ hours. Even 500ms delay would cause unpleasent flash

These only need to be visible / used if you intend on manually turning CL on/off. I have this fully automated so the switches (after the initial creation) are never seen again. They exist but are controlled via HA actions (service calls).

I suggest you try it before making judgement. You have nothing to lose other than half an hour of your time to install and setup.

@maxym, you edited your post that you have a workaround so this may be irrelevant but here’s some additional information about your questions/concerns.

  • You are correct that if you turn on a light external to HA there could be a delay between when the light is visibly on to when CL sets it to the correct settings. The delay will vary greatly depending on the type of light, the speed of your hardware, etc. I have a LIFX light and the service it uses to adjust settings while remaining off is lifx.set_state. This is obviously only for LIFX lights and your Shelly would use a different service, which is what I mean by non-standard. For me to implement the ability you’re looking for directly CL would need to have configuration options allowing the user to specify the name of the service and the format for the service call, for each light. This is doable but complex for both myself and users. My suggestion would be to simply write an automation that triggers when the color temperature from the CL sensor or the brightness from the CL switch change, and has an action that uses the appropriate service call to adjust the lights without turning them on. In addition to adjusting the lights, CL exposes the calculated values in the sensor/switches so that you can build upon the functionality for your specific needs.
  • The only notable extra overhead caused by creating multiple CL switch configurations vs just one is that the states would be logged to your logger/history DB. If you exclude those entities from history (so HA isn’t keeping track of the history of them being turned on/off) then the difference should be completely negligible - even without excluding them that extra overhead would be extremely minor.

@JaimeZX you got the error about SwitchDevice with CL v1.0.13? Can you provide that exact error? In regards to timezonefinder, if HA was unable to install the package automatically you may need to install it yourself manually - the method for doing so will depend on how HA is installed on your system.

Thank you @claytonjn for detailed answer. I didn’t know that there is no universal API to talk with all lights and you would have to use light integration specific service calls. It sounds a bit like PC hardware scene yet before DirectX
 But if the situation is as you described then I understand that it’s not in your hands.

Thank you for the idea too. I’m going to do that using NodeRed with approach you described (actually i saw someones solution already on this forum).

BTW I cannot see Circadian Lighting component in HACS. Found no additional info which would help in that. Github pages says: Once you have HACS setup you can simply search for and install Circadian Lighting under STORE.
HACS has no STORE section. No available sections list any component after entering “circadian” phrase into search
Is it still possible to install it via hacs?
Edit: I’m stupid. i was using search instead pressing big [+] button.

with regards

That’s correct, sir.
For CL v1.0.11, I get the following on boot:

2020-09-01 05:26:34 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-09-01 05:26:37 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 experience issues with Home Assistant.
2020-09-01 05:26:37 WARNING (MainThread) [homeassistant.components.switch] SwitchDevice is deprecated, modify CircadianSwitch to extend SwitchEntity
2020-09-01 05:26:38 ERROR (MainThread) [homeassistant.setup] Error during setup of component circadian_lighting
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/setup.py”, line 191, in _async_setup_component
result = await task
File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/circadian_lighting/init.py”, line 92, in setup
conf = config[DOMAIN]
KeyError: ‘circadian_lighting’
2020-09-01 05:26:38 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Unable to set up component.

 Using HACS I have re-updated to v1.0.13, which now gives this on boot:

2020-09-01 05:34:11 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-09-01 05:34:14 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 experience issues with Home Assistant.
2020-09-01 05:34:15 ERROR (MainThread) [homeassistant.setup] Error during setup of component circadian_lighting
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/setup.py”, line 191, in _async_setup_component
result = await task
File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/circadian_lighting/init.py”, line 92, in setup
conf = config[DOMAIN]
KeyError: ‘circadian_lighting’
2020-09-01 05:34:15 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Unable to set up component.

I don’t see anything about timezonefinder this time.
Thanks again for your thoughts here!

Sorry bothering you.
I cannot find brightness attribute in circadian sensor:

I’m sorry, the HACS interface updated since I wrote up that blurb and it’s no longer accurate I need to update that. Glad you figured it out!

Brightness is an attribute of the switch entity because it can be different for different switch instances.

@JaimeZX 1.0.13 includes the fix for the SwitchDevice warning which is why 1.0.11 shows that warning. I thought perhaps the latest HA version completely removed SwitchDevice but I don’t see anything about that so that warning can still be ignored. It seems that there’s something else going on - what’s your configuration for CL look like and have you run Configuration validation?

Check Configuration: Configuration Valid!

Log:
‘’‘2020-09-01 12:13:48 ERROR (MainThread) [homeassistant.setup] Error during setup of component circadian_lighting
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/setup.py”, line 191, in _async_setup_component
result = await task
File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)’’’
File “/config/custom_components/circadian_lighting/init.py”, line 92, in setup
conf = config[DOMAIN]
KeyError: ‘circadian_lighting’
2020-09-01 12:13:48 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Unable to set up component.’’’

THAT SAID
 I am super confused. If i SSH into the HA instance, there IS NO /usr/src OR /usr/local/lib/python3.8 for that matter. Logged in as root
 I DID find a setup.py in /config/custom_components/hacs/operational/ though. ?

What do you have in your configuration.yaml for Circadian Lighting?

Only this:

switch:

  • platform: circadian_lighting
    lights_ct:
    • light.feitbulb1_feitbulb1

I have no idea why my font is different sizes in every comment.

That’s your problem, you also need circadian_lighting: so you should have:

circadian_lighting:

switch:
  - platform: circadian_lighting
    lights_ct:
      - light.feitbulb1_feitbulb1

WELL! Excellent! That fixed the errors. Now I just have to figure out where to find the interface (?)
I’ll re-read all of the documentation here after work. Thanks! :slight_smile:

There isn’t really an ‘interface’ as such. You will now have switch entities that you can turn on/off for your circadian lighting, so include those in your Lovelace somewhere to control it. I’d suggest changing the code above slightly with a name for this switch so when you have more they are easily distinguished.

circadian_lighting:

switch:
  - platform: circadian_lighting
    name: Feitbulb 1
    lights_ct:
      - light.feitbulb1_feitbulb1

and you should end up with a switch entity: switch.circadian_lighting_feitbulb_1 which you can control however you feel to enable / disable the CL effect on this light. I personally use automations to switch CL on/off based on other events

No, you arent stupid. and with all respect to the owner/designer/nabucasa employee. The previous version of the site was much more intuitive and to be honest. Better.

1 Like

Yep! Got it! Thanks. I guess I was just thinking there was an interface based on the graphs at the top of this page. I’ll probably have more questions but I want to let it run on one bulb for at least 24 hours before engaging. :slight_smile: