Hi,
I'm to move forward with transition to EasyIOT
I setup a MySensors Sensor with a button (S2) and 2 led's acting as single switch S1.
I want the button to make the the leds switch on (red) off (Yellow)
Sketch is here
https://codebender.cc/sketch:86965
I have setup automation to toggle between red and yellow. Problem is that it only works some of the time. At some point it claims to send command but according to serial monitor it's not revived on sensor. Once that happens it no longer receives the button push on sensor although sensor seems to be sending it just fine. output in terminal just stops. If I manually via web UI switch the state of the led it will sometimes but not always come back to life.
Issue seems to happen a lot more when I push the button in less then 3 sec intervals. waiting 5 secs seems to make very hard to reproduce. Any ideas what could cause this?
Also it seems that the event is being called twice with the same value. Not really clear on what is going on.
My automation code and sample console output below
Thanks in advance of any help
/*
This code is running one time when program is enabled
*/
public void Setup()
{
//bool toggle = false;
EventHelper.ModuleChangedHandler((o, m, p) =>
{
if (m.Domain == Domains.MYSENSORS && m.Address == "N1S2" && p.Property == "Sensor.DigitalValue") {
ModuleParameter pVal = ModuleHelper.GetProperty(Domains.MYSENSORS, "N1S1", "Sensor.DigitalValue");
bool on =false;
if (pVal!= null) {
Console.WriteLine("Value:" + pVal.Value);
if (pVal.Value.Equals("1")) on = true;
}
//tring res = DriverHelper.ProcessCommad(Domains.MYSENSORS, "N1S1", "ControlOn", "");
if (on) {
String res = DriverHelper.ProcessCommad(Domains.MYSENSORS, "N1S1", "ControlOff", "");
Console.WriteLine("!!!!- Sent Control OFF !!!! Res: "+res);
} else {
String res = DriverHelper.ProcessCommad(Domains.MYSENSORS, "N1S1", "ControlOn", "");
Console.WriteLine("!!!!- Sent Control On !!!! Res: "+res);
}
}
return true;
});
}
/*
This code is running periodicaly when program is enabled.
Cron job detirmine running period.
*/
public void Run()
{
}
Value: 0
!!!!- Sent Control On !!!! Res: 1
2015-03-22T05:43:57.3174890+02:00 INFO MySensors N1S2 Sensor.DigitalValue 1-
Value: 0
!!!!- Sent Control On !!!! Res: 1
2015-03-22T05:43:57.3404900+02:00 INFO MySensors N1S1 Sensor.DigitalValue 1-
2015-03-22T05:43:57.3574950+02:00 INFO MySensors N1S1 Sensor.DigitalValue 1-
2015-03-22T05:43:57.3725060+02:00 INFO MySensors N1S1 Sensor.DigitalValue 1-
2015-03-22T05:44:00.2974380+02:00 INFO MySensors N1S1 Sensor.DigitalValue 1-
2015-03-22T05:44:04.4744670+02:00 INFO MySensors N1S1 Sensor.DigitalValue 1-
2015-03-22T05:44:09.9954430+02:00 INFO MySensors N1S2 Sensor.DigitalValue 1-
Value: 1
!!!!- Sent Control OFF !!!! Res: 1
2015-03-22T05:44:10.0194840+02:00 INFO MySensors N1S2 Sensor.DigitalValue 1-
Value: 1
!!!!- Sent Control OFF !!!! Res: 1
2015-03-22T05:44:10.0425190+02:00 INFO MySensors N1S1 Sensor.DigitalValue 0-
2015-03-22T05:44:10.0595240+02:00 INFO MySensors N1S1 Sensor.DigitalValue 0-
2015-03-22T05:44:10.0735320+02:00 INFO MySensors N1S1 Sensor.DigitalValue 0-
2015-03-22T05:44:12.9995390+02:00 INFO MySensors N1S1 Sensor.DigitalValue 0-
2015-03-22T05:44:17.4064410+02:00 INFO MySensors N1S2 Sensor.DigitalValue 1-
Value: 0
!!!!- Sent Control On !!!! Res: 1
2015-03-22T05:44:17.4294430+02:00 INFO MySensors N1S2 Sensor.DigitalValue 1-
Value: 0
!!!!- Sent Control On !!!! Res: 1
2015-03-22T05:44:17.4524820+02:00 INFO MySensors N1S1 Sensor.DigitalValue 1-
2015-03-22T05:44:17.4695250+02:00 INFO MySensors N1S1 Sensor.DigitalValue 1-
2015-03-22T05:44:17.4855150+02:00 INFO MySensors N1S1 Sensor.DigitalValue 1-
2015-03-22T05:44:20.4104420+02:00 INFO MySensors N1S1 Sensor.DigitalValue 1-
2015-03-22T05:44:28.4964530+02:00 INFO MySensors N1S2 Sensor.DigitalValue 1-
Value: 1
!!!!- Sent Control OFF !!!! Res: 1
2015-03-22T05:44:28.5184610+02:00 INFO MySensors N1S2 Sensor.DigitalValue 1-
Value: 1
!!!!- Sent Control OFF !!!! Res: 1
2015-03-22T05:44:28.5385490+02:00 INFO MySensors N1S1 Sensor.DigitalValue 0-
2015-03-22T05:44:28.5535220+02:00 INFO MySensors N1S1 Sensor.DigitalValue 0-
2015-03-22T05:44:28.5706340+02:00 INFO MySensors N1S1 Sensor.DigitalValue 0-
2015-03-22T05:44:31.4964510+02:00 INFO MySensors N1S1 Sensor.DigitalValue 0-
2015-03-22T05:44:34.7844400+02:00 INFO MySensors N1S1 Sensor.DigitalValue 0-
2015-03-22T05:44:34.8015080+02:00 INFO MySensors N1S1 Sensor.DigitalValue 0-
<-- freezes at this point