Page 1 of 1

Updating Color of RGB color switch

Posted: Monday 25 May 2020 23:36
by mariopeters
I would like to update the color of my RGB color switch.
if I use the code below nothing happens.
Both Log output doesn't show any Color has been set.
Could someone explain what I've done wrong.

Code: Select all

   color = json.dumps({
              'ColorMode': 3, #mode 3: RGB
              'r': 200,
              'g': 255,
              'b': 100
            })
            Domoticz.Log(str(Devices[Unit].Color))
            Devices[Unit].Update(nValue=1,sValue="1", Color=str(color))
            Domoticz.Log(str(Devices[Unit].Color))
The device it is used for is created in this way:

Code: Select all

Domoticz.Device(Name="RGBW", Unit=1, Used=1, Type=241, Subtype=1).Create()
I hope that someone can help me with this.

Re: Updating Color of RGB color switch

Posted: Thursday 28 May 2020 12:13
by mariopeters
mariopeters wrote: Monday 25 May 2020 23:36 I would like to update the color of my RGB color switch.
if I use the code below nothing happens.
Both Log output doesn't show any Color has been set.
Could someone explain what I've done wrong.

Code: Select all

   color = json.dumps({
              'ColorMode': 3, #mode 3: RGB
              'r': 200,
              'g': 255,
              'b': 100
            })
            Domoticz.Log(str(Devices[Unit].Color))
            Devices[Unit].Update(nValue=1,sValue="1", Color=str(color))
            Domoticz.Log(str(Devices[Unit].Color))
The device it is used for is created in this way:

Code: Select all

Domoticz.Device(Name="RGBW", Unit=1, Used=1, Type=241, Subtype=1).Create()
I hope that someone can help me with this.
My mistake.
"Colormode" must be "m".
Now the color is correctly stored.
But when I g back to the switches view and then edit the color switch again, the color circle isn't set to the correct color.
Strangly enough the color values of the device are still correct in the logging.
So it seems that only the color circle in the edit screen isn't correctly set when I open the edit screen.
Does someone recognize this?