Fatal exception and Disconnects WiFi Every 3 Hours or Less While Reading or Writing UART Data

Hello,

I developed with ESPHOME and WEMOS D1 Mini to get my data from the RS232 port of my UPS device. Although currently working fine, my device loses wifi connection at intervals of 3 hours or less. I should also mention that my other ESP8266 devices connected to the same wifi network are connected for days and I do not have any connection problems.

In my research on the internet, there is information that it is caused by the general wifi settings and the problem will be fixed when the wifi settings are changed, but the issues are not closed as resolved and I have encountered many similar issues.

In the AP logs, information appears as “device disconnected or terminated”.

The codes I wrote below are available.
I look forward to your comments and suggestions for solutions to my problem.

Wemos D1 Mini Nodemcu Esp8266
RS232 to TTL
Makelsan POWERPACK SE SERİSİ 1 kVA
UPS Data Read and Parse

Home Assistant Screenshot

UPS-Makelsan.h

#include "esphome.h"

class Get
{
public:
	static int readline(int readch, char* buffer, int len)
	{
		static int pos = 0;
		int rpos;

		if (readch > 0)
		{
			switch (readch)
			{
			case '#': // "#220.0 005 024.0 50.0"
			case '(': // "(216.5 000.0 219.6 027 50.0 2.26 40.00 00110000"
				break;
			case '\r': // Return on CR
				rpos = pos;
				pos = 0; // Reset position index ready for next time
				return rpos;
			default:
				if (pos < len - 1)
				{
					buffer[pos++] = readch;
					buffer[pos] = 0;
				}
			}

ha-ups-makelsan.yaml validate export

substitutions:
  platform: ESP8266
  board: d1_mini
  deviceName: ha-ups-makelsan
  deviceNameId: ha_ups_makelsan
  deviceFriendlyName: HA Makelsan UPS
esphome:
  name: ha-ups-makelsan
  includes:
  - common/scripts/uart/UPS-Makelsan.h
  build_path: .esphome/build/ha-ups-makelsan
  platformio_options: {}
  libraries: []
  name_add_mac_suffix: false
esp8266:
  board: d1_mini
  framework:
    version: 3.0.2
    source: ~3.30002.0
    platform_version: platformio/espressif8266 @ 3.2.0
  restore_from_flash: false
  board_flash_mode: dout
wifi:
  ap:
    ssid: HA Makelsan UPS Hotspot
    password: ha_ups_makelsan_ML080wxvFS8z_ha_ups_makelsan
    ap_timeout: 1min
  domain: !secret 'wifi_domainname'
  fast_connect: true
  power_save_mode: NONE
  reboot_timeout: 15min
  output_power: 20.0
 

Thanks in advance for yours help.

Hi,

Am I trying too hard, is there anyone who can answer?
I guess no one understands this stuff?

@esphomeGuru, please help?

Wifi disconnects seem to be a common talking point, even if you have decent db to your AP/router. I notice far better reliability using the following;

  • HA → Configuration → Addons → ESPHome → Configuration → status_use_ping
  • ESPHome yaml:
    mdns:
      disabled: true

    wifi:
      power_save_mode: none
  • router/AP → DTIM = 1

Hi @crlogic ,
I just caught this log.
Is this problem due to wifi or ip settings?

In addition, nothing changed after the settings you forwarded. The problem persists.

I guess there is no one around here who understands esph8266 and esphome. Looks like we’ll take care of ourselves… :frowning:

I believe quite a few of the ESPHome developers are active on their discord server. I’ve often had better luck there. Recommend posting your question there if unsuccessful here.

this is pretty sad :frowning:

This problem is solved.

Solition URL

Thansk everybody.

Silly question… …what was the solution?

The URL goes to a GitHub with a 200 line yaml and .h file.

Struggling to identify what fixed it for you…

Hi,

Use RX and TX pins instead of pins.