No announcement yet.

****** is not a valid RGB value

  • Filter
  • Time
  • Show
Clear All
new posts

    ****** is not a valid RGB value

    I have searched and read every thread I could find about RGB and the HS color picker and still cannot figure out what I'm doing wrong here. Here's the scenario.

    I'm setting up an RGB controller for some ws2812's and for the life of me cannot figure out why the color picker will not update with the correct color but sends the correct info to the controller to change the actual color.

    My controller sends a json formatted message on color change as a status confirmation: {"color":{"r":255,"g":0,"b":0},"brightness":126}. The plugin has created the rgb device like it's supposed to and I have selected that device as the associated mqtt device and have tried every color picker UI model available but the color in the UI color picker will not update to the current color. The RGB device under the associations table shows the correct RGB value (ie 0000FF) when I change the color. The device publishes the correct json formatted output to change the color in the controller when selected from the color picker but will not update to reflect the correct color. I have enabled debugging and the output is below. There is an error expressing 0000FF is not a valid RGB value.

    Device 536 is "brightness"
    Device 537 is "b" (RGB)
    Device 538 is "g" (RGB)
    Device 539 is "r" (RGB)
    Device 540 is "rgb" (Device created by the plugin which I'm using as the associated MQTT device)

    5/17/2020 9:57:25 AM 308211 | Update Accepted 539 to 0 StatusType=11 Payload= 0 RegExValue=0
    5/17/2020 9:57:25 AM 308230 | Updating Device from 255 PayloadNumeric=True
    5/17/2020 9:57:25 AM 308236 | HSEvent VALUE_CHANGE| 1024| rgb| 0| 255| 539
    5/17/2020 9:57:25 AM 308241 | Update Accepted 538 to 0 StatusType=11 Payload= 0 RegExValue=0
    5/17/2020 9:57:25 AM 308260 | Updating Device from 0 PayloadNumeric=True
    5/17/2020 9:57:25 AM 308264 | Update Accepted 537 to 255 StatusType=11 Payload= 255 RegExValue=255
    5/17/2020 9:57:25 AM 308282 | Updating Device from 0 PayloadNumeric=True
    5/17/2020 9:57:25 AM 308288 | HSEvent VALUE_CHANGE| 1024| rgb| 255| 0| 537
    5/17/2020 9:57:25 AM 308295 | Update Accepted 536 to 126 StatusType=11 Payload= 126 RegExValue=126
    5/17/2020 9:57:25 AM 308314 | Updating Device from 126 PayloadNumeric=True
    5/17/2020 9:57:25 AM 308318 | Update Accepted 540 to 0000FF StatusType=5 Payload= 0000FF RegExValue=0000FF
    5/17/2020 9:57:25 AM 308333 | Updating Device from 16711680 PayloadNumeric=False
    5/17/2020 9:57:25 AM 308333 | SetDeviceValueString RGB 0000FF is not a valid RGB value
    5/17/2020 9:57:25 AM 308337 | ActoOnMessageForTrigger Topic test/rgb,Payload={"color":{"r":0,"g":0,"b":255},"brightness":126} , Triggers=0

    Any help would be appreciated.

    It first looks as if you are mapping RGB into three separate devices. The color picker is a composite of all three. With the info I have it looks like the Control/Status UI should be RGBW selection. This should take the JSON color and map it into a single HS device with color picker control. I think what you have setup is a Red device, a Green device, and a Blue device so each device has only a partial picture of color and a color picker is not the control for this case.

    It would be easier for me to have your mcsMQTT database so a get a better picture of what you have setup for association between MQTT and HS. It is in \data\mcsMQTT\mcsMQTT.db. posting or email to mcsSolutions at CenturyTel dot net works equally well.


      I just sent the db to your email.

      To clarify: I have started from scratch and let your plugin create a new db with just my controller publishing anything on the broker (for simplicity I hope). When the controller is powered up and connects to the broker it publishes it's current status in a json formatted message.
      {"state":"Off","color":{"r":0,"g":0,"b":255},"brightness" :64 ,"effect":"Solid","transition":0}
      When the controller published its status for the first time (above) the individual R,G,B devices are picked up in the associations tab and your plugin creates another device that appears to convert the individual rgb values into one device with a HEX value (ie. FFFF00). This plugin created device is the one I use to create the HS device and have selected RGBW as the UI model in your plugin. This is device ref 555.

      Click image for larger version  Name:	SS.jpg Views:	0 Size:	175.9 KB ID:	1386283

      Selecting a color in the HS color picker publishes a json formatted message and the controller receives it and changes to the color successfully and publishes its status again with the updated color (json formatted) but the color change is not reflected in the HS color picker even though the plugin created device does change to the appropriate HEX value. Right now the HS color picker should be set at 0000FF (Blue) but it is still set at 000000 (Black). I hope this makes sense.


        I have other things going on tonight, but will look tomorrow morning.


          After a bit more experimenting I found that when I first create the device for RGB the value (integer) is populated in the HS device value. After that any subsequent changes in color result in the error that the value "is not a valid RGB value" and the HS device does not change. It seems that the conversion from RGB to an integer is not happening after the initial device creation. The plugin sees the change, changed the payload in the plugin's associations tab but never updates the HS device with the converted integer to change the color picker.


            Sorry I forgot about this. It was an error I recently introduced when trying to provide more descriptive error messages for a ill-formed color. It is fixed in HSPI_MCSMQTT.exe goes in HS folder. mcsMQTT_2020.dll goes in \bin\mcsMQTT folder.


              Works perfectly now.
              Thanks for the fix and thanks for the work on this plugin. It seems to be the glue that holds a lot of my setup together.