Hek I just updated the first post a bit (had some issues there I noticed)
this is the node log
send: 250-250-0-0 s=255,c=0,t=17,pt=0,l=3,sg=0,st=ok:1.5
send: 250-250-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
sensor started, id=250, parent=0, distance=1
send: 250-250-0-0 s=255,c=3,t=11,pt=0,l=6,sg=0,st=ok:Blinds
send: 250-250-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
send: 250-250-0-0 s=250,c=0,t=5,pt=0,l=6,sg=0,st=ok:Blinds
Node ready to receive messages...
read: 0-0-250 s=250,c=0,t=5,pt=0,l=6,sg=0:Blinds
Blinds
UPDATE: I am a bit further. I can now send one command to the sensor, yet after that it fails. The relay will be enable, but another command fails.
0;0;3;0;9;send: 0-0-250-250 s=10,c=1,t=30,pt=0,l=0,sg=0,st=ok:
0;0;3;0;9;read: 1-3-0 s=0,c=1,t=0.0
0;0;3;0;9;send: 0-0-250-250 s=10,c=1,t=29,pt=0,l=0,sg=0,st=fail:
As you can see the V_CLOSE works, but the next command fails when I use gw.sleep. When I reset the sensor or use gw.wait they work again.
I copied the latest sketch below
#include <MySensor.h>
#include <SPI.h>
#define UP_PIN 3
#define DOWN_PIN 4
#define CHILD_ID 250
MySensor gw;
void setup()
{
gw.begin(incomingMessage, AUTO, false);
gw.sendSketchInfo("Blinds", "1.0");
gw.present(CHILD_ID, S_COVER,"Blinds",true);
pinMode(UP_PIN, OUTPUT);
pinMode(DOWN_PIN, OUTPUT);
digitalWrite(UP_PIN, 0);
digitalWrite(DOWN_PIN, 0);
Serial.println( "Node ready to receive messages..." );
}
void loop()
{
gw.process();
}
void incomingMessage(const MyMessage &message) {
Serial.println(message.data);
if (message.type==V_UP) {
Serial.println("opening up covers");
digitalWrite(UP_PIN,1);
gw.wait(15000);
digitalWrite(UP_PIN,0);
}
else if (message.type==V_DOWN) {
Serial.println("closing up covers");
digitalWrite(DOWN_PIN,1);
gw.wait(15000);
digitalWrite(DOWN_PIN,0);
}
else if (message.type==V_STOP) {
Serial.println("stopping covers");
digitalWrite(UP_PIN,0);
digitalWrite(DOWN_PIN,0);
}
}