No announcement yet.

Sending payload via Virtual Device

  • 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):

    here is JSON payload that works with MQTT client:

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

    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.


    • #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

      Steven Giles


      • #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


        • #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:	124
Size:	29.9 KB
ID:	1306270

          Click image for larger version

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

          Thanks again for the help.

          Steven Giles


          • #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.


            • #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

              Steven G


              • #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.


                • #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:	115
Size:	24.8 KB
ID:	1306278

                  Steven G


                  • #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.


                    • #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

                      Steven Giles


                      • #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.


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

                          everything is turning off and on now with buttons and remotes

                          Thanks you for your help

                          Steven G


                          • #14

                            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

                            Attached Files