ParadoxAlarmInterface / pai

Paradox Magellan, Spectra and EVO, with MQTT, Signal, Pushbullet, Pushover and others
https://gitter.im/paradox-alarm-interface
Eclipse Public License 2.0
352 stars 94 forks source link

Problem with serial over ip with a esp32. #259

Closed danilodivaio closed 2 years ago

danilodivaio commented 3 years ago

Good morning, I try to connect to alarm panel (paradox EVO 192 by serial over ip with a esp32) but I've a problem:

2021-08-14 11:11:11,871 - INFO - PAI.paradox.connections.ip.connection - Connecting. Try 1/3 2021-08-14 11:11:11,988 - INFO - PAI.paradox.connections.connection - Connection established 2021-08-14 11:11:11,990 - INFO - PAI.paradox.paradox - Connecting to Panel 2021-08-14 11:11:17,004 - ERROR - PAI.paradox.paradox - Timeout while connecting to panel. Is an other connection active? 2021-08-14 11:11:17,006 - ERROR - PAI - Unable to connect to alarm

my configuration:

LOGGING_LEVEL_CONSOLE: 20 LOGGING_LEVEL_FILE: 40 CONNECTION_TYPE: IP SERIAL_PORT: /dev/ttyUSB0 SERIAL_BAUD: 57600 IP_CONNECTION_HOST: 192...* IP_CONNECTION_PORT: 23 IP_CONNECTION_PASSWORD: paradox KEEP_ALIVE_INTERVAL: 10 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: core-mosquitto 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 live,trouble,-clock live,tamper PUSHBULLET_CONTACTS: [] PUSHBULLET_EVENT_FILTERS: live,alarm,-restore live,trouble,-clock live,tamper PUSHOVER_EVENT_FILTERS: live,alarm,-restore live,trouble,-clock live,tamper PUSHOVER_BROADCAST_KEYS: [] SIGNAL_CONTACTS: [] SIGNAL_EVENT_FILTERS: live,alarm,-restore live,trouble,-clock live,tamper GSM_CONTACTS: [] GSM_EVENT_FILTERS: live,alarm,-restore live,trouble,-clock live,tamper IP_INTERFACE_ENABLE: false IP_INTERFACE_PASSWORD: paradox DUMMY_EVENT_FILTERS: [] IP_CONNECTION_BARE: true

how can i solve? Thanks to all!

vladimirzrnic commented 3 years ago

@danilodivaio, please can you share an image with connection details? Sharing code will also be helpful.

danilodivaio commented 3 years ago

hi, thanks for replying, what connection details should i share?

danilodivaio commented 3 years ago

The code in ESP32 is: / Credit to https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino Changes made as a Template for PAI /

include

include

include

include

include

include

WiFiMulti wifiMulti; //variabls for blinking an LED with Millis

define LED 2

// ESP32 Pin to which onboard LED is connected unsigned long previousMillis = 0; // will store last time LED was updated const long interval = 3000; // interval at which to blink (milliseconds) int ledState = LOW; // ledState used to set the LED //how many clients should be able to telnet to this ESP32

define MAX_SRV_CLIENTS 4

const char ssid = "x"; const char password = "x";

WiFiServer server(23); WiFiClient serverClients[MAX_SRV_CLIENTS];

void wifisetup(){ Serial.println("Connecting Wifi "); for (int loops = 10; loops > 0; loops--) { if (wifiMulti.run() == WL_CONNECTED) { Serial.println(""); Serial.print("WiFi connected "); Serial.print("IP address: "); Serial.println(WiFi.localIP()); break; } else { Serial.println(loops); delay(1000); } } if (wifiMulti.run() != WL_CONNECTED) { Serial.println("WiFi connect failed"); delay(1000); ESP.restart(); } }

void setup() { Serial.begin(115200); Serial.println("\nConnecting"); pinMode(LED,OUTPUT); digitalWrite(LED, LOW); wifiMulti.addAP(ssid, password); //wifiMulti.addAP("x1", "x1"); wifisetup();

// }

//start UART and the server Serial2.begin(9600); server.begin(); server.setNoDelay(true);

ArduinoOTA .onStart([]() { String type; if (ArduinoOTA.getCommand() == U_FLASH) type = "sketch"; else // U_SPIFFS type = "filesystem";

  // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
  Serial.println("Start updating " + type);
})
.onEnd([]() {
  Serial.println("\nEnd");
})
.onProgress([](unsigned int progress, unsigned int total) {
  Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
})
.onError([](ota_error_t error) {
  Serial.printf("Error[%u]: ", error);
  if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
  else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
  else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
  else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
  else if (error == OTA_END_ERROR) Serial.println("End Failed");
});

ArduinoOTA.begin();

Serial.print("Ready! Use 'telnet "); Serial.print(WiFi.localIP()); Serial.println(" 23' to connect"); }

int count; void loop() { uint8_t i;

ArduinoOTA.handle();
//loop to blink without delay unsigned long currentMillis = millis(); if (currentMillis - previousMillis >= interval) { // save the last time you blinked the LED previousMillis = currentMillis; // if the LED is off turn it on and vice-versa: ledState = not(ledState); // set the LED with the ledState of the variable: digitalWrite(LED, ledState); }

if (wifiMulti.run() == WL_CONNECTED) { //check if there are any new clients

count = 0;
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]) Serial.println("available broken");
      Serial.print("New client: ");
      Serial.print(i); Serial.print(' ');
      Serial.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()) {Serial2.write(serverClients[i].read());
        // if the LED is off turn it on and vice-versa:

ledState = not(ledState); // set the LED with the ledState of the variable: digitalWrite(LED, ledState);} } } else { if (serverClients[i]) { serverClients[i].stop(); } } } //check UART for data if(Serial2.available()){ size_t len = Serial2.available(); uint8_t sbuf[len]; Serial2.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); ledState = not(ledState); // set the LED with the ledState of the variable: digitalWrite(LED, ledState); } } } } else { Serial.println("WiFi not connected!"); for(i = 0; i < MAX_SRV_CLIENTS; i++) { if (serverClients[i]) serverClients[i].stop(); } wifisetup(); }

}

vladimirzrnic commented 3 years ago

hi, thanks for replying, what connection details should i share?

Can you please take a photo of how ESP32 is wired?

Re code- there are few issues with the code you are using. Try using:

#include <WiFi.h>
#include <WiFiMulti.h>

WiFiMulti wifiMulti;

//how many clients should be able to telnet to this ESP32
#define MAX_SRV_CLIENTS 1
const char* ssid = ""; //wifi ssid
const char* password = ""; // wifi password

WiFiServer server(23);
WiFiClient serverClients[MAX_SRV_CLIENTS];

void setup() {
  Serial.begin(115200);
  Serial.println("\nConnecting");

  wifiMulti.addAP(ssid, password);
  wifiMulti.addAP("ssid_from_AP_2", "your_password_for_AP_2");
  wifiMulti.addAP("ssid_from_AP_3", "your_password_for_AP_3");

  Serial.println("Connecting Wifi ");
  for (int loops = 10; loops > 0; loops--) {
    if (wifiMulti.run() == WL_CONNECTED) {
      Serial.println("");
      Serial.print("WiFi connected ");
      Serial.print("IP address: ");
      Serial.println(WiFi.localIP());
      break;
    }
    else {
      Serial.println(loops);
      delay(1000);
    }
  }
  if (wifiMulti.run() != WL_CONNECTED) {
    Serial.println("WiFi connect failed");
    delay(1000);
    ESP.restart();
  }

  //start UART and the server
  Serial2.begin(57600);
  server.begin();
  server.setNoDelay(true);

  Serial.print("Ready! Use 'telnet ");
  Serial.print(WiFi.localIP());
  Serial.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]) Serial.println("available broken");
          Serial.print("New client: ");
          Serial.print(i); Serial.print(' ');
          Serial.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()) Serial2.write(serverClients[i].read());
        }
      }
      else {
        if (serverClients[i]) {
          serverClients[i].stop();
        }
      }
    }
    //check UART for data
    if(Serial2.available()){
      size_t len = Serial2.available();
      uint8_t sbuf[len];
      Serial2.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 {
    Serial.println("WiFi not connected!");
    for(i = 0; i < MAX_SRV_CLIENTS; i++) {
      if (serverClients[i]) serverClients[i].stop();
    }
    delay(1000);
  }
}

Cheers, Vlad

vladimirzrnic commented 3 years ago

@danilodivaio did you manage to solve the puzzle? If so, please advise.

proasnet commented 3 years ago

I have solved this problem. I solve it before change interface to IP100. Plase see here https://github.com/ParadoxAlarmInterface/pai/wiki/Connection-methods#serial-over-ip-esp32

Some more info in this ticket: https://github.com/ParadoxAlarmInterface/pai/issues/198#issuecomment-771388699

Serial on ESP32 need 3,3V level convertor from 5V uart. Thats all. In my ticket I have a link to very very easy schematic of converter. The second converter is for powering ESP32

yozik04 commented 3 years ago

If you have some updates to the wiki - Please update it so we get less help requests here. It is not my field of knowledge unfortunately to help others with these requests.

proasnet commented 3 years ago

Hello, my problem with ESP32 was solved here https://github.com/ParadoxAlarmInterface/pai/issues/198#issuecomment-771388699 at February. Now, I am not using it. I have a IP100. Is not possible connect EVO with EPS32 Rx and Tx directly. You need convert data between 5V-3,3V !!! ESP32 have not data pins compatible with 5V level !!!

Schematic is here https://i.stack.imgur.com/YMjIK.gif

maartenschalekamp commented 2 years ago

I have the same issue using my NodeMCU (ESP8266). I am using GPIO13/TX and GPIO13/RX with a pulldown resistor on GPIO15 to ensure booting.

I have tried using esp-link, WiFiTelnetToSerial (8266) example, as well as the esphome. All cases I was able to connect to some random Mikrotik device I had with me and showed that I can connect to it remotely.

So, going to try using the non swapped ports GPIO1/TC and GPIO3/RX. If this also does not work then I don't know what to try anymore. Been at it for a week.

Do we have a minimum version for EVO firmware? I think I am on 6.X or something. (will double check)

What I currently have, just modified this one for some LED flashing and OTA support. https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino

/*
  WiFiTelnetToSerial - Example Transparent UART to Telnet Server for esp8266
  Copyright (c) 2015 Hristo Gochkov. All rights reserved.
  This file is part of the ESP8266WiFi library for Arduino environment.
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

#include <algorithm> // std::min

#ifndef STASSID
#define STASSID "SSID"
#define STAPSK  "PASSWD"
#endif

/*
    SWAP_PINS:
   0: use Serial1 for logging (legacy example)
   1: configure Hardware Serial port on RX:GPIO13 TX:GPIO15
      and use SoftwareSerial for logging on
      standard Serial pins RX:GPIO3 and TX:GPIO1
*/

#define SWAP_PINS 1

/*
    SERIAL_LOOPBACK
    0: normal serial operations
    1: RX-TX are internally connected (loopback)
*/

#define SERIAL_LOOPBACK 0

#define BAUD_SERIAL 57600
#define BAUD_LOGGER 115200
#define RXBUFFERSIZE 1024

////////////////////////////////////////////////////////////

#if SERIAL_LOOPBACK
#undef BAUD_SERIAL
#define BAUD_SERIAL 3000000
#include <esp8266_peri.h>
#endif

#if SWAP_PINS
#include <SoftwareSerial.h>
SoftwareSerial* logger = nullptr;
#else
#define logger (&Serial1)
#endif

#define STACK_PROTECTOR  512 // bytes

//how many clients should be able to telnet to this ESP8266
#define MAX_SRV_CLIENTS 2
const char* ssid = STASSID;
const char* password = STAPSK;

const int port = 23;
unsigned long previousMillis = 0;  // will store last time LED was updated
int ledState = LOW;  // ledState used to set the LED
const long interval = 100;  // interval at which to blink (milliseconds)

WiFiServer server(port);
WiFiClient serverClients[MAX_SRV_CLIENTS];

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW); // Turn ON status led - ON = Booting
  Serial.begin(BAUD_SERIAL);
  Serial.setRxBufferSize(RXBUFFERSIZE);

#if SWAP_PINS
  Serial.swap();
  // Hardware serial is now on RX:GPIO13 TX:GPIO15
  // use SoftwareSerial on regular RX(3)/TX(1) for logging
  logger = new SoftwareSerial(3, 1);
  logger->begin(BAUD_LOGGER);
  logger->enableIntTx(false);
  logger->println("\n\nUsing SoftwareSerial for logging");
#else
  logger->begin(BAUD_LOGGER);
  logger->println("\n\nUsing Serial1 for logging");
#endif
  logger->println(ESP.getFullVersion());
  logger->printf("Serial baud: %d (8n1: %d KB/s)\n", BAUD_SERIAL, BAUD_SERIAL * 8 / 10 / 1024);
  logger->printf("Serial receive buffer size: %d bytes\n", RXBUFFERSIZE);
#if SERIAL_LOOPBACK
  USC0(0) |= (1 << UCLBE); // incomplete HardwareSerial API
  logger->println("Serial Internal Loopback enabled");
#endif

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  logger->print("\nConnecting to ");
  logger->println(ssid);
  while (WiFi.status() != WL_CONNECTED) {
    logger->print('.');
    delay(500);
  }
  logger->println();
  logger->print("connected, address=");
  logger->println(WiFi.localIP());
  digitalWrite(LED_BUILTIN, HIGH); // Switch off status led ( OFF = Connected )

  // OTA Update
  ArduinoOTA.setHostname("ESP_NAME_HERE");
  ArduinoOTA.setPassword("OTA_PWD");
  ArduinoOTA.onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH) {
      type = "sketch";
    } else { // U_FS
      type = "filesystem";
    }

    // NOTE: if updating FS this would be the place to unmount FS using FS.end()
    Serial.println("Start updating " + type);
  });
  ArduinoOTA.onEnd([]() {
    Serial.println("\nEnd");
  });
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
  });
  ArduinoOTA.onError([](ota_error_t error) {
    Serial.printf("Error[%u]: ", error);
    if (error == OTA_AUTH_ERROR) {
      Serial.println("Auth Failed");
    } else if (error == OTA_BEGIN_ERROR) {
      Serial.println("Begin Failed");
    } else if (error == OTA_CONNECT_ERROR) {
      Serial.println("Connect Failed");
    } else if (error == OTA_RECEIVE_ERROR) {
      Serial.println("Receive Failed");
    } else if (error == OTA_END_ERROR) {
      Serial.println("End Failed");
    }
  });
  ArduinoOTA.begin();

  //start server
  server.begin();
  server.setNoDelay(true);

  logger->print("Ready! Use 'telnet ");
  logger->print(WiFi.localIP());
  logger->printf(" %d' to connect\n", port);
}

void loop() {
  ArduinoOTA.handle();

  //loop to blink without delay
  unsigned long currentMillis = millis();
  if (ledState == HIGH and currentMillis - previousMillis >= interval) {
    // if the LED is off turn it on and vice-versa:
    ledState = not(ledState);
    // set the LED with the ledState of the variable:
    digitalWrite(LED_BUILTIN,  not(ledState));
  }

  //check if there are any new clients
  if (server.hasClient()) {
    //find free/disconnected spot
    int i;
    for (i = 0; i < MAX_SRV_CLIENTS; i++)
      if (!serverClients[i]) { // equivalent to !serverClients[i].connected()
        serverClients[i] = server.available();
        logger->print("New client: index ");
        logger->print(i); 
        logger->print(' ');
        logger->println(serverClients[i].remoteIP());
        break;
      }

    //no free/disconnected spot so reject
    if (i == MAX_SRV_CLIENTS) {
      server.available().println("busy");
      // hints: server.available() is a WiFiClient with short-term scope
      // when out of scope, a WiFiClient will
      // - flush() - all data will be sent
      // - stop() - automatically too
      logger->printf("server is busy with %d active connections\n", MAX_SRV_CLIENTS);
    }
  }

  //check TCP clients for data
#if 1
  // Incredibly, this code is faster than the buffered one below - #4620 is needed
  // loopback/3000000baud average 348KB/s
  for (int i = 0; i < MAX_SRV_CLIENTS; i++)
    while (serverClients[i].available() && Serial.availableForWrite() > 0) {
      // working char by char is not very efficient
      ledState = HIGH;
      digitalWrite(LED_BUILTIN,  not(ledState));
      previousMillis = currentMillis;
      Serial.write(serverClients[i].read());
    }
#else
  // loopback/3000000baud average: 312KB/s
  for (int i = 0; i < MAX_SRV_CLIENTS; i++)
    while (serverClients[i].available() && Serial.availableForWrite() > 0) {
      size_t maxToSerial = std::min(serverClients[i].available(), Serial.availableForWrite());
      maxToSerial = std::min(maxToSerial, (size_t)STACK_PROTECTOR);
      uint8_t buf[maxToSerial];
      size_t tcp_got = serverClients[i].read(buf, maxToSerial);
      size_t serial_sent = Serial.write(buf, tcp_got);
      if (serial_sent != maxToSerial) {
        logger->printf("len mismatch: available:%zd tcp-read:%zd serial-write:%zd\n", maxToSerial, tcp_got, serial_sent);
      }
    }
#endif

  // determine maximum output size "fair TCP use"
  // client.availableForWrite() returns 0 when !client.connected()
  int maxToTcp = 0;
  for (int i = 0; i < MAX_SRV_CLIENTS; i++)
    if (serverClients[i]) {
      int afw = serverClients[i].availableForWrite();
      if (afw) {
        if (!maxToTcp) {
          maxToTcp = afw;
        } else {
          maxToTcp = std::min(maxToTcp, afw);
        }
      } else {
        // warn but ignore congested clients
        logger->println("one client is congested");
      }
    }

  //check UART for data
  size_t len = std::min(Serial.available(), maxToTcp);
  len = std::min(len, (size_t)STACK_PROTECTOR);
  if (len) {
    uint8_t sbuf[len];
    int serial_got = Serial.readBytes(sbuf, len);
    // push UART data to all connected telnet clients
    for (int i = 0; i < MAX_SRV_CLIENTS; i++)
      // if client.availableForWrite() was 0 (congested)
      // and increased since then,
      // ensure write space is sufficient:
      if (serverClients[i].availableForWrite() >= serial_got) {
        size_t tcp_sent = serverClients[i].write(sbuf, serial_got);
        if (tcp_sent != len) {
          logger->printf("len mismatch: available:%zd serial-read:%zd tcp-write:%zd\n", len, serial_got, tcp_sent);
        }
      }
  }
}

Output from PAI

2021-11-10 15:42:25,827 - INFO     - PAI - Starting Paradox Alarm Interface 2.7.1
2021-11-10 15:42:25,827 - INFO     - PAI - Config loaded from /etc/pai/pai.conf
2021-11-10 15:42:25,827 - INFO     - PAI - Console Log level set to 20
2021-11-10 15:42:25,828 - INFO     - PAI - Starting...
2021-11-10 15:42:25,828 - INFO     - PAI.paradox.paradox - Connecting to interface
2021-11-10 15:42:25,828 - INFO     - PAI.paradox.paradox - Using IP Connection
2021-11-10 15:42:25,881 - INFO     - PAI.paradox.connections.ip.connection - Connecting. Try 1/3
2021-11-10 15:42:25,900 - INFO     - PAI.paradox.connections.connection - Connection established
2021-11-10 15:42:25,900 - INFO     - PAI.paradox.paradox - Connecting to Panel
2021-11-10 15:42:30,908 - ERROR    - PAI.paradox.paradox - Timeout while connecting to panel. Is an other connection active?
2021-11-10 15:42:30,911 - ERROR    - PAI - Unable to connect to alarm
yozik04 commented 2 years ago

Do you use IP_CONNECTION_BARE: true ?

maartenschalekamp commented 2 years ago

Yeah, my config currently very simple.

import logging

CONNECTION_TYPE = 'IP'          # Serial or IP
IP_CONNECTION_HOST = '192.168.11.7' # IP Module address when using direct IP Connection
IP_CONNECTION_PORT = 23         # IP Module port when using direct IP Connection
IP_CONNECTION_BARE = True      # No not expect an IP150 module. Used this for base Serial over TCP tunnels

I am using a max232n with 1uF Electrolytic capacitors. I don't have ceramic 1uf's and on the datasheet it indicates that electrolytic caps also fine.

Can't get the nodemcu to use gpio1&3 as I think is due to the onboard ttl converter.

Maybe need to find ceramics caps or try using my esp32f but feels like a bit of an overkill.

proasnet commented 2 years ago

Why max232? Here is not a RS232. Paradox has 5V uart and esp have a 3.3V uart. You need convert levels between 5V and 3.3V. Use my convertor. I published here if you will find.

maartenschalekamp commented 2 years ago

Why max232? Here is not a RS232. Paradox has 5V uart and esp have a 3.3V uart. You need convert levels between 5V and 3.3V. Use my convertor. I published here if you will find.

🤦‍♂️ Well, that would explain my issues... Thank you!

proasnet commented 2 years ago

Here you have an converter schematic for uart!!! This is not for powering of the ESP, for power you need dc/dc converter from 12V to 5V https://i.stack.imgur.com/YMjIK.gif

maartenschalekamp commented 2 years ago

Here you have an converter schematic for uart!!! This is not for powering of the ESP, for power you need dc/dc converter from 12V to 5V https://i.stack.imgur.com/YMjIK.gif

Can't I just use a voltage divider with resistors? 1k + 2.2k ? So max volts will be 3.438V

proasnet commented 2 years ago

You have a two data directions. The firs from paradox uart from 5V. Here you can use a divider and the second direct from esp 3.3V to pqradox 5v uart and here you need an amplifier with two transistors. This converter I have tried and working with PAI and esp32.

maartenschalekamp commented 2 years ago

thank you @proasnet - managed to get it working

2021-11-12 23:17:49,037 - INFO     - PAI - Starting...
2021-11-12 23:17:49,037 - INFO     - PAI.paradox.paradox - Disconnecting from the Alarm Panel
2021-11-12 23:17:49,038 - INFO     - PAI.paradox.paradox - Clean Session
2021-11-12 23:17:49,038 - INFO     - PAI.paradox.paradox - Cleaning previous session. Closing connection
2021-11-12 23:17:49,039 - ERROR    - PAI.paradox.connections.protocols - Connection was closed: None
2021-11-12 23:17:49,041 - ERROR    - PAI.paradox.connections.connection - Connection was lost
2021-11-12 23:17:49,043 - INFO     - PAI.paradox.paradox - Disconnected from the Alarm Panel
2021-11-12 23:17:49,043 - INFO     - PAI.paradox.paradox - Connecting to interface
2021-11-12 23:17:49,043 - INFO     - PAI.paradox.connections.ip.connection - Connecting. Try 1/3
2021-11-12 23:17:49,047 - INFO     - PAI.paradox.connections.connection - Connection established
2021-11-12 23:17:49,047 - INFO     - PAI.paradox.paradox - Connecting to Panel
2021-11-12 23:17:49,072 - INFO     - PAI.paradox.paradox - Panel Identified EVO192 version 6.80 build 6
2021-11-12 23:17:49,072 - INFO     - PAI.paradox.paradox - Initiating panel connection
2021-11-12 23:17:49,109 - INFO     - PAI.paradox.hardware.evo.panel - Installer login
2021-11-12 23:17:49,126 - INFO     - PAI.paradox.hardware.evo.panel - Authentication Success
2021-11-12 23:17:49,126 - INFO     - PAI.paradox.paradox - Connection OK
2021-11-12 23:17:49,126 - INFO     - PAI.paradox.paradox - Loading data from panel memory
2021-11-12 23:17:49,126 - INFO     - PAI.paradox.hardware.panel - Loading definitions
2021-11-12 23:17:49,127 - INFO     - PAI.paradox.hardware.panel - Updating Definitions from Panel
2021-11-12 23:17:49,296 - INFO     - PAI.paradox.hardware.panel - Zone definitions loaded (0.17s)
2021-11-12 23:17:49,305 - INFO     - PAI.paradox.hardware.panel - Partition definitions loaded (0.01s)
2021-11-12 23:17:53,454 - INFO     - PAI.paradox.hardware.panel - User definitions loaded (4.15s)
2021-11-12 23:17:53,506 - INFO     - PAI.paradox.hardware.panel - Loading labels
2021-11-12 23:17:53,507 - INFO     - PAI.paradox.hardware.panel - Updating Labels from Panel
stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.