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
351 stars 94 forks source link

Interface with Arduino Uno and W5100 from ESP32 telnet source code #214

Open proasnet opened 3 years ago

proasnet commented 3 years ago

Hi yozik04 Now I trying telnet interface with Arduino Uno and W5100 shield for EVOHD connection. Have you yourself working no wirelles project for direct ethernet connection, which I can not edit current settings in HA PAI? Now, I am using ESP connection, I thing that Arduino Ethernet may by very similar, but If I edit code for ESP, go out all wifi functions as next code:

#include <SPI.h>
#include <Ethernet.h>
#define MAX_SRV_CLIENTS 1
byte mac[] = { 0xF0, 0x08, 0xD1, 0xC5, 0xC7, 0x2C };
#define MAX_SRV_CLIENTS 1
EthernetServer server(23);
EthernetClient serverClients[MAX_SRV_CLIENTS];

void setup() {
  Serial.begin(57600);
  Ethernet.begin(mac);
  server.begin();
}

void loop() {
  uint8_t i;
  //  EthernetClient client = server.available();

  //check clients for data - funguje dobře
  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();
      break;
    }
  }
  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 {
    for (i = 0; i < MAX_SRV_CLIENTS; i++) {
      if (serverClients[i]) serverClients[i].stop();
    }
    delay(1000);
  }
}

Then no working. Data goes only one direct... Very Thanks

yozik04 commented 3 years ago

Hi,

  1. https://www.markdownguide.org/extended-syntax#fenced-code-blocks
  2. What you are asking?
proasnet commented 3 years ago

I am sorry for bad include code. My ask is, thay you have your own tested sketch for Arduino Uno with ethernet shield as replacement for ESP32. I have working ESP32 interface, but only for this I have one wifi AP. The better will be wired connection. I trying edit working ESP32 sketch for use with UNO. not working yet. So that I don't invent what may already exist. I tried other telnet servers for arduino, but none of them worked with PAI, probably some is special.

yozik04 commented 3 years ago

Hmm, I do not remember if anybody tried to use it with Arduino. Are you sure baud rate matches setting in panel? It should not be any special.

proasnet commented 3 years ago

Yes. I have 57600 Bauds, in panel and in the code. I found some another request here https://gitter.im/paradox-alarm-interface/community?at=5e5d1071376d882250c7be84 but your answer was link to ESP32 interface. Thank you.

montyx99 @montyx99 mar 02 2020 14:20 hello guys I'd like to ask 2 questions:

  1. my uncle can replace my EVO192 to any Spectra panel. I have a flat, with 10 sensors and 1 sirene. Is the spectra devices more reliable with the PAI? If yes, which spectra panel that you recommend to choose?
  2. is there any working solution for TTL to Ethernet devices? Such an arduino with a w5100 shield, or a ttl2lan modul? I'd like to avoid the usage of Wifi in case of communication. My flat is brand new, and I've requested a CAT6 cable to build in between my alarm box and my giganet switch.

_ Jevgeni Kiski @yozik04 mar 02 2020 14:56

I Use EVO and it is way better than any SP/MG
https://github.com/ParadoxAlarmInterface/pai/wiki/Connection-methods#serial-over-ip-esp32
dmylnka commented 2 years ago

I had made this setup for two Paradox Alarm models (SP4000/5500 and EVO48). I use an arduino mega 2560 with Ethernet Shield. Then arduino serial port is directly connected to Alarm panels.

I can post implementation for anyone who needs/wants to interconnect Paradox Alarm with PAI over Ethernet wire.

295922916_639011177844919_7119595746886632874_n 297248787_442188497853836_6051159011051769049_n

yozik04 commented 2 years ago

@dmylnka It is great! Please share! I had many requests for that.

PS: you can edit wiki and put you knowledge directly there.

Thank you!

dmylnka commented 2 years ago

@yozik04 i will collect all files (arduino code , STL 3D Print etc) and post to wiki. i am going to add some instructions as supports different serial baudrate (configurable throught Telnet CLI).

dmylnka commented 2 years ago

@yozik04 , after trying to find some time to gather all staff you can find all required files and a sort description to the following repository. https://github.com/dmylnka/Paradox-Ethernet-USB-Interface

I am going to write a more detailed description and instructions how to use.

Regards, Dimitris.

yozik04 commented 2 years ago

@dmylnka Really cool. Great work. Thank you for sharing!

dmylnka commented 1 year ago

wiki updated with ethernet usb interface to Paradox Control Panels. https://github.com/ParadoxAlarmInterface/pai/wiki/Connection-methods

yozik04 commented 1 year ago

Wow. Great write up. Thank you!

mmaccaroni commented 4 months ago

I had made this setup for two Paradox Alarm models (SP4000/5500 and EVO48). I use an arduino mega 2560 with Ethernet Shield. Then arduino serial port is directly connected to Alarm panels.

I can post implementation for anyone who needs/wants to interconnect Paradox Alarm with PAI over Ethernet wire.

295922916_639011177844919_7119595746886632874_n 297248787_442188497853836_6051159011051769049_n

So it is confirmed that this interface works with EVO48§? I am planning to build it to connect to my EVO48

dmylnka commented 4 months ago

So it is confirmed that this interface works with EVO48§? I am planning to build it to connect to my EVO48

Yes i confirm that tested with EVO48 running on latest FW. I suppose that could operate in earlier Paradox EVO48 FW.

mmaccaroni commented 4 months ago

So it is confirmed that this interface works with EVO48§? I am planning to build it to connect to my EVO48

Yes i confirm that tested with EVO48 running on latest FW. I suppose that could operate in earlier Paradox EVO48 FW.

Thanks a lot! will try to build it

mmaccaroni commented 3 months ago

So it is confirmed that this interface works with EVO48§? I am planning to build it to connect to my EVO48

Yes i confirm that tested with EVO48 running on latest FW. I suppose that could operate in earlier Paradox EVO48 FW.

It works like charm! Thanks for sharing this awesone project!

dmylnka commented 3 months ago

happy that helped you!!!