Dilbert66 / esphome-vistaECP

This is an implementation of an ESPHOME custom component and ESP Library to interface directly to a Safewatch/Honeywell/Ademco Vista 15/20 alarm system using the ECP interface and very inexpensive ESP8266/ESP32 modules .
GNU Lesser General Public License v2.1
124 stars 21 forks source link

Where is the sample alarm_control_panel code is supposed to be included? #121

Open mmoraes80 opened 7 months ago

mmoraes80 commented 7 months ago

I am trying to link the alarm control panel with the code snippet but I can't figure out where the code needs to included.

Also, it seems that the new esphome version does not accept some of the keywords and only arm-away service is being pulled from the standard panel.

bmwhitetx commented 7 months ago

Short answer - files go in the www folder that is one below the folder your configuration.yaml file is in. Long answer: The readme is a little hosed due to ill-placed formatting tags and for me references an older version of HA. I use the HA OS in a virtual machine so for me if I open the File Editor add-on, then click on the folder icon in the top right (Browse Filesystem), I am in the /homeassistant folder. This is the same as /config in other methods. You will see your configuration.yaml file there as well as the home-assistant.log file. You should also see a www folder. Click to open that. That is where alarm-keypad-card.js and the *beeps.mp3 files go. You can upload them from File Editor using the Upload File button (one at a time I think). You know you're in the right folder if you see a community folder there that has subfolders of any other custom cards you have downloaded (e.g. lovelace-mushroom).

Next add the reference to the .js file. Go to Settings - Dashboards [used to be called Config - Lovelace]. Click on the three dots in the upper right and choose Resources from the dropdown (the only choice). It will display a list of files. In the lower right click the blue Add Resource button. In the URL field enter /local/alarm-keypad-card.js?id=1 and for type choose Javascript module. Click Create and restart HA.

Finally go to the Dashboard you want and click Add Card. Choose the Alarm panel card. Choose Code Editor mode. Delete any lines that are already there and then paste in all the code from the lovelace.yaml file. Note copying from Github directly always causes me grief so I paste into a notepad first and recopy. Double check the service name matches yours (e.g., the 'vistaalarm' part).

Here are the original instructions with formatting tags fixed - note they are for a previous version of HA:

I've added a sample lovelace alarm-panel card copied from the repository at https://github.com/GalaxyGateway/HA-Cards. I've customized it to work with this ESP library's services. I've also added two new text fields that will be used by the card to display the panel prompts the same way a real keypad does. To configure the card, just place the alarm-keypad-card.js and *.mp3 files into the /config/www directory of your homeassistant installation and add a new resource in your lovelace configuration pointing to /local/alarm-keypad-card.js.
Add a reference to alarm-keypad-card.js in Lovelace. There’s two way to do that:

  1. Using UI: Configuration → Lovelace Dashboards → Resources Tab → Click Plus button → Set Url as /local/alarm-keypad-card.js?id=1 → Set Resource type as JavaScript Module.
    Note: If you do not see the Resources Tab, you will need to enable Advanced Mode in your User Profile.
  2. Using YAML: Add following code to lovelace section
yaml
resources:
- url: /local/alarm-keypad-card.js?id=1
  type: module

NOTE : Every time you update this file, you will need to increase the id=xx number in the url by 1 in order to force the browser to reload it.

You can then configure the card as shown below. Just substitute your service name to your application and choose one of the two chunks.
[then the lovelace.yaml card contents are shown]

mmoraes80 commented 7 months ago

Thank you for posting. Perhaps I should've been more specific about my question.

What I meant about the alarm sample code is the yaml piece of code calling the services below:

alarm_control_panel:

The ESP yaml file does not seem to accept some of the keywords such as "panels", "safe_alarm_panel", or the service itself.

Dilbert66 commented 7 months ago

That's because it's not an ESPhome config. It's an HA config. Read up on it here: https://www.home-assistant.io/integrations/alarm_control_panel.template/

You don't need this config though if you are using the virtual keypad.

mmoraes80 commented 7 months ago

Thank you!