claytonjn / hass-circadian_lighting Goto Github PK
View Code? Open in Web Editor NEWCircadian Lighting custom component for Home Assistant
License: Apache License 2.0
Circadian Lighting custom component for Home Assistant
License: Apache License 2.0
Currently, if a CL switch is configured to adjust both color temperature and brightness, the CL toggle switch and the disable_state
disables all adjustment (both color temperature and brightness). It would be nice to be able to dynamically enable/disable just color temperature or brightness - for example, you may want the option to turn brightness up for certain tasks while still maintaining the proper color temperature.
This can technically be accomplished already by configuring a "color temperature" CL switch (with disable_brightness_adjust
set to true) and a "brightness" CL switch (with lights included under lights_brightness
). While this works, it doubles the amount of service calls when both are on.
The ideal solution should be to create a new type of entity (i.e. cl_group
) with two toggles (color temperature and brightness), if both are configured. This would also mean creating a custom entity-row for Lovelace.
Hi, I just discovered this component and I love it! That said, having said that, I sometimes might not want to use it :-)
If I'm writing an automation to manually adjust brightness or color temperature, I can turn off the switch for CL. I also know there is a disable_entity
and disable_state
option that I can use to monitor another entity. But is there any way to intercept a change to, say, brightness that is done via the Alexa integration in HA and use that to tell CL to stop controlling a particular light? If someone explicitly sets the light configuration, it's a pretty good sign that they want control (probably with a timeout; that's for later), and not have the automatic CL.
Hi,
when using the HA Automation Assistant (editor), data_template seems not allowed. Getting message "service data_template not allowed"
Added in the action panel (service data box) the correct light entity id:
data_template:
entity_id: light.entity
kelvin: "{{ state_attr('sensor.circadian_values', 'colortemp') | int }}"
brightness_pct: "{{ state_attr('switch.circadian_lighting_[...]', 'brightness') | int }}"
Seems it does not work this way. Also got the same error using /developer-tools/service.
See :
https://github.com/claytonjn/hass-circadian_lighting/wiki/Additional-Functionality
Circadian Lighting currently is hardcoded to a 1 sec transition when a light is turned on, so that it will immediately be set to the proper value. I could make this configurable.
My only hesitation in doing so is that Circadian Lighting already has relatively complex configuration options and I don't want to add unnecessary confusion. Perhaps I should remove the options for disable entity and disable state because very simple automations could be written to turn on/off the CL switch... 🤔
I'm having a strange issue with the component where the min brightness level is ignored and the brightness moves down to zero, and further down to negative numbers. This causes my lights to turn off and not turn on again. This started a couple of weeks back (without doing anything to the config, or downloading updates. Updating to the latest version did not help, and it might even have made it worse.
My theory is that this could have something to do with the sun not actually setting until very late in the evening here in Sweden, (which is why I have it set att a steady time of 19:00).
I'll attach my debug log .here:
2019-05-24 22:22:56 DEBUG (SyncWorker_11) [custom_components.circadian_lighting.switch] light.entrance_ceiling CT Adjusted - color_temp: 400, brightness: -2.179779968261719, transition: 1 2019-05-24 22:22:56 DEBUG (SyncWorker_2) [custom_components.circadian_lighting.switch] light.entrance_ceiling CT Adjusted - color_temp: 400, brightness: -2.179779968261719, transition: 1 2019-05-24 22:22:56 DEBUG (SyncWorker_15) [custom_components.circadian_lighting.switch] light.entrance_ceiling CT Adjusted - color_temp: 400, brightness: -2.179779968261719, transition: 1 2019-05-24 22:22:57 DEBUG (SyncWorker_13) [custom_components.circadian_lighting.switch] light.entrance_ceiling CT Adjusted - color_temp: 400, brightness: -2.179779968261719, transition: 1 2019-05-24 22:23:29 DEBUG (SyncWorker_0) [custom_components.circadian_lighting] Astral location: name/region, tz=Europe/London, lat=60.67, lon=17.21 2019-05-24 22:23:29 DEBUG (SyncWorker_0) [custom_components.circadian_lighting] now: 2019-05-24 22:23:29.008020+02:00 2019-05-24 22:23:29 DEBUG (SyncWorker_0) [custom_components.circadian_lighting] Astral location: name/region, tz=Europe/London, lat=60.67, lon=17.21 2019-05-24 22:23:29 DEBUG (SyncWorker_0) [custom_components.circadian_lighting] x1: 1558717200.0 2019-05-24 22:23:29 DEBUG (SyncWorker_0) [custom_components.circadian_lighting] percentage: -106.36279296875 2019-05-24 22:23:29 DEBUG (SyncWorker_0) [custom_components.circadian_lighting] Circadian Lighting Component Updated 2019-05-24 22:23:29 DEBUG (SyncWorker_0) [custom_components.circadian_lighting.switch] Auto adjust stairwell and bedroom Switch Updated 2019-05-24 22:23:29 DEBUG (SyncWorker_0) [custom_components.circadian_lighting.switch] Auto adjust stairwell and bedroom off - not adjusting 2019-05-24 22:23:29 DEBUG (SyncWorker_0) [custom_components.circadian_lighting.switch] Auto adjust regular lamps Switch Updated 2019-05-24 22:23:29 DEBUG (SyncWorker_15) [custom_components.circadian_lighting.sensor] Circadian Lighting Sensor Updated 2019-05-24 22:24:31 DEBUG (SyncWorker_8) [custom_components.circadian_lighting] Astral location: name/region, tz=Europe/London, lat=60.67, lon=17.21 2019-05-24 22:24:31 DEBUG (SyncWorker_8) [custom_components.circadian_lighting] now: 2019-05-24 22:24:31.010575+02:00 2019-05-24 22:24:31 DEBUG (SyncWorker_8) [custom_components.circadian_lighting] Astral location: name/region, tz=Europe/London, lat=60.67, lon=17.21 2019-05-24 22:24:31 DEBUG (SyncWorker_8) [custom_components.circadian_lighting] x1: 1558717200.0 2019-05-24 22:24:31 DEBUG (SyncWorker_8) [custom_components.circadian_lighting] percentage: -106.5587158203125 2019-05-24 22:24:31 DEBUG (SyncWorker_8) [custom_components.circadian_lighting] Circadian Lighting Component Updated 2019-05-24 22:24:31 DEBUG (SyncWorker_6) [custom_components.circadian_lighting.switch] Auto adjust stairwell and bedroom Switch Updated 2019-05-24 22:24:31 DEBUG (SyncWorker_3) [custom_components.circadian_lighting.switch] Auto adjust regular lamps Switch Updated 2019-05-24 22:24:31 DEBUG (SyncWorker_8) [custom_components.circadian_lighting.sensor] Circadian Lighting Sensor Updated 2019-05-24 22:24:31 DEBUG (SyncWorker_6) [custom_components.circadian_lighting.switch] Auto adjust stairwell and bedroom off - not adjusting
And my config here:
circadian_lighting: transition: 0 interval: 50 sunset_time: "19:00:00"
And the switches:
`
switch:
Do you have any idéas what could be causing this?
Thanks for this great project. I've been using it for a few months with great success.
I believe I have my configuration.yaml setup mostly correct with the custom_update but I don't see a way of updating except for manually triggering custom_updater.update_all
Am I missing something?
# Custom Updater
custom_updater:
track:
- cards
- components
component_urls:
- https://raw.githubusercontent.com/claytonjn/hass-circadian_lighting/master/custom_updater.json
Thanks again
Clicking on the circadian sensor at the top of the Lovelace screen opens a small detail window.
There is no value in displaying X decimals here, figures without decimals would be much clearer/simpler and formatting would be much better.
One question: sometimes I see negative percentages in this window, what do they mean or are they a bug?
Apart from this, a wonderful plugin, powerful and runs 'out of the box'.
Regards, ahartman, belgium
Would be really useful for people looking at this to get a sense of what bulbs/hardware might be supported by this to enable quickly researching upgrade options. Thanks!
The current defaults are 900/900. Although transition values can be as large as 6553, some lights seem to have issues with larger transitions. If transition is decreased, interval should probably be increased to maintain smooth adjustments throughout the day.
@claytonjn thanks for this component - love it!
Not sure if I'm using the correct terminology, but is there any chance you could allow this component to be installed via this method?
As described here, if CL only adjusted lights on for X amount of time it would likely eliminate the issue where certain lights can't be turned off after being configured in CL.
This isn't ideal because when you turn lights on it would be ideal to have them immediately be the correct color temperature/brightness, however some people may prefer the delay to always having to turn off the CL switch before turning off the lights. Also, in automations lights can be turned on directly to the correct values by pulling the information from the sensor.circadian_values
, or native platform scenes can be adjusted - either of these methods are actually better than CL adjusting immediately anyway.
For these reasons, I think an on_adjustment_delay
option at the switch level would be a good addition.
Being able to set a min/max color temperature per light would be very useful. While working in my office I like to have my lights at 5500K max. While I would only want my kitchen lights to get up to ~3500K.
Hi, I'm opening this issue also here, even if not entirely related to circadian, because I think you can do something. (Koenkk/zigbee2mqtt#1810)
As stated in the other issue, if you send at the same time, the color, brightness and transition time to ikea lightbulbs, the brightness is not applied to the bulb (but z2m thinks it is).
So would it be possible to make circadian send first the brightness, and after transition time, the color temp to z2m?
And as a bug, even if the transition time is set to 0 in config, CL is sending a transition of 10.
While I was still using the IKEA gateway I would adjust all lights (both CT and RGB) bulbs with just lights_ct and they were in sync.
However after testing out zigbee2mqtt and Hue controlling the IKEA bulbs the RGB bulbs refuse CT setting and need to be added to either light_rgb or light_xy , however the lights are way out of colour from eachother.
Would it be possible to make circadian lighting translate the CT to a RGB or XY value that makes the lights actually similar?
I can supply examples and do testing if necessary.
019-04-05 15:17:07 ERROR (MainThread) [homeassistant.setup] Error during setup of component circadian_lighting
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/setup.py", line 154, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/circadian_lighting/__init__.py", line 111, in setup
interval, transition)
File "/config/custom_components/circadian_lighting/__init__.py", line 137, in __init__
self.data['percent'] = self.calc_percent()
File "/config/custom_components/circadian_lighting/__init__.py", line 202, in calc_percent
today_sun_times = self.get_sunrise_sunset(now)
File "/config/custom_components/circadian_lighting/__init__.py", line 170, in get_sunrise_sunset
location.elevation = self.data['elevation']
File "/usr/local/lib/python3.7/site-packages/astral.py", line 678, in elevation
self._elevation = int(elevation)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of circadian_lighting.switch. Setup failed for dependencies: circadian_lighting
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Could not set up all dependencies.
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of circadian_lighting.switch. Setup failed for dependencies: circadian_lighting
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Could not set up all dependencies.
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of circadian_lighting.switch. Setup failed for dependencies: circadian_lighting
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Could not set up all dependencies.
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of circadian_lighting.switch. Setup failed for dependencies: circadian_lighting
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Could not set up all dependencies.
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of circadian_lighting.switch. Setup failed for dependencies: circadian_lighting
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Could not set up all dependencies.
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of circadian_lighting.switch. Setup failed for dependencies: circadian_lighting
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Could not set up all dependencies.
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of circadian_lighting.switch. Setup failed for dependencies: circadian_lighting
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Could not set up all dependencies.
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of circadian_lighting.switch. Setup failed for dependencies: circadian_lighting
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Could not set up all dependencies.
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of circadian_lighting.switch. Setup failed for dependencies: circadian_lighting
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.switch: Could not set up all dependencies.
2019-04-05 15:17:08 WARNING (MainThread) [homeassistant.loader] You are using a custom component for circadian_lighting.sensor 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.
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of circadian_lighting.sensor. Setup failed for dependencies: circadian_lighting
2019-04-05 15:17:08 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform circadian_lighting.sensor: Could not set up all dependencies.
Per Introducing Integrations, Home Assistant 0.92 introduces a new manifest.json.
If user omits sleep_colortemp
the non-sleep calculated colortemp should be used. If user omits sleep_brightness
the non-sleep calculated brightness should be used. If user omits both, both non-sleep values should be used (resulting in "sleep" mode being the same as "regular" mode).
I have a lot of Hue bulbs that are controlled by a RaspBee controller.
The brightness and color_temp values only have a certain resolution, which means that they cannot be set to any number. As circadian_lighting is trying to change the values smoothly, this generates a lot of events like:
These sequences creates a lot of events, and my events
table is filled with maybe 10 events every second:
MariaDB [hassio]> select event_type, created from events order by event_id desc limit 20;
+---------------+---------------------+
| event_type | created |
+---------------+---------------------+
| call_service | 2019-05-04 19:38:07 |
| state_changed | 2019-05-04 19:38:07 |
| state_changed | 2019-05-04 19:38:07 |
| state_changed | 2019-05-04 19:38:07 |
| call_service | 2019-05-04 19:38:07 |
| state_changed | 2019-05-04 19:38:07 |
| state_changed | 2019-05-04 19:38:06 |
| state_changed | 2019-05-04 19:38:06 |
| call_service | 2019-05-04 19:38:06 |
| state_changed | 2019-05-04 19:38:06 |
| state_changed | 2019-05-04 19:38:06 |
| call_service | 2019-05-04 19:38:06 |
| state_changed | 2019-05-04 19:38:06 |
| state_changed | 2019-05-04 19:38:06 |
| call_service | 2019-05-04 19:38:06 |
| state_changed | 2019-05-04 19:38:05 |
| state_changed | 2019-05-04 19:38:05 |
| call_service | 2019-05-04 19:38:05 |
| state_changed | 2019-05-04 19:38:05 |
| state_changed | 2019-05-04 19:38:04 |
+---------------+---------------------+
20 rows in set (0.006 sec)
Could this be solved by somehow allowing the values to deviate a bit from what circadian_lighting wants them to be? E.g. only send a new command if the absolute deviation is above some value?
I'm happy to provide my configuration and logs by request :)
For some of my lights I have two separate brightness-switches:
When switching between these 2 switches, I would like to have a faster transition than the transition-setting in configuration.yaml, for instance similar to when switching on a light as described in #35,
How would you feel about adding a table with bulb models and what color formats (rgb, ct, xy) work with them that people could contribute too? Personally I've checked this repo and the thread on the HA forum probably a half dozen times to see if someone has listed what color format works best for my bulbs (they usually haven't or I haven't found them). This could be super helpful.
I really like the graph examples on the readme page. I would like to have a history graph on my Lovelace frontend as well to motor the brightness and temperature changes. Is this possible through the normal Lovelace UI? Or do I need to change something in the setup of the circadian_lighting to be able to monitor this? If you are able to help me get these graphs too I would be very grateful! Thanks!!!
Get this error on startup:
2019-04-06 17:10:30 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/circadian_lighting/switch.py", line 335, in sleep_state_changed
if to_state.state == self._attributes['sleep_state'] or from_state.state == self._attributes['sleep_state']:
AttributeError: 'NoneType' object has no attribute 'state'
Instead of having separate switches for circadian lighting and the actual light, I like to create template lights that transparently include circadian lighting. My implementation looks like this:
switch:
- platform: circadian_lighting
name: Office
lights_ct:
- light.office_light
light:
- platform: template
lights:
circadian_office_light:
friendly_name: Circadian Office Light
level_template: "{{ state_attr('switch.circadian_lighting_office', 'brightness') | int }}"
value_template: "{{ states('light.office_light') }}"
turn_on:
service: script.circadian_lighting_office_turn_on
turn_off:
service: homeassistant.turn_off
data:
entity_id:
- switch.circadian_lighting_office
- light.office_light
script:
circadian_lighting_office_turn_on:
sequence:
- service: homeassistant.turn_on
data:
entity_id: switch.circadian_lighting_office
- service: homeassistant.turn_on
data_template:
entity_id: light.office_light
kelvin: "{{ state_attr('sensor.circadian_values', 'colortemp') | int }}"
brightness_pct: "{{ state_attr('switch.circadian_lighting_office', 'brightness') | int }}"
This solves multiple issues, most importantly it will guarantee that the lights come on in the correct state and that they can be turned off properly. It also makes it easier to include them in automations, groups, or whatever else people usually want to do with their lights.
The example above could probably be improved a little by making the turn_on script more generic, however it is still quite cumbersome to define these entities for every light. So I was thinking, would you be interested in adding something like this to the component?
It would be even greater if the virtual light would disable circadian lighting when colortemp or brightness have been set explicitly, until the light is turned off again.
Programatically adjust light_profiles.csv to make it even easier for automations to turn on lights directly to the proper color temperature/brightness
this sound great and one of the main reasons i started getting into home assistant a few weeks ago. i am transitioning from hue to wifi rbg bulbs. i have several installed already. does it work with both hue and rgb wifi bulbs?
Make CL async (where appropriate).
Add option for “differential threshold” which would disable Circadian Lighting if lights are set to a color too far away from the appropriate circadian color temperature. This unique idea provided by @cicero222 would prevent Circadian Lighting from overriding Hue scenes, for example.
the sensor.circadian_values sensor shows on the map page when configured. It appears to show because it has a lat and long value.
Hi!
I found non compatible issues with hass-circadian_lighting and hass switch light.toggle automations.
the issues this caused: light doesnt on/off correctly first time randomly due to on then off during circadian calibrations with brightness/colortemp (eg im off light with switch with light.toggle, but it doesnt off, it will on again, i need to repeat off procedure). I need to use switches again second or third times to make it works as intended. After disable hass-circadian_lighting any issues are completely gone.
please add something to code to ignore light.toggle with circadian manipulations or investigate this issue more cleanly.
I am running your module at home and we like the outcome.
However, for production somewhere else, I have to do this in Node-RED in a situation where Home Assistant is not available.
Would it be possible for you to explain the formulas you're using?
That would help many people to understand the logic in your module and it would help me enormously towards realising the sale in Node-RED.
I took a long look in your code and as far as I can see it is all about calculating self.data['percent']. Applying that to color temperature and brightness is easy.
Hope to hear from you.
Regards, ahartman
I've been struggling to get this to work on my own. I really appreciate the work that has been put into this. Adding in the documentation for updating hue scenes would be extremely helpful.
Hi,
When using circadian at each event, the mqtt server resends an "on" value of the light that seems to retrigger circadian, who resend a new value (the same as before) and makes the server resend an "on" value, and so on.
So it spams the whole server with light changes orders even when the light is at the correct value.
(I don't know if I'm clear, don't hesitate to ask me if you want another explanation, it's late for me ^^)
I’ve been working to get the additional feature of turning lights on to the appropriate state in order to avoid noticeable transitions, to no avail. I’m kind of a noob. Would anyone be willing to share their code with this feature implemented? Thanks!
If I wasn't an idiot with git I'd submit a pull request to update custom_updater.json to 1.0.9
Could this pls be updated to the latest release?
Thanks!
The state has been returning negative values since install. Just now realizing that this is supposed to be the brightness. Last night, for example, it was at 0 at 5:00pm, and -100 at 12:00pm. It seems to be at its highest at around 12:00 noon. At 7:00am this morning, it turned from negative values to positive.
I manually input the lat/long in case there was an issue with using the hass-determined-location, but that didn't fix it.
Searching, I only saw one other similar issue, and that ended up being related to calculations. But since my time-zone (West Coast/United States) is somewhat common, I feel like I wouldn't be the first to have this issue.
Can you let me know: 1) what information I should be looking at and (if it rises to the level of something I can't fix myself), 2) what information I should provide in order to obtain help. (I've seen you request logs on other issues. Are these logs obtained by adjusted the logger value in home assistant and including the component/sensor in the configuration?)
Thank you for all the help.
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/custom_components/circadian_lighting/switch.py", line 245, in update_switch
self._hs_color = self.calc_hs()
File "/home/homeassistant/.homeassistant/custom_components/circadian_lighting/switch.py", line 228, in calc_hs
return color_xy_to_hs(*self.calc_xy())
File "/home/homeassistant/.homeassistant/custom_components/circadian_lighting/switch.py", line 225, in calc_xy
return color_RGB_to_xy(*self.calc_rgb())
File "/home/homeassistant/.homeassistant/custom_components/circadian_lighting/switch.py", line 220, in calc_rgb
return color_temperature_to_rgb(self._attributes['sleep_colortemp'])
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/util/color.py", line 453, in color_temperature_to_rgb
if color_temperature_kelvin < 1000:
TypeError: '<' not supported between instances of 'NoneType' and 'int'
Got this when turning CL switch on.
I have a Xiaomi Desk Lamp setup in HomeAssistant, and it's working as expected:
Curiously, although I can configure the brightness and color temperature via Home Assistant, the circadian lighting component does not adjust colour temperature (but brightness works). In fact, it seems to generate the following error:
2019-10-07 21:11:46 ERROR (SyncWorker_12) [homeassistant.components.yeelight.light] Error when calling <function YeelightGenericLight.set_colortemp at 0x6ed219c0>: {'code': -5000, 'message': 'general error'}
2019-10-07 21:11:46 ERROR (SyncWorker_5) [homeassistant.components.yeelight.light] Error when calling <function YeelightGenericLight.set_colortemp at 0x6ed219c0>: {'code': -5000, 'message': 'general error'}
2019-10-07 21:15:15 ERROR (SyncWorker_6) [homeassistant.components.yeelight.light] Error when calling <function YeelightGenericLight.set_colortemp at 0x6ed219c0>: {'code': -5000, 'message': 'general error'}
2019-10-07 21:15:15 ERROR (SyncWorker_18) [homeassistant.components.yeelight.light] Error when calling <function YeelightGenericLight.set_colortemp at 0x6ed219c0>: {'code': -5000, 'message': 'general error'}
2019-10-07 21:15:17 ERROR (SyncWorker_16) [homeassistant.components.yeelight.light] Error when calling <function YeelightGenericLight.set_colortemp at 0x6ed219c0>: {'code': -5000, 'message': 'general error'}
2019-10-07 21:15:19 ERROR (SyncWorker_16) [homeassistant.components.yeelight.light] Error when calling <function YeelightGenericLight.set_colortemp at 0x6ed219c0>: {'code': -5000, 'message': 'general error'}
2019-10-07 21:15:48 ERROR (SyncWorker_8) [homeassistant.components.yeelight.light] Error when calling <function YeelightGenericLight.set_colortemp at 0x6ed219c0>: {'code': -5000, 'message': 'general error'}
I have a number of Yeelight bulbs and Milight bulbs (using Sidoh's Milight Hub) controlled using Circadian Lighting and working as expected. Only the Desk Lamp doesn't work.
circadian_lighting:
min_colortemp: 1900
max_colortemp: 4000
interval: 30
transition: 10
yeelight:
devices:
192.168.1.188: # <----- Working bulb
name: Hallway
transition: 1000
192.168.1.182: # <----- Trouble Lamp
name: Desk Lamp
transition: 1000
switch:
- platform: circadian_lighting
name: Main
min_brightness: 20
max_brightness: 80
sleep_colortemp: 1000
sleep_brightness: 1
sleep_entity: input_boolean.sleepy_time
sleep_state: "on"
lights_ct:
- light.Desk_Lamp
- light.Hallway
Really love circadian lighting, but one thing I noticed when looking at my led lights is that the color temperature seems a bit off on some of them despite having set eg. 2700k on all the lights (different manufacturers)
Do you think it would be possible to make some kind of a color shift settings where a correction value can be set e.g +100k, -100k that gets added/substracted after the internal color temperature calculation? This way some fine tuning would be possible if different lights are used that are right next to each other.
In the winter, especially December, my lights get darker faster than I want.
For context, Chicago is at the eastern edge of the timezone with the sun setting between 16:15 and 16:30 in December.
With the default sun tracking, things get too dark too fast for our daily life. Dinner in the 18:00-20:0 range is dim, too dim for me. With modifications to the sunset time (i.e. hardcoding), coming in from outside is jarring. It's dark outside, but the indoor light color temp is too blue.
What I think I want is a way to keep the lights brighter longer, while at the min color temp after sunset. One approach I've considered is modifying the sunset-sunrise parabola into not a parabola. Consider my ugly sketch below. The current parabola is on the left, and my proposed graph is on the right.
I am planning to modify the graph calculation myself to test it out. I haven't figured the math out yet, though(and not looking forward to verifying it at the scale of epoch seconds). I do think this could be annoying to configure. The most intuitive thing I can think of is defining a minimum brightness at a certain time. This would roughly map to the inflection point of when the gradual approximately linear drop would turn back into a parabola. For example, I might say min brightness of 70% at 20:00.
Anyone have other ideas on solving or working around this? Any ideas on configuring my altered graph?
@claytonjn I have read a few of your principled posts, especially on discourse. If we come up with something workable, are you open to including it?
Please don't prefix generated entity_id's with circadian_lighting_
, this is not how Home Assistant does this in general.
In my case, it screws with my naming schemes. e.g., I use a naming schema <domain>.<area>_<name>
When adhering to my scheme, the switch for my hall would end up being:
switch.circadian_lighting_hall_circadian_lighting
😔
I know similar requests has been make before, i.e. wake up light
I have a lot of different bulbs and for some I'd like the brightness to be adjusted but for some I prefer to set/adjust the brightness myself. Therefore it would be great if the disable_brightness_adjust could take a list of entities instead of just a boolean for all the lights.
Related to #4
E.g. allow max_brightness
to be set from an input slider, etc.
https://community.home-assistant.io/t/circadian-lighting-custom-component/61246/530
Allow user to specify a Hue scene to be programatically adjusted, allowing devices like the Hue tap/Hue dimmer to turn on lights directly to the proper color temperature/brightness.
I would like to propose to add offset_brightness to the switch configuration variables as an enhancement.
My personal reason: not all my lights have the same output power. So to have the same brightness everywhere I would like to finetune the brightness with an offset.
The most straightforward way would be adding a constant offset. It's easy enough to clip the output to the maximum allowed brightness and keep the offset as min_brightness. This would work for me as I set my min_brightness to 20% anyway.
To generalise this approach it's maybe possible to just continue dimming until min_brightness is reached (thus extending the dimming time).
Another approach to keep might be to reduce the offset from a certain threshold. So that min_brightness is reached at the same time as the other lights. This approach would increase the dimming speeds.
I'm not sure which one would fit best in the whole circadian lighting rhythm theory ;-)
You might even use the same approach for #29
Simply put, the sun does not set here for a period during summer causing this to error out.
Mon Jul 08 2019 00:03:49 GMT+0200 (Central European Summer Time)
Error during setup of component circadian_lighting
Traceback (most recent call last):
File "/home/steino/venv/homeassistant/lib/python3.6/site-packages/astral.py", line 1891, in sunrise_utc
return self._calc_time(90 + 0.833, SUN_RISING, date, latitude, longitude, observer_elevation)
File "/home/steino/venv/homeassistant/lib/python3.6/site-packages/astral.py", line 2747, in _calc_time
hourangle = self._hour_angle(latitude, solarDec, depression + adjustment)
File "/home/steino/venv/homeassistant/lib/python3.6/site-packages/astral.py", line 2723, in _hour_angle
HA = acos(h)
ValueError: math domain error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/steino/venv/homeassistant/lib/python3.6/site-packages/homeassistant/setup.py", line 156, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/steino/.homeassistant/custom_components/circadian_lighting/init.py", line 112, in setup
interval, transition)
File "/home/steino/.homeassistant/custom_components/circadian_lighting/init.py", line 138, in init
self.data['percent'] = self.calc_percent()
File "/home/steino/.homeassistant/custom_components/circadian_lighting/init.py", line 205, in calc_percent
today_sun_times = self.get_sunrise_sunset(now)
File "/home/steino/.homeassistant/custom_components/circadian_lighting/init.py", line 179, in get_sunrise_sunset
sunrise = location.sunrise(date)
File "/home/steino/venv/homeassistant/lib/python3.6/site-packages/astral.py", line 871, in sunrise
sunrise = self.astral.sunrise_utc(date, self.latitude, self.longitude, elevation)
File "/home/steino/venv/homeassistant/lib/python3.6/site-packages/astral.py", line 1895, in sunrise_utc
("Sun never reaches the horizon on this day, " "at this location.")
astral.AstralError: Sun never reaches the horizon on this day, at this location.
I'm likely doing something wrong - but brightness doesn't seem to auto adjust. From my read of the code, line 238 of switch.py just chooses "max brightness" every time - unless sleep mode is on.
Is that what's supposed to happen?
I'd have expected that block of code to be more like:
def calc_brightness(self): if self._attributes['disable_brightness_adjust'] is True: return None else: if self.is_sleep(): _LOGGER.debug(self._name + " in Sleep mode") return self._attributes['sleep_brightness'] else: return ((self._attributes['max_brightness'] - self._attributes['min_brightness']) * ((self._cl.data['percent']) / 100)) + self._attributes['min_brightness']
So I want to disable this switch under two conditions, either when the room is empty or when I am sleeping. I have it set to disable when the room is empty, but I can't set the sleep brightness to 0 (the minimum is 1).
Would it be possible to replace the Sun for a Luminosity sensor for a more accurate interior brightness calculation?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.