ESP8266 into existing alarm DSC System

Have a look at this:

alarm_control_panel:
  - platform: template
    panels:
      safe_alarm_panel:
        name: "Alarm Panel"
        value_template: "{{states('sensor.dscalarm_partition_1_status')}}"
        code_arm_required: false
        
        arm_away:
          - service: esphome.dscalarm_alarm_arm_away
                  
        arm_home:
          - service: esphome.dscalarm_alarm_arm_home
          
        arm_night:
          - service: esphome.dscalarm_alarm_arm_night
            data_template:
              code: '{{code}}' #if you didnt set it in the yaml, then send the code here
          
        disarm:
          - service: esphome.dscalarm_alarm_disarm
            data_template:
              code: '{{code}}'                    

That needs to go into your configuration.yaml. Change the service/value template to what you might have called yours. Then you need to create a card with the alarm panel card.

2 Likes

[SOLVED]

Very thanks, i have the alarm control panel working successfully using your code but only recieves and send data from ā€œAlarm Panel Cardā€ if i press a key in the real DSC keypad or if i send a key using esphome service ā€œesphome.alarma_dsc_alarm_keypressā€.

When i do this, recieve an status message ā€œ01: Readyā€ for only 25 seconds and i can to use the Alarm Panel Card from Lovelace but then go unavaliable again and i cant to communicate using the ā€œAlarm Panel Cardā€. The esphome service communicates ok with the alarm even if Partition 1 says unavaliable.

Here are the logs, in this case i send it a ā€œ###ā€ command via esphome.alarma_dsc_alarm_keypress service.

[15:52:20][C][logger:189]: Logger:
[15:52:20][C][logger:190]:   Level: VERBOSE
[15:52:20][C][logger:191]:   Log Baud Rate: 0
[15:52:20][C][logger:192]:   Hardware UART: UART0
[15:52:20][C][restart:021]: Restart Switch 'restart_switch'
[15:52:20][C][restart:021]:   Icon: 'mdi:restart'
[15:52:20][C][captive_portal:148]: Captive Portal:
[15:52:20][C][ota:029]: Over-The-Air Updates:
[15:52:20][C][ota:030]:   Address: alarma-dsc.local:3232
[15:52:20][C][ota:032]:   Using Password.
[15:52:20][C][api:095]: API Server:
[15:52:20][C][api:096]:   Address: alarma-dsc.local:6053
[15:52:26][D][Debug:126]: Writing keys: ###
[15:52:27][D][Debug22:247]: Panel command data: 05,00,85,01,00,C7,00,C7,00,C7
[15:52:27][D][Debug33:254]: Partition data 00: 85,01,00,00,00,00,00,00,00,01,01,00,00
[15:52:27][D][text_sensor:015]: 'dscalarm Partition 1 Msg ': Sending state '01: Ready'
[15:52:27][D][text_sensor:015]: 'dscalarm Partition 1 Status ': Sending state 'disarmed'
[15:52:32][D][Debug22:247]: Panel command data: A5,00,20,32,31,A0,00,00,C8,00
[15:52:32][D][Debug33:254]: Partition data 00: 85,01,00,00,00,00,00,00,00,00,01,00,00
[15:52:52][D][Debug22:247]: Panel command data: 05,00,85,40,00,C7,00,C7,00,C7
[15:52:52][D][Debug33:254]: Partition data 00: 85,40,00,00,00,00,00,00,00,01,00,00,00
[15:52:52][D][text_sensor:015]: 'dscalarm Partition 1 Msg ': Sending state '40: Keypad blanked'
[15:52:52][D][text_sensor:015]: 'dscalarm Partition 1 Status ': Sending state 'unavailable'
[15:56:31][D][Debug22:247]: Panel command data: A5,00,20,32,31,B0,00,00,D8,00
[15:56:32][D][Debug33:254]: Partition data 00: 85,40,00,00,00,00,00,00,00,00,00,00,00

ĀæMay be a problem with the alarm installation and configuration? I think that the technician who make the installation a few years ago wasnt an expert in DSC Alarm because he installed me resistors in all the zones (including the zones that i dont use).

UPDATE2: Was a config issue from the DSC 1832 board, the configs 3 and 6 must to be off in [019] menu options (i think that the installer wanted to save energy)

Would say that the config might have an issue somewhere, as you mentioned. I copied/paste as shown on github and worked for me after editing the device name.

Ignorant question would this project work with a DSC Classic pc1565?

The original dsc development branch library does support that system with an MQTT example but my esphome implementation does not.

Iā€™m configuring the DscAlarm.yaml file and there are some vars that Iā€™ve no idea what they are, I didnā€™t find it on the documentation.

  • substitutions ā†’ accessCode
  • ota ā†’ password
  • api ā†’ password

What do I have to put on those vars?

ota is an ESPhome password that allows access if your system goes into a boot loop.
api is the api password that esphome uses to connect to your device for upload/monitoring
Check into the ESPHOMe configuration documenation for those.

The accessCode variable is where you can put your panel password if you want allow the system to autmatically enter your password for certain modes such as arming night mode if you didnt provide it. Optional.

Thanks for your quick response, Iā€™m going to start from the beginning and read the ESPHome documentation.

I have been following this DSC Alarm integration (Dilbert66), bought all the bits, connected it with USB power and everything worked great, notification of zones, arming, disarming etc. It is an awesome project. Great intro to my first ESP device.

Over the weekend I decided to swop the USB power out for a buck converter (set to 5.5v). Everything powers up but I think I must have damaged/disconnected something in the setup along the way. My alarm still works perfectly with my Olarm app and DSC key panel, but nothing comes through to HA unless I disconnect the wire connected on to the NPN transistor on pin 3. Then everything works as per normal, except the arm, disarm etc.

Any advice on what to redo or replace? I have replaced the transistor as well as the 1K ohm resistor with no luck.
Maybe worth trying to use a different pin on my ESP32? I am currently using pin GPIO18/D18 for the green return as recommended.

Definitively sounds like you have a wiring issue or a damaged part somewhere that keeps your transistor turned on all the time. i really canā€™t say what it could be. I suggest you double check all connections. Does disconnecting gpio18 from the resistor fix the issue? Can you put a meter on gpio18 and see if it is stuck high? It should normally be low unless sending. If so, yes, try a different gpio pin like 17/19/23, etc

Thank you for your reply.

I think you are correct about the Green Out sending constant signal, alternatively I think that the Green In might have been sending incorrectly too.

I changed pins around a bit and got it working albeit not getting most of the motion alerts and when I do get motion alerts, I donā€™t always get the clear event. But I could arm and disarm the alarm etc.

I got another ESP32 although a 34 pin this time. Iā€™ve managed to get it working but the alerts are also missing some and not always clearing. Arm, disarm etc is working. I thought it might be low power, so I connected the USB power bank again and still not getting frequent alerts like I am getting in my Olarm app. Olarm is getting all motion alerts in the app but not HA.

I have bought a breadboard to clean up the mess of wiring I have. I hope that the rewiring and setup will get it back to what it was in the beginning when everything was seamless. I have tested all resistors, the transistor and checked wiring and everything is as expected, except the missed events.

Any noise or misconfiguration on the lines will cause missed data as you know iā€™m sure. I assume you donā€™t have access to an oscilloscope? Even a cheap pc based one? That will definitively help identify your issue.

Hi PipeDeveloper,

Really amazing job done! congratulations.
Just by chance, do you have printed circuit for ESP32 too?

Thank you,

I am very new to this and learning like crazy. I donā€™t have access to an oscilloscope.

Iā€™ve redone everything into a breadboard and it is once again working like a dream. There must have been a loose connection or something as Iā€™ve reused almost all the parts from before.

Thank you for your help and this awesome project!

Hello @miriumar , I could design a PCB for ESP32 on the weekend. Stay alert on the github pull request.

[SOLVED]

Hi again. I am trying to compile from master branch, using latest pip esphome (Version: 2021.10.3) from command line in my Linux, and I am getting some errors:

In file included from src/main.cpp:62:0:
src/dscAlarm.h:21:71: error: expected class-name before '{' token
 class DSCkeybushome : public PollingComponent, public CustomAPIDevice {
                                                                       ^
In file included from src/main.cpp:62:0:
src/dscAlarm.h: In member function 'virtual void DSCkeybushome::setup()':
src/dscAlarm.h:71:101: error: 'register_service' was not declared in this scope
     register_service(&DSCkeybushome::set_alarm_state,"set_alarm_state", {"partition","state","code"});

Not sure if it is a mistake in the process I am performing, or related to being in latest version. Maybe an incompatibility using core libraries or the way namespaces are defined?

Thanks in advance!

Compiles fine here. Just tried. Not sure what the issue would be.

do we have same esp version? Are you using the HA supervisor add on ?

I use the latest epshome ha add on as well as windows command line with Python 38 installed and the lastest platformio. Both compile the application fine.
Perhaps itā€™s an issue with linefeeds in files, etc. I really canā€™t say. It seems that your platform is having an issue reading the files correctly.

OK, that could be it. I will report later if I fixed it. Thanks!