Iotawatt frequently disconnects

Iotawatt frequently disconnects and is not able to connect again.
I see this in the logs where it gets assigned a 169.254 IP address.
After the next restart it still doesnt find it.
This was the state from July 14. until today when we discovered it.
Restarted the rasberryPI and then Iotawatt was able to connect again and the right IP is shown in the logs. All the data are persisted and they are now added to influxdb.

What could be the cause of this state?

The iotawatt is very close to the router and it is in a plastic cabinet.


** Restart **

SD initialized.
7/14/23 10:42:49z Real Time Clock is running. Unix time 1689331369
7/14/23 10:42:49z Reset reason: Software/System restart
7/14/23 10:42:49z Trace: 1:3, 1:6[1], 1:6[2], 1:6[2], 1:6[3], 1:5[31], 1:6[4], 31:0, 31:1, 31:2[5], 31:120, 21:100[31], 21:101, 31:120, 31:122, 31:123, 31:123, 21:110, 21:110, 31:1, 1:6[6], 1:3, 1:3, 1:6[1], 1:6[2], 1:6[3], 1:5[21], 1:6[4], 21:0, 21:1, 21:10, 21:10
7/14/23 10:42:49z ESP8266 ID: 14631604, RTC PCF8523 (68)
7/14/23 10:42:49z IoTaWatt 5.0, Firmware version 02_08_02
7/14/23 10:42:49z SPIFFS mounted.
7/14/23 12:42:49 Local time zone: +1:00, using DST/BST when in effect.
7/14/23 12:42:49 device name: IotaWatt
7/14/23 12:42:49 HTTP server started
7/14/23 12:42:49 influxDB_v2: Starting, interval:60, url:http://192.168.50.37:8086
7/14/23 12:42:49 timeSync: service started.
7/14/23 12:42:49 statService: started.
7/14/23 12:42:49 dataLog: service started.
7/14/23 12:42:51 dataLog: Last log entry 07/14/23 12:42:45
7/14/23 12:42:54 historyLog: service started.
7/14/23 12:42:56 historyLog: Last log entry 07/14/23 12:42:00
7/14/23 12:42:57 WiFi connected. SSID=MUDE_2.4, IP=192.168.50.147, channel=11, RSSI -62db
7/14/23 12:42:57 Updater: service started. Auto-update class is MINOR
7/14/23 12:42:59 Updater: Auto-update is current for class MINOR.
7/14/23 12:42:59 influxDB_v2: Resume posting 07/13/23 10:42:55
7/15/23 04:44:42 Updater: Invalid response from server. HTTPcode: -4
7/16/23 03:44:13 timeSync: No time update in last 24 hours.
7/16/23 06:30:08 Heap memory has degraded below safe minimum, restarting.

** Restart **

SD initialized.
7/16/23 04:30:19z Real Time Clock is running. Unix time 1689481819
7/16/23 04:30:19z Reset reason: Software/System restart
7/16/23 04:30:19z Trace: 18:2, 18:3, 18:2, 18:3, 18:2, 18:3, 18:2, 18:3, 18:4, 18:5, 1:6[6], 1:1[9], 1:2[10], 9:0[10], 9:0, 9:1, 8:4, 8:6, 8:8, 9:3, 9:5, 9:9, 1:3, 1:3, 1:6[1], 1:6[3], 1:5[21], 1:6[4], 21:0, 21:1, 21:10, 21:10
7/16/23 04:30:19z ESP8266 ID: 14631604, RTC PCF8523 (68)
7/16/23 04:30:19z IoTaWatt 5.0, Firmware version 02_08_02
7/16/23 04:30:19z SPIFFS mounted.
7/16/23 06:30:19 Local time zone: +1:00, using DST/BST when in effect.
7/16/23 06:30:19 device name: IotaWatt
7/16/23 06:30:19 HTTP server started
7/16/23 06:30:19 influxDB_v2: Starting, interval:60, url:http://192.168.50.37:8086
7/16/23 06:30:19 timeSync: service started.
7/16/23 06:30:19 statService: started.
7/16/23 06:30:20 dataLog: service started.
7/16/23 06:30:22 dataLog: Last log entry 07/16/23 06:30:05
7/16/23 06:30:25 historyLog: service started.
7/16/23 06:30:27 historyLog: Last log entry 07/16/23 06:30:00
7/16/23 06:34:30 Updater: service started. Auto-update class is MINOR
7/16/23 06:34:30 WiFi connected. SSID=MUDE_2.4, IP=169.254.181.66, channel=11, RSSI -70db
7/16/23 06:38:50 Heap memory has degraded below safe minimum, restarting.

** Restart **

SD initialized.
7/16/23 04:38:51z Real Time Clock is running. Unix time 1689482331
7/16/23 04:38:51z Reset reason: Software/System restart
7/16/23 04:38:51z Trace: 21:100[31], 21:101, 31:120, 31:122, 31:123, 31:123, 21:110, 21:110, 31:1, 1:6[6], 1:1[13], 1:2[14], 9:0[14], 9:0, 9:1, 8:4, 8:6, 8:8, 9:3, 9:5, 9:9, 1:3, 1:3, 1:6[1], 1:6[2], 1:6[3], 1:5[21], 1:6[4], 21:0, 21:1, 21:10, 21:10
7/16/23 04:38:51z ESP8266 ID: 14631604, RTC PCF8523 (68)
7/16/23 04:38:51z IoTaWatt 5.0, Firmware version 02_08_02
7/16/23 04:38:51z SPIFFS mounted.
7/16/23 06:38:51 Local time zone: +1:00, using DST/BST when in effect.
7/16/23 06:38:51 device name: IotaWatt
7/16/23 06:38:51 HTTP server started
7/16/23 06:38:51 influxDB_v2: Starting, interval:60, url:http://192.168.50.37:8086
7/16/23 06:38:51 timeSync: service started.
7/16/23 06:38:51 statService: started.
7/16/23 06:38:52 dataLog: service started.
7/16/23 06:38:54 dataLog: Last log entry 07/16/23 06:38:50
7/16/23 06:38:56 historyLog: service started.
7/16/23 06:38:57 historyLog: Last log entry 07/16/23 06:38:00
7/16/23 06:43:02 WiFi connected. SSID=MUDE_2.4, IP=169.254.181.66, channel=11, RSSI -70db
7/16/23 06:43:02 Updater: service started. Auto-update class is MINOR
7/17/23 06:39:06 timeSync: No time update in last 24 hours.
7/18/23 06:40:06 timeSync: No time update in last 24 hours.
7/19/23 06:41:06 timeSync: No time update in last 24 hours.
7/20/23 06:42:06 timeSync: No time update in last 24 hours.
7/21/23 06:43:06 timeSync: No time update in last 24 hours.
7/22/23 06:44:06 timeSync: No time update in last 24 hours.
7/23/23 06:45:06 timeSync: No time update in last 24 hours.
7/24/23 06:46:06 timeSync: No time update in last 24 hours.
7/24/23 14:01:43 WiFi disconnected.
7/24/23 14:01:47 WiFi connected. SSID=MUDE_2.4, IP=169.254.181.66, channel=11, RSSI -82db
7/24/23 14:05:55 Heap memory has degraded below safe minimum, restarting.

** Restart **

SD initialized.
7/24/23 12:07:06z Real Time Clock is running. Unix time 1690200426
7/24/23 12:07:06z Reset reason: Software/System restart
7/24/23 12:07:06z Trace: 21:100[31], 21:101, 31:120, 31:122, 31:123, 31:124, 31:126, 31:1, 1:6[6], 1:1[10], 1:2[11], 9:0[11], 9:0, 9:1, 8:4, 8:6, 8:8, 9:3, 9:5, 9:9, 1:3, 1:3, 1:6[1], 1:6[2], 1:6[2], 1:6[3], 1:5[21], 1:6[4], 21:0, 21:1, 21:10, 21:10
7/24/23 12:07:06z ESP8266 ID: 14631604, RTC PCF8523 (68)
7/24/23 12:07:06z IoTaWatt 5.0, Firmware version 02_08_02
7/24/23 12:07:06z SPIFFS mounted.
7/24/23 14:07:06 Local time zone: +1:00, using DST/BST when in effect.
7/24/23 14:07:06 device name: IotaWatt
7/24/23 14:07:06 HTTP server started
7/24/23 14:07:06 influxDB_v2: Starting, interval:60, url:http://192.168.50.37:8086
7/24/23 14:07:06 timeSync: service started.
7/24/23 14:07:06 statService: started.
7/24/23 14:07:07 dataLog: service started.
7/24/23 14:07:10 dataLog: Last log entry 07/24/23 14:05:55
7/24/23 14:07:12 historyLog: service started.
7/24/23 14:07:13 historyLog: Last log entry 07/24/23 14:05:00
7/24/23 14:11:17 WiFi connected. SSID=MUDE_2.4, IP=169.254.181.66, channel=11, RSSI -80db
7/24/23 14:11:17 Updater: service started. Auto-update class is MINOR
7/24/23 14:14:22 Heap memory has degraded below safe minimum, restarting.

** Restart **

SD initialized.
7/24/23 12:14:23z Real Time Clock is running. Unix time 1690200863
7/24/23 12:14:23z Reset reason: Software/System restart
7/24/23 12:14:23z Trace: 1:3, 1:6[1], 1:6[2], 1:6[2], 1:6[3], 1:5[31], 1:6[4], 31:0, 31:1, 31:2[5], 31:120, 21:100[31], 21:101, 31:120, 31:122, 31:123, 31:123, 21:110, 21:110, 31:1, 1:6[6], 1:3, 1:3, 1:6[1], 1:6[2], 1:6[3], 1:5[21], 1:6[4], 21:0, 21:1, 21:10, 21:10
7/24/23 12:14:23z ESP8266 ID: 14631604, RTC PCF8523 (68)
7/24/23 12:14:23z IoTaWatt 5.0, Firmware version 02_08_02
7/24/23 12:14:23z SPIFFS mounted.
7/24/23 14:14:23 Local time zone: +1:00, using DST/BST when in effect.
7/24/23 14:14:23 device name: IotaWatt
7/24/23 14:14:23 HTTP server started
7/24/23 14:14:23 influxDB_v2: Starting, interval:60, url:http://192.168.50.37:8086
7/24/23 14:14:23 timeSync: service started.
7/24/23 14:14:23 statService: started.
7/24/23 14:14:24 dataLog: service started.
7/24/23 14:14:26 dataLog: Last log entry 07/24/23 14:14:20
7/24/23 14:14:28 historyLog: service started.
7/24/23 14:14:32 historyLog: Last log entry 07/24/23 14:14:00
7/24/23 14:18:34 WiFi connected. SSID=MUDE_2.4, IP=169.254.181.66, channel=11, RSSI -82db
7/24/23 14:18:34 Updater: service started. Auto-update class is MINOR
7/24/23 14:21:39 Heap memory has degraded below safe minimum, restarting.


** Restart **

SD initialized.
8/01/23 16:41:58z Real Time Clock is running. Unix time 1690908118
8/01/23 16:41:58z Reset Reason: Power-fail restart.
8/01/23 16:41:58z ESP8266 ID: 14631604, RTC PCF8523 (68)
8/01/23 16:41:58z IoTaWatt 5.0, Firmware version 02_08_02
8/01/23 16:41:58z SPIFFS mounted.
8/01/23 18:41:58 Local time zone: +1:00, using DST/BST when in effect.
8/01/23 18:41:58 device name: IotaWatt
8/01/23 18:42:01 Connecting with WiFiManager.
8/01/23 18:42:34 HTTP server started
8/01/23 18:42:34 influxDB_v2: Starting, interval:60, url:http://192.168.50.37:8086
8/01/23 18:42:34 WiFi connected. SSID=MUDE_2.4, IP=192.168.50.147, channel=11, RSSI -69db
8/01/23 18:42:34 timeSync: service started.
8/01/23 18:42:34 statService: started.
8/01/23 18:42:34 Updater: service started. Auto-update class is MINOR
8/01/23 18:42:35 dataLog: service started.
8/01/23 18:42:39 dataLog: Last log entry 08/01/23 18:41:05
8/01/23 18:42:40 historyLog: service started.
8/01/23 18:42:44 historyLog: Last log entry 08/01/23 18:41:00
8/01/23 18:42:45 Updater: Auto-update is current for class MINOR.
8/01/23 18:42:45 influxDB_v2: Resume posting 07/15/23 03:44:55
8/01/23 19:02:18 WiFi disconnected.
8/01/23 19:03:07 WiFi connected. SSID=MUDE_2.4, IP=192.168.50.147, channel=11, RSSI -73db

** Restart **

SD initialized.
8/01/23 17:30:04z Real Time Clock is running. Unix time 1690911004
8/01/23 17:30:04z Reset Reason: Power-fail restart.
8/01/23 17:30:04z ESP8266 ID: 14631604, RTC PCF8523 (68)
8/01/23 17:30:04z IoTaWatt 5.0, Firmware version 02_08_02
8/01/23 17:30:04z SPIFFS mounted.
8/01/23 19:30:04 Local time zone: +1:00, using DST/BST when in effect.
8/01/23 19:30:04 device name: IotaWatt
8/01/23 19:30:07 Connecting with WiFiManager.
8/01/23 19:30:23 HTTP server started
8/01/23 19:30:23 influxDB_v2: Starting, interval:60, url:http://192.168.50.37:8086
8/01/23 19:30:24 WiFi connected. SSID=MUDE_2.4, IP=192.168.50.147, channel=11, RSSI -71db
8/01/23 19:30:24 timeSync: service started.
8/01/23 19:30:24 statService: started.
8/01/23 19:30:24 Updater: service started. Auto-update class is MINOR
8/01/23 19:30:24 dataLog: service started.
8/01/23 19:30:27 dataLog: Last log entry 08/01/23 19:29:55
8/01/23 19:30:29 historyLog: service started.
8/01/23 19:30:31 historyLog: Last log entry 08/01/23 19:29:00
8/01/23 19:30:35 Updater: Auto-update is current for class MINOR.
8/01/23 19:30:35 influxDB_v2: Resume posting 07/27/23 14:42:55

Don’t know. The RSSI is not great, and possibly there is interference in the channel 11 frequency. IoTaWatt is not getting a DHCP. handshake with up address and routing information.

Restarting a Rpi should have nothing to do with this unless your router is a Rpi.

Look closely at the timing in the logs. When it gets an IP address, it is within a few seconds on when it restarted. When it doesn’t, it the message is quite a bit later.

So, it is something with Wi-Fi and networking. You provided no information on your environment, so it is hard to say the cause.

What are you using for a router/access point?
How many access points do you have?

The networking code in the esp8266 is fairly decent, but some people have issues in some environments. It sounds like that might be the case here.