Announcement

Collapse
No announcement yet.

Devices RGB Color Picker works but events won't publish color

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Devices RGB Color Picker works but events won't publish color

    Greetings. My trouble is with the RGB Color Picker. I am new to RGB lights and not really sure which is the proper way to set this up.

    The Power and Dimmer devices are fully functional in events and seem to works well. The Color device color picker works as expected and colors look correct. Nothing is published when I use the Color device within an event. HS event drop down offers a range between -2147483648 to -2147482649 but I do not see anything published in MQTT Explorer. The Status values also do not seem to correspond or convert to the hex color value.
    Thanks for your help


    Click image for larger version

Name:	Cap22.PNG
Views:	56
Size:	117.1 KB
ID:	1426364
    Click image for larger version

Name:	Cap23.PNG
Views:	30
Size:	322.2 KB
ID:	1426365

    Click image for larger version

Name:	Cap24.PNG
Views:	31
Size:	48.2 KB
ID:	1426366

    #2
    I notice the same thing and confirmed with a breakpoint that HS4 never calls the plugin when an event action is executed with a color picker type device. Suggest that a bug report be submitted.

    What you can do is use Send MQTT Message action rather than a Control Device action. The syntax of this action is Topic=Payload. Look at what is sent as MQTT message by the Color Picker control and use it as the Topic and Payload in the action. Then change the color value of the payload from the specific one on that message to a more generalized one using the event substitution variables. Likely $$DVRref):

    The problem that will occur, however, is that HS provides a number and you will likely want a #RRGGBB format for this number. I would need to add an expression function to convert to this format.

    Comment


      #3
      I added the RGB function in version 5.6.0.0 of mcsMQTT at http://mcssprinklers.com/HSPI_mcsMQTT_5_6_0_0.zip. The Zip is placed in the HS4 folder and the file in the zip updater_override.json is extracted to also in the HS4 folder. From the Plugins menu select Add and the only HS4 one that shows up is mcsMQTT. Select it. Remove updater_override.json to restore normal updater operation.

      An example of how to use the inline expression in the event action is shown below. This is the one I used for testing with HS Device 5662. I am not clear on how you will use the color device in an event, but you will need to store a decimal value of the RGB color in the HS DeviceValue. The color picker does this for you, but if other means are used such as one-line script then it will work too.

      Click image for larger version

Name:	Capture1.PNG
Views:	46
Size:	39.5 KB
ID:	1426484

      Comment


        #4
        Wow. Thanks for the response. I am glad to hear there is a reasonable workaround.

        In your opinion would this problem be common for all types of RGB device eg; Zigbee / ZWave ?

        I will try to get a bug report off to them this weekend. I think as RGB lights become more prevalent it would be important for HS to have a events working.

        Comment


          #5
          It seems that it would be common for any Color Picker device, or it could be those with color control as their control use. The color picker for HS4 has had growing pains so easy to see where there could be aspects that were not considered.

          Comment


            #6
            Thanks Michael, I have this working using the Send MQTT message with the string formatted as

            Tasmota/RGBWLight1/cmnd/Color=#01FF22

            COLOR does not equal Color

            I am not sure how I would incorporate your device string into a publish command.

            Comment


              #7
              I am not clear what aspect is working and what is not. Are you able to send mqtt message in event action, but not color picker control?

              The publish topic in both cases is what you show to the left of =. This is the pub topic text box entry on Association or Edit tabs. McsMQTT will format the color picker payload as RGB when it sends it. There should be some examples in the manual.

              What I showed in post #3 to the right of the = is the format for the event action.

              Comment


                #8
                Thanks again for the help, I think it is quite usable the way it is.

                This first example works just fine even though it reports that the message is not formed correctly. It does allow me to save and collapses the editor.

                Click image for larger version

Name:	Cap25.PNG
Views:	21
Size:	440.9 KB
ID:	1426691

                The event below is the one we discussed earlier that is not working.

                Click image for larger version

Name:	Cap26.PNG
Views:	13
Size:	228.5 KB
ID:	1426692

                I have not tried using your publish $$DVR command yet. I need to dig deeper into your docs. While the page count is intimidating the manual has nice examples and is a good reading.

                Comment


                  #9
                  Searching for keywords helps much in the manual.

                  The RGB color space is 0 to 16,777,215. Try a positive number. Actually mcsMQTT probably should use this range for the color picker rather than the range of a 32 bit number.

                  Comment


                    #10
                    In the device editor I set the color value to the 24bit range you suggested but the drop down only shows 0-999 as the available options. With a positive value selected HS still will not publish the value in the event.

                    Click image for larger version

Name:	Cap27.PNG
Views:	16
Size:	231.2 KB
ID:	1426820
                    Click image for larger version

Name:	Cap28.PNG
Views:	10
Size:	434.2 KB
ID:	1426821

                    Comment


                      #11
                      This just confirms the HS4 bug that started this thread.

                      As a side note, the HST decision criteria to use a selector for the number control when the number range is wide seems questionable. Why list only integer values as the value is represented internally as a floating point number. It seems if a selector is going to be used then something like 100 values in the range of the number would be more appropriate rather than the first 1000 integers.

                      Comment


                        #12
                        Yes I agree. I'd be happy with 100 colors if they are well spaced out. I think it'd be nice to be able to call the color by name within and event. As it stands I will need to capture the values for the colors I want to use and store them in a variable or virtual device.


                        Comment


                          #13
                          Another option you have is to not use the Color Picker, but use a List Selector for the Contol/Status UI. In your list define the color presets that you want as VSP entries on the mcsMQTT Edit tab. The VSP text box has a verbose tool tip to help define entry format. It would be something like FF0000=16711680;Red for the red color entry. The HS selector should show Red and your publish template could use $$VALUE: rather than the $$DVRxxx): substitution. Tasmota would send FF0000 for the color. If it sends #FF0000 then setup the VSP pattern to use #FF0000 rather than FF0000. The downside to this approach is that if Tasmota sends a color that is not a preset then HS will not have it mapped to a number.

                          Comment

                          Working...
                          X