Light profiles#114
Conversation
bff660b to
afaea38
Compare
There was a problem hiding this comment.
I removed the service_call because I am not sure how to best do it once there are multiple sensors. Also I think it's not really needed. If you want frequent updates, just decease the interval?
There was a problem hiding this comment.
I'm not sure how much the service call is used, TBH. Off the top of my head I could imagine it would be useful with the only_once option where a user may want to control exactly when a light adjusts (e.g. any time there's motion).
|
Hi @basnijholt and @claytonjn, I'm implimenting this now and will report back after a day or two of use 👍 |
|
Just a quick update to say so far I've had no problems. I setup profiles per room and applied them to the light groups without issue. I also got around to setting up my auto-disable system where it checks if the light is ~ the correct temp. It works even if I adjust the lights using the Google Home or apps outside of Home Assistant. - profile: loungeroom
min_colortemp: 2800
max_colortemp: 4000
sunset_offset: -00:30:00
interval: 300
transition: 2- platform: circadian_lighting
name: Loungeroom
profile: loungeroom
min_brightness: 60
max_brightness: 100
initial_transition: 5
disable_entity: sensor.loungeroom_circadian_lighting_enabled
disable_state: false
lights_ct:
- light.loungeroom_downlight_left_1
- light.loungeroom_downlight_left_2
- light.loungeroom_downlight_left_3
- light.loungeroom_downlight_left_4
- light.loungeroom_downlight_right_1
- light.loungeroom_downlight_right_2
- light.loungeroom_downlight_right_3
- light.loungeroom_downlight_right_4- platform: template
sensors:
loungeroom_circadian_lighting_enabled:
friendly_name: Loungeroom circadian lighting enabled
value_template: >-
{% set sensor_current_mirds = (1000000 / state_attr('sensor.circadian_values_loungeroom', 'colortemp')) | int %}
{% set light_current_mirds = state_attr('light.loungeroom_downlights', 'color_temp') | int %}
{% set offset = 5 %}
{% set range_low = sensor_current_mirds - offset %}
{% set range_high = sensor_current_mirds + offset %}
{% if not light_current_mirds >= range_low and light_current_mirds <= range_high %}
false
{% else %}
true
{% endif %}I had to add an offset as sometimes what the sensor value is and what the light reports are different, I assume as it depends on what the light can actually produce. |
4b8b971 to
e31915c
Compare
|
Now when I restart HASS, I get a notification with:
I also get the following error in my logs:
I commented out the disable_entity/disable_state just in case they were the cause but still get the error. |
|
After regrabbing #114 and replacing the folder under custom_components it appears to be working again. |
|
So I've still been getting those errors, and it occurs after I update the sunrise_offset and restart HASS. If I reboot the Pi, it loads fine. |
|
Are you sure you used the updated code? I rebased and force pushed here. So you need to download a new copy of the repo. |
|
@basnijholt I downloaded #114 from this page, using the "Open With" button and then "Open in Desktop". Once pulled, I removed Circadian Lighting from HACS and installed this one manually by copying it into the custom_components. I think that's all correct and I have the updated files, but if not please let me know. Profiles are working, so I assume it is. I'm able to replicate the issue pretty reliably. I have the following profile for a room: - profile: office
min_colortemp: 2800
max_colortemp: 4000
sunrise_offset: -01:30:00
sunset_offset: 01:00:00
interval: 300
transition: 2I then commented the sunrise offset out: - profile: office
min_colortemp: 2800
max_colortemp: 4000
# sunrise_offset: -01:30:00
sunset_offset: 01:00:00
interval: 300
transition: 2After restarting HASS from Configuration -> Server Control -> Restart, I get the follow notification and error log:
I've had mixed success getting it back working, just now I had to roll back to an earlier backup as rebooting the Pi, disabling and reenabling the config as well as re-pulling the code didn't fix it. Update: rolling back didn't fix it either. |
|
I saw https://github.com/claytonjn/hass-circadian_lighting/pull/119/files was mentioned as a possible fix for another user, modified the init file as I can see that #119 doesn't have the profile feature and it appears to have solved my issue too. |
|
@iamcagn, I have added that fix to this PR too now 😄 |
The development of this code happened in claytonjn/hass-circadian_lighting#117 With prework done in claytonjn/hass-circadian_lighting#114 and claytonjn/hass-circadian_lighting#107.
The development of this code happened in claytonjn/hass-circadian_lighting#117 With prework done in claytonjn/hass-circadian_lighting#114 and claytonjn/hass-circadian_lighting#107.
|
Hi there! Is this still working? I'm really interested in adjusting temperature by group because I have different types of bulb. Thanks in advance! |
@markianwallace and @iamcagn, could you guys try the code of #114?
It works like this:
and
Note that
is internally converted to
So it's fully backward compatible.