Announcement

Collapse
No announcement yet.

How do I publish different topics than my status values in the same device?

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

  • How do I publish different topics than my status values in the same device?

    I’m new to MQTT and mcsMQTT. Thus far the combo seems extremely powerful but in spite of reading the manual, I can’t figure out how to create a single status/control device for my OpenEVSE EV charger (yes, technically it’s not a charger but I’m simplifying).

    To date, I’ve successfully subscribed to openevse/status where I get 3 potential values. 0=Off, 1=On, 2=Charging and 254=Standby. I’ve created a device that nicely maps the numeric values to status text with graphics and all that.

    Where I’m lost is that I want to be able to control the state of the EVSE. To do this, I need to publish to openevse/rapi/in/$FE to turn the EVSE ON, and publish to openevse/rapi/in/$FS to put it to sleep (no payload in either of these cases).

    I could probably do this via HS events but I feel like there’s a way to do it in mcsMQTT but I can’t seem to get there. I can publish OFF/ON/STANDBY or 0/1/254 to openevse/rapi/in but can’t equate these to arbitrary topics like openevse/rapi/in/$FE and publishing the text or value is ignored by the device.

    In an ideal world, I’d have a single “Toggle” button that sends the $FE when in standby, and $FS when on, but I’d settle for an ON button and a SLEEP button that hit the correct topic.

    Thanks for any help!

  • #2
    What I see the difficulty to be is that the topic also contains the payload. The device reports status in the payload, but appears to ignore the payload in the ../in/... topic.

    Provisions exist for a topic template with substitution variables, but there are no variables that would contain $FE or $FS unless you want to $FE and $FS as the label on the buttons used from HS Device Management. If case this is acceptable, I added a substitution variable $$LABEL: in 4.1.3.0 at http:/mcsSprinkers.com/mcsMQTT_4_1_3_0.zip. I did the following setup to test it. Note that the $ in the topic will be URI encoded unless you disable this encoding on the General Tab, outbound management.

    First setup mcsMQTT and then edit HS Device Management for the device. If you go back and change this device in mcsMQTT then it will overwrite what you do in HS Device Management because HS provides no mechanism for a plugin to read what a user has edited.

    Click image for larger version

Name:	Capture1.PNG
Views:	76
Size:	17.3 KB
ID:	1321498

    Click image for larger version

Name:	Capture2.PNG
Views:	58
Size:	28.4 KB
ID:	1321499
    Click image for larger version

Name:	Capture.PNG
Views:	60
Size:	7.9 KB
ID:	1321500

    The graphics could also be edited from On and Off if desired. When the $FE button is pressed then the openevse/rapi/in/$FE topic with payload of $FE will be published.

    If you want customized HS Device Management buttons then you will need to setup a virtual device, associate the operevse/status topic to it so status is updated. Use events when your button(s) is clicked to send mqtt messages as action to the event.

    I am also open to making other changes to the plugin if you can think of a good way of handling this and similar situations.

    Comment


    • #3
      I though on this a little more and I believe a good way to what you want it to define another substitution variable for which you have control. This will be the VSP from the edit page and using substitution variable $$VSP:. The HS setup is just like the example I used, but in mcsMQTT VSP you also define the 3 and 4 numbers to be $FE and $FS. The topic template will use $$VSP: rather than $$LABEL: In HS you would define the status to be whatever label you want on the button such as ON and SLEEP. mcsMQTT will see the 3 or 4 in this example and lookup $FE or $FS to be put in the topic. It is version 4.1.4.0 at http://mcsSprinklers.com/mcsMQTT_4_1_4_0.zip.

      Click image for larger version

Name:	Capture1.PNG
Views:	70
Size:	18.6 KB
ID:	1321547

      Click image for larger version

Name:	Capture.PNG
Views:	53
Size:	8.9 KB
ID:	1321549


      Click image for larger version

Name:	Capture2.PNG
Views:	53
Size:	33.4 KB
ID:	1321548

      Comment


      • #4
        I like that. I’ll give it a try. I’ve also been struggling to get the status values to appear in the homeseer device but let me tackle one challenge at a time.

        Thanks for your help and I’ll let you know how it turns out.

        Comment


        • #5
          OK. I'm getting closer and have my buttons that are doing the appropriate mqtt publish. The only problem is now I've lost my status text and images. In the device config/Advanced tab, I have a status of "-1 Unknown":

          Click image for larger version

Name:	Capture.PNG
Views:	38
Size:	70.8 KB
ID:	1324148

          As we say in SC, asbestos I can tell, my config matches what you suggested for the Status and MQTT plugin:

          Click image for larger version

Name:	Capture.PNG
Views:	27
Size:	99.3 KB
ID:	1324149

          MQTT:

          Click image for larger version

Name:	Capture.PNG
Views:	26
Size:	473.5 KB
ID:	1324150

          Open to any thoughts...

          Comment


          • #6
            The status is based upon what is received per the subscription. It seems you have not received anything from openvse/state topic. If this topic is being published then next step would be the debug file that is enabled for General Tab and data in \data\,mcsMQTT.

            Comment

            Working...
            X