No announcement yet.

Newbie create a device that both report and control the status of the Sonoff?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbie create a device that both report and control the status of the Sonoff?

    Thank you for creating this wonderful plug in!

    It is my first time playing with this plugin, and having some trouble setting it up like I did with HomeAssistant.

    I would like to have a device in HS that controls a sonoff device and displays status in the same device.

    Is this possible?

    For example device I have in HA
    name: "Living Room Floor Lamp"
    state_topic: "stat/sonoff01/POWER"
    command_topic: "cmnd/sonoff01/POWER"
    availability_topic: "tele/sonoff01/LWT"
    qos: 0
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: true

    What I am getting in HS is 3 separate devices one for control, one for status and one for availability.

    Any help would be appreciated.

  • #2
    You can also try big5 plugin. it has mqtt protocol.

    Both plugins works on different paradigm. Depends of you taste.


    • #3
      Originally posted by MattL0 View Post
      You can also try big5 plugin. it has mqtt protocol.

      Both plugins works on different paradigm. Depends of you taste.
      Thanks Matt for the quick reply, but I am trying to learn about mcsmqtt plugin before moving on to others

      I see that in the release notes there is this
      "PR 6 12/22/2017 Provide bidirectional status and control in single HS3 device"
      I am guessing this is what I need but I can't figure out how to achieve that.


      • #4
        Start at the Association tab. You should see the topic from Sonoff "stat/sonoff01/POWER". Click the A column checkbox on this row. A text box opens up for pub: on this row. Enter cmnd/sonoff01/POWER in that text box. This will give you a device that you can control on/off from HS that will change the Sonoff device and the Sonoff status updated in that device.

        If you want to change the QOS or Retain from the default for "cmnd/sonoff01/POWER" then click on the Association tab row of this device Ref button. It will bring up the Edit tab where you can change these properties.

        The LWT topic is associated with the Sonoff and not the Lamp. It is a separate device.


        • #5
          Beautiful! It works!

          Thank you, very much. I tried that earlier, but for some reason it didn't work.


          • #6
            mcsMQTT monitors the payload received for each topic. When it sees the ON or OFF payload it will assume that you want a button type control from HS. It will create the Value Status Pairs, Graphics and Button controls within HS to support it. If it sees other text items other than standard two-state words then it will assume that this information is random text and will put the payload in DeviceString and no Value Status Pairs will be created. It will keep track for awhile of the text that was received so that it could be easily converted to a List device with VSP rather than text. Things like a printer status may have a finite number of text strings where this would fit nicely. Just pay attention to the Control UI row on the Edit page so you can change the type if mcsMQTT did not guess correctly for your use case.


            • #7
              I just tried with another sonoff and it didn't work, and I had to go create the status pairs manually in HS. I was wondering if the plugin monitors the payloads in order to create the statuses
              Thank you for the clarification!


              • #8
                Creating status pairs in HS will cause you problems because mcsMQTT cannot read what you created so it will not know what numbers to associate with which text. You can create the VSP manually, but you need to do it in mcsMQTT Edit tab. The tool tip gives you the syntax that you need to use.

                If mcsMQTT sees On, or Off (Case insenstivie) it will assume the other state. Same for True/False, Active/Inactive etc. When you select Button type you will see that associations that have been assumed on the VSP row of the Edit tab.


                • #9
                  Yes, you can create a single sonoff device that shows status and has control. in my case I used an S20 plug with tasmota firmware. See my how-to guide here:


                  • #10
                    Something odd is going on. For some reason HS won't create status gfx for my sonoff (see screenshots)
                    I am not sure what I am doing wrong. It worked for one of the sonoffs but not for this one. I even tried deleting devices and recreating associations.
                    Attached Files


                    • #11
                      I wonder if there is some sort of caching is going on with this page.


                      • #12
                        Note the followng:
                        PR250 2/23/2019 Control buttons in HS GUI are not generated when a Button type device is associated

                        I do not know if I submitted to updater or not. I was traveling at that time and forgot about it when I returned. It is at All that is needed is the HSPI...exe file from the zip copied into the HS folder.

                        Another option is to manually define them in HS Device Management with 0 and 1 as the OFF and ON values respectively. "Both" option for each device rather than status or control.


                        • #13
                          Thank you Michael for the update!!
                          I am currently on (HS plugin page doesnt have any updates yet) and will check out your updated version of plugin soon.
                          My workaround was to create the the statuses manually as per screenshot:


                          • #14
                            An option is to add the status buttons manually as shown below:


                            • #15
                              I will submit to updater now. The workaround suggested by taylormia and what you did will work since mcsMQTT has the VSP defined the same way you manually defined it in HS