Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. General Discussion
  3. Mysensors - Keep alive / LWT (last will, testament)?

Mysensors - Keep alive / LWT (last will, testament)?

Scheduled Pinned Locked Moved General Discussion
testamentkeep alivelwtlast willmqtt
6 Posts 4 Posters 3.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ahhk
    Hardware Contributor
    wrote on last edited by
    #1

    Hi,

    i am evaluating mysensors and it's quite interesting and easy to understand! Just, what i was looking for!:) But i am missing a feature, which enables the gateway/controller to detect node-failures. At the moment i have a mqtt-client-gateway running very nicely. But i dont know how to configure /implement a feature, that i get a mail/info/note (red LED blink) when a node dies, goes "offline" or does not send sensor-values any more.
    In mqtt this is called LWT (last will, testament). Is there something comparable in mysensors?
    Any ideas howto get this?

    Sry for my english, i am native german ;)

    greetings

    Andreas

    YveauxY 1 Reply Last reply
    0
    • A ahhk

      Hi,

      i am evaluating mysensors and it's quite interesting and easy to understand! Just, what i was looking for!:) But i am missing a feature, which enables the gateway/controller to detect node-failures. At the moment i have a mqtt-client-gateway running very nicely. But i dont know how to configure /implement a feature, that i get a mail/info/note (red LED blink) when a node dies, goes "offline" or does not send sensor-values any more.
      In mqtt this is called LWT (last will, testament). Is there something comparable in mysensors?
      Any ideas howto get this?

      Sry for my english, i am native german ;)

      greetings

      Andreas

      YveauxY Offline
      YveauxY Offline
      Yveaux
      Mod
      wrote on last edited by Yveaux
      #2

      @ahhk you could have the sensor send a value update at regular, known intervals. Track the arrival of these updated values from some client that subscribes to the mqtt topics. When no new value arrives within a certain time (e.g. 3 times the sensor update interval) you can consider the sensor to be off-line. When a new value does come in again from an offline sensor, the sensor is online again.
      This logic can easily be accomplished by e.g. node-red.

      http://yveaux.blogspot.nl

      1 Reply Last reply
      0
      • hekH Offline
        hekH Offline
        hek
        Admin
        wrote on last edited by
        #3

        Added a dedicated heartbeat message in the development branch a while ago. But you must actively send it from your node. So any "smart" gateway/controller implementation (with LWT functionality) should take normal messages into account also... as sending heartbeats should really only be needed when node doesn't have anything "real" to transmit.

        https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/MySensor.h#L226

        1 Reply Last reply
        0
        • A Offline
          A Offline
          ahhk
          Hardware Contributor
          wrote on last edited by
          #4

          Hi,

          sending a "heartbeat" or other value regularly is not a problem. The processing of this on gateway/controller-side is missing. I hoped to find a feature like:

          • Node presents sensor to controller/gateway WITH time-intervall-value
          • The controller /gateway sends alert-message if node doesnt send for >presented time-intervall-value...
            (-perhaps a manual "offline-switch"-function to disable alarm/node/sensor)

          This would be really great...does anybody know if something like this is on the roadmap for mysensors?

          I will take a look into scripting (mqtt+python?) to realise my alert-function...
          Greetings

          Andreas

          1 Reply Last reply
          0
          • hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by
            #5

            The gateway is stateless today and there is good reasons for keeping it that way.

            So it is really up to the controller plugin developer (or in your case using some scripting) to implement a "offline" feature when sensor hasn't reported any values in due time. What is a valid interval should probably be configurable per node.

            1 Reply Last reply
            0
            • E Offline
              E Offline
              ericvdb
              wrote on last edited by
              #6

              Although i like the idea, it will force you to send a value even if it has not changed. Defeats a bit a battery optimized sensor node.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              17

              Online

              11.7k

              Users

              11.2k

              Topics

              113.1k

              Posts


              Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • MySensors
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular