Closed cimba007 closed 7 years ago
I solved the issue by:
smartSleep(5000);
Serial.print("."); Serial.flush();
sendHeartbeat();
delay(500);
Will check why this is not included in smartSleep ?!
Update:
PreSleep From my understanding this happens in mysensors sleep function:
if (smartSleep) {
// notify controller about going to sleep, payload indicates smartsleep waiting time in MS
(void)_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL,
I_PRE_SLEEP_NOTIFICATION).set((uint32_t)MY_SMART_SLEEP_WAIT_DURATION_MS));
wait(MY_SMART_SLEEP_WAIT_DURATION_MS); // listen for incoming messages
}
PostSleep
if (smartSleep) {
// notify controller about waking up, payload indicates sleeping time in MS
(void)_sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL,
I_POST_SLEEP_NOTIFICATION).set(sleepingTimeMS));
}
I think mycontroller only listens to heartbeat messages and should listen to I_POST_SLEEP_NOTIFICATION and I_PRE_SLEEP_NOTIFICATION too and send queued messages accordingly.
@cimba007 Sure, I will add this.
Somehow I can't get the fix to work. I see that mycontroller is sending the messages but the node is unable to receive them .. investigating.
I like the idea of:
+ //Check still do we have duration on receiver side
+ if (sleepWaitDuration != null && (System.currentTimeMillis() <= (startTime + sleepWaitDuration))) {
+ break;
+ }
But it seems this is a bit too optimistic. There are various delays that might make the time shorter as it seems.
Delay Node -> Gateway Delay Gateway -> MQTT Delay MQTT -> Mycontroller
..
Still no clue why it is not working. I tried to do the "old" behavior of sleep() and then sending heartbeat and wait() .. but I only get once message at a time.
Any way to check/modifie txDelay of gateway?
Thread.sleep(McObjectManager.getGateway(mcMessage.getGatewayId()).getGateway().getTxDelay(),333333);
Maybe this value got mixed up.
Same problem with smartSleep
You can see that only the "oldest" value gets sent.
Found the mistake I guess:
After the first cycle
System.currentTimeMillis() <= (startTime + sleepWaitDuration
will evaluate to "true" and break the loop so only one message gets send.
+ //Check still do we have duration on receiver side
+ if (sleepWaitDuration != null && (System.currentTimeMillis() <= (startTime + sleepWaitDuration))) {
+ break;
+ }
@cimba007 Thank you for the findings. I have fixed and updated the SNAPSHOT build. Could you please check it there?
I like this display. Where did you buy? any link?
I would recommend to get one from waveshare as they already got the required electronic parts (mostly capacitors):
Hello,
I have the following setup:
Node A = A node with temperature + humidity Sensor Node B = A Node with a display
Now I want to forward temperature and humidity from Node A to Node B with the "Forward payload" feature which is btw. REALLY REALLY NEAT!!! very good feature.
Node B is sleeping most of the time with smartsleep .. but due to smart sleep misses the forwarded payloads. Is there maybe a bug with smartsleep?
I have enabled smart sleep on Node B:
As I see this correctly the controller might forward the values despite Node B not beeing "online"??
This function is not called when I use smartsleep
void receive(const MyMessage &message) { printmsg(message); }
If I comment it out it is working as expected.
PS: I am running 2.2.0-beta on my gateway and Node B I am using Built on 2017-05-08T08:27:47+0530
PS: This is my current project:
I tried this too but the list stays empty:
https://forum.mycontroller.org/topic/128/send-payload-but-nack/7