- Posts: 24
- Thank you received: 2
Please Log in or Create an account to join the conversation.
vickeyhort wrote: Hi. I am facing a strange problem. I have a sensor node with node ID 1 (automatically assigned by controller, and also tried assigning manually). It has three children. When I add node through mysensor drivers, it gets added successfully. But after a certain time period (that is 15 seconds, after each 15 seconds, node updates light level to the controller), controller generates version mismatch error. Debug report is as following;
At first:
2015-10-08T21:31:55.8753890+05:00 DEBUG MySensors Requesr for new node Id
2015-10-08T21:31:55.8793340+05:00 DEBUG MySensors New node id:1
2015-10-08T21:31:55.9163300+05:00 DEBUG MySensors Send: 0-0-255-255s=255,c=3,t=4,pt=1,l=1,st=fail:1
2015-10-08T21:31:55.9227590+05:00 DEBUG MySensors Read: 1-1-0 s=255,c=0,t=17,pt=0,l=3:1.5
2015-10-08T21:31:55.9372650+05:00 DEBUG MySensors Read: 1-1-0 s=255,c=3,t=6,pt=1,l=1:0
2015-10-08T21:31:57.9321850+05:00 DEBUG MySensors Read: 1-1-0 s=0,c=0,t=16,pt=0,l=0:
2015-10-08T21:31:57.9354440+05:00 DEBUG MySensors Update route table, ChildId:1 -> route:1
2015-10-08T21:31:57.9428990+05:00 DEBUG MySensors Rx: Sensor presentation NodeId:1,SensorId:0,type:S_LIGHT_LEVEL,data:
2015-10-08T21:31:57.9453480+05:00 DEBUG MySensors Add new module NodeId:1,SensorId:0,type:S_LIGHT_LEVEL,data:
2015-10-08T21:31:58.0702310+05:00 DEBUG MySensors Read: 1-1-0 s=1,c=0,t=0,pt=0,l=0:
2015-10-08T21:31:58.0714060+05:00 DEBUG MySensors Rx: Sensor presentation NodeId:1,SensorId:1,type:S_DOOR,data:
2015-10-08T21:31:58.0723030+05:00 DEBUG MySensors Add new module NodeId:1,SensorId:1,type:S_DOOR,data:
2015-10-08T21:31:58.1072900+05:00 DEBUG MySensors Read: 1-1-0 s=2,c=0,t=1,pt=0,l=0:
2015-10-08T21:31:58.1080870+05:00 DEBUG MySensors Rx: Sensor presentation NodeId:1,SensorId:2,type:S_MOTION,data:
2015-10-08T21:31:58.1086100+05:00 DEBUG MySensors Add new module NodeId:1,SensorId:2,type:S_MOTION,data:
2015-10-08T21:31:58.3402210+05:00 DEBUG MySensors Read: 1-1-0 s=0,c=1,t=23,pt=2,l=2:46
2015-10-08T21:31:58.3415120+05:00 INFO MySensors N1S0 Sensor.LightLevel 46 -
In above debug, read is 1-1-0 s=0,c=1,t=23,pt=2,l=2:46.
And when there is an error;
2015-10-08T21:36:20.4911740+05:00 DEBUG MySensors Read: 170-108-138 s=0,c=7,t=192,pt=0,l=17:1b5
2015-10-08T21:36:20.4922290+05:00 DEBUG MySensors Version mismatch
Node ID is changed, that is, 170-108-138 s=0,c=7,t=192,pt=0,l=17:1b5.
I have only one sensor and only one network and there is no sensor with ID of 170.
Here is the sketch I am using
#include <SPI.h>
#include <MySensor.h>
#define CHILD_ID_LDR 0
#define CHILD_ID_DOOR 1
#define CHILD_ID_PIR 2
#define LDR_PIN A0
#define DOOR_PIN 2
#define PIR_PIN 3
#define INTERRUPT DOOR_PIN-2
unsigned long SLEEP_TIME = 15000; // Sleep time 1800000 i.e. 30 minutes (in milliseconds)
MySensor gw;
MyMessage msgLDR(CHILD_ID_LDR, V_LIGHT_LEVEL);
MyMessage msgDoor(CHILD_ID_DOOR, V_TRIPPED);
MyMessage msgPir(CHILD_ID_PIR, V_TRIPPED);
void setup()
{
gw.begin(NULL, 1, false);
pinMode(DOOR_PIN,INPUT_PULLUP);
pinMode(PIR_PIN,INPUT);
gw.present(CHILD_ID_LDR, S_LIGHT_LEVEL);
gw.present(CHILD_ID_DOOR, S_DOOR);
gw.present(CHILD_ID_PIR, S_MOTION);
Serial.println("System initialized");
}
void loop()
{
int LightLevel = (100 - ((1023-analogRead(LDR_PIN))/10.23));
gw.send(msgLDR.set(LightLevel));
Serial.print("Light level: ");
Serial.print(LightLevel);
Serial.print(" %: ");
Serial.println();
boolean door = digitalRead(DOOR_PIN) == HIGH;
// gw.send(msgDoor.set(door?"1":"0"));
Serial.print("Door status: ");
Serial.print(door);
Serial.println();
boolean tripped = digitalRead(PIR_PIN) == HIGH;
// gw.send(msgPir.set(tripped?"1":"0"));
Serial.print("PIR status: ");
Serial.print(tripped);
Serial.println();
Serial.println();
gw.sleep(INTERRUPT, FALLING, SLEEP_TIME);
}
This is the test sketch to get light level data for day and night and on the basis of which I'll modify this sketch to turn the lights on and off based upon light level, door reed switch and motion sensor.
I am using EasyIOT Server 0.9 and mysensor version 1.5.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.