Dilbert66 / esphome-vistaECP

This is an implementation of an ESPHOME custom component and ESP Library to interface directly to a Safewatch/Honeywell/Ademco Vista 15/20 alarm system using the ECP interface and very inexpensive ESP8266/ESP32 modules .
GNU Lesser General Public License v2.1
124 stars 21 forks source link

Random disconnects, from multiple times per minute to a few times per day #82

Closed jakejakejakejakejakejake closed 1 year ago

jakejakejakejakejakejake commented 1 year ago

Random disconnects, from multiple times per minute to a few times per day. This started happening once I updated to the dev branch, currently have multiple partitions set up on a vista 20p, I accidently posted this to fast and can amend as needed.

INFO Reading configuration /config/esphome/esphome-web-2af211.yaml...
INFO Detected timezone 'America/New_York'
INFO Starting log output from vistapanel-2af211.local using esphome API
INFO Successfully connected to vistapanel-2af211.local
[00:09:24][I][app:102]: ESPHome version 2022.9.4 compiled on Oct  8 2022, 23:39:47
[00:09:24][C][status_led:019]: Status LED:
[00:09:24][C][wifi:372]:   Subnet: 255.255.255.0
[00:09:24][C][wifi:374]:   DNS1: 172.16.20.1
[00:09:24][C][logger:275]: Logger:
[00:09:24][C][logger:278]:   Hardware UART: UART0
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Trouble'
[00:09:24][C][template.binary_sensor:018]:   Device Class: 'problem'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Bypass'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Away'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Armed'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Stay'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Instant'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Night'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 AC'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Chime'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Alarm'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Battery'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Fire'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Ready'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Trouble 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Bypass 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Away 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Armed 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Stay 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Instant 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Night 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 AC 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Chime 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Alarm 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Battery 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Fire 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Ready 2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Relay1'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Relay2'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Relay3'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'vistapanel-2af211 Relay4'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'r5'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'r6'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'r7'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'r8'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'r9'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'r10'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'r11'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'r12'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'r13'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'r14'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'r15'
[00:09:24][C][template.binary_sensor:018]: Template Binary Sensor 'r16'
[00:09:24][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Zone 1'
[00:09:24][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Side Door'
[00:09:24][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Zone 3'
[00:09:24][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Zone 4'
[00:09:24][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Zone 5'
[00:09:24][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Zone 6'
[00:09:24][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Zone 7'
[00:09:24][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Zone 8'
[00:09:24][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Front Door'
[00:09:24][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Back Door'
[00:09:24][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Zone 11'
[00:09:24][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Zone 12'
[00:09:25][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Zone 13'
[00:09:25][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Zone 14'
[00:09:25][C][template.text_sensor:021]:   Icon: 'mdi:alert-box'
[00:09:25][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Line1'
[00:09:25][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Line2'
[00:09:25][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Line1 2'
[00:09:25][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Line2 2'
[00:09:25][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Beeps'
[00:09:25][C][template.text_sensor:021]: Template Sensor 'vistapanel-2af211 Beeps 2'
[00:09:25][C][template.text_sensor:021]: Template Sensor 'zoneExtended'
[00:09:25][C][template.switch:058]: Template Switch 'vistapanel-2af211 Connection'
[00:09:25][C][template.switch:059]:   Restore State: NO
[00:09:25][C][restart:022]: Restart Switch 'restart_switch'
[00:09:25][C][restart:022]:   Icon: 'mdi:restart'
[00:09:25][C][mdns:100]: mDNS:
[00:09:25][C][mdns:101]:   Hostname: vistapanel-2af211
[00:09:25][C][api:138]: API Server:
[00:09:25][C][api:143]:   Using noise encryption: NO
[00:09:25][C][wifi_signal.sensor:009]: WiFi Signal 'vistapanel-2af211 WiFi'
[00:09:25][C][wifi_signal.sensor:009]:   State Class: 'measurement'
[00:09:25][C][wifi_signal.sensor:009]:   Accuracy Decimals: 0
[00:09:25][C][sntp:050]: SNTP Time:
[00:09:25][C][sntp:053]:   Server 3: '2.pool.ntp.org'
[00:09:25][I][CMD:505]: 2022-10-09 00:09  F7 00 00 07 10 08 00 1C 28 02 00 00 20 
[00:09:25][I][INFO:813]: Display to partition: 01
[00:09:25][I][INFO:834]: Prompt:   Ready to Arm  
[00:09:25][I][CMD:505]: 2022-10-09 00:09  F7 00 00 08 00 08 00 1C 08 02 00 00 2A 
[00:09:25][I][INFO:813]: Display to partition: 02
[00:09:25][I][INFO:834]: Prompt:   Ready to Arm  
[00:09:26][I][CMD:505]: 2022-10-09 00:09  F7 00 00 10 00 08 00 1C 08 02 00 00 2A 
[00:09:26][I][INFO:813]: Display to partition: 03
[00:09:26][I][INFO:834]: Prompt:   Ready to Arm  
[00:09:26][D][text_sensor:067]: 'vistapanel-2af211 Beeps': Sending state '0'
[00:09:28][D][text_sensor:067]: 'vistapanel-2af211 Zone 13': Sending state 'C'
[00:09:30][D][text_sensor:067]: 'vistapanel-2af211 Zone 8': Sending state 'C'
INFO vistapanel-2af211.local: Error while reading incoming messages: Error while reading data: 0 bytes read on a total of 1 expected bytes
INFO vistapanel-2af211.local: Ping Failed: Error while reading data: 0 bytes read on a total of 1 expected bytes
INFO Disconnected from ESPHome API for vistapanel-2af211.local
WARNING Disconnected from API
INFO Successfully connected to vistapanel-2af211.local
[00:09:45][I][CMD:505]: 2022-10-09 00:09  F7 00 00 08 00 08 00 1C 08 02 00 00 2A 
[00:09:45][I][INFO:813]: Display to partition: 02
[00:09:45][I][CMD:505]: 2022-10-09 00:09  F7 00 00 10 00 08 00 1C 08 02 00 00 2A 
[00:09:45][I][INFO:813]: Display to partition: 03
[00:09:45][I][INFO:834]: Prompt:   Ready to Arm  
[00:09:46][D][text_sensor:067]: 'vistapanel-2af211 Line2 2': Sending state '  Ready to Arm  '
[00:09:58][D][api:102]: Accepted 172.16.20.107
[00:10:01][D][api:102]: Accepted 172.16.20.107
[00:10:03][D][api.connection:917]: Home Assistant 2022.10.1 (172.16.20.107): Connected successfully
INFO vistapanel-2af211.local: Ping timed out!
INFO Disconnected from ESPHome API for vistapanel-2af211.local
WARNING Disconnected from API
INFO Successfully connected to vistapanel-2af211.local
[00:10:29][D][api:102]: Accepted 172.16.20.107
[00:10:29][D][api.connection:917]: Home Assistant 2022.10.1 (172.16.20.107): Connected successfully
INFO vistapanel-2af211.local: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer
INFO vistapanel-2af211.local: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer
INFO Disconnected from ESPHome API for vistapanel-2af211.local
WARNING Disconnected from API
INFO Successfully connected to vistapanel-2af211.local
[00:10:43][I][CMD:505]: 2022-10-09 00:10  FB 02 20 81 62 00 00 00 00 00 00 00 00 
[00:10:43][I][EXT:505]: 2022-10-09 00:10  00 24 00 DC FF FF FF 00 00 00 00 00 74 
[00:10:44][D][api:102]: Accepted 172.16.20.107
[00:10:44][D][api.connection:917]: Home Assistant 2022.10.1 (172.16.20.107): Connected successfully
INFO vistapanel-2af211.local: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer
INFO vistapanel-2af211.local: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer
INFO Disconnected from ESPHome API for vistapanel-2af211.local
WARNING Disconnected from API
INFO Successfully connected to vistapanel-2af211.local
[00:10:59][D][api:102]: Accepted 172.16.20.107
[00:10:59][D][api.connection:917]: Home Assistant 2022.10.1 (172.16.20.107): Connected successfully
INFO vistapanel-2af211.local: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer
INFO vistapanel-2af211.local: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer
INFO Disconnected from ESPHome API for vistapanel-2af211.local
WARNING Disconnected from API
INFO Successfully connected to vistapanel-2af211.local
[00:11:14][D][api:102]: Accepted 172.16.20.107
INFO vistapanel-2af211.local: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer
INFO vistapanel-2af211.local: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer
INFO Disconnected from ESPHome API for vistapanel-2af211.local
WARNING Disconnected from API
INFO Successfully connected to vistapanel-2af211.local
[00:11:27][D][api:102]: Accepted 172.16.20.107
[00:11:27][D][api.connection:917]: Home Assistant 2022.10.1 (172.16.20.107): Connected successfully
jakejakejakejakejakejake commented 1 year ago

attaching yaml

#for documentation see project at https://github.com/Dilbert66/esphome-VistaECP
substitutions:
  systemName: "vistapanel-2af211"
  accessCode: !secret access_code #Only comes into effect if needed for arming and quickarm is not set

  #assign a new virtual keypad address to each active partition using programs *190 - *196
  #and enter it below.  For unused partitions, use 0 as the keypad address.
  keypadAddr1: "18" #partition 1 virtual keypad
  keypadAddr2: "19" #partition 2 virtual keypad. Set to 0 to disable
  keypadAddr3: "20" #partition 3 virtual keypad. Set to 0 to disable

  ##esp32
  #rxPin: "22" #GPIO pin to use for data receive (yellow line) 
  #txPin: "21" #GPIO pin to use for data transmit (green line)
  #monitorPin: "18" #GPIO pin to use for monitoring module traffic such as RF or Expanders . Set to -1 to disable

  ##esp8266
  rxPin: "5" #GPIO pin to use for data receive (yellow line) 
  txPin: "4" #GPIO pin to use for data transmit (green line)
  monitorPin: "14" #GPIO pin to use for monitoring module traffic such as RF or Expanders . Set to -1 to disable

  # module addresses:
  # 07 4229 zone expander  zones 9-16
  # 08 4229 zone expander zones 17-24
  # 09 4229 zone expander zones 25-32
  # 10 4229 zone expander zones 33-40
  # 11 4229 zone expander zones 41 48
  # 12 4204 relay module  
  # 13 4204 relay module
  # 14 4204 relay module
  # 15 4204 relay module

  expanderAddr1: "0" # 1st zone expander emulator (4229) address to use . Set to 0 to disable. 
  expanderAddr2: "0" # 2nd expander emulator address to use . Set to 0 to disable. 

#
# TESTED IF TOO MANY RELAY EMULATIONS ARE TOO MUCH
#
#  relayAddr1: "12" # relay module emulation (4204) addresses. Set to 0 to disable
#  relayAddr2: "13"
#  relayAddr3: "14"
#  relayAddr4: "15"

  relayAddr1: "12" # relay module emulation (4204) addresses. Set to 0 to disable
  relayAddr2: "0"
  relayAddr3: "0"
  relayAddr4: "0"

  TTL: "10000"  # time  to live  in ms for zone/fire status before expiring;
  quickArm: "true"
  lrrSupervisor: "false" # set to true if we don't have an LRR monitoring supervisor we can emulate one to get the statuses

globals:
       #persistent storage variables
    - id: zoneStates  #persistant storage for zone states in case of reboot
      type: int
      restore_value: yes
    - id: zoneAlarms  #persistant storage for zone states in case of reboot
      type: int
      restore_value: yes
    - id: zoneBypass  #persistant storage for zone states in case of reboot
      type: int
      restore_value: yes
    - id: zoneChecks  #persistant storage for zone states in case of reboot
      type: int
      restore_value: yes      
    - id: lrrCode  #persistant storage for last lrr message in case of reboot
      type: int
      restore_value: yes      

esphome:
  name: $systemName
  #platform: ESP32
  #board: nodemcu-32s
  platform: ESP8266
  board: nodemcuv2
  arduino_version: latest

  # subdirectory where library *.h and *.cpp are placed 
  includes:
    - esphome-vistaECP/src/vistaEcpInterface/

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  power_save_mode: none

  ap:
    ssid: "$systemName"
    password: !secret wifi_password
    #encryption:
      #key: !secret encryption_key    

sensor:
  - platform: wifi_signal
    name: "$systemName WiFi"
    update_interval: 60s

logger:
  baud_rate: 115200
  level: DEBUG

api:
   #password: !secret api_password  
   #encryption:
     #key: !secret encryption_key   

ota:
   password: !secret ota_password
   safe_mode: True

status_led:
  pin:
    number: GPIO2
    #inverted: yes

time:
 - platform: sntp
   id: sntp_time        

custom_component:
- lambda: |-
    auto VistaECP = new vistaECPHome($keypadAddr1,$rxPin,$txPin,$monitorPin);
    VistaECP->partitionKeypads[1]=$keypadAddr1;
    VistaECP->partitionKeypads[2]=$keypadAddr2;
    VistaECP->partitionKeypads[3]=$keypadAddr3;
    VistaECP->accessCode="$accessCode";
    VistaECP->quickArm=$quickArm;
    VistaECP->expanderAddr1=$expanderAddr1; //zone expander
    VistaECP->expanderAddr2=$expanderAddr2;
    VistaECP->relayAddr1=$relayAddr1; //relay module 
    VistaECP->relayAddr2=$relayAddr2;
    VistaECP->relayAddr3=$relayAddr3; 
    VistaECP->relayAddr4=$relayAddr4;     
    VistaECP->lrrSupervisor=$lrrSupervisor;
    VistaECP->TTL=$TTL;
    VistaECP->debug=1;

    VistaECP->onSystemStatusChange([&](std::string statusCode,uint8_t partition) {
       switch(partition) {
         case 1: id(system_status).publish_state(statusCode);break;
         case 2: id(system_status_2).publish_state(statusCode);break;
         case 3: break;
         default: break;
       }
    });

      VistaECP->onLine1DisplayChange([&](std::string msg,uint8_t partition) {
       switch(partition) {    
         case 1: id(l1).publish_state(msg); break; //partition 1 line 1
         case 2: id(l1_2).publish_state(msg); break; //partition 2 line1
         case 3: break;
         default: break;
       }
    });  

    VistaECP->onLine2DisplayChange([&](std::string msg,uint8_t partition) {
       switch(partition) {    
         case 1: id(l2).publish_state(msg); break; //partition 1 line 2
         case 2: id(l2_2).publish_state(msg); break; //partition 2 line 2
         case 3: break;
         default: break;
       }
    }); 

    VistaECP->onBeepsChange([&](std::string beeps,uint8_t partition) {
       switch(partition) {        
          case 1: id(beep1).publish_state(beeps); break;
          case 2: id(beep1_2).publish_state(beeps); break;;
          case 3: break;
          default: break;
       }
    });
    VistaECP->onZoneExtendedStatusChange([&](std::string msg) {
       id(zoneExtended).publish_state(msg); 
    });   
    VistaECP->onStatusChange([&](sysState led,bool open,uint8_t partition) {
     switch(partition) {          
      case 1: switch(led) { //partition 1 definitions
                case sfire: id(fire).publish_state(open);break;
                case salarm: id(alarm1).publish_state(open);break;
                case strouble: id(trouble).publish_state(open);break;
                case sarmedstay: id(stay).publish_state(open);break;
                case sarmedaway: id(away).publish_state(open);break;
                case sinstant: id(instant).publish_state(open);break; 
                case sready: id(ready).publish_state(open);break; 
                case sac: id(ac).publish_state(open);break;          
                case sbypass: id(bypass).publish_state(open);break;  
                case schime: id(chime).publish_state(open);break;
                case sbat: id(bat).publish_state(open);break;
                case sarmednight: id(night).publish_state(open);break;  
                case sarmed: id(armed).publish_state(open);break;                   
                default: break;
              };break;
      case 2:  switch(led) { //partition 2 definitions
                case sfire: id(fire_2).publish_state(open);break;
                case salarm: id(alarm1_2).publish_state(open);break;
                case strouble: id(trouble_2).publish_state(open);break;
                case sarmedstay: id(stay_2).publish_state(open);break;
                case sarmedaway: id(away_2).publish_state(open);break;
                case sinstant: id(instant_2).publish_state(open);break; 
                case sready: id(ready_2).publish_state(open);break; 
                case sac: id(ac_2).publish_state(open);break;          
                case sbypass: id(bypass_2).publish_state(open);break;  
                case schime: id(chime_2).publish_state(open);break;
                case sbat: id(bat_2).publish_state(open);break;
                case sarmednight: id(night_2).publish_state(open);break;  
                case sarmed: id(armed_2).publish_state(open);break;                   
                default: break;
              };break;
      case 3: break; 
      default: break;
     }
    });

    VistaECP->onLrrMsgChange([&](std::string msg) {
        id(m1).publish_state(msg); 
    }); 

    VistaECP->onRfMsgChange([&](std::string msg) {
        id(rf1).publish_state(msg); 
    });

    VistaECP->onZoneStatusChange([&](uint8_t zone, std::string open) {
      switch (zone) {
        case 1: id(z1).publish_state(open); break;
        case 2: id(z2).publish_state(open); break;
        case 3: id(z3).publish_state(open); break;
        case 4: id(z4).publish_state(open); break;
        case 5: id(z5).publish_state(open); break;
        case 6: id(z6).publish_state(open); break;
        case 7: id(z7).publish_state(open); break;
        case 8: id(z8).publish_state(open); break;
        case 9: id(z9).publish_state(open); break;
        case 10: id(z10).publish_state(open); break;
        case 11: id(z11).publish_state(open); break;
        case 12: id(z12).publish_state(open); break;
        case 13: id(z13).publish_state(open); break;
        case 14: id(z14).publish_state(open); break;

      }
    }); //you can add more zones above . Also add the text sensor entry below

    VistaECP->onRelayStatusChange([&](uint8_t addr,uint8_t zone,bool open) {
     switch(addr) {
     case 12: switch (zone) {
                case 1: id(r1).publish_state(open); break;
                case 2: id(r2).publish_state(open); break;
                case 3: id(r3).publish_state(open); break;
                case 4: id(r4).publish_state(open); break;
                case 5: id(r5).publish_state(open); break;
                case 6: id(r6).publish_state(open); break;
                case 7: id(r7).publish_state(open); break;
                case 8: id(r8).publish_state(open); break;
                case 9: id(r9).publish_state(open); break;
                case 10: id(r10).publish_state(open); break;
                case 11: id(r11).publish_state(open); break;
                case 12: id(r12).publish_state(open); break;
                case 13: id(r13).publish_state(open); break;
                case 14: id(r14).publish_state(open); break;
                case 15: id(r15).publish_state(open); break;
                case 16: id(r16).publish_state(open); break;
              }
              break;
      case 13: break;
      }
    });  //add as many case and switch statements as needed to control your binary sensor outputs      
    return {VistaECP};

binary_sensor:
 #- platform: gpio  #example use of pin d8 as a zone trigger port for the emulated zone expander
  #  pin: D8
  #  id: pind8
  #  device_class: window
   # on_press:       #zone,on/off
   #   - lambda: |-
   #       vista.setExpFault(17,1); 
  #  on_release:
  #    - lambda: |-
   #       vista.setExpFault(17,0);  

    #system status indicator definitions
  - platform: template
    id: trouble
    name: "$systemName Trouble"
    device_class: problem    

  - platform: template
    id: bypass
    name: "$systemName Bypass"

  - platform: template
    id: away
    name: "$systemName Away"

  - platform: template
    id: armed
    name: "$systemName Armed"    

  - platform: template
    id: stay
    name: "$systemName Stay"

  - platform: template
    id: instant
    name: "$systemName Instant"

  - platform: template
    id: night
    name: "$systemName Night"

  - platform: template
    id: ac
    name: "$systemName AC"
    device_class: plug  

  - platform: template
    id: chime
    name: "$systemName Chime"

  - platform: template
    id: alarm1
    name: "$systemName Alarm"

  - platform: template
    id: bat
    name: "$systemName Battery"
    device_class: problem

  - platform: template
    id: fire
    device_class: smoke
    name: "$systemName Fire"

  - platform: template
    id: ready
    name: "$systemName Ready"
    #device_class: problem

##partition 2
  - platform: template
    id: trouble_2
    name: "$systemName Trouble 2"
    device_class: problem

  - platform: template
    id: bypass_2
    name: "$systemName Bypass 2"

  - platform: template
    id: away_2
    name: "$systemName Away 2"

  - platform: template
    id: armed_2
    name: "$systemName Armed 2"    

  - platform: template
    id: stay_2
    name: "$systemName Stay 2"

  - platform: template
    id: instant_2
    name: "$systemName Instant 2"

  - platform: template
    id: night_2
    name: "$systemName Night 2"

  - platform: template
    id: ac_2
    name: "$systemName AC 2"
    device_class: plug  

  - platform: template
    id: chime_2
    name: "$systemName Chime 2"

  - platform: template
    id: alarm1_2
    name: "$systemName Alarm 2"

  - platform: template
    id: bat_2
    name: "$systemName Battery 2"
    device_class: problem

  - platform: template
    id: fire_2
    device_class: smoke
    name: "$systemName Fire 2"

  - platform: template
    id: ready_2
    name: "$systemName Ready 2"
    #device_class: problem
## end partition 2    

    #relay module channels add as many as you need.  To hide, comment out the name: attribute
  - platform: template
    id: r1
    name: "$systemName Relay1"

  - platform: template
    id: r2
    name: "$systemName Relay2"   

  - platform: template
    id: r3
    name: "$systemName Relay3"   

  - platform: template
    id: r4
    name: "$systemName Relay4"   

  - platform: template
    id: r5
 #   name: "$systemName Relay5"   

  - platform: template
    id: r6
 #   name: "$systemName Relay6"   

  - platform: template
    id: r7
 #   name: "$systemName Relay7"   

  - platform: template
    id: r8
 #  name: "$systemName Relay8"   

  - platform: template
    id: r9
 #  name: "$systemName Relay9"   

  - platform: template
    id: r10
 #  name: "$systemName Relay10"   

  - platform: template
    id: r11
 #  name: "$systemName Relay11"   

  - platform: template
    id: r12
 #  name: "$systemName Relay12"   

  - platform: template
    id: r13
 #  name: "$systemName Relay13"   

  - platform: template
    id: r14
 #  name: "$systemName Relay14"   

  - platform: template
    id: r15
 #  name: "$systemName Relay15"   

  - platform: template
    id: r16
 #  name: "$systemName Relay16"   

    #zone definitions.  Add more (also add to the switch statment above). To hide, comment out the name: attribute
text_sensor:
    #zone definitions
  - platform: template
    id: z1
    name: "$systemName Zone 1"

  - platform: template
    id: z2
    name: "$systemName Side Door"

  - platform: template
    id: z3
    name: "$systemName Zone 3"

  - platform: template
    id: z4
    name: "$systemName Zone 4"

  - platform: template
    id: z5
    name: "$systemName Zone 5"

  - platform: template
    id: z6
    name: "$systemName Zone 6"

  - platform: template
    id: z7
    name: "$systemName Zone 7"

  - platform: template
    id: z8
    name: "$systemName Zone 8"

  - platform: template
    id: z9
    name: "$systemName Front Door"

  - platform: template
    id: z10
    name: "$systemName Back Door"

  - platform: template
    id: z11
    name: "$systemName Zone 11"

  - platform: template
    id: z12
    name: "$systemName Zone 12"

  - platform: template
    id: z13
    name: "$systemName Zone 13"

  - platform: template
    id: z14
    name: "$systemName Zone 14"

  #system status 
  - platform: template
    id: system_status
    name: "$systemName System Status 1"
    icon: "mdi:shield"

  - platform: template
    id: system_status_2
    name: "$systemName System Status 2"
    icon: "mdi:shield"    

  - platform: template
    id: m1
    name: "$systemName Lrr Msg"
    icon: "mdi:alert-box"

  - platform: template
    id: rf1
    name: "$systemName RF Msg"
    icon: "mdi:alert-box"    

  - platform: template
    id: l1
    name: "$systemName Line1"

  - platform: template
    id: l2
    name: "$systemName Line2"

  - platform: template
    id: l1_2
    name: "$systemName Line1 2"

  - platform: template
    id: l2_2
    name: "$systemName Line2 2"

  - platform: template
    id: beep1
    name: "$systemName Beeps"    

  - platform: template
    id: beep1_2
    name: "$systemName Beeps 2"   

  - platform: template
    id: zoneExtended
    #name: "$systemName Zone Status" 

switch:
  - platform: template
    name: "$systemName Connection"
    id: connection_status_switch
    lambda: |-
      return vista.keybusConnected;
    icon: "mdi:shield-link-variant"
    turn_on_action:
      - switch.toggle: restart_switch
    turn_off_action:
      - lambda: |-
          disconnectVista();
  - platform: restart
    id: restart_switch
Dilbert66 commented 1 year ago

The best way really to debug what is going on is if you have a laptop or computer that you can connect to the esp usb port. You can then run epshome dashboard, select log, select connected to this computer. You can then capture the serial logs. The esp is possibly rebooting due to a bug somewhere. That should give an idea where it fails.

At this point its hard to know what the issue could be. Sounds like a firmware bug but I need more info. I don't see any issues with your config.

Dilbert66 commented 1 year ago

I'll have to setup an esp8266 to test the code again. I usually develop with an esp32 nowadays.

Edit: Ok, I setup my esp8266 and did notice a crash. Looking into it..

Dilbert66 commented 1 year ago

Ok, looks like your getting out of memory errors. The dev branch uses a bit more ram and the esp8266 is tight on that. I'll try and see if I can optimise the code better. This is one reason I've moved on to the esp32. It's a much more powerful and versatile platform compared to the esp8266.

jakejakejakejakejakejake commented 1 year ago

Acknowledged, I'll see if I can source a esp32 and move to that (or get my hands dirty and try to contribute). Really great work!

jakejakejakejakejakejake commented 1 year ago

Changed to esp32 a while ago, have not run out memory since.