trying to extract the color value from a nspanel color widget .At mqttexplorer i get
{"NSPanel":{"ctype":"group","id":"3","params":{"switch":"on","light_type":1,"colorR":88,"colorG":252,"colorB":0,"bright":50,"mode":1}}}
from my tele/nspanel/RESULT topic
so i made a color channel and trying to extract the color value in the form of R,G,B .My Incoming Value Transformations is
REGEX:(.*"id":"3".*)∩JSONPATH:$.NSPanel.params.colorR∩JSONPATH:$.NSPanel.params.colorG∩JSONPATH:$.NSPanel.params.colorB
but its not working…I am a complete noobie at tranformations so just need a hint where to fix that…
For Outgoing Value Format i use
{"NSPanel":{"ctype":"group","id":"3","params":{"colorR":%s,"colorG":%s,"colorB":%s}}}
and it is working very nice.
edit: i tried JS tranformation ,i add this nscolor.js file inside tranform folder
(function(i) {
var rgb = JSON.parse(i)
return rgb.colorR+","+rgb.colorG+","+rgb.colorB
})(input)
and at channel’s Incoming Value Transformations :
REGEX:(.*"id":"3".*)∩JS:nscolor.js
with that i get in the logs
2023-03-09 09:59:45.906 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command 'undefined,undefined,undefined' from channel 'mqtt:topic:b94727f5:nspanel:nscolor' not supported by type 'ColorValue': For input string: "undefined"
Any ideas?