sapnho
(Wolfgang)
November 20, 2018, 3:10pm
1
I would like my Hue light color temperature change depending on the sunset. How can I change only the color temperature of lights that are already on?
I tried this:
{
"color_temp": "454",
"entity_id": "light_galerie"
}
with light.turn_on
as the service but that didn’t change a thing.
I think storing the value in a variable to use every time you turn on the bulb. I use it for one of my lamps, and it works like a charm. The value is set from attributes for another lamp, but it could be set from anywhere.
And for them to adjust while on, you create an automation with condition checking for if it is on
did you test it in the dev-service page?
If I try that with several lights, it works as expected
or use the circadian algorithm available here:
- alias: 'Circadian Lights'
id: 'Circadian Lights'
initial_state: 'off'
trigger:
platform: time
minutes: '/15'
seconds: 00
condition:
condition: template
value_template: >
{{ is_state('light.hue_go_1', 'on')}}
action:
service: light.turn_on
entity_id: light.hue_go_1
data_template:
color_temp: >
{{ states('sensor.circadian_light') }}
length_of_day_factor:
friendly_name: 'Length of day' # factor for circadian light calculation'
value_template: >
{% set daylength = ( (as_timestamp(state_attr('sun.sun','next_setting')) -
as_timestamp(state_attr('sun.sun','next_rising')) ) /
3600) + 24 %}
{{ ((daylength*-0.0063616)+0.11131) | round(5) }}
circadian_light:
friendly_name: 'Circadian light'
unit_of_measurement: 'mired'
value_template: >
{% if is_state('sun.sun' , 'above_horizon') %}
{{ ((states('sensor.length_of_day_factor') | float) *
((state_attr('sun.sun','azimuth') )-180)**2 + 175) | round }}
{% elif (as_timestamp(state_attr('sun.sun','next_dusk'))) -
(as_timestamp(state_attr('sun.sun','next_setting'))) < 0 or
(as_timestamp(state_attr('sun.sun','next_rising'))) -
(as_timestamp(state_attr('sun.sun','next_dawn'))) < 0 %}
350
{% else %}
390
{% endif %}
sapnho
(Wolfgang)
November 20, 2018, 3:56pm
4
did you test it in the dev-service page?
Yes, I did but with no result. What I want to achieve is that even if the light is already on, that the color temperature changes. I know how to trigger it depending on the sun but just changing the color temperature doesn’t work in my case.
don’t want to ask the obvious, but still, you’re sure this light supports color_temp? Not all hue lights do.
I tested with the light on without issue, but had to replace the text in the dev-service page before is was accepted as valid json… as follows:
setting a color results in:
no more color_temp, they are mutually exclusive
1 Like
sapnho
(Wolfgang)
November 20, 2018, 4:08pm
6
Thanks @Mariusthvdb .
I tested with the light on without issue, but had to replace the text in the dev-service page before is was accepted as valid json…
Could you post the json that you used, maybe I am making a mistake here. And yes, color temperature is supported by these lights.
sapnho
(Wolfgang)
November 20, 2018, 4:55pm
7
Ah, I tested in “States” not in “Services” …green HA noob I still am…
So, this works but now I have to find out why my script doesn’t… Thanks @Mariusthvdb !
sapnho
(Wolfgang)
November 20, 2018, 5:19pm
9
Ha, found my mistake: I had put light_galerie
instead of light.galerie
in the script… Thanks!!
1 Like
hi @sapnho … i went through your post … and have a small question.
length_of_day_factor: & circadian_light: are added in the config.yaml?
tom_l
Split this topic
August 1, 2024, 9:15pm
11
A post was split to a new topic: Light automation at certain tim