It should! For me with deCONZ + Hue it works 100% of the time.
I’m taking the plunge, and after reading the Pull Request discussion and the related documentation I’m excited!
Since there’s no official Adaptive Lighting message thread yet, and I’m unsure whether the PR is the correct place to ask.
- Does
adaptive_lighting.set_manual_control
accept multiple entities in theentity_id
attribute? I ask because I am wondering if it necessary to create two separate service calls or not. - Why lights not optional? It seems like omitting the lights parameter would simple apply the
manual_control
state to all lights in the entity_id’s list. I’m sure there will be instances where I want to set it for a single light, however it seems redundant otherwise.
- Does
adaptive_lighting.set_manual_control
accept multiple entities in theentity_id
attribute? I ask because I am wondering if it necessary to create two separate service calls or not.
Yes, see the screenshot from the docs.
- Why lights not optional? It seems like omitting the lights parameter would simple apply the
manual_control
state to all lights in the entity_id’s list. I’m sure there will be instances where I want to set it for a single light, however it seems redundant otherwise.
That is a good suggestion! Would you mind opening an issue such that I won’t forget?
I’ve been using adaptive lighting for a few weeks now and it is amazing. It works great (also deconz+hue here, but also works great on my WiFi lights!).
I would highly recommend this component (just be aware that it is not the final product and that there are many updates and it could break somewhere in between). This has not happened for me however in all those weeks!
Thanks @basnijholt
I’ve implemented your suggestion now
Adaptive Lighting
Good news!
Adaptive Lighting does not interfere like Circadian Lighting did.
Bad news!
A work-around is still required for me to get my ZHA light bulb groups. But, the solution is a bit simplier!
Simplified automation
This solution still requires the creation of a group named the same as your light group. This group needs to contain every bulb in that fixture. Example: for light.dining_room
I created group.dining_room_fixture
with all 9 bulbs.
alias: "Light Group Turn Off - Force To Stay Off"
id: light_group_turn_off
initial_state: true
mode: single
trigger:
- platform: state
entity_id:
- light.dining_room
- light.play_room_floor_lamp
from: "on"
to: "off"
variables:
light: '{{ trigger.entity_id }}'
group: '{{ light | replace("light.","group.") + "_fixture" }}'
bulbs: '{{ expand(group) | map(attribute="entity_id") | list }}'
action:
- alias: Turn the light group off repeatedly until it stays off.
repeat:
sequence:
- delay:
seconds: 5
# Turn off the individual bulbs one at a time.
- repeat:
count: "{{ bulbs|count }}"
sequence:
- service: light.turn_off
data:
entity_id: '{{ bulbs[repeat.index-1] }}'
until:
- condition: template
value_template: "{{ is_state(light, 'off') }}"
Just out of curiosity: Does HA provides service calls to change light attributes (color warmth, brightness etc) without turning the light on?
There are devices which are designed to accept such changes separately to on/off commands. But AFAIK HA’s light service provides TURN_ON/OFF/Toggle methods only.
If you adk why: I want to be sure that a light turns on with warmth and intensity already set to expected values.
If there is no such feature, I have to stick with proxying warmth changes to mqtt where mentioned devices can pick them from
@maxym You are correct. The only way to set the light attributes is at the same time as the light.turn_on command. However, my lights turn on to the correct setting every time, from the off position. I just experimented with calling light.turn_on to blue, after turning my bulb off after changing it red. The color was blue the second it started fading up from off.
Can you expose a sensor that shows the current color temp and brightness?
I’d need this because I control my light mostly from node red and I’d like to turn the bulbs on to the correct color and brightness straight away. That works fine with CL.
Thanks for confirming that. Hope HA will get improvments in this area.
I have a feeling your approach works only for detached buttons / smart bulbs . If one is using switches which directly turns lights on, the only way is to intercept turning on the light and send proper settings afterward.
It wouldn’t be a case if there were no devices which can change light settings being turned off. But it’s opposite so there is opportunity to fully use this feature instead of working around. But tbh I’m not sure this idea will get any traction in HA. Maybe after circadian integration being official component it has better chances
Just define these template sensors: https://github.com/basnijholt/home-assistant-config/blob/93d42dba1fc0d1eeaf33e1c2260807bc3cc6d7b4/includes/sensors.yaml#L264-L282
You are using NR already so stick with it.
Here is fragment of my flow which extracts brightness and warmth from circadian sensor and switch. Then store those values into sensors created from within NodeRed.
Also you can see how I joined those values into one payload in order to distribute them later on to my mqtt lights.
[{"id":"ecd4dcfe.33461","type":"trigger-state","z":"1fa6fb07.b08b25","name":"","server":"6cdd0bc8.b8e434","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.circadian_values","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":true,"state_type":"str","x":310,"y":260,"wires":[["51aef3ce.b37ab4","ca2c2e51.85c0a8"],[]]},{"id":"51aef3ce.b37ab4","type":"function","z":"1fa6fb07.b08b25","name":"WW CW","func":"var colortemp = msg.data.event.new_state.attributes.colortemp;\nvar rgb = msg.data.event.new_state.attributes.rgb_color;\nvar newmsg = \n{\n payload: {\n red: Math.round((1000000 / colortemp - 153) * 0.734870317),\n green: Math.round((500 - (1000000 / colortemp)) * 0.734870317),\n blue: 0 /*,\n gain: Math.round(100 * (rgb[0] + rgb[1] + rgb[2]) / 765)*/\n }\n \n}\nreturn newmsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":560,"y":240,"wires":[["6dd6c462.eb32a4"]]},{"id":"2ff51749.a5b8a","type":"trigger-state","z":"1fa6fb07.b08b25","name":"","server":"6cdd0bc8.b8e434","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"switch.circadian_lighting_circadian_lighting","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":250,"y":180,"wires":[["6dd15362.a10fe4","c8eac31d.c5117"],[]]},{"id":"6dd15362.a10fe4","type":"function","z":"1fa6fb07.b08b25","name":"Gain","func":"var brightness = msg.data.event.new_state.attributes.brightness;\nvar newmsg = \n{\n payload: {\n gain: Math.round(brightness)\n }\n \n}\nreturn newmsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":180,"wires":[["6dd6c462.eb32a4"]]},{"id":"c8eac31d.c5117","type":"ha-entity","z":"1fa6fb07.b08b25","name":"sensor: cl_brightness","server":"6cdd0bc8.b8e434","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"cl_brightness"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"%"}],"state":"data.event.new_state.attributes.brightness","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":600,"y":100,"wires":[[]]},{"id":"ca2c2e51.85c0a8","type":"ha-entity","z":"1fa6fb07.b08b25","name":"sensor: cl_warmth","server":"6cdd0bc8.b8e434","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"cl_warmth"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"K"}],"state":"data.event.new_state.attributes.colortemp","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":590,"y":300,"wires":[[]]},{"id":"6dd6c462.eb32a4","type":"join","z":"1fa6fb07.b08b25","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"0","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":710,"y":200,"wires":[["86ebcdea.c559c8","94776893.663ee"]]},{"id":"6cdd0bc8.b8e434","type":"server","z":"","name":"Home Assistant"}]
The result is obvious
If you use light groups (https://www.home-assistant.io/integrations/light.group/) then the integration will work with it!
Can you share the settings for that Lovelace card?
edit: nevermind
type: vertical-stack
cards:
- color_thresholds_transition: smooth
entities:
- entity: sensor.adaptive_lighting_brightness
name: Brightness
show_state: true
- entity: sensor.adaptive_lighting_color_temp_kelvin
name: Color temperature (Kelvin)
show_state: true
y_axis: secondary
font_size: 100
group: false
name: Brightness vs color temperature
hours_to_show: 48
line_width: 6
points_per_hour: 1
lower_bound: 60
upper_bound: 105
lower_bound_secondary: 0
upper_bound_secondary: 5500
show:
extrema: false
fill: fade
labels: false
name: true
state: true
type: 'custom:mini-graph-card'
- color_thresholds_transition: smooth
entities:
- entity: sensor.adaptive_lighting_brightness
name: Brightness
show_state: true
- entity: sensor.adaptive_lighting_sun_position
name: Sun position
show_state: true
y_axis: secondary
font_size: 100
group: false
name: Brightness vs sun position
hours_to_show: 48
line_width: 6
points_per_hour: 2
lower_bound: 40
upper_bound: 100
lower_bound_secondary: -100
upper_bound_secondary: 100
show:
extrema: false
fill: fade
labels: false
name: true
state: true
type: 'custom:mini-graph-card'
- color_thresholds_transition: smooth
entities:
- entity: sensor.adaptive_lighting_color_temp_kelvin
name: Color temperature
show_state: true
- entity: sensor.adaptive_lighting_sun_position
name: Sun position
show_state: true
y_axis: secondary
font_size: 100
group: false
hours_to_show: 48
name: Color temperature vs sun position
line_width: 6
points_per_hour: 2
lower_bound: 0
upper_bound: 5500
lower_bound_secondary: -100
upper_bound_secondary: 100
show:
extrema: false
fill: fade
labels: false
name: true
state: true
type: 'custom:mini-graph-card'
Here is:
type: 'custom:mini-graph-card'
name: Circadian Light
show:
icon: false
labels: false
font_size: 80
font_size_header: 10
hour24: true
hours_to_show: 72
line_width: 2
lower_bound: 1
lower_bound_secondary: ~2000
higher_bound: 100
higher_bound_secondary: ~7000
smoothing: true
entities:
- entity: sensor.cl_brightness
name: Brightness
- entity: sensor.cl_warmth
name: Warmth
show_state: true
y_axis: secondary
However when I was copying this code for you. I figured out that the defualt graph resolution is not enough to represent actual changes. Adding points_per_hour: 60
changes a bit the look (see below). TBH I liked more the view before changes
Btw proper support for Dual ID RGBW controllers would be nice (like fls-pp that exposes a separate entity for W and or RGB) so it’s treated as one device where depending on the current color temp either the W device, the RGB device or both are on and adjusted accordingly.
Most bulbs controlled by Smart Switches in my house are dumb dimmable led bulbs. The only thing to change there is brightness, but that’s all handled. Any switches with smart bulbs attached are bypassed to have constant power with any button presses being handled by Home Assistant.
Before I gave control over to Adaptive/Circadian Lighting I had an automation set to intercept any light turn ons and send the brightness based arbitrarily on the time of day. In those days I remember there being a brief delay between rapidly heading to 100% brightness and the automation dimming the light. But, I was running Home Assistant on a Raspberry Pi back then, and both my code and Home Assistant have been optimized since then. I don’t notice any delay with Adaptive Lighting.
Yeah. I believe in that otherwise you would stop using it
But potentially it’s possible especially in hands of less skilled home automation owners. This is why I would expect ability to set light attrs while the lights is turned off. Personally I can achieve it by feeding my devices through mqtt (btw mqtt gives a lot more flexibility in that than built-in integrations). I really like what I achieved, because changing circadian related attributes is completely separated process than turning lights on/off. It perfectly matches Single responsibility principle.
I however suppose, that not all smart appliances sport such feature. I know about Shellies because I’m using them. I’ve read that Lifx too. Don’t know about others. And if there are no more, it might be the reason why there is no such service call in HA.
So I am quite happy with it and I think I can retire the circadian solution I built with NodeRed.
BUT: it only works for my RGB bulbs, not for my Philips Hue tunable whites (connected via Zigbee2Mqtt), which work perfectly fine with my custom NodeRed solution, where I periodically send color and brightness to all lamps that are currently on.
any Idea?
not for my Philips Hue tunable whites (connected via Zigbee2Mqtt),
Could you be more specific about what doesn’t work? Does it give an error? Does the light not change? Only brightness, only color?