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.