The json value looks like this:
Color "{\"b\":255,\"cw\":0,\"g\":247,\"m\":3,\"r\":199,\"t\":0,\"ww\":0}"
in my dzvent script i would like to have 3 variables for Red\Green\Blue.
So from the wiki i get that i need to use domoticz.utils.fromJSON() and that i can then assign these 3 values so i made this script:
Code: Select all
return {
on = {
devices = {
'color_switch'
}
},
execute = function(domoticz, device)
myColor = domoticz.utils.fromJSON(device.color) -- also tried this with 'local myColor'
print(myColor.r)
print(myColor.g)
print(myColor.b)
end
Is this the right way to get specific values from a json value?
How do i make this so these values are from the made change.