Keepalive


  • Hero Member

    I was experimenting with a Temp/Hum sensor this weekend and I noticed that the environment in which the sensor "lives" doesn't change much at all. The code onl;ine skips the send if the last value is the same as the current value. In this case as a result there was no update to the Vera gateway for over 14 hours, to the point where I assumed something might be wrong. So I manually reset the sensor to forcean update.

    How about a "Keepalive" function in the Library that can be included in he sketch to update the Gateway every "N" minutes whether there is a value change or not. One could declare the keepalive period in the sketch, say 1 hour, so that the sensor would send an update to the Gateway even if there was no change.



  • And what's the problem with making a loop in code and forcing node to send values?


  • Admin

    yes, by default we try to minimize message sending in the examples. But like Andrej says you could just allow it to send one message each X sleep cycle.


  • Hero Member

    @hek Which is what I ended up doing in the code I modified for the triple sensor device. I was merely suggesting that it might be nice to have a standardized keepalive routine in the library, call it and it takes care of it for you.


  • Hero Member

    Hi guys ...
    i agree sending the values periodically helps if the radio transmission is not ack'ed. I was testing yesterday a sketch and looks like i have another dodgy radio module. probably 80% packets were successful, but other 20% resulted in Vera not being told the door was open or closed...

    So i added this "hack" which whilst it works could be better coded im sure!!

    if (counter < 1000000){
    counter++ ;
    // Serial.println(counter);
    } else {
    Serial.println("sending status");
    gw.sendVariable(CHILD_ID_DOORA, V_LOCK_STATUS, trippedA?DOOR_CLOSED:DOOR_OPEN); // Send value change to gw
    counter = 0;
    }

    I was thinking... since debug message prints "Ack: received OK" - what if the library repeated the transmission when the ACK was not received.. Hek i do recall a short discussion on this...not sure if its to be in 1.4 or what...

    Cheers,


  • Admin

    Next version will use the burst mode which result in much better success rate for packages. I hope you won't need to resent same data.


Log in to reply
 

Suggested Topics

  • 2
  • 10
  • 25
  • 11
  • 3
  • 2
  • 16
  • 9

207
Online

9.1k
Users

9.8k
Topics

102.4k
Posts