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. Controllers
  3. Home Assistant
  4. Heartbeats

Heartbeats

Scheduled Pinned Locked Moved Home Assistant
23 Posts 6 Posters 7.8k Views 6 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.
  • iLusionI iLusion

    Thanks @martinhjelmare. My use case is as follows. I have nodes with binary sensors for door/window. These nodes send status information 1 or 0 upon events, say door opened or closed. They also send the heartbeat message at regular interval. I'd like to see the time when last heartbeat was received by the HA. This way, when I see the status of the Node in HA, I could determine if the Node is active or not. As of now, if the node crashed, I have no idea as HA simply shows the last status.

    martinhjelmareM Offline
    martinhjelmareM Offline
    martinhjelmare
    Plugin Developer
    wrote on last edited by
    #8

    @iLusion

    I see the use case. I'll think about a solution.

    1 Reply Last reply
    0
    • dpressleD dpressle

      @iLusion You can see the last update in the node details, for example i have temp node and i can see when it last updated HA:
      0_1480851427898_upload-647ad622-4cc3-484e-b453-8a3210818f15

      I hope it helps.

      BTW: i do agree that it is annoying that nodes that no longer exists but was issued a node id by the gateway will stay forever in HA until you change that in the GW or assigning this ID to another node.

      martinhjelmareM Offline
      martinhjelmareM Offline
      martinhjelmare
      Plugin Developer
      wrote on last edited by
      #9

      @dpressle

      As the heartbeat will change each update but state might not, the current last changed time is not enough.

      Please stay on topic, and open a new thread if there are other issues.

      dpressleD 1 Reply Last reply
      0
      • martinhjelmareM martinhjelmare

        @dpressle

        As the heartbeat will change each update but state might not, the current last changed time is not enough.

        Please stay on topic, and open a new thread if there are other issues.

        dpressleD Offline
        dpressleD Offline
        dpressle
        wrote on last edited by
        #10

        @martinhjelmare

        1. Well it depends on the type of sensor you have, so its a partial solution for him, only he knows his sensors and if its helping him.
          I know that for me its good enough.
        2. I think i was right on the topic with my message, the solution might be different but its the same basic problem.

        But any way, @iLusion should answer this...

        1 Reply Last reply
        0
        • dpressleD dpressle

          @iLusion You can see the last update in the node details, for example i have temp node and i can see when it last updated HA:
          0_1480851427898_upload-647ad622-4cc3-484e-b453-8a3210818f15

          I hope it helps.

          BTW: i do agree that it is annoying that nodes that no longer exists but was issued a node id by the gateway will stay forever in HA until you change that in the GW or assigning this ID to another node.

          martinhjelmareM Offline
          martinhjelmareM Offline
          martinhjelmare
          Plugin Developer
          wrote on last edited by
          #11

          I was referring to this, which is not connected to heartbeats.

          @dpressle said:

          BTW: i do agree that it is annoying that nodes that no longer exists but was issued a node id by the gateway will stay forever in HA until you change that in the GW or assigning this ID to another node.

          iLusionI 1 Reply Last reply
          0
          • martinhjelmareM martinhjelmare

            I was referring to this, which is not connected to heartbeats.

            @dpressle said:

            BTW: i do agree that it is annoying that nodes that no longer exists but was issued a node id by the gateway will stay forever in HA until you change that in the GW or assigning this ID to another node.

            iLusionI Offline
            iLusionI Offline
            iLusion
            wrote on last edited by
            #12

            @martinhjelmare @dpressle Thanks guys for keeping the thread active.

            The last time stamp of state change is not sufficient, e.g. The node status in HA shows as door closed as of T days ago but the node may have crashed at T+1 and door may have opened after that.

            The force update of binary sensors may partially solve this but not really a good alternative as if HA processed force updates, information would be lost about when exactly the state had changed.

            If HA shows last time stamp of Heartbeat then we could deterministically display the last status time stamp as well as last known state of the node itself. This needs to be configurable for nodes which do not generate heartbeats.

            dpressleD 1 Reply Last reply
            0
            • iLusionI iLusion

              @martinhjelmare @dpressle Thanks guys for keeping the thread active.

              The last time stamp of state change is not sufficient, e.g. The node status in HA shows as door closed as of T days ago but the node may have crashed at T+1 and door may have opened after that.

              The force update of binary sensors may partially solve this but not really a good alternative as if HA processed force updates, information would be lost about when exactly the state had changed.

              If HA shows last time stamp of Heartbeat then we could deterministically display the last status time stamp as well as last known state of the node itself. This needs to be configurable for nodes which do not generate heartbeats.

              dpressleD Offline
              dpressleD Offline
              dpressle
              wrote on last edited by
              #13

              @iLusion i am just trying to help here so i hope no one is med about me for saying what i have to say and where i have to say it :smiley:
              So i am thinking out load here, if you want to send heartbeat and assuming your node is time sleeping (not interrupt) otherwise how would you send heartbeat right? why dont you send your current status (even if its not changed) so HA will be updated as i suggested before.

              I mean , unless i missed something here, whats the difference between heartbeat and sending the status??? they both use radio and node needs to be awake...

              iLusionI 1 Reply Last reply
              0
              • dpressleD dpressle

                @iLusion i am just trying to help here so i hope no one is med about me for saying what i have to say and where i have to say it :smiley:
                So i am thinking out load here, if you want to send heartbeat and assuming your node is time sleeping (not interrupt) otherwise how would you send heartbeat right? why dont you send your current status (even if its not changed) so HA will be updated as i suggested before.

                I mean , unless i missed something here, whats the difference between heartbeat and sending the status??? they both use radio and node needs to be awake...

                iLusionI Offline
                iLusionI Offline
                iLusion
                wrote on last edited by
                #14

                @dpressle ofcourse! I appreciate your help and I am sure, so does anyone who'd benefit from this thread. This is the power of open source and community supported projects! :smiley:

                Sending the same state over and over again won't be ideal. Here is why -

                Assumptions

                1. Node is not interrupt driven

                Scenario

                1. Loop 0 - Door closed, send state Door close as of T
                2. Loop 1 - Door open, send state Door open as of T+1
                3. Loop 2 - Door open, send state Door open as of T+2

                Now, the door was actually, open at T+1, if HA processes, force updates then HA would show that door is open as of T+2 - We cannot now determine that the door was actually open since T+1 as oppose to T+2.

                Hope this helps.

                1 Reply Last reply
                0
                • martinhjelmareM Offline
                  martinhjelmareM Offline
                  martinhjelmare
                  Plugin Developer
                  wrote on last edited by martinhjelmare
                  #15

                  I think forced updates should only be used for pure sensor types. Using it for binary sensors is not a good solution, as mentioned.

                  The built in last changed time report in home assistant is only applied when the state is changed, so will not come in play in cases when the state is not changed even though a device sent an update. Using forced updates circumvents this, but as said is not a good solution in all cases.

                  We could report heartbeats as a regular sensor value which could then be checked in an automation/script. A problem might be what sensor ID to use, cause the heartbeat is for the node, not only for a sensor. I'll think about this.

                  iLusionI 1 Reply Last reply
                  0
                  • martinhjelmareM martinhjelmare

                    I think forced updates should only be used for pure sensor types. Using it for binary sensors is not a good solution, as mentioned.

                    The built in last changed time report in home assistant is only applied when the state is changed, so will not come in play in cases when the state is not changed even though a device sent an update. Using forced updates circumvents this, but as said is not a good solution in all cases.

                    We could report heartbeats as a regular sensor value which could then be checked in an automation/script. A problem might be what sensor ID to use, cause the heartbeat is for the node, not only for a sensor. I'll think about this.

                    iLusionI Offline
                    iLusionI Offline
                    iLusion
                    wrote on last edited by
                    #16

                    @martinhjelmare

                    The NodeID could be the least common denominator here, I'd think.

                    1 Reply Last reply
                    0
                    • martinhjelmareM Offline
                      martinhjelmareM Offline
                      martinhjelmare
                      Plugin Developer
                      wrote on last edited by
                      #17

                      No, each entity needs node and child ID. Another option would be to report heartbeat as a state attribute for all children of a node. But I have to look into how that would affect last changed/updated time stamps and if there's a difference between state and state attributes in this context.

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        koen01
                        wrote on last edited by
                        #18

                        @martinhjelmare
                        Any new developments regarding this topic?

                        martinhjelmareM 1 Reply Last reply
                        0
                        • K koen01

                          @martinhjelmare
                          Any new developments regarding this topic?

                          martinhjelmareM Offline
                          martinhjelmareM Offline
                          martinhjelmare
                          Plugin Developer
                          wrote on last edited by
                          #19

                          @koen01

                          No, but it's on my todo list. PR is also welcome.

                          1 Reply Last reply
                          0
                          • flyswiftlyF Offline
                            flyswiftlyF Offline
                            flyswiftly
                            wrote on last edited by
                            #20

                            I wonder if a 'virtual child' of the sensor might be a solution? Just define a second child of the node that periodically sends the opposite status. It would simply be defined in the sketch on the sensor, not tied to actual hardware. First interval, it sends 'true' or 'open' or 1, next interval it sends 'false' or 'closed' or 0. Since it's programmed to change every interval, looking at the last update of the virtual child will let you know the sensor is functional or not.

                            martinhjelmareM 1 Reply Last reply
                            0
                            • flyswiftlyF flyswiftly

                              I wonder if a 'virtual child' of the sensor might be a solution? Just define a second child of the node that periodically sends the opposite status. It would simply be defined in the sketch on the sensor, not tied to actual hardware. First interval, it sends 'true' or 'open' or 1, next interval it sends 'false' or 'closed' or 0. Since it's programmed to change every interval, looking at the last update of the virtual child will let you know the sensor is functional or not.

                              martinhjelmareM Offline
                              martinhjelmareM Offline
                              martinhjelmare
                              Plugin Developer
                              wrote on last edited by martinhjelmare
                              #21

                              @flyswiftly

                              Yes, this is already possible today. Downside is that the user has to keep track of what other sensors (entities) this information applies to. The node_id is available among the state attributes so that will be a help.

                              1 Reply Last reply
                              0
                              • flyswiftlyF Offline
                                flyswiftlyF Offline
                                flyswiftly
                                wrote on last edited by
                                #22

                                Seems the node id would server that tracking need.

                                1 Reply Last reply
                                0
                                • martinhjelmareM Offline
                                  martinhjelmareM Offline
                                  martinhjelmare
                                  Plugin Developer
                                  wrote on last edited by
                                  #23

                                  Yes, with some imagination, you could probably make a template that would match the correct criteria, and use eg for a notification.

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


                                  9

                                  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