MG5050 challenge esp8266 esp32 Wemos D1 mini
Hi everyone,

Noob here trying to hook up my Paradox MG5050 to Home Assistant but failed enough to eventually reach out for help /guidance. I have installed the Paradox Alarm Interface Current version: 3.5.0 Ad-on.

I bought the IP150MQ to see if I can get it to work with my Mosquitto instance and HA, but I could only find port 80 open on it after scanning it with nmap, no port 10000 on this module.
When connecting to the IP of the module, I have to enter the Installer pc code: 000000 to get into the module.
Once in, I can set the static IP and disable SWAN, that’s it.
The firmware on the module is 6.10.10
I disconnected the IP150 from the panel and network and decided not to waste more time on that just yet. And I want to keep the unit stock in case I need to return it to the supplier.

I have a couple of ESP devices around so I decided to try the ESP Serial over IP option. 
I have tried this with the following devices with no luck:
QuinLED-ESP32
ESP8266(LiLon NodeMCU V3)
ESP8266 WeMos D1 Mini

Like I say, I'm quite new to this so maybe I have a couple of things completely wrong.
I have tried BAUD: 115200 and 9600 and swopping the TR and RX and different code examples and did factory reset on the panel as well as different passwords.

I am currently on the D1 mini setup described below:

**Panel**
Type: MG5050+
Firmware: 1.30 (from what I could see when I was connected to the IP150 before I unplugged it)

Circuit of D1 mini connected to Serial 1 on the panel

![image](https://github.com/user-attachments/assets/e8f52732-b045-449a-a965-d7143591e6f6)

D1 mini code:====================================================

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ArduinoOTA.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
ESP8266WiFiMulti wifiMulti;
// Maximum clients allowed to connect via Telnet
#define MAX_SRV_CLIENTS 1
const char* ssid = "***";
const char* password = "***";
// Set Static IP address
IPAddress local_IP(***, ***, ***, ***);
// Set Gateway IP address
IPAddress gateway(***, ***, ***, ***);
IPAddress subnet(255, 255, 255, 0);
IPAddress primaryDNS(***, ***, ***, ***); // optional
WiFiServer server(23);
WiFiClient serverClients[MAX_SRV_CLIENTS];
void wifisetup() {
    Serial1.println("Connecting WiFi");
    for (int loops = 10; loops > 0; loops--) {
        if (wifiMulti.run() == WL_CONNECTED) {
            Serial1.println("");
            Serial1.print("WiFi connected ");
            Serial1.print("IP address: ");
            Serial1.println(WiFi.localIP());
            break;
        } else {
            Serial1.println(loops);
            delay(1000);
        }
    }
    if (wifiMulti.run() != WL_CONNECTED) {
        Serial1.println("WiFi connect failed");
        delay(1000);
        ESP.restart();
    }
}
void setup() {
    Serial1.begin(115200);
    Serial1.println("\nConnecting");
    // Configures static IP address
    if (!WiFi.config(local_IP, gateway, subnet, primaryDNS)) {
        Serial1.println("STA Failed to configure");
    }
    wifiMulti.addAP(ssid, password);
    wifisetup();
    // Start UART and the server
    server.begin();
    server.setNoDelay(true);
    Serial1.print("Ready! Use 'telnet ");
    Serial1.print(WiFi.localIP());
    Serial1.println(" 23' to connect");
}
void loop() {
    uint8_t i;
    if (wifiMulti.run() == WL_CONNECTED) {
        // Check if there are any new clients
        if (server.hasClient()) {
            for (i = 0; i < MAX_SRV_CLIENTS; i++) {
                // Find free/disconnected spot
                if (!serverClients[i] || !serverClients[i].connected()) {
                    if (serverClients[i]) serverClients[i].stop();
                    serverClients[i] = server.available();
                    if (!serverClients[i]) Serial1.println("available broken");
                    Serial1.print("New client: ");
                    Serial1.print(i); 
                    Serial1.print(' ');
                    Serial1.println(serverClients[i].remoteIP());
                    break;
                }
            }
            if (i >= MAX_SRV_CLIENTS) {
                // No free/disconnected spot, so reject
                server.available().stop();
            }
        }
        // Check clients for data
        for (i = 0; i < MAX_SRV_CLIENTS; i++) {
            if (serverClients[i] && serverClients[i].connected()) {
                if (serverClients[i].available()) {
                    // Get data from the Telnet client and push it to the UART
                    while (serverClients[i].available()) {
                        Serial.write(serverClients[i].read());
                    }
                }
            } else {
                if (serverClients[i]) {
                    serverClients[i].stop();
                }
            }
        }
        // Check UART for data
        if (Serial.available()) {
            size_t len = Serial.available();
            uint8_t sbuf[len];
            Serial.readBytes(sbuf, len);
            // Push UART data to all connected Telnet clients
            for (i = 0; i < MAX_SRV_CLIENTS; i++) {
                if (serverClients[i] && serverClients[i].connected()) {
                    serverClients[i].write(sbuf, len);
                    delay(1);
                }
            }
        }
    } else {
        Serial1.println("WiFi not connected!");
        for (i = 0; i < MAX_SRV_CLIENTS; i++) {
            if (serverClients[i]) serverClients[i].stop();
        }
        wifisetup();
    }
}

PIA Config:===================================================================

LOGGING_LEVEL_CONSOLE: 20
LOGGING_LEVEL_FILE: 40
CONNECTION_TYPE: IP
SERIAL_PORT: /dev/ttyUSB0
SERIAL_BAUD: 115200
IP_CONNECTION_HOST: ***.***.***.***
IP_CONNECTION_PORT: 23
IP_CONNECTION_PASSWORD: paradox
KEEP_ALIVE_INTERVAL: 10
IO_TIMEOUT: 0.5
LIMITS:
  zone: auto
  user: 1-10
  door: ""
  pgm: 1-5
  partition: auto
  module: ""
  repeater: ""
  keypad: ""
  key-switch: ""
SYNC_TIME: true
SYNC_TIME_MIN_DRIFT: 120
PASSWORD: "0000"
MQTT_ENABLE: true
MQTT_HOST: ****.***.***.***
MQTT_PORT: 1883
MQTT_KEEPALIVE: 60
MQTT_USERNAME: ***
MQTT_PASSWORD: ***
MQTT_HOMEASSISTANT_AUTODISCOVERY_ENABLE: true
COMMAND_ALIAS:
  arm: partition all arm
  disarm: partition all disarm
MQTT_COMMAND_ALIAS:
  armed_home: arm_stay
  armed_night: arm_sleep
  armed_away: arm
  disarmed: disarm
HOMEASSISTANT_NOTIFICATIONS_EVENT_FILTERS:
  - live,alarm,-restore
  - trouble,-clock
  - live,tamper
HOMEASSISTANT_PUBLISH_PARTITION_PROPERTIES:
  - target_state
  - current_state
HOMEASSISTANT_PUBLISH_ZONE_PROPERTIES:
  - open
  - tamper
PUSHBULLET_CONTACTS: []
PUSHBULLET_EVENT_FILTERS:
  - live,alarm,-restore
  - trouble,-clock
  - live,tamper
PUSHOVER_EVENT_FILTERS:
  - live,alarm,-restore
  - trouble,-clock
  - live,tamper
PUSHOVER_BROADCAST_KEYS: []
SIGNAL_CONTACTS: []
SIGNAL_EVENT_FILTERS:
  - live,alarm,-restore
  - trouble,-clock
  - live,tamper
GSM_CONTACTS: []
GSM_EVENT_FILTERS:
  - live,alarm,-restore
  - trouble,-clock
  - live,tamper
IP_INTERFACE_ENABLE: false
IP_INTERFACE_PASSWORD: paradox
DUMMY_EVENT_FILTERS: []
IP_CONNECTION_BARE: true

PIA Output:===========================================================================

2024-10-26 15:12:19,372 - INFO     - PAI - Good bye!
2024-10-26 15:12:30,024 - INFO     - PAI - Starting Paradox Alarm Interface 3.5.0
2024-10-26 15:12:30,024 - INFO     - PAI - Config loaded from /data/options.json
2024-10-26 15:12:30,024 - INFO     - PAI - Console Log level set to 20
2024-10-26 15:12:30,043 - INFO     - PAI.paradox.interfaces - Starting BasicMQTTInterface Interface
2024-10-26 15:12:30,044 - INFO     - PAI.paradox.interfaces.mqtt.core - MQTT loop started
2024-10-26 15:12:30,046 - INFO     - PAI.paradox.interfaces - Starting HomeAssistantMQTTInterface Interface
2024-10-26 15:12:30,046 - INFO     - PAI - Starting...
2024-10-26 15:12:30,046 - INFO     - PAI.paradox.paradox - Connecting to interface
2024-10-26 15:12:30,046 - INFO     - PAI.paradox.paradox - Using IP Connection
2024-10-26 15:12:30,114 - INFO     - PAI.paradox.connections.ip.connection - Connecting. Try 1/3
2024-10-26 15:12:30,117 - INFO     - PAI.paradox.connections.connection - Connection established
2024-10-26 15:12:30,117 - INFO     - PAI.paradox.paradox - Connecting to Panel
2024-10-26 15:12:31,111 - INFO     - PAI.paradox.interfaces.mqtt.core - MQTT Broker Connected
2024-10-26 15:12:35,124 - ERROR    - PAI.paradox.paradox - Timeout while connecting to panel. Is an other connection active?
2024-10-26 15:12:35,124 - ERROR    - PAI - Unable to connect to alarm
2024-10-26 15:12:38,128 - INFO     - PAI - Starting...
2024-10-26 15:12:38,128 - INFO     - PAI.paradox.paradox - Disconnecting from the Alarm Panel
2024-10-26 15:12:38,128 - INFO     - PAI.paradox.paradox - Clean Session
2024-10-26 15:12:38,128 - INFO     - PAI.paradox.paradox - Cleaning previous session. Closing connection
2024-10-26 15:12:38,129 - ERROR    - PAI.paradox.connections.protocols - Connection was closed: None
2024-10-26 15:12:38,129 - ERROR    - PAI.paradox.connections.connection - Connection was lost
2024-10-26 15:12:38,129 - INFO     - PAI.paradox.paradox - Disconnected from the Alarm Panel
2024-10-26 15:12:38,129 - INFO     - PAI.paradox.paradox - Connecting to interface
2024-10-26 15:12:38,130 - INFO     - PAI.paradox.connections.ip.connection - Connecting. Try 1/3
2024-10-26 15:12:38,144 - INFO     - PAI.paradox.connections.connection - Connection established
2024-10-26 15:12:38,144 - INFO     - PAI.paradox.paradox - Connecting to Panel

I'm out of ideas and hoping it's just a small adjustment to get this working. Any guidance would be greatly appreciated.
