Heartbeat
-
hello
Has it there in the library means to control whether a node is active?
type heartbeat
thanks -
hello
Has it there in the library means to control whether a node is active?
type heartbeat
thanksI do it by sending the status with a regular interval... so that you can see from the Last Update time in the device panel (Vera).
like this example:
/* * Motion Sensor Version 1.1 * * November 7, 2014 * -Added pushing text status to V_VAR1 * * Version 1 - October 4, 2014 * -Modified to transmit on state change * -removed Sleep for mains-only device * -Updates gateway according to UPDATE_INTERVAL * */ #include <MySensor.h> #include <SPI.h> // #define DEBUG // #define DIGITAL_INPUT_SENSOR 3 #define RADIO_ID 2 #define CHILD_ID 1 #define UPDATE_INTERVAL 60000UL // 1 minute // boolean lastSensorState; // MySensor gw; // MyMessage stateMsg(CHILD_ID, V_TRIPPED); MyMessage updateMsg(CHILD_ID, V_VAR1); // void setup() { gw.begin(NULL, RADIO_ID, false); #ifdef DEBUG Serial.begin(115200); #endif gw.sendSketchInfo("MotionSensor", "V1.1"); pinMode(DIGITAL_INPUT_SENSOR, INPUT); gw.present(CHILD_ID, S_MOTION); } // void loop() { boolean sensorState = digitalRead(DIGITAL_INPUT_SENSOR); if (sensorState != lastSensorState) { #ifdef DEBUG digitalWrite(13, sensorState ? HIGH : LOW); Serial.println(sensorState ? "Tripped" : "Not Tripped"); #endif gw.send(stateMsg.set(sensorState ? "1" : "0")); } lastSensorState = sensorState; updateStatus(UPDATE_INTERVAL); } // void updateStatus(unsigned long updateInterval) { static unsigned long lastUpdate; if (millis() - lastUpdate >= updateInterval) { gw.send(updateMsg.set(lastSensorState ? "Motion Detected" : "No Motion")); #ifdef DEBUG digitalWrite(13, lastSensorState ? HIGH : LOW); Serial.println(lastSensorState ? F("Tripped") : F("Not Tripped")); #endif lastUpdate += updateInterval; } } -
thank you for your answer
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login