dscKeybusInterface
dscKeybusInterface copied to clipboard
Errors compiling using ESPHOME addon in Home Assistant OS
Firstly, thanks for all work put in to the projects! I'm a bit of a novice but I've been working on taligentx's implementation for my DSC PC3000 (classic) panel. I was able to get Dilbert66's code working (likely because it uses the external components feature to fetch everything) but that project doesn't support classic panels. I'm getting compile errors in ESPHome that I think are related to the files I've added to my dscKeybusInterface directory within ESPHome. I added dscAlarm.h from the extras repo and then everything from the SRC folder. The other thing is that I get an error where the pins are not defined and it suggests new pins but I dont know where to configure the pins i'm using on my ESP32 board.
esphome/dscKeybusInterface folder that my .yaml includes
my .yaml
#for documentation see project at https://github.com/Dilbert66/esphome-dsckeybus
substitutions: accessCode: !secret access_code #Only comes into effect if a password prompt occurs when arming eg. night mode name: "dscalarm" #unique network name friendly_name: "DSC Alarm" #friendly name for this device panelId: DSCAlarm #used as the service variable name.
esphome: name: ${name} friendly_name: ${friendly_name} min_version: 2024.6.0 name_add_mac_suffix: false project: name: esphome.web version: dev
includes: - dscKeybusInterface/
esp32: board: esp32dev framework: type: arduino
wifi: ssid: !secret wifi_ssid password: !secret wifi_password use_address: 192.168.2.122
ap: ssid: "DSCalarm" password: !secret wifi_password
logger: baud_rate: 0 level: verbose
api:
ota:
- platform: esphome
custom_component:
lambda: |- auto DSCkeybus = new DSCkeybushome();
DSCkeybus->accessCode="$accessCode"; DSCkeybus->debug=0; // 0 = off, 1 = status change data, 2 = + 05/27 packets, 3 = + all packets received
DSCkeybus->onSystemStatusChange([&](std::string statusCode) { id(system_status).publish_state(statusCode); }); DSCkeybus->onPartitionStatusChange([&](uint8_t partition,std::string statusCode) { switch(partition) { case 1: id(p1).publish_state(statusCode); break; case 2: id(p2).publish_state(statusCode); break; } }); DSCkeybus->onPartitionMsgChange([&](uint8_t partition,std::string msg) { switch(partition) { case 1: id(m1).publish_state(msg); break; case 2: id(m2).publish_state(msg); break; } }); DSCkeybus->onTroubleStatusChange([&](bool open) { id(t1).publish_state(open); }); DSCkeybus->onFireStatusChange([&](uint8_t partition, bool open) { switch (partition) { case 1: id(f1).publish_state(open); break; } }); DSCkeybus->onZoneStatusChange([&](uint8_t zone, bool 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; } }); DSCkeybus->onZoneAlarmChange([&](uint8_t zone, bool open) { switch (zone) { case 1: id(za1).publish_state(open); break; case 2: id(za2).publish_state(open); break; case 3: id(za3).publish_state(open); break; case 4: id(za4).publish_state(open); break; case 5: id(za5).publish_state(open); break; case 6: id(za6).publish_state(open); break; case 7: id(za7).publish_state(open); break; case 8: id(za8).publish_state(open); break; case 9: id(za9).publish_state(open); break; case 10: id(za10).publish_state(open); break; case 11: id(za11).publish_state(open); break; } }); return {DSCkeybus};
binary_sensor: #zone status
platform: template id: z1 name: "Zone Front door" device_class: door
platform: template id: z2 name: "Zone Garage door" device_class: door
platform: template id: z3 name: "Zone Back door" device_class: door
platform: template id: z4 name: "Zone Living room window" device_class: window
platform: template id: z5 name: "Zone Dining room window" device_class: window
platform: template id: z6 name: "Zone Family room window LF" device_class: window
platform: template id: z7 name: "Zone Family room window RF" device_class: window
platform: template id: z8 name: "Zone Basement windows" device_class: window
platform: template id: z9 name: "Zone Upstairs motion" device_class: motion
platform: template id: z10 name: "Zone Basement motion" device_class: motion
platform: template id: z11 name: "Zone Main floor motion" device_class: motion
#zone alarm status
platform: template id: za1 name: "Zone Front door alarm" #device_class: safety
platform: template id: za2 name: "Zone Garage door alarm" #device_class: safety
platform: template id: za3 name: "Zone Back door alarm" #device_class: safety
platform: template id: za4 name: "Zone Living room window alarm" #device_class: safety
platform: template id: za5 name: "Zone Dining room window alarm" #device_class: safety
platform: template id: za6 name: "Zone Family room window LF alarm" #device_class: safety
platform: template id: za7 name: "Zone Family room window RF alarm" #device_class: safety
platform: template id: za8 name: "Zone Basement windows alarm" #device_class: safety
platform: template id: za9 name: "Zone Upstairs motion alarm" #device_class: safety
platform: template id: za10 name: "Zone Basement motion alarm" #device_class: safety
platform: template id: za11 name: "Zone Main floor motion alarm" #device_class: safety
platform: template id: t1 name: "DSCAlarm Trouble Status" device_class: problem
platform: template id: f1 device_class: safety name: "DSCAlarm Partition1 Fire Status"
text_sensor:
- platform: template id: system_status name: "DSCAlarm System Status" icon: "mdi:shield"
- platform: template id: p1 name: "DSCAlarm Partition 1 Status " icon: "mdi:shield"
- platform: template id: p2 name: "DSCAlarm Partition 2 Status " icon: "mdi:shield"
- platform: template id: m1 name: "DSCAlarm Partition 1 Msg " icon: "mdi:alert-box"
- platform: template id: m2 name: "DSCAlarm Partition 2 Msg " icon: "mdi:alert-box"
switch:
- platform: template name: "DSCAlarm Connection" id: connection_status_switch lambda: |- return dsc.keybusConnected; icon: "mdi:shield-link-variant" turn_on_action:
- switch.toggle: restart_switch turn_off_action:
- lambda: |- disconnectKeybus();
- platform: restart id: restart_switch
The errors when I compile
INFO ESPHome 2024.8.3 INFO Reading configuration /config/esphome/esphome-web-339449.yaml... INFO Generating C++ source... INFO Compiling app... Processing dscalarm (board: esp32dev; framework: arduino; platform: platformio/[email protected])
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5 Dependency Graph |-- WiFi @ 2.0.0 |-- ESPmDNS @ 2.0.0 |-- Update @ 2.0.0 Compiling .pioenvs/dscalarm/src/main.cpp.o In file included from src/dscKeybusInterface.h:163, from src/dscAlarm.h:2, from src/main.cpp:60: src/dscKeybus.h:36:12: error: redefinition of 'const byte dscPartitions' const byte dscPartitions = 8; ^~~~~~~~~~~~~ In file included from src/main.cpp:59: src/dscClassic.h:25:12: note: 'const byte dscPartitions' previously defined here const byte dscPartitions = 1; // Maximum number of partitions - requires 19 bytes of memory per partition ^~~~~~~~~~~~~ In file included from src/dscKeybusInterface.h:163, from src/dscAlarm.h:2, from src/main.cpp:60: src/dscKeybus.h:37:12: error: redefinition of 'const byte dscZones' const byte dscZones = 8; ^~~~~~~~ In file included from src/main.cpp:59: src/dscClassic.h:26:12: note: 'const byte dscZones' previously defined here const byte dscZones = 1; // Maximum number of zone groups, 8 zones per group - requires 6 bytes of memory per zone group ^~~~~~~~ In file included from src/dscKeybusInterface.h:163, from src/dscAlarm.h:2, from src/main.cpp:60: src/dscKeybus.h:38:22: error: redefinition of 'const byte dscBufferSize' const DRAM_ATTR byte dscBufferSize = 50; ^~~~~~~~~~~~~ In file included from src/main.cpp:59: src/dscClassic.h:34:22: note: 'const byte dscBufferSize' previously defined here const DRAM_ATTR byte dscBufferSize = 50; ^~~~~~~~~~~~~ In file included from src/dscKeybusInterface.h:163, from src/dscAlarm.h:2, from src/main.cpp:60: src/dscKeybus.h:39:22: error: redefinition of 'const byte dscReadSize' const DRAM_ATTR byte dscReadSize = 16; ^~~~~~~~~~~ In file included from src/main.cpp:59: src/dscClassic.h:27:12: note: 'const byte dscReadSize' previously defined here const byte dscReadSize = 2; // Maximum bytes of a Keybus command ^~~~~~~~~~~ In file included from src/main.cpp:60: src/dscAlarm.h:5:21: error: 'D1' was not declared in this scope #define dscClockPin D1 // esp8266: D1, D2, D8 (GPIO 5, 4, 15) ^~ src/dscAlarm.h:9:24: note: in expansion of macro 'dscClockPin' dscKeybusInterface dsc(dscClockPin, dscReadPin, dscWritePin); ^~~~~~~~~~~ src/dscAlarm.h:5:21: note: suggested alternative: 'm1' #define dscClockPin D1 // esp8266: D1, D2, D8 (GPIO 5, 4, 15) ^~ src/dscAlarm.h:9:24: note: in expansion of macro 'dscClockPin' dscKeybusInterface dsc(dscClockPin, dscReadPin, dscWritePin); ^~~~~~~~~~~ src/dscAlarm.h:6:20: error: 'D2' was not declared in this scope #define dscReadPin D2 // esp8266: D1, D2, D8 (GPIO 5, 4, 15) ^~ src/dscAlarm.h:9:37: note: in expansion of macro 'dscReadPin' dscKeybusInterface dsc(dscClockPin, dscReadPin, dscWritePin); ^~~~~~~~~~ src/dscAlarm.h:6:20: note: suggested alternative: 'm2' #define dscReadPin D2 // esp8266: D1, D2, D8 (GPIO 5, 4, 15) ^~ src/dscAlarm.h:9:37: note: in expansion of macro 'dscReadPin' dscKeybusInterface dsc(dscClockPin, dscReadPin, dscWritePin); ^~~~~~~~~~ src/dscAlarm.h:7:21: error: 'D8' was not declared in this scope #define dscWritePin D8 // esp8266: D1, D2, D8 (GPIO 5, 4, 15) ^~ src/dscAlarm.h:9:49: note: in expansion of macro 'dscWritePin' dscKeybusInterface dsc(dscClockPin, dscReadPin, dscWritePin); ^~~~~~~~~~~ src/dscAlarm.h:7:21: note: suggested alternative: 'z8' #define dscWritePin D8 // esp8266: D1, D2, D8 (GPIO 5, 4, 15) ^~ src/dscAlarm.h:9:49: note: in expansion of macro 'dscWritePin' dscKeybusInterface dsc(dscClockPin, dscReadPin, dscWritePin); ^~~~~~~~~~~ In file included from src/main.cpp:62: src/dscKeypad.h:28:12: error: redefinition of 'const byte dscBufferSize' const byte dscBufferSize = 50; ^~~~~~~~~~~~~ In file included from src/main.cpp:59: src/dscClassic.h:34:22: note: 'const byte dscBufferSize' previously defined here const DRAM_ATTR byte dscBufferSize = 50; ^~~~~~~~~~~~~ In file included from src/main.cpp:62: src/dscKeypad.h:30:12: error: redefinition of 'const byte dscReadSize' const byte dscReadSize = 16; // Maximum bytes of a Keybus command ^~~~~~~~~~~ In file included from src/main.cpp:59: src/dscClassic.h:27:12: note: 'const byte dscReadSize' previously defined here const byte dscReadSize = 2; // Maximum bytes of a Keybus command ^~~~~~~~~~~ In file included from src/main.cpp:63: src/dscClassicKeypad.h:28:12: error: redefinition of 'const byte dscBufferSize' const byte dscBufferSize = 50; ^~~~~~~~~~~~~ In file included from src/main.cpp:59: src/dscClassic.h:34:22: note: 'const byte dscBufferSize' previously defined here const DRAM_ATTR byte dscBufferSize = 50; ^~~~~~~~~~~~~ In file included from src/main.cpp:63: src/dscClassicKeypad.h:30:12: error: redefinition of 'const byte dscReadSize' const byte dscReadSize = 2; // Maximum bytes of a Keybus command ^~~~~~~~~~~ In file included from src/main.cpp:59: src/dscClassic.h:27:12: note: 'const byte dscReadSize' previously defined here const byte dscReadSize = 2; // Maximum bytes of a Keybus command ^~~~~~~~~~~ In file included from src/main.cpp:63: src/dscClassicKeypad.h:32:6: error: multiple definition of 'enum Light' enum Light {off, on, blink}; // Custom values for keypad lights status ^~~~~ In file included from src/main.cpp:62: src/dscKeypad.h:32:6: note: previous definition here enum Light {off, on, blink}; // Custom values for keypad lights status ^~~~~ *** [.pioenvs/dscalarm/src/main.cpp.o] Error 1 ========================== [FAILED] Took 3.51 seconds ==========================