Yes that’s exactly what the emulated zones are for. You can use your ha motion sensors as zones.
Could you post your PCB? I’m also using a W32-ETH01, but I’m all breadboarded up and no idea how to start a PCB design.
I love to but have no idea how. The size of Gerber zip file is only 130kB but I am not allow to upload file here. I can also send schematics and related documents. It’s prepared using KiCAD 6.0.
Dear Alain,
Is it possible somehow control (interact) your code without MQTT?
Yes, use ESPHOME api
You could share via github. Just extract the contents of your zip file before you get started. If you’re unfamiliar with git, this should help: https://www.datacamp.com/tutorial/git-push-pull
@Dilbert66 Thanks for sharing this great project.
Please could you briefly explain how one would link a ha sensor to an emulated zone? In the .yaml file you have an example of how to use a physical pin on the ESP board, but what if you want to link a sensor that is linked to home assistant, but not physically to the ESP that is connected to the alarm?
From the readme:
A new service is also made available in home assistant called
esphome.<yourdscsystemname>_set_zone_fault with attributes zone and fault: zone is 2 digit zone number and fault is 0 or 1 where 1 sets a zone as open and 0 closes it. By calling this service from a home assistant function, you can enable any event, sensor, etc to trigger any one of your emulated zones in your alarm system.
@Dilbert66 Thank you for the quick reply, I missed that part in the readme, thank you for pointing me to it, and apologies for not checking thoroughly first.
I added an emulated zone (17) and set up an automation to call the service, but I can’t seem to change the state of the zone through the service. Must the zone be added to a partition first to ‘activate’ it or does it default to a specific partition?
Yes, you need to make sure the zone is assigned to an active partition and you also need to program the zone type in your panel programming.
@Dilbert66 Thank you for the advice, it works perfectly. This is such an awesome project that opens so many possibilities.
Can someone share with me the design of the ESP32 isolated circuit panel? Thanks!
@Dilbert66 One more question if you don’t mind:
I have been using the keybus interface based on an ESP8266 (D1 Mini) for a couple of weeks now and it has worked really well using the non-isolated schematic and using the exact components as shown in your “WemosD1_R2_THT_schematic.pdf”.
I then decided to get an ESP32 as an alternative so that I can use the “ESP32 only” features and just because the ESP32 is overall a more capable device.
In the .yamI file, I changed the platform and board to ESP32, changed the pin numbers, and uncommented the “ESP32 only” sections as per the comments. I left the rest of the configuration exactly as it is being used on the ESP8266.
The code compiled and installed onto the device without any problems and it immediately connected to the network while being connected to the server via USB cable.
When I connect it via 4 wires to the alarm panel, however, it does not want to connect to the WIFI network at all.
My own suspicions of what the cause may be and how I tried to rectify it:
- Wifi signal may be too weak:
- I moved my router closer to the alarm panel with no improvement.
- I disconnected the device from the alarm panel and powered it from a USB PSU in the farthest corner of the room and it connected without any problem.
- The ESP8266 has no problem connecting to the network while connected to the alarm panel in the same spot so WIFI signal should not be the problem.
- The ESP32 may draw more current than the ESP8266 and the alarm panel’s keybus power output may be too limiting for the ESP32 to properly boot:
- I moved the red and black lines directly to the panel’s backup battery and double-checked that the LM2596 outputs 5V as it should. This made no difference.
- I may have damaged the ESP32 or alarm panel during my experimenting:
- I disconnected the ESP32 from the alarm panel and powered it via USB and it immediately connected to the WIFI and all entities are recognized by Home Assistant.
- I reconnected the ESP8266 to the alarm panel and I can fully control the alarm panel from Home Assistant.
At this point, I can only assume that there is a firmware or hardware change that needs to be made when migrating to an ESP32 that I have somehow missed.
Have you encountered a similar problem and/or do you perhaps know what the problem may be?
It sounds like you are not getting clean power when powering from the panel using the lm2596 which is possibly impacting wifi. I don’t know if the esp32 is more sensitive than the esp8286. I have not seen the issue but I use a MP1584EN buck boost board for power when connecting to the panel. I also bypass the 5volt input and feed 3.3volt direct to the board 3.3 input. I suggest you try powering up the esp32 from usb when connecting to the panel or try a different 5 volt converter and see if that works.
Also note that you might be also generating interference from the lm2596 which can affect wifi since it’s a switching regulator.
@Dilbert66 Thank you for the feedback, much appreciated.
I did some more testing by disconnected the LM2596, as well as the power wire from the alarm panel, and powered up the ESP from USB and it still didn’t want to connect to the WIFI.
It then became apparent that the power may not be the problem, so I took turns disconnecting each data line from the panel and powering it up. The result is that if I disconnect the green line from the panel (while keeping the yellow line connected) it connects to the WIFI immediately even when powering it through the LM2596 so it seems that there is something fishy related to GPIO21.
As far as I’m aware there aren’t any limitations that prevent the esp from booting based on the state of GPIO21, but I can be wrong.
If you can think of anything else that I can try I would appreciate your advice. Otherwise I will have to abandon the ESP32 idea. Luckily the 8266 approach still works so I’m not at a total loss.
Thanks again for all your efforts.
That’s very odd. I prefer the ESP32 and for the new branch it’s the recommended platform. The green line is the data line and that 's what reads the panel/module data and can get quite active. Are you using the “new” branch? If not, give it a try. It has quite optimized code so perhaps that will help. I have not seen the issue you have and the ESP32 is my main platform.
@Dilbert66 Yes, I have been using the new branch but in case I downloaded the wrong libraries I will start from scratch tomorrow. Maybe I’m lucky and the problem disappears :D.
As a side note. The custom Lovelace panel card is an absolute lifesaver. I have an older type LED keypad and programming the panel on that is very tedious. Now with a visual menu-based virtual keypad things just got so much more convenient. A very big thanks for adding that function.
Thank you for your time in trying to assist. I will keep experimenting and revert if I manage to solve the problem. For now I appreciate that the 8266 works correctly and I can still interface the system to Home Assistant.
I will do more testing on my end. It’s always possible that it’s code related since both wifi and my dsc code use interrupts but the issue should be a lot less noticeable on the esp32 since it’s a more powerful chip. What esp32 dev board are you using? I use a WROOM variant for my testing. Another variant is the WROVER I believe. Both are dual core.
I have been using the D1 Mini ESP32 as a replacent for the normal D1 mini 8266 as I made a custom PCB and it fits in the same socket. I have made some modifications to test both the original GPIO5 and GPIO18 for the transistor line as I thought that might be the problem but both give the same result. I believe the d1mini32 is WROOM based.
That board is perfect. I use one here as well. One thing you can try is to increase the update interval. Comment out this line (371) in dscAlarm.h by putting two forward slashes // in front. This will then allow the update interval to be the default. I forget what it is exactly. I think it’s 16ms:
set_update_interval(16);
Edit: Alternatively, instead of commenting the line, try just setting a larger value for example:
set_update_interval(32);
This sets to poll the component every 32 ms.