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. Troubleshooting
  3. [Solved] No heartbeat

[Solved] No heartbeat

Scheduled Pinned Locked Moved Troubleshooting
4 Posts 2 Posters 2.4k 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.
  • jsiddallJ Offline
    jsiddallJ Offline
    jsiddall
    Plugin Developer
    wrote on last edited by tekka
    #1

    I am trying to implement sendHeartbeat() periodically so my gateway knows that a sensor is alive even when it doesn't have any data to send.

    The issue is that while I am pretty sure sendHeartbeat() is being called nothing is actually being sent.

    This is a node running MYS 2.0.

    Here's the sketch excerpt from loop():

    #define MY_DEBUG
    
    if ((millis() - last_heartbeat_time) > HEARTBEAT_TIME) {
      // If it exceeds the heartbeat time then send a heartbeat
      void sendHeartbeat();
      last_heartbeat_time = millis();
      
      #ifdef MY_DEBUG
        Serial.println("Sent heartbeat");
      #endif
    }
    
    wait(UPDATE_TIME);
    

    And here's the debug log:

    Sent heartbeat
    TSP:SANCHK:OK
    TSP:MSG:SEND 3-3-0-0 s=0,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=ok:0.00
    TSP:MSG:SEND 3-3-0-0 s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=ok:4.37
    Sent heartbeat
    

    I know the if clause is executing because I get the "Sent heartbeat" debug message.

    The two other messages are from child sensors 1 and 2 and those seem to be working fine.

    I would expect that if a message was being sent for the heartbeat I should see some kind of debug log showing the message was sent. However, I neither see a debug message nor receive a heartbeat message at the gateway.

    Can anyone see any reason the above code shouldn't send a heartbeat?

    Thanks,

    Jeff

    tekkaT 1 Reply Last reply
    0
    • jsiddallJ jsiddall

      I am trying to implement sendHeartbeat() periodically so my gateway knows that a sensor is alive even when it doesn't have any data to send.

      The issue is that while I am pretty sure sendHeartbeat() is being called nothing is actually being sent.

      This is a node running MYS 2.0.

      Here's the sketch excerpt from loop():

      #define MY_DEBUG
      
      if ((millis() - last_heartbeat_time) > HEARTBEAT_TIME) {
        // If it exceeds the heartbeat time then send a heartbeat
        void sendHeartbeat();
        last_heartbeat_time = millis();
        
        #ifdef MY_DEBUG
          Serial.println("Sent heartbeat");
        #endif
      }
      
      wait(UPDATE_TIME);
      

      And here's the debug log:

      Sent heartbeat
      TSP:SANCHK:OK
      TSP:MSG:SEND 3-3-0-0 s=0,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=ok:0.00
      TSP:MSG:SEND 3-3-0-0 s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=ok:4.37
      Sent heartbeat
      

      I know the if clause is executing because I get the "Sent heartbeat" debug message.

      The two other messages are from child sensors 1 and 2 and those seem to be working fine.

      I would expect that if a message was being sent for the heartbeat I should see some kind of debug log showing the message was sent. However, I neither see a debug message nor receive a heartbeat message at the gateway.

      Can anyone see any reason the above code shouldn't send a heartbeat?

      Thanks,

      Jeff

      tekkaT Offline
      tekkaT Offline
      tekka
      Admin
      wrote on last edited by
      #2

      @jsiddall Yes, your code does not work, you should remove void before sendHeartbeat();

      1 Reply Last reply
      1
      • jsiddallJ Offline
        jsiddallJ Offline
        jsiddall
        Plugin Developer
        wrote on last edited by
        #3

        @tekka Thanks, easy fix. I'm obviously not a C guy! I guess you only use "void" when you are defining a function.

        tekkaT 1 Reply Last reply
        0
        • jsiddallJ jsiddall

          @tekka Thanks, easy fix. I'm obviously not a C guy! I guess you only use "void" when you are defining a function.

          tekkaT Offline
          tekkaT Offline
          tekka
          Admin
          wrote on last edited by
          #4

          @jsiddall yup, defining a function without return value :)

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


          23

          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