Bentel KYO32 Alarm System Integration

Hi everyone,
If anyone is interested I developed with ESPHome the integration of the Bentel Kyo32 Alarm System via serial port (UART).

This is my project, I hope it can be useful to some of you who use this old control unit that still does its job well.
https://github.com/lorenzo-deluca/espkyogate

If anyone wants to participate in the project go ahead and PR at will!

4 Likes

You linked to the wrong repository, https://github.com/lorenzo-deluca/espkyogate

1 Like

Sorry, fixed! :slight_smile:

Hi @lorenzo-deluca,

your project sounds what I was looking for since years, I have some questions:

can you share some example of 12V->USB converter?
any MAX3232 RS232 to TTL is ok?
I see that you used the wemos, I guess that also any ESP32 should work as well, correct?
once the ESP is connected through the serial, all the existing keypad and proximity sensor still work?
image
image
how I can check the central unit firmware?

regards

Hello @bremby :wink:
For 12V to USB you can found a lot of device like this


Yes, MAX232 it’s ok, also ESP32 should work as well, some user has already used it.

Absolutely, my system does not disturb the normal operation of keyboards and other devices! :slight_smile:

Try it and let me know! :wink:

I’m spending more time to read/learn the configuration, can you help me to understand the differences between the yaml files? espkyogate_configuration.yaml VS Kyo_Full.yaml

Please, keep me honest here.
I understand that Kyo_Full.yaml contains all the 8 areas and all the 32 zones;
but I see that something is missing in the espkyogate_configuration.yaml

 kyo32->zona_esclusa_1,
 kyo32->inserimento_parziale_ritardo_0_area_1,

 - id: zona_esclusa_1
        name: "Zona esclusa 1"
 - id: inserimento_parziale_ritardo_0_area_1
        name: "Inserimento parziale ritardo 0  area 1"
 - id: sabotaggio_bpi
      name: "Sabotaggio BPI"
 - id: sabotaggio_jam
      name: "Sabotaggio Jam"
 - id: sabotaggio_wireless
      name: "Sabotaggio wireless"

there is also a mismatch with this
Kyo_Full.yaml

        - id: stato_uscita_1
        name: "Stato uscita 1"

espkyogate_configuration.yaml

        - id: stato_uscita_1
        name: "Uscita 1"

that will create 2 different entity in HA as the name is different
regards

HI @lorenzo-deluca,

one more; I see that in the bentel_kyo32.h there is the switch for the “fake key” case:
BinarySensor *sabotaggio_chiave_falsa = new BinarySensor("Sabotaggio Chiave Falsa");

but I’m not able to find it in the ESP code, adding the following rows should be ok?

      kyo32->sabotaggio_chiave_falsa

      - id: sabotaggio_chiave_falsa
        name: "Sabotaggio Chiave Falsa"

Hello @bremby,
the two configuration files are an example,
the important thing is that you configure all the variables you want to control.
I know that I’ve to do a refactor of that part to simplify it but I never have time,
if you want to do a pull request I would be very happy! :slight_smile:

Yes, the “fake key” variable is that one (sorry for italian!)
I don’t have a key inserter so I’ve never tried that signal, if you have it and can confirm that it works I’d appreciate it.

Before wasting too much time in the configuration, have you tested that the communication with the central works?
I always recommend doing this by setting up a zone and testing that you can see the change on home assistant and the arming and disarming commands work.

Let me know if you have any problems :slight_smile:

Hi,

I just received the MAX232, and I’m now uploading the conf

Compiling /data/esp32-01/.pioenvs/esp32-01/src/main.cpp.o

In file included from src/esphome/components/sensor/sensor.h:3:0,
                 from src/esphome/core/application.h:16,
                 from src/esphome/components/api/api_connection.h:4,
                 from src/esphome.h:2,
                 from src/main.cpp:3:
src/bentel_kyo32.h: In member function 'bool Bentel_Kyo32::update_kyo_partitions()':
src/esphome/core/log.h:95:100: warning: repeated ' ' flag in format [-Wformat=]
   esp_log_printf_(ESPHOME_LOG_LEVEL_DEBUG, tag, __LINE__, ESPHOME_LOG_FORMAT(format), ##__VA_ARGS__)
                                                                                                    ^
src/esphome/core/log.h:155:28: note: in expansion of macro 'esph_log_d'
 #define ESP_LOGD(tag, ...) esph_log_d(tag, __VA_ARGS__)
                            ^
src/bentel_kyo32.h:595:5: note: in expansion of macro 'ESP_LOGD'
     ESP_LOGD("stato_uscita", "Uscita % - Stato %i", i, StatoZona);
     ^
src/esphome/core/log.h:95:100: warning: ' ' flag used with '%S' gnu_printf format [-Wformat=]
   esp_log_printf_(ESPHOME_LOG_LEVEL_DEBUG, tag, __LINE__, ESPHOME_LOG_FORMAT(format), ##__VA_ARGS__)
                                                                                                    ^
src/esphome/core/log.h:155:28: note: in expansion of macro 'esph_log_d'
 #define ESP_LOGD(tag, ...) esph_log_d(tag, __VA_ARGS__)
                            ^
src/bentel_kyo32.h:595:5: note: in expansion of macro 'ESP_LOGD'
     ESP_LOGD("stato_uscita", "Uscita % - Stato %i", i, StatoZona);
     ^
src/esphome/core/log.h:95:100: warning: format '%S' expects argument of type 'wchar_t*', but argument 5 has type 'int' [-Wformat=]
   esp_log_printf_(ESPHOME_LOG_LEVEL_DEBUG, tag, __LINE__, ESPHOME_LOG_FORMAT(format), ##__VA_ARGS__)
                                                                                                    ^
src/esphome/core/log.h:155:28: note: in expansion of macro 'esph_log_d'
 #define ESP_LOGD(tag, ...) esph_log_d(tag, __VA_ARGS__)
                            ^
src/bentel_kyo32.h:595:5: note: in expansion of macro 'ESP_LOGD'
     ESP_LOGD("stato_uscita", "Uscita % - Stato %i", i, StatoZona);
     ^
Linking /data/esp32-01/.pioenvs/esp32-01/firmware.elf

any ideas?

A typo. Replace the first % with %i.

Hi @lorenzo-deluca ,

did you ever try to load the full zone (32) with the full area (8)?
At some point the ESP becomes unresponsive and I need to reset it (flash it from a base image)
I tried a different combination, but at some point, when I add a new zone or a new area, it sounds that I exceed a limit and the ESP stops connecting to the Wi-Fi
I’m able to load only 19 Zones, 8 Areas, and 8 Exits; after that the ESP doesn’t work any more

any ideas?

copy that, after the change, it works
thank you @lcavalli

Yes, I know… but it’s only warnings, it compiles and works however :wink:

Yes, another user also reported it to me.
I had also contacted the developers of ESPHome and it is a limitation of this type of integration.
Do you have more than 19 zones?

I see
I don’t think I have more than 19 Zones to manage, but I will check.
However, I think you should put somewhere these kinds of “limits” to let people know how to manage it; especially if someone has already reported it. I spent 3hrs to test the behavior and understand the reason, it can be that some people are less devoted to that :wink:
As I said, I love it; a little more details/info can help others to manage it confidently

for my awareness, do you have more details on where is the limitation? is the number of entities that can be associated to a device in ESPHome integration?

regards

You’re right, unfortunately I haven’t had time to work on this integration.
Few weeks ago another user was brought to my attention this issue,
I investigated and even ask to esphome developers, it was not clear what the limitation was.
Fact is that after a certain number of sensors the firmware became unstable at runtime.

I recommend to start the configuration with one zone and then expand it a little at a time by integrating all the sensors. So far no one has reported any anomalies on installed systems.

To solve this problem, on the advice of the ESPHome developers, I should change the integration mode, which involves rewriting a large part of the code.
I don’t have time for that now, so I will introduce the 16-zone limit instead.

Sounds good, don’t worry; you are a good guy

Can you help me to better understand how you used the service entities; is the first time I play with it.
You shared the lovelace picture and some examples, if you don’t mind, can you share/explain how you managed it?
On the picture I see that you don’t have the numpad as this one

on the bentel keyboard today I used a code to arm/disarm, how I should do the same on the UI?

Controlling the alarm via serial link doesn’t require to provide the PIN. What does the Bentel software is to retrieve the list of all configured PINs from the alarm panel and check them with the provided one. You can implement a similar approach with the esphome device, at least for disarming the alarm.

As says @lcavalli PIN is not necessary to arm or disarm with my system.
You can however in your virtual panel on lovelace put a pin of your choice,
then calling the service as described in my documentation you can arm or disarm one or more areas.
Did you try to connect the esp to the central unit? does it work?

Hi @lorenzo-deluca ,
I’m planning the test during this week-end