I’m trying to get a light to change colour in sync with Cheerlights (http://cheerlights.com/ and although I have a sensor configured to see wheat the resent hex colour is, I would appreciate any guidance as to how I may convert that to RGB values.
My local MQTT server is connected to the cheerlights feed and makes it available locally. I put this into the Mosquitto configuration:
connection cheerlights
address iot.eclipse.org
cleansession true
topic cheerlightsRGB in
and I have created a Home Assistant sensor which I can use to display the value for the time being:
and I actually display the present value on one of my tabs. That works fine, and the value updates as people change the colour from wherever they are in the world.
The part I need some pointers for is how to change that hex value into RGB. At the moment I have an automation that triggers whenever the color changes - but all I can do is make a fixed colour show up (for now, at least!).
automaton:
alias: setCheerlightsColour
trigger:
platform: mqtt
topic: cheerlightsRGB
action:
service: light.turn_on
entity_id:
- light.arilux_lc03_rgb_led_controller_00185c1b
data:
rgb_color: [255, 0, 0] #<<< This is what I need to get from the hex value of the sensor.
Right now I’m driving an RGB strip (see https://github.com/mertenats/Arilux_AL-LC0X), but I’d also like to be able to set a Lifx bulb with the appropriate colour. From this example you can see that I can only turn things red (or whatever I hardcode in!).
Can anyone point me at an example or suggest how I might complete this project? I have 'till Christmas to get this working, but will share the final solution - if I succeed.
Thanks in advance for any help or guidance
Nicholas
Thanks for the response.
That’s definitely a good lead and something to help me move forward. Am also looking at a response to a question for changing the colour of a light in response to a weather condition which is very similar that has come up this evening.
Thanks again.