KeepAlive to Gateway


  • Hero Member

    I'm looking for a way to do a "KeepAlive" as a way to get a time update on the Vera display so i know the sensors are working. Is it permissible to send gw.sendsketchInfo( ... etc ...) every 30 minutes or so if there is no change in any of the sensor data?

    ....
    Example:

    // Initialize
    int RADIO_CYCLE = 0; // Start the cycle counter
    int KEEP_ALIVE = 30; // number of empty radio cycles
    
    [ ... Processes ... ]
    
    if (RADIO_CYCLE >= KEEP_ALIVE)  
       {
       gw.sendSketchInfo("Combo THL", "1.01B (20140711)");    // just resend sketch info as a keep alive
       Serial.println("KA");
       RADIO_CYCLE = 0;  // reset the counter
       }

  • Admin

    I don't think the sent sketch info updates LAST_UPDATE field. Use VAR_1 if you don't have a real sensor value to send in.


  • Hero Member

    Thanks

    John


  • Hero Member

    So I can do this then to get an empty VAR1 sent to the Gateway?

       #define CHILD_ID_EMPTY 9
    
       [ .... Processes ...]
    
       Serial.print("C: ");
       Serial.println(RADIO_CYCLE); 
       if (RADIO_CYCLE >= KEEP_ALIVE)  // force update of last values if the counter is maxed
            {
            gw.sendVariable(CHILD_ID_EMPTY, V_VAR1, 1); // just send VAR1 to update the last update time 20140713
            Serial.println("KA");
            RADIO_CYCLE = 0;  // reset the counter
            }
    

    I have run into a problem though. I compiled this and uploaded it to another Pro Mini and when I tried to include it in Vera I got three devices (Light, Temp, Humidity) but NO NODE device. I tried this several times to be sure, each time I ran the ClearEEPROM sketch to erase the Mini. I don't see how any of this would cause that to happen though.

    Just in case this was causing a problem I commented the CHILD_ID_EMPTY and associated bits but it made no difference.

    The "setup()" hasn't changed:

        void setup() 
            {
            // Send the Sketch Version Information to the Gateway
            gw.begin();
            dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
    
            gw.sendSketchInfo("Combo THL", "1.01C (20140713)");
    
           // Register all sensors to gw (they will be created as child devices)
           gw.sendSensorPresentation(CHILD_ID_HUM, S_HUM);
           gw.sendSensorPresentation(CHILD_ID_TEMP, S_TEMP);
           gw.sendSensorPresentation(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
    
           metric = gw.isMetricSystem();
    
           }
    

    Is it possible I have to reinitialize the Gateway for some reason?

    Thanks

    John


  • Admin

    @clippermiami said:

    Is it possible I have to reinitialize the Gateway for some reason?

    No, you shouldn't need to reinitialize gateway in any way.

    Can you see the presentation message for the node device in Vera logs?
    Did you try restarting Vera to reveal any hidden devices (has happened before)?


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.