I have some Yeelight RGB bulbs which I would like to set the colour of via MQTT.
Does anyone know if it is possible to create an automation that will extract the RGB and brightness values from a MQTT message and pass them to a service command to update the bulb?
Using a template to set rgb_color is complicated by the fact the value must be presented as a python list.
rgb_color: [254, 124, 213]
The challenge to create the list is that a template produces a string. So even if the payload contains [10, 10, 10] which looks like a list, this template {{ trigger.payload }} will render it as a string. The result will be the error message you received.
I haven’t tried this but there’s a new Jina2 filter in the latest release of Home Assistant called from_json. Just for fun, try this:
rgb_color: '{{ trigger.payload | from_json }}'
If it fails to work then there’s another (tried and true) way to fix this issue.
This would be so much easier if my PR was accepted, or even looked at! (Yes, it needs to be rebased, but I did that twice and it never even got a comment. Doesn’t want to make me go through the effort again, only to be ignored again.)
Clearly your PR is not a case of ‘no news is good news’. With zero commentary, one is left wondering why it’s being overlooked. It’s far from being a disruptive PR so it should have been an easy-in.