Add auto restart function

Hello, I have two sensors, one where I live, and another in a second apartment. My second sensor, due to some problem that I do not know (it is not very frequent), the ESP does not connect correctly to the wifi, or does not communicate with the PM sensor, and does not send the data, until I manually unplug it and plug it back in , which is a problem, because I don’t go to the second department very often, and no data is sent for weeks.
For this reason I think it would be a good idea to propose adding a configurable option to auto restart the ESP every X amount of time, like once a day.

we can’t really modify the firmware for one person but you can do it yourself for your own need:

In defines.h:

You can’t change the value here.
It is normally used to restart when the millis() reaches its max.

1 Like

I solved this problem using smartplug and home assistant.
When no ping reply cycle smartplug.


Yeah, I was just thinking of doing that, just mentioning auto reset because I think communication loss might be a common problem, and the feature could be included in a future firmware release

The communication loss comes mostly from the internet/router and I should Start again automaticaly. But actally I ve got a secondar wifi router which all my sensors are connected on. So there is no Connection loss but transmission loss

This may be a more general problem. I am experiencing the same problems. I have two air quality sensors (type numbers in the Netherlands respectively: WH-FS-01 (SDS011/BME280) and WS-FS-02 (SPS30 / SHT3x).

The first sensor regularly failed. This sensor has been in test at the supplier for a while and ran at the supplier’s location without any problems. During this test, the second sensor showed the same problems at the location of the first sensor.

Characteristic of the problem is that the sensor is no longer pingable. But according to my router it is still connected. The only way to get the sensor working again is to turn it off and on. For that purpose, I have now connected the power supply to the sensor via a Zigbee plug, controlled from Home Assistant. Although the sensor is not pingable, Home Assistant unfortunately does not show that the sensor is no longer connected (presumably because the router thinks there is still a connection). So I don’t have a trigger to automate the on/off switching.

I now suspect that the connection to the sensor is lost due to a Wi-Fi access point of a neighbour near the sensor. I will test that, as soon as sensor 1 comes back from the supplier, by repositioning the sensors.

I do think that the behaviour may be caused by a problem in the firmware: unable to recover after a lost Wi-Fi connection. So maybe the discussion in this thread actually belongs in a different section of this forum?