From f828eec25143e15e87dccd9c63c701af5af8a905 Mon Sep 17 00:00:00 2001 From: Bruce Lacey Date: Fri, 21 Mar 2014 13:39:02 -0700 Subject: [PATCH 1/2] Modified all example sketches to report the sketch info to the gateway/controller. --- .../examples/BatteryPoweredSensor/BatteryPoweredSensor.ino | 7 +++++-- .../DallasTemperatureSensor/DallasTemperatureSensor.ino | 4 ++++ .../MySensors/examples/DistanceSensor/DistanceSensor.ino | 3 +++ .../EnergyMeterPulseSensor/EnergyMeterPulseSensor.ino | 4 ++++ libraries/MySensors/examples/IrSensor/IrSensor.ino | 3 +++ .../MySensors/examples/LightLuxSensor/LightLuxSensor.ino | 3 +++ libraries/MySensors/examples/LightSensor/LightSensor.ino | 3 +++ libraries/MySensors/examples/MotionSensor/MotionSensor.ino | 4 ++++ .../MySensors/examples/PressureSensor/PressureSensor.ino | 4 ++++ .../MySensors/examples/RelayActuator/RelayActuator.ino | 3 +++ .../RelayWithButtonActuator/RelayWithButtonActuator.ino | 3 +++ libraries/MySensors/examples/RelayingNode/RelayingNode.ino | 2 +- .../MySensors/examples/ServoActuator/ServoActuator.ino | 3 +++ .../MySensors/examples/SoilMoistSensor/SoilMoistSensor.ino | 3 +++ .../TimeAndVariableSensor/TimeAndVariableSensor.ino | 3 +++ .../WaterMeterPulseSensor/WaterMeterPulseSensor.ino | 3 +++ 16 files changed, 52 insertions(+), 3 deletions(-) diff --git a/libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino b/libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino index 4449531d5ae..fd320eb5069 100644 --- a/libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino +++ b/libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino @@ -1,5 +1,5 @@ -// This is an example on how to send in battery measurement for a sensor -// For instruction how to measure battery power on A0 see the follwoing forum +// This is an example that demonstrates how to report the battery level for a sensor +// Instructions for measuring battery capacity on A0 are available in the follwoing forum // thread: http://forum.micasaverde.com/index.php/topic,20078.0.html @@ -21,6 +21,9 @@ void setup() // use the 1.1 V internal reference analogReference(INTERNAL); gw.begin(); + + // Send the sketch version information to the gateway and Controller + gw.sendSketchInfo("Battery Meter", "1.0"); } void loop() diff --git a/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino b/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino index 8027a4f81ef..22fd82461e7 100644 --- a/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino +++ b/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino @@ -23,6 +23,10 @@ void setup() sensors.begin(); gw.begin(); + // Send the sketch version information to the gateway and Controller + gw.sendSketchInfo("Temperature Sensor", "1.0"); + + // Fetch the number of attached sensors numSensors = sensors.getDeviceCount(); // Register all sensors to gw (they will be created as child devices) diff --git a/libraries/MySensors/examples/DistanceSensor/DistanceSensor.ino b/libraries/MySensors/examples/DistanceSensor/DistanceSensor.ino index 36935099edd..c0bb6ce7055 100644 --- a/libraries/MySensors/examples/DistanceSensor/DistanceSensor.ino +++ b/libraries/MySensors/examples/DistanceSensor/DistanceSensor.ino @@ -21,6 +21,9 @@ void setup() { gw.begin(); + // Send the sketch version information to the gateway and Controller + gw.sendSketchInfo("Distance Sensor", "1.0"); + // Register all sensors to gw (they will be created as child devices) gw.sendSensorPresentation(0, S_DISTANCE); metric = gw.isMetricSystem(); diff --git a/libraries/MySensors/examples/EnergyMeterPulseSensor/EnergyMeterPulseSensor.ino b/libraries/MySensors/examples/EnergyMeterPulseSensor/EnergyMeterPulseSensor.ino index 6492b928bfc..9eb7b1f3ddd 100644 --- a/libraries/MySensors/examples/EnergyMeterPulseSensor/EnergyMeterPulseSensor.ino +++ b/libraries/MySensors/examples/EnergyMeterPulseSensor/EnergyMeterPulseSensor.ino @@ -39,6 +39,10 @@ void setup() { gw.begin(); + // Send the sketch version information to the gateway and Controller + gw.sendSketchInfo("Energy Meter", "1.0"); + + // Register this device as power sensor gw.sendSensorPresentation(CHILD_ID, S_POWER); diff --git a/libraries/MySensors/examples/IrSensor/IrSensor.ino b/libraries/MySensors/examples/IrSensor/IrSensor.ino index 277cf313d79..2abe096050e 100644 --- a/libraries/MySensors/examples/IrSensor/IrSensor.ino +++ b/libraries/MySensors/examples/IrSensor/IrSensor.ino @@ -26,6 +26,9 @@ void setup() irrecv.enableIRIn(); // Start the ir receiver gw.begin(); + // Send the sketch version information to the gateway and Controller + gw.sendSketchInfo("IR Sensor", "1.0"); + // Register a sensors to gw. Use binary light for test purposes. gw.sendSensorPresentation(CHILD_1, S_LIGHT); } diff --git a/libraries/MySensors/examples/LightLuxSensor/LightLuxSensor.ino b/libraries/MySensors/examples/LightLuxSensor/LightLuxSensor.ino index 579d13eb90e..b92efad4847 100644 --- a/libraries/MySensors/examples/LightLuxSensor/LightLuxSensor.ino +++ b/libraries/MySensors/examples/LightLuxSensor/LightLuxSensor.ino @@ -38,6 +38,9 @@ void setup() { gw.begin(); + // Send the sketch version information to the gateway and Controller + gw.sendSketchInfo("Light Lux Sensor", "1.0"); + // Register all sensors to gateway (they will be created as child devices) gw.sendSensorPresentation(CHILD_ID_LIGHT, S_LIGHT_LEVEL); diff --git a/libraries/MySensors/examples/LightSensor/LightSensor.ino b/libraries/MySensors/examples/LightSensor/LightSensor.ino index 43f14d6f41d..671b0c52788 100644 --- a/libraries/MySensors/examples/LightSensor/LightSensor.ino +++ b/libraries/MySensors/examples/LightSensor/LightSensor.ino @@ -17,6 +17,9 @@ void setup() { gw.begin(); + // Send the sketch version information to the gateway and Controller + gw.sendSketchInfo("Light Sensor", "1.0"); + // Register all sensors to gateway (they will be created as child devices) gw.sendSensorPresentation(CHILD_ID_LIGHT, S_LIGHT_LEVEL); } diff --git a/libraries/MySensors/examples/MotionSensor/MotionSensor.ino b/libraries/MySensors/examples/MotionSensor/MotionSensor.ino index dfb48c5c7dd..81ce66b7637 100644 --- a/libraries/MySensors/examples/MotionSensor/MotionSensor.ino +++ b/libraries/MySensors/examples/MotionSensor/MotionSensor.ino @@ -14,6 +14,10 @@ Sleep sleep; void setup() { gw.begin(); + + // Send the sketch version information to the gateway and Controller + gw.sendSketchInfo("Motion Sensor", "1.0"); + pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input // Register all sensors to gw (they will be created as child devices) gw.sendSensorPresentation(CHILD_ID, S_MOTION); diff --git a/libraries/MySensors/examples/PressureSensor/PressureSensor.ino b/libraries/MySensors/examples/PressureSensor/PressureSensor.ino index 6d49d20f149..64a484ac133 100644 --- a/libraries/MySensors/examples/PressureSensor/PressureSensor.ino +++ b/libraries/MySensors/examples/PressureSensor/PressureSensor.ino @@ -27,6 +27,10 @@ boolean metric; void setup() { gw.begin(); + + // Send the sketch version information to the gateway and Controller + gw.sendSketchInfo("Pressure Sensor", "1.0"); + if (!bmp.begin()) { Serial.println("Could not find a valid BMP085 sensor, check wiring!"); while (1) { } diff --git a/libraries/MySensors/examples/RelayActuator/RelayActuator.ino b/libraries/MySensors/examples/RelayActuator/RelayActuator.ino index 61d31f92aa9..98fcb4f1551 100644 --- a/libraries/MySensors/examples/RelayActuator/RelayActuator.ino +++ b/libraries/MySensors/examples/RelayActuator/RelayActuator.ino @@ -16,6 +16,9 @@ void setup() { gw.begin(); + // Send the sketch version information to the gateway and Controller + gw.sendSketchInfo("Relay", "1.0"); + // Register all sensors to gw (they will be created as child devices) for (int i=0; i Date: Fri, 21 Mar 2014 13:41:21 -0700 Subject: [PATCH 2/2] Tweaked sketch info formatting in two examples for consistency... --- .../DallasTemperatureSensor/DallasTemperatureSensor.ino | 5 ++--- .../EnergyMeterPulseSensor/EnergyMeterPulseSensor.ino | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino b/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino index 22fd82461e7..6d6252c1c70 100644 --- a/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino +++ b/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino @@ -23,9 +23,8 @@ void setup() sensors.begin(); gw.begin(); - // Send the sketch version information to the gateway and Controller - gw.sendSketchInfo("Temperature Sensor", "1.0"); - + // Send the sketch version information to the gateway and Controller + gw.sendSketchInfo("Temperature Sensor", "1.0"); // Fetch the number of attached sensors numSensors = sensors.getDeviceCount(); diff --git a/libraries/MySensors/examples/EnergyMeterPulseSensor/EnergyMeterPulseSensor.ino b/libraries/MySensors/examples/EnergyMeterPulseSensor/EnergyMeterPulseSensor.ino index 9eb7b1f3ddd..526714d08f1 100644 --- a/libraries/MySensors/examples/EnergyMeterPulseSensor/EnergyMeterPulseSensor.ino +++ b/libraries/MySensors/examples/EnergyMeterPulseSensor/EnergyMeterPulseSensor.ino @@ -42,7 +42,6 @@ void setup() // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Energy Meter", "1.0"); - // Register this device as power sensor gw.sendSensorPresentation(CHILD_ID, S_POWER);