Own action on heatbeat request



  • Hi,
    I would like to capture the heartbeat request send by a controller (in my case Domoticz).
    However this does not work within the receive funtction.
    What did I overlook?

    void receive(const MyMessage &message)
    {
        if (message.type == I_HEARTBEAT_REQUEST) { 
          Serial.println("heartbeat request");
        }   
    }```


  • Afaik, heartbeat (and other internal messages) are designed for "internal" use, so the automatics behind that is - without further changes in the internal coding - not meant to be used by "regular" receive function.

    Why don't you just use other data types like S_CUSTOM to get the same result?



  • @wimd said in Own action on heatbeat request:

    I_HEARTBEAT_REQUEST

    It looks is done automatically:

    MySensorsCore.cpp

    bool _processInternalMessages(void)
    .
    .
    .
    
    		} else if (type == I_HEARTBEAT_REQUEST) {
    			(void)sendHeartbeat();
    		} else if (type == I_TIME) {
    			// Deliver time to callback
    			if (receiveTime) {
    				receiveTime(_msg.getULong());
    


  • All works fine.
    I can update Text sensor or send a switch command.
    But when it comes to the heartbeat request there is no response form the gateway.
    I



  • @wimd In case you are looking for an option to check if the GW is available: There somewhere is an option to check, if uplink is available. Don't have a link by hand, but search for that, there's somewhere at least one sketch in the forum offering that (light-switch afai remember).



  • I have now a heartbeat response form the gateway.

    For my test stetup I did not define any transport layer and this is probably the reason why the gateway did not respond to the heatbeatrequest from domoticz.



  • @wimd Could you share how you done that?
    I also want to check if gate is alive (backup-batterypowered node - if mains or gateway died, send me a message).
    I also use domoticz.


Log in to reply
 

Suggested Topics

  • 1
  • 2
  • 2
  • 3
  • 1
  • 10

12
Online

11.4k
Users

11.1k
Topics

112.7k
Posts