Sorry for the delay. Here is what I have done.
-Cleared Eprom (verified that serial monitor showed no activity)
-Uninstalled Arduino Software from PC completely and reinstalled
-Uploaded the Sketch
-It created all the devices
Motion Device ID 225
Temp Device ID 228
Humidity Device ID 227
Distance Device ID 226
Alt ID for Distance Sensor is 7;3 and Humidity is 7;0
Again all sensors appear to be working and sending the data, except that the data for the Distance Sensor is going to the humidity device in Vera.
Here are the current Logs from the last poll (You can see distance is 3 Inches sent to Device 227 which is the humidity Device):
03/12/14 14:18:14.104 luup_log:131: Arduino: Incoming internal command discarded <0x2fbec680>
04 03/12/14 14:18:14.106 <Job ID="19" Name="pollnode #75 0 cmds" Device="100" Created="2014-03-12 14:18:14" Started="2014-03-12 14:18:14" Completed="2014-03-12 14:18:14" Duration="0.3539000" Runtime="0.869000" Status="Aborted" LastNote="" Node="75" NodeType="ZWaveController" NodeDescription="Master Scene Switch"/> <0x2b791680>
50 03/12/14 14:18:14.114 luup_log:131: Arduino: Presentation: 7;0;0;7;1.2+ <0x2fbec680>
50 03/12/14 14:18:14.115 luup_log:131: Arduino: Presentation: 7;1;0;6;1.2+ <0x2fbec680>
50 03/12/14 14:18:14.116 luup_log:131: Arduino: Presentation: 7;2;0;1;1.2+ <0x2fbec680>
50 03/12/14 14:18:14.117 luup_log:131: Arduino: Presentation: 7;3;0;15;1.2+ <0x2fbec680>
50 03/12/14 14:18:14.118 luup_log:131: Arduino: Sending: 7;255;4;13;I <0x2fbec680>
50 03/12/14 14:18:14.174 luup_log:131: Arduino: Set Var: 7;2;1;16;1 <0x2fbec680>
50 03/12/14 14:18:14.174 luup_log:131: Arduino: Setting variable 'Tripped' to value '1' <0x2fbec680>
50 03/12/14 14:18:14.174 luup_log:131: Arduino: urn:micasaverde-com:serviceId:SecuritySensor1,Tripped, 1, 225 <0x2fbec680>
50 03/12/14 14:18:14.175 luup_log:131: Arduino: urn:micasaverde-com:serviceId:SecuritySensor1,LastTrip, 1394655494, 225 <0x2fbec680>
06 03/12/14 14:18:14.175 Device_Variable::m_szValue_set device: 225 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: LastTrip was: 1394655464 now: 1394655494 #hooks: 0 upnp: 0 v:0xe0eaa0/NONE duplicate:0 <0x2fbec680>
50 03/12/14 14:18:14.177 luup_log:131: Arduino: Set Var: 7;0;1;13;3 <0x2fbec680>
50 03/12/14 14:18:14.177 luup_log:131: Arduino: Setting variable 'CurrentDistance' to value '3' <0x2fbec680>
50 03/12/14 14:18:14.177 luup_log:131: Arduino: urn:micasaverde-com:serviceId:DistanceSensor1,CurrentDistance, 3, 227 <0x2fbec680>
50 03/12/14 14:18:14.178 luup_log:131: Arduino: urn:micasaverde-com:serviceId:HaDevice1,LastUpdate, 1394655494, 227 <0x2fbec680>
06 03/12/14 14:18:14.178 Device_Variable::m_szValue_set device: 227 service: urn:micasaverde-com:serviceId:HaDevice1 variable: LastUpdate was: 1394655464 now: 1394655494 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2fbec680>
50 03/12/14 14:18:14.179 luup_log:131: Arduino: Set Var: 7;1;1;0;57.0 <0x2fbec680>
50 03/12/14 14:18:14.180 luup_log:131: Arduino: Setting variable 'CurrentTemperature' to value '57.0' <0x2fbec680>
50 03/12/14 14:18:14.180 luup_log:131: Arduino: urn:upnp-org:serviceId:TemperatureSensor1,CurrentTemperature, 57.0, 228 <0x2fbec680>
50 03/12/14 14:18:14.181 luup_log:131: Arduino: urn:micasaverde-com:serviceId:HaDevice1,LastUpdate, 1394655494, 228 <0x2fbec680>
06 03/12/14 14:18:14.181 Device_Variable::m_szValue_set device: 228 service: urn:micasaverde-com:serviceId:HaDevice1 variable: LastUpdate was: 1394655464 now: 1394655494 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2fbec680>
50 03/12/14 14:18:14.182 luup_log:131: Arduino: Set Var: 7;0;1;1;24.2 <0x2fbec680>
50 03/12/14 14:18:14.183 luup_log:131: Arduino: Setting variable 'CurrentLevel' to value '24.2' <0x2fbec680>
50 03/12/14 14:18:14.183 luup_log:131: Arduino: urn:micasaverde-com:serviceId:HumiditySensor1,CurrentLevel, 24.2, 227 <0x2fbec680>
06 03/12/14 14:18:14.183 Device_Variable::m_szValue_set device: 227 service: urn:micasaverde-com:serviceId:HumiditySensor1 variable: CurrentLevel was: 24.9 now: 24.2 #hooks: 0 upnp: 0 v:0xe2d780/NONE duplicate:0 <0x2fbec680>
50 03/12/14 14:18:14.184 luup_log:131: Arduino: urn:micasaverde-com:serviceId:HaDevice1,LastUpdate, 1394655494, 227 <0x2fbec680>
06 03/12/14 14:18:14.185 Device_Variable::m_szValue_set device: 227 service: urn:micasaverde-com:serviceId:HaDevice1 variable: LastUpdate was: 1394655494 now: 1394655494 #hooks: 0 upnp: 0 v:
Here is my sketch (i know it is probably messy, I am still learning)
#include <Sleep_n0m1.h>
#include <SPI.h>
#include <EEPROM.h>
#include <RF24.h>
#include <Sensor.h>
#include <DHT.h>
#include <NewPing.h>
// Set RADIO_ID to something unique in your sensor network (1-254)
// or set to AUTO if you want gw to assign a RADIO_ID for you.
#define RADIO_ID AUTO
#define CHILD_ID_HUM 0
#define CHILD_ID_TEMP 1
#define HUMIDITY_SENSOR_DIGITAL_PIN 5 //Default 3
#define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
#define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
#define CHILD_ID 2 // Id of the sensor child Default
#define TRIGGER_PIN 6 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 7 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 30 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
unsigned long SLEEP_TIME = 5; // Sleep time between reads (in seconds)
//unsigned long SLEEP_TIME = 30; // Sleep time between reads (in seconds)
Sensor gw (9,10);
DHT dht;
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
Sleep sleep;
float lastTemp;
float lastHum;
boolean metric = true;
int lastDist;
void setup()
{
Serial.begin(BAUD_RATE); // Used to type in characters
gw.begin(RADIO_ID);
dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
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_HUM, S_HUM);
gw.sendSensorPresentation(CHILD_ID_TEMP, S_TEMP);
gw.sendSensorPresentation(CHILD_ID, S_MOTION);
gw.sendSensorPresentation(3, S_DISTANCE);
metric = gw.isMetricSystem();
}
void loop()
{
// Read digital motion value
gw.powerUp();
boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
Serial.println(tripped);
gw.sendVariable(CHILD_ID, V_TRIPPED, tripped?"1":"0"); // Send tripped value to gw
//Distance
int dist = metric?sonar.ping_cm():sonar.ping_in();
Serial.print("Ping: ");
Serial.print(dist); // Convert ping time to distance in cm and print result (0 = outside set distance range)
Serial.println(metric?" cm":" in");
if (dist != lastDist) {
gw.sendVariable(0, V_DISTANCE, dist);
lastDist = dist;
}
//DHT Sensor
//delay(dht.getMinimumSamplingPeriod());
float temperature = dht.getTemperature();
if (isnan(temperature)) {
Serial.println("Failed reading temperature from DHT");
} else if (temperature != lastTemp) {
lastTemp = temperature;
if (!metric) {
temperature = dht.toFahrenheit(temperature);
}
gw.sendVariable(CHILD_ID_TEMP, V_TEMP, temperature, 1);
Serial.print("T: ");
Serial.println(temperature);
}
float humidity = dht.getHumidity();
if (isnan(humidity)) {
Serial.println("Failed reading humidity from DHT");
} else if (humidity != lastHum) {
lastHum = humidity;
gw.sendVariable(CHILD_ID_HUM, V_HUM, humidity, 1);
Serial.print("H: ");
Serial.println(humidity);
}
// Power down the radio. Note that the radio will get powered back up
// on the next write() call.
delay(200); //delay to allow serial to fully print before sleep
gw.powerDown();
sleep.pwrDownMode(); //set sleep mode
sleep.sleepInterrupt(INTERRUPT,CHANGE);
//sleep.sleepDelay(SLEEP_TIME * 1000); //sleep for: sleepTime
}