<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Recovery of Battery Powered Sensor after Gateway Outage]]></title><description><![CDATA[<p dir="auto">Re: <a href="/topic/4381/solved-gatewayesp8266mqttclient-recovery-failure-after-gateway-outage">[SOLVED] GatewayESP8266MQTTClient - Recovery failure after gateway outage</a></p>
<p dir="auto">My battery powered sensor works fine while the Gateway is powered.  (Stating the obvious).<br />
If I power down the Gateway for more than the sleep period of  the sensor will not reconnect to the Gateway and continue sending period messages until I disconnect and reconnect the battery to the sensor.<br />
I am using a SAMD21 based board with the Arduino ArduinoLowPower library for sleeping.<br />
The above solution will drain the battery while waiting for the gateway to come back because sleep is prevented.<br />
Is it possible to do something upon waking from sleep and then go back to sleep immediately if no gateway is found?<br />
While I like the low power sensor solution MySensors with RFM69 provides it must be as robust as my ESP8266 WIFI solution in terms of recovering from any combination of sensor/controller shutdowns.   You don't want to be in Hawaii and have your thermostat temperature sensor lock up.:grinning:</p>
]]></description><link>https://forum.mysensors.org/topic/9591/recovery-of-battery-powered-sensor-after-gateway-outage</link><generator>RSS for Node</generator><lastBuildDate>Thu, 12 Mar 2026 19:35:49 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/9591.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 10 Aug 2018 05:59:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Recovery of Battery Powered Sensor after Gateway Outage on Tue, 14 Aug 2018 00:35:17 GMT]]></title><description><![CDATA[<p dir="auto">Here is a <a href="https://github.com/gb53smith/Public" rel="nofollow ugc">link</a> to my sketches and log file.</p>
<p dir="auto">If I don't sleep the SAMD21G18 but instead wait, I can cycle the power on the gateway and the sensor recovers even with my SPI write to a register to implement the radio sleep.<br />
The log file is called "node_debug_wait.txt"</p>
<p dir="auto">However,  If the wait is replaced with a sleep, LowPower.deepSleep(10000);  the sensor does not recover until it too is power cycled.  I also tried the RTCZero.h library to implement the sleep.<br />
See MySensors_BME280_RTC sketch.  Both sleep methods work as long as the gateway never goes down.</p>
<p dir="auto">I tried<br />
#define MY_TRANSPORT_WAIT_READY_MS 2000<br />
and the sensor does not connect with gateway at all.<br />
When the sensor is down after the gateway power cycle there is no receive data at the gateway so I did not collect the gateway log.<br />
On the sensor side, once the CPU powers down the serial USB connection lost.  I tried both Arduino Serial Monitor and PuTTY to get the sensor log file.<br />
To overcome the serial problem I created a blink function and then inserted that into the code to determine if my interrupt service function was working see <a href="https://github.com/gb53smith/Public/tree/master/MySensors_BME280_Debug" rel="nofollow ugc">MySensors_BME280_Debug.</a></p>
<p dir="auto"><strong>Now the solution:</strong><br />
I added an awake up interrupt service routine which calls transportCheckUplink().  That's it.  It seems to be enough to get the transport layer running again after a CPU sleep.</p>
<p dir="auto">My Motenio M0 board only draws 10 - 20 uA total when CPU, RFM69 and BME280 are shutdown with no modifications of the factory board.  It is be a very capable yet low power MySensor.<br />
I look forward to official support of sleep for a  SAMD21G18 based board.  Meanwhile, this is a workaround.</p>
]]></description><link>https://forum.mysensors.org/post/92537</link><guid isPermaLink="true">https://forum.mysensors.org/post/92537</guid><dc:creator><![CDATA[gbsmith]]></dc:creator><pubDate>Tue, 14 Aug 2018 00:35:17 GMT</pubDate></item><item><title><![CDATA[Reply to Recovery of Battery Powered Sensor after Gateway Outage on Fri, 10 Aug 2018 20:02:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gbsmith" aria-label="Profile: gbsmith">@<bdi>gbsmith</bdi></a> define <a href="https://www.mysensors.org/apidocs/group__RoutingNodeSettingGrpPub.html#ga45b4f1c868b8cb5d7396cdfb4939559c" rel="nofollow ugc">MY_TRANSPORT_WAIT_READY_MS</a> to something larger than 0 to let the node go back to sleep if it isn't able to communicate. Maybe 2000 milliseconds could be suitable.</p>
<p dir="auto">But the battery powered node should be able to re-establish connection when the gateway is up. Could you collect and post logs from gateway and the sensor?</p>
]]></description><link>https://forum.mysensors.org/post/92397</link><guid isPermaLink="true">https://forum.mysensors.org/post/92397</guid><dc:creator><![CDATA[mfalkvidd]]></dc:creator><pubDate>Fri, 10 Aug 2018 20:02:52 GMT</pubDate></item></channel></rss>