Hi
I'm struggling a bit with the smartSleep functionality in MySensors.
I know it should be straight forward, since it appears that the usage of sleep and smartSleep methods are basically the same from a developers perspective, but for some reason, the "wake up" message the node sends when the smart sleep is over, never gets sent. I almost never see messages that I manually send with sensor data etc. getting NACK'ed, and this happens on every single wake.
Below is a tiny PoC test I have made. I kept it as simple as possible so I could hopefully get something working, and build on to that. But this simple example also fails
#define MY_DEBUG
#define MY_RADIO_NRF24
#define MY_RF24_CHANNEL 0x44
#define MY_RF24_BASE_RADIO_ID 0x00, 0xf6, 0x4d,0x89, 0xc0
#include <MySensors.h>
void presentation() {
sendSketchInfo("SmartSleepTest", "1.0");
present(1, S_INFO, "Info");
}
void loop() {
smartSleep(1000);
}
When running, the output looks like this:
6 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0
26 TSM:INIT
28 TSF:WUR:MS=0
36 TSM:INIT:TSP OK
38 TSF:SID:OK,ID=204
40 TSM:FPAR
77 TSF:MSG:SEND,204-204-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
446 TSF:MSG:READ,202-202-204,s=255,c=3,t=8,pt=1,l=1,sg=0:2
452 TSF:MSG:FPAR OK,ID=202,D=3
573 TSF:MSG:READ,201-201-204,s=255,c=3,t=8,pt=1,l=1,sg=0:1
579 TSF:MSG:FPAR OK,ID=201,D=2
2084 TSM:FPAR:OK
2084 TSM:ID
2086 TSM:ID:OK
2088 TSM:UPL
2095 TSF:MSG:SEND,204-204-201-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
2140 TSF:MSG:READ,0-201-204,s=255,c=3,t=25,pt=1,l=1,sg=0:2
2148 TSF:MSG:PONG RECV,HP=2
2150 TSM:UPL:OK
2152 TSM:READY:ID=204,PAR=201,DIS=2
2160 TSF:MSG:SEND,204-204-201-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
2191 TSF:MSG:READ,0-201-204,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
2201 TSF:MSG:SEND,204-204-201-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.0
2211 TSF:MSG:SEND,204-204-201-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:201
2355 TSF:MSG:READ,0-201-204,s=255,c=3,t=6,pt=0,l=1,sg=0:M
2363 TSF:MSG:SEND,204-204-201-0,s=255,c=3,t=11,pt=0,l=14,sg=0,ft=0,st=OK:SmartSleepTest
2410 !TSF:MSG:SEND,204-204-201-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=NACK:1.0
2420 TSF:MSG:SEND,204-204-201-0,s=1,c=0,t=36,pt=0,l=4,sg=0,ft=1,st=OK:Info
2428 MCO:REG:REQ
2441 TSF:MSG:SEND,204-204-201-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
2506 TSF:MSG:READ,0-201-204,s=255,c=3,t=27,pt=1,l=1,sg=0:1
2512 MCO:PIM:NODE REG=1
2514 MCO:BGN:INIT OK,TSP=1
2519 MCO:SLP:MS=1000,SMS=1,I1=255,M1=255,I2=255,M2=255
2529 TSF:MSG:SEND,204-204-201-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=0,st=OK:500
3037 TSF:TDI:TSL
3039 MCO:SLP:WUP=-1
3041 TSF:TRI:TSB
5457 !TSF:MSG:SEND,204-204-201-0,s=255,c=3,t=33,pt=5,l=4,sg=0,ft=0,st=NACK:1000
5466 MCO:SLP:MS=1000,SMS=1,I1=255,M1=255,I2=255,M2=255
5476 TSF:MSG:SEND,204-204-201-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=1,st=OK:500
5984 TSF:TDI:TSL
5986 MCO:SLP:WUP=-1
5988 TSF:TRI:TSB
8404 !TSF:MSG:SEND,204-204-201-0,s=255,c=3,t=33,pt=5,l=4,sg=0,ft=0,st=NACK:1000
8413 MCO:SLP:MS=1000,SMS=1,I1=255,M1=255,I2=255,M2=255
8423 TSF:MSG:SEND,204-204-201-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=1,st=OK:500
8931 TSF:TDI:TSL
8933 MCO:SLP:WUP=-1
The PRE-SLEEP message at 2529 gets sent correct, but the POST-SLEEP message gets NACK'ed at 5457.
I have tried the following, without any luck:
-
Longer and shorter smart sleep durations, with the same result.
-
Attempts has been made both with a Raspberry Pi gateway and an ESP8266 gateway, but I doubt the gateway type matter, since it looks like something locally on the node.
-
Two types of hardware for the node, both a home-designed mini-pcb which run great for other nodes (without smart sleep), and the Easy/Newbie PCB from openhardware.io.
-
Looking for examples that use smartSleep, but the ones I found only use sleep.
ANY help or push in the right direction will be greatly appreciated.
/Henrik