Announcement

Collapse
No announcement yet.

Poll or Monitor devices for offline

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

    Poll or Monitor devices for offline

    Can anyone here suggest a good way to poll or monitor devices for offline:
    a. Zigbee devices connected through a tasmota Zigbee bridge running Zigbee2MQTT
    b: Wifi devices with tasmota firmware

    I can see these devices are sending MQTT status captured by mcsMQTT every few minutes. Maybe read these status lastdate each day to determine if each of the device is offline, and send notification (PushOver) ?

    Edit: With the new version of mcsMQTT I see a virtual device called "Ävailability". Can it be used for the above?

    #2
    I track Tasmota "uptime" (in seconds) for that purpose or LWT. You can also enable the "availability" feature with Z2M:

    https://www.zigbee2mqtt.io/guide/con...ilability.html

    Comment


      #3
      Thanks 123. I will look into it.

      Comment


        #4
        mcsMQTT provides an event trigger that will fire when a topic has not been received for a user-specified time. It can be qualified by not receiving some payload text in the topic for a more refined trigger. Your question is really the purpose of this Event trigger.

        Comment


          #5
          Originally posted by Michael McSharry View Post
          mcsMQTT provides an event trigger that will fire when a topic has not been received for a user-specified time. It can be qualified by not receiving some payload text in the topic for a more refined trigger. Your question is really the purpose of this Event trigger.
          Thanks Michael for replying to my question. Are you referring to the Event's Mqtt Topic Timeout? I can see it has a parameter for minutes elapsed since last received.
          I can think of a few mqtt topic, but which topic would you use for this event?

          Comment


            #6
            Any topic from your device that you expect to have periodic messages where the timeout being setup to 2 or 3 times the expected timeout interval. Event-based topics are not good choices for this because you do not know how often they will occur. For Tasmota, tele/x/y messages are periodic. stat/x/y messages are event based. Each device has its own rules for when it delivers messages.

            If you do not have any periodic data, then it may be possible to send a command to the device via MQTT that sets its state to the current state and it could respond with an acknowledge of the current state. You would user HS periodic event to send the command and MQTT Timeout trigger to look for the acknowledge/status update topic.

            Comment


              #7
              Thanks Michael for the info.

              I can see all my wifi tasmota devices is already listed and monitored in "Availability" device. Zwave devices are covered by a script that recursively poll it. Now left with Zigbee devices connected to a bridge running Zigbee2MQTT. The bridge does periodically send the tele/device/SENSOR of the Zigbee devices. Those not, as you have suggested, I will send a redundant command to get a response ("I am still alive").

              Comment


                #8
                Availability is the Last Will and Testament sent from the MQTT Broker. The Broker does a periodic ping of the client and when it does not respond it send the Will message that is typically a payload of "offline". It is good for monitoring Tasmota devices and others that user the MQTT Last Will and Testament capability. I believe that zigbee2mqtt also supports this capability so it that is what you are using for the zigbee interface then it can be done in the same way as Tasmota devices.

                Comment


                  #9
                  All my tasmota Wifi devices, including the tasmota Zigbee bridge (hub) is listed and monitored in Availability. But the Zigbee devices connected via the bridge was not listed, and they don't send LWT periodically like the wifi devices do.

                  The bridge do send mqtt tele/devices/sensor: with payload {"ZbReceived":{"XXXXX":{"Device":"XXXXX","Power":0,"Endpoint ":1,.....} periodically.
                  I tried using mqtt topic timeout but i am having problem with colon in the payload. see above. So I go down the Availability path. I associate the periodic mqtt topic (from my zigbee devices) with 1 of the payload and redefine the VSP as "keep alive" in Availability. I also ticked off the 'Last Change Time Updates on Status Change Only' to capture the timestamp. It seems to work so far.

                  Don't know if i am doing it right here. Could you point me where I can read more about the Availability/LWT? eg. how/when it will update offline/online ?

                  Comment


                    #10
                    mcsMQTT groups the LWT topics under the Availability HS Device. It is just an organizational feature.

                    For the timeout trigger the idea in the payload text box is to put something that will uniquely identify the sensor in your case. It is likely you only need the XXXXX if that is the unique ID of the sensor. I would have to look deeper, but it could be that the colon causes issue because mcsMQTT uses the colon to separate the topic from the json endpoint. If you do need the colon to make a unique identification of the sensor in the tele/devices/sensor topic then I will look into it.

                    For the alternate approach you are using, what are you doing to know when the periodic message has stopped transmitting? My thought is that you would have a timeout trigger and the action of that trigger would store a value in this keep-alive device feature that could be used to know it had stopped updating. It would stay this way until the message comes back online.

                    Comment


                      #11
                      Thanks again Michael for insight.

                      Yes I would need to use colon to uniquely identify the device. If you look at the 'mqtt topic received' under Event, I can define the 'payload to match' with colons no problem.

                      For now, I will continue to use the alt approach, to define my Zigbee devices in Availability and monitor the behavior. I will associate the payload 'Endpoint' since it is sending value 1. 1=online.

                      Comment


                        #12
                        The Topic will contain no colons. The colons are used in the Association table to append a JSON endpoint onto the topic to form a unique name. The actual topic has no colons.

                        Comment


                          #13
                          Yes the topic got no colons, but the payload do.

                          Comment

                          Working...
                          X