I have controller for LED strip. OpenHab know it via WiFi Led Binding.
I have Yandex Alice home assistant. It may transform voice commands to MQTT.
I want change color of my LED strip by voice.
I make two things in PaperUI - one for controller (it is work) and one virtual via MQTT binding for Alice.
In my virtual thing I make channels for on-off (work), brightness (work) and HSV color - doesn’t work, because I have JSON with H,S and V and don’t know that I can do wit it
Use a String channel and get the whole json string in a String Item linked to that channel
Use a rule to extract the 3 values by using the transform action
Parse the 3 values and send them to the LED strip color channel
Ok, I make new channel and already have string {“h”:225,“s”:96,“v”:100}. How extract values? I don’t find transform in rules… May be you can send me address of manual or examples… I’m true beginner, I know.
I don’t know if this is a copy/paste issue or not, but these are the wrong double quote characters. I think the jsonpath transform will choke on those double quote characters.
This works in a rule
val String sJson = '{ "h": 270, "s": 96, "v": 100 }'
val String h = transform("JSONPATH", "$.h", sJson)
val String s = transform("JSONPATH", "$.s", sJson)
val String v = transform("JSONPATH", "$.v", sJson)
logInfo("test", "hsv={},{},{}", h, s, v)