Skip to content

Commit c958e84

Browse files
authored
Waiting between child presentation and sleep
Adding a "wait" between the presentation of child sensor and before sleeping to allow processing of a gateway's potential followup present requests.
1 parent a4683fb commit c958e84

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/DhtTemperatureAndHumiditySensor/DhtTemperatureAndHumiditySensor.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ void presentation()
8080

8181
// Register all sensors to gw (they will be created as child devices)
8282
present(CHILD_ID_HUM, S_HUM);
83+
// Delay between each present process.
84+
wait(500);
8385
present(CHILD_ID_TEMP, S_TEMP);
8486

8587
metric = getConfig().isMetric;
@@ -147,6 +149,8 @@ void loop()
147149
nNoUpdatesHum++;
148150
}
149151

152+
// Delay before going to sleep so we can potentially respond to "present" requests from the gateway.
153+
wait(1000);
150154
// Sleep for a while to save energy
151155
sleep(UPDATE_INTERVAL);
152156
}

0 commit comments

Comments
 (0)