Closed jakejakejakejakejakejake closed 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
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.
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..
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.
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!
Changed to esp32 a while ago, have not run out memory since.
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.