I would like to set the color on a Philips Hue lamp depending on a trigger value.
Is there a way to change the color of an action?
There seems to be an attribute named rgb_color, but how do I set it?
I would like to set the color on a Philips Hue lamp depending on a trigger value.
Is there a way to change the color of an action?
There seems to be an attribute named rgb_color, but how do I set it?
Something like this you mean?
- service: light.turn_on
data:
rgb_color:
- 55
- 26
- 26
target:
entity_id: light.conservatory1
Yes, something like that, I’ll try!
But I need it to be in an action.
I have this
- id: '1659182131604'
alias: Trigger light every 5 seconds
description: ''
trigger:
- platform: time_pattern
seconds: /5
condition: []
action:
- type: toggle
device_id: a67b5113374dc9e2aa00ec8d5df57a4d
entity_id: light.runda_bords_lampan
domain: light
mode: single
Where do I put your code snippet?
If you want to check for yourself then go to developer tools / services and find the service you are interested in, in this case 'light.turn_on
Fill out the what you want based on the options and then click on the ‘GO TO YAML MODE’ to see the associated yaml syntax etc.
Do I need a Scene to change colors?
There’s no way to do it directly in an Action?
No you don’t need a scene. Like I said you need to call a service, that service being light turn on.
I assume you are using the Ui to make your automations, so under action, choose ‘call a service’ the choose ‘light turn on’ choose the light or lights and you will see boxes with options like, brightness, RGB, etc
Fill out the boxes as per what you want the lights to do.
Haha, I keep mixing up scenes, scenarios, and scripts. They all start with the same two letters.
My question was actually if I need a service to change the color?
Hi. I realize this was a long time ago, but here is what I did.
I saw that you wanted to toggle the light on or off based on a trigger, and set it to a spesific color when turned on. Correct me if i’m wrong.
I used a if-then test to see if the ligt was off, then i called a service to turn the ligt on to a spesific color temoerature (use rgb-code above for a rgb-color). Else the light would turn of.
I made this in the UI, but here is my YAML
if:
- condition: device
type: is_off
device_id: 56bc8eafd2eadf3a070880dcde0dd42c
entity_id: light.hue_color_lamp_2_3
domain: light
then:
- service: light.turn_on
data:
kelvin: 3000
brightness_pct: 60
target:
entity_id: light.hue_color_lamp_2_3
else:
- type: turn_off
device_id: 56bc8eafd2eadf3a070880dcde0dd42c
entity_id: light.hue_color_lamp_2_3
domain: light