Announcement

Collapse
No announcement yet.

Question: How to have HS control buttons update HS device

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

  • Question: How to have HS control buttons update HS device

    Browsed the help PDF and didn't see this covered, maybe I missed it, apologize if I did.

    I have a device that sends and receives MQTT. Think of it as a light switch. It sends an MQTT message (status) when the light is turned on at the device and can also be controlled via a received MQTT message from HS (control). The device sends its payload as two JSON values, status, and signal strength.

    The published MQTT (status) message from the device is:

    moteino/100/2/Office{"Led1":"Off","RSSI":-49}

    In the plugin associations tab I have changed the published topic when HS value has changed (control) to be:

    moteino/100/2/Office/Led1/control

    This was done to separate the status and control MQTT messages so duplicate messages are not sent to the device. Previously if the status and control topics were the same, the device would receive its own status message. For instance, if it published on moteino/100/2/Office and subscribed to moteino/100/2/Office it would receive its own messages. Typically this is not a big deal but my devices are communicating across a low bandwidth, high range wireless network and need to reduce the bandwidth utilization as much as possible.

    The issue is that when the device control buttons are pressed in HS, the device status in HS does not update. For instance, if I click the On button, the device in HS does not change from Off to On. The device does receive the MQTT message and turns on the light, but the HS device status does not change.

    Attached are the device's MQTT and VS pairs. I left the VS pairs as they were created by the PI. Also tried the "echo" setting general tab but that didn't appear to help with this situation.

    Am I doing something incorrectly? I believe this worked in the past but I haven't been able to test the plugin for several revisions due to the Mono issues in the past.

    Thanks!
    Attached Files
    Last edited by mwolter; April 10th, 2018, 03:18 PM. Reason: Corrected MQTT topic published by HS

  • #2
    The issue is that when the device control buttons are pressed in HS, the device status in HS does not update. For instance, if I click the On button, the device in HS does not change from Off to On. The device does receive the MQTT message and turns on the light, but the HS device status does not change.
    Which of these describes your situation:
    1. Your light does not publish "moteino/100/2/Office{"Led1":"Off","RSSI":-49}" when the light is commanded Off by HS?
    2. "moteino/100/2/Office{"Led1":"Off","RSSI":-49}" is published after HS sends the command, but HS Device Value does not change to 0.

    Comment


    • #3
      Originally posted by Michael McSharry View Post
      Which of these describes your situation:
      1. Your light does not publish "moteino/100/2/Office{"Led1":"Off","RSSI":-49}" when the light is commanded Off by HS?
      2. "moteino/100/2/Office{"Led1":"Off","RSSI":-49}" is published after HS sends the command, but HS Device Value does not change to 0.
      The way I have it setup is option 2. HS is actually publishing:

      Topic: moteino/100/2/Office/Led1/control Payload:Off (not JSON)

      I don't have the light set to publish its state when commanded off by HS. Would it be better to do that? Trying to reduce communication over the wireless, plus trying to save power since these are battery powered devices, but if it's necessary I can do it. Funny thing is, I think this worked before. Would this work if I wasn't using JSON?

      Comment


      • #4
        The options are with respect to your light. I recognize that HS is publishing the command and the light is getting it because of the physical behavior. I want to know if the light is responding with a new message because the light's state has changed. There is actually a third option which is the case the light only publishes periodic status so HS would get it eventually, but not soon enough to have real time visibility.

        Comment


        • #5
          The device only publishes when the button (switch) press changes the light state, not the light state change alone. The device does not periodically report the light state.

          Comment


          • #6
            This light is not very automation friendly for having a MQTT capability. Do you have control of the firmware in this device?

            Looks like what will be needed is the option to update HS status based up command for those situations where the commanded thing does not provide an acknowledge of acting upon the command.

            Comment


            • #7
              Agreed. It's an Arduino based board, rewriting the code now. Makes sense to have the light state transmitted/published from the device regardless of how it was set.

              Maybe this will help someone else interested in local (on device) as well as HS control.

              Thanks for helping to think this through.

              Comment


              • #8
                Glad you are able to implement a more robust solution.

                Comment

                Working...
                X