ESP8266 into existing alarm DSC System

Yep, worked like a charm just like that. The last update that I did was with ESPHome version 2023.9.0 and that is what is still flawlessly running on the device at the moment, so somewhere between that version and the latest version there must have been a breaking change in ESPHome.

I tried adding the variant and framework options when I encountered the recent issue, but it didn’t make a difference.

Thanks for the link. I will try the hotfix that is discussed there and see if it works.

Luckily, the board still works as it is so I’m not completely in the dark.

I think the best long term solution might be to just make a new pcb for a regular ESP32 some time which will probably avoid more potential issues in the future.

Thanks for your input, I appreciate it.

WT32-Eth-01 + Web_Keypad everything works well since 17d (project start), until i try to update project to esphome 2024.3.0

compile error ?

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
    |-- noise-c @ 0.1.4
    Compiling .pioenvs/dscalarm/src/esphome/components/api/api_connection.cpp.o
    src/esphome/components/api/api_connection.cpp: In member function ‘bool esphome::api::APIConnection::send_text_sensor_info(esphome::text_sensor::TextSensor*)’:
    src/esphome/components/api/api_connection.cpp:546:35: error: ‘class esphome::text_sensor::TextSensor’ has no member named ‘get_device_class’
    msg.device_class = text_sensor->get_device_class();
    ^~~~~~~~~~~~~~~~
    *** [.pioenvs/dscalarm/src/esphome/components/api/api_connection.cpp.o] Error 1
    ========================== [FAILED] Took 2.84 seconds ==========================

I have to update the text sensor code on the lib as there were breaking changes. I will update the code and advise when done.

Ok, compilation issue fixed. Code in both main and dev of esphome_components have been updated.

1 Like

Now i have this error (web_keypad) works before update to esphome 2024.3.0

If i remove web_keypad (comment) everything works great , another code to update ?

Compiling .pioenvs/dscalarm/src/esphome/components/web_keypad/web_server.cpp.o
src/esphome/components/web_keypad/web_server.cpp:647:45: error: expected initializer before ‘mg_connection’
void WebServer::handle_button_requeststruct mg_connection *c, void ev_data, const UrlMatch &match) {
^~~~~~~~~~~~~
src/esphome/components/web_keypad/web_server.cpp: In member function 'bool esphome::web_server::WebServer::callKeyService(const char
, int)':
src/esphome/components/web_keypad/web_server.cpp:1465:21: error: qualified-id in declaration before ‘(’ token
void WebServer::push(msgType mt, const char *data,uint32_t id,uint32_t reconnect) {
^
src/esphome/components/web_keypad/web_server.cpp:1501:58: error: a function-definition is not allowed here before ‘{’ token
struct mg_http_part *part) {
^
src/esphome/components/web_keypad/web_server.cpp:1535:25: error: qualified-id in declaration before ‘[’ token
char WebServer::matchBuf[MATCH_BUF_SIZE];
^
src/esphome/components/web_keypad/web_server.cpp:1536:30: error: qualified-id in declaration before ‘=’ token
uint8_t WebServer::matchIndex=0;
^
src/esphome/components/web_keypad/web_server.cpp:1538:27: error: qualified-id in declaration before ‘(’ token
void WebServer::ev_handler(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
^
src/esphome/components/web_keypad/web_server.cpp:1696:30: error: qualified-id in declaration before ‘(’ token
void WebServer::handleRequest(struct mg_connection *c,void *ev_data) {
^
src/esphome/components/web_keypad/web_server.cpp:1843:26: error: qualified-id in declaration before ‘(’ token
void WebServer::schedule_(std::function<void()> &&f) {
^
src/esphome/components/web_keypad/web_server.cpp:1853:33: error: qualified-id in declaration before ‘(’ token
void WebServer::report_ota_error() {
^
src/esphome/components/web_keypad/web_server.cpp:1865:29: error: qualified-id in declaration before ‘(’ token
bool WebServer::handleUpload(size_t bodylen, const String &filename, size_t index,uint8_t *data, size_t len, bool final) {
^
src/esphome/components/web_keypad/web_server.cpp:1930:1: warning: no return statement in function returning non-void [-Wreturn-type]
} // namespace web_server
^
src/esphome/components/web_keypad/web_server.cpp: At global scope:
src/esphome/components/web_keypad/web_server.cpp:1931:1: error: expected ‘}’ at end of input
} // namespace esphome
^
src/esphome/components/web_keypad/web_server.cpp:36:19: note: to match this ‘{’
namespace esphome {
^
*** [.pioenvs/dscalarm/src/esphome/components/web_keypad/web_server.cpp.o] Error 1
========================= [FAILED] Took 78.13 seconds =========================

Ahh yes, you are using dev. Change web_keypad to web_server in your yaml, add component mg_lib to the list and then add line mg_lib: to the yaml.


#location of alarm panel code.  You can use the github release version  or 
#copy the code to directory "my_components" in your main esphome directory          
external_components:
  #- source: github://Dilbert66/esphome-components@main #uncomment to use github repository
  - source:  alarm_components #uncomment to use local directory 
    components: [dsc_alarm_panel,binary_sensor,text_sensor,web_server,mg_lib] 
    refresh: 10s

mg_lib:
  
web_server:
  port: 80  
  partitions: 1
  log: true
  local: true
  config_url: https://dilbert66.github.io/config_files/config_dsc.yml
  js_url: https://dilbert66.github.io/js_files/www.js

I have moved away from using the default ESPAsyncwebserver library as used on the esphome web_server component. It has known issues with crashing with memory errors. I have migrated the web_server code to using the Mongoose.ws library for testing. Much faster and no crashing when busy.

Well, I picked up an esp32c3 super mini board to try out. For the first download you need to use a factory-bin. Using esphomeflasher will not work. You can use esphome web flasher or the tasmota one.
First step was to compile the yaml and choose manual download. Then select the “modern format”. , Upload to esphome or tasmota web app , connect and flash.

Also, the firmware will not compile correctly due to the issue with integer format so you need to apply the fix as I linked to here: api services remote_transmitter compile error esp32c3 #2 · Issue #3564 · esphome/issues · GitHub

It compiles anyhow, I havent had a chance to hook it up to my panel yet though.

Edit: Hooked it up to my panel. Everything works perfectly. FYI, I’m using the dev branch .

esphome:
  name: $name
  friendly_name: $friendlyName
  includes:
    - risc_fix.h
  platformio_options:
    board_build.extra_flags:
      - "-include \"src/risc_fix.h\""


  
esp32: 
  variant: ESP32C3  
  board: esp32-c3-devkitm-1
  framework:
    type: arduino

contents of “risc_fix.h”. Place in same directory where your yaml files are.

#ifdef __riscv

#undef __INT32_TYPE__
#define __INT32_TYPE__      int

#undef __UINT32_TYPE__
#define __UINT32_TYPE__     unsigned int

#endif // __riscv

FYI, I added this fix to the dev branch so you don’t need to add this include in the yaml if using that branch. If using master, you need to do the above.

If using the dev branch, I’ve added bidirectional support for the data line which simplifies the interface quite a bit if using one of those cheap 4 channel arduino level shifters. No circuit board needed as the lines from the panel and the esp can be wired directly to the level shifter. If using 2 mosfets , then a small circuit board will be helpful.

1 Like

Hi @Dilbert66, thank you for all the work you put into this. I struggled a bit with reading wiring diagrams and then with my network, but I now have everything wired up, I can see the logs, I can arm it, but I can’t disarm it. lol. We bought the house 6 months ago, and we weren’t given a code. I’ve tried resetting the unit, PC1864, and using every installer code I can find. It looks like the library you use can determine the current installer code, but I don’t yet understand the code well enough to know if you’ve implemented that somewhere or how hard that would be. Do you have any experience with this? Thank you.

Correct me if I am wrong, I don’t think installer code ‘unlocker’ is included in Dilbert66’s library. If you know how to use Dilbert66’s code and connect to your DSC panel, I presume you know how to flash code to a ESP8266/ESP32. I suggest you take a look at tagligentx’s code on GitHub. There is a ‘unlocker’ in the example directory that was designed for this purpose.
https://github.com/taligentx/dscKeybusInterface/tree/master/examples/esp32

1 Like

Wkchick is correct. The taligentx repository is best for using to unlock a panel. I suppose you can use my lib do this but it would require some extra code to call the services directly which I don’t provide.

1 Like

Thank you both. I didn’t realize those examples were in there. This is the first ESP thing I’ve ever done, so I barely know how to flash anything, but I think I can manage with the example provided.

This post has been a great resource to me as I was able to get the WT32-Eth01 board up and running using the PCB layout on Dilbert66’s page. Did anyone happen to create a printed case to house the setup that can be mounted outside the panel. My setup is connected down the line past a wireless receiver module that was closer to a network drop.

So far everything looks good except I’m stuck on one part and can’t find documentation on it.

My zones 1 through 6 are hardwired with wireless motion sensor on zone 7.
Problem starts where I have wireless fire alarm on 8 and wirless flood sensor on 9.
There doesn’t seem to be a device class for “fire” under binary sensor and in the partition fire alarm section it only specifies partition not zone (8) as I have it programmed on the panel.
Lastly, I don’t see an option for flood sensor.

I get the feeling I just missed something simple.

Any guidance would be greatly appreciated.
Thank You.

Use “smoke” device class for fire and “moisture” for flood. Those only for display anyhow but are close enough. The partition fire section is a separate indicator that the panel sends at partition level. Not the same as a zone indicator.

I’ve merged an update from fjpmeijers who has generously provided a python script to allow getting the installer code from a DSC panel using the mqtt protocol. See the README and associated files in the extras\crack_installer_code folder of the dev branch:

Edit: I’ve also added a couple of additional scripts that can use the ESPHOME API or the web_keypad REST API and mg_lib components from my library for unlocking instead of mqtt. See the readme for details.

Works!
Thank You.

Another toy for those interested…

1 Like

I am wondering if it is the expected behavior for the partition status to remain pending for approximately the duration of the exit delay when I disarm during this period?