Announcement

Collapse
No announcement yet.

Sending payload via Virtual Device

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

    Sending payload via Virtual Device

    New to MQTT, but think I have it running for the most part. I have create a virtual device with ON/OFF and used it in an association with a topic. I can change status on the actual device and it will update homeseer virtual device. I cannot seem to get the homeseer to send status to actual device.

    MQTT Topic: milight/0x10B5/rgb_cct/0
    Homeseer Recieved Topic: UPmilight/0x10B5/rgb_cct/0:state

    I have tried - (published message on device change using topic):
    milight/0x10B5/rgb_cct/0
    milight/0x10B5/rgb_cct/0:state

    here is JSON payload that works with MQTT client:
    milight/0x10B5/rgb_cct/0:{"state":"OFF"}
    milight/0x10B5/rgb_cct/0:{"state":"ON"}

    So my question is how do I send this payload from homeseer virtual device using MQTT?

    Thanks,
    Steven G

    #2
    I would not create a virtual device. in the topic that is published and received by mcsMQTT click the A column checkbox. This will create the device for you. When this happens a text box will appear where you can enter the publish topic that mcsMQTT should use when the device value or device string change. Depending upon the type of payload being numeric, an enumeration, or text you may want to select the appropriate control UI on the edit screen. you get to it by clicking on the newly created ref button or on the first column sequence number. This will also give you visibility into use of device string vs device value as the change event.

    Comment


      #3
      I tried that and same thing actual device controls Homeseer device but the ON/OFF button does nothing and it does not send out a payload. Im sure I have something wrong somewhere so included screen shots just in case


      Click image for larger version  Name:	screen1.JPG Views:	0 Size:	210.2 KB ID:	1306250

      here is virtual device


      Thanks,
      Steven Giles

      Comment


        #4
        MQTT protocol does not use the ":" in the topic. That is just a convention adopted by mcsMQTT so it could map JSON payloads into individual HS devices. Remove the portion of your publish topic that the the 0:state. If you want the 0 that is fine, but not the :state

        Comment


          #5
          Thank you for helping me along, once I get one working I will be good to get the rest

          Have that changed to milight/0x10B5/rgb_cct/0 but the buttons on the created device do not control anything (homeseer device or actual device). If I use a client to change status homeseer device does change status. Should I be able to use the buttons on the created homeseer device (its like they are disabled they do nothing when clicked)?


          (ref 1763) Yellow highlighted buttons do not work and do not change status of homeseer device or device
          Blue highlighted is the virtual device I created and it sends topic: milight/0x10B5/rgb_cct/1 with a payload of: 0 or 1

          Click image for larger version

Name:	image3.JPG
Views:	338
Size:	29.9 KB
ID:	1306270

          Click image for larger version

Name:	screen2.JPG
Views:	330
Size:	205.9 KB
ID:	1306271

          Thanks again for the help.

          Thanks,
          Steven Giles

          Comment


            #6
            Enable debug from General tab. Use the HS button for device 1763. The debug output will be in /data/mcsMQTT as a .txt file. Post it.

            Comment


              #7
              Pressed off / on / off

              5/20/2019 8:44:21 PM 165290169 | HSEvent VALUE_CHANGE| 1024| YW007X491775_app| -101| 0| 1749
              5/20/2019 8:44:21 PM 165290169 | SetIOMulti 1763, oCAPI.ControlType=Button
              5/20/2019 8:44:21 PM 165290170 | CommandControllableDevice milight/0x10B5/rgb_cct/0=OFF
              5/20/2019 8:44:21 PM 165290171 | ActoOnMessageForTrigger Topic milight/0x10B5/rgb_cct/0,Payload=OFF
              5/20/2019 8:44:21 PM 165290172 | HSEvent VALUE_CHANGE| 1024| YW007X491775_root| 1| 2| 1748
              5/20/2019 8:44:30 PM 165299389 | SetIOMulti 1763, oCAPI.ControlType=Button
              5/20/2019 8:44:30 PM 165299390 | CommandControllableDevice milight/0x10B5/rgb_cct/0=ON
              5/20/2019 8:44:30 PM 165299390 | ActoOnMessageForTrigger Topic milight/0x10B5/rgb_cct/0,Payload=ON
              5/20/2019 8:44:35 PM 165304456 | SetIOMulti 1763, oCAPI.ControlType=Button
              5/20/2019 8:44:35 PM 165304456 | CommandControllableDevice milight/0x10B5/rgb_cct/0=OFF
              5/20/2019 8:44:35 PM 165304457 | ActoOnMessageForTrigger Topic milight/0x10B5/rgb_cct/0,Payload=OFF

              Thanks,
              Steven G

              Comment


                #8
                this shows the topic was published. It also shows the same topic that was published is the one that was subscribed so in essence you are asking it to send it to itself. Change the publish topic so it is different than the subscribe topic. For example, Tasmota, will include /cmnd in the topic if you are trying to send something to a Tasmota device.

                Comment


                  #9
                  I think they are different
                  MQTT Subscribe Topic: STmilight/0x10B5/rgb_cct/1:state
                  HS Device Publish Topic: milight/0x10B5/rgb_cct/0
                  see Screenshot above

                  If I am understanding this correctly (my brain hurts)
                  STmilight/0x10B5/rgb_cct/1:state - is the MQTT state topic pattern coming from device which updates homeseer device
                  milight/0x10B5/rgb_cct/0 - is to publish back to device from homeseer


                  screen from device
                  Click image for larger version

Name:	screen3.JPG
Views:	342
Size:	24.8 KB
ID:	1306278

                  Thanks,
                  Steven G

                  Comment


                    #10
                    I am not familiar with your device, but I can see that mcsMQTT is sendin the topic and mcsMQTT is receiving it because it has subscribed to all topics. This is from the debug segment. It looks to me as if whatever you are using to recognize the message has not subscribed to the topic you are publishing from mcsMQTT.

                    Comment


                      #11
                      Is there a way to make the payload send: {"state":"OFF"} from mcsMQTT (this is format that device is expecting)

                      I have everything working with a client but can only get mcsMQTT to send OFF, ON, 0, 1


                      Thanks,
                      Steven Giles

                      Comment


                        #12
                        This is the payload template field on the edit page. It will be something like {“state”:”$$label:”}. Refer to the manual for syntax if this does not work.

                        Comment


                          #13
                          Got it {"state":"$$STATUS:"}

                          everything is turning off and on now with buttons and remotes

                          Thanks you for your help

                          Thanks,
                          Steven G

                          Comment


                            #14
                            Steveng

                            I'm interpreting you are using MiLight

                            to control RGB lights..... Were you successful with this? I would appreciate if you would share your MQTT setup



                            I want to install RGB Flood lights and came across your post using this Wfi controller


                            Devoir
                            Attached Files

                            Comment

                            Working...
                            X