Figured I’d share the alarm.com setup for those wanting to be able to view their sensor state. I went with the split config approach for my sensors. In my configuration.yaml file I included the below.
binary_sensor: !include binary_sensors.yaml
I put all my binary sensors within a file called “binary_sensors.yaml”. One thing to note that I didn’t see documented or I perhaps wasn’t looking at the right stuff. You denote the sensor type before the !include command line. If you put the sensor type of "binary_sensor: within the binary_sensor.yaml it will fail with an error stating “Invalid config for [binary_sensor]: required key not provided @ data[‘platform’]…”
Below is an example of what I have in place in the binary_sensor.yaml file. You can simply copy a entry and edit to to reflect your sensor name in alarm.com You can change out the device_class with anything from Binary Sensor Class documentation.
- platform: template
sensors:
alarm_frontdoor:
friendly_name: "Front Door"
device_class: door
value_template: >-
{{ state_attr('alarm_control_panel.alarm_com', 'sensor_status')|regex_search('Front Door is Open', ignorecase=TRUE) }}
- platform: template
sensors:
alarm_backdoor:
friendly_name: "Back Door"
device_class: door
value_template: >-
{{ state_attr('alarm_control_panel.alarm_com', 'sensor_status')|regex_search('Back Door is Open', ignorecase=TRUE) }}
- platform: template
sensors:
alarm_smokedetector:
friendly_name: "Smoke Detector"
device_class: smoke
value_template: >-
{{ state_attr('alarm_control_panel.alarm_com', 'sensor_status')|regex_search("Smoke Detector is OK", ignorecase=TRUE) }}
Now go to your overview within HA, add an entity card, and select binary sensor/s you created.
Giving credit where its due as this was based off @FlyGuy62Npost here. but wanted something a little more simpler and easier to setup for those just starting out with HA like I am.
Edit: I’m aware of the typo, just to didn’t want to mess with uploading a corrected screenshot after the fact.
Hey thanks for this @StealthWyvern it’s exactly what i’m looking for. I followed your instructions and having trouble.
When adding your content into binary_sensors.yaml it complains with:
bad indentation of a sequence entry at line 2, column 2:
sensors:
^
Tried to space them out and all but still complains. Would appreciate some pointers, super new to this whole yaml stuff.
Out of curiosity: How is the responsiveness in the alarm.com integration?
Is it a real API with an open session or “get status once in a while”?
It’s really nice to get the alarm status, and statuses into HA, but for usage in an automation you usually need quite fast responses. Like if you have “turn on the lights when the alarm is disarmed”, then it’s nice if the lights are turned of when you eneter, not 5 minutes later
I’m asking since I’m about to buy an alarm.com based system just now.
@Dino-Tech Thanks for pointing that extra space out, I’ve since corrected. @Hashin_Maedom Sorry, I’ve been stupid busy as of lately and haven’t even had a chance to look at my Pi in ages it seems. @boneheadfraggle - There is a slight delay but nothing major, just a few seconds, and way shorter than 10 seconds. So its nothing crazy like 5 minutes.
I am in need of some help.
After reading your post and the one you referenced, I still can not get my sensor to work.
I have 30+ alarm sensors in the house. I have made a binary_sensor.yaml file and it works for all my other sensors, but will not show an open sensor.
Here is what I have in my confi.yaml
Did you ever get this issue solved? I followed the instructions, no error messages in any log, and all of my sensors are “closed”, this is not correct.
There are two parts that make this work correctly – one is the Device Class which by the example in @carltonb’s config is in good shape. The second is that the Jinga template has to evaluate to TRUE when the window/door is open or the motion sensor detects motion.
Try using the Template evaluator (Developer Tools–>Template) to evaluate your Jinga templates. Just paste in everything including the quotation marks and open the door. It should evaluate to TRUE.
Hi! Quick question — trying to create automations that trigger when the alarm is armed/disarmed.
platform: state
entity_id: alarm_control_panel.myalarmdotcom
to: armed away
from: disarmed
But when I toggle from disarmed to armed; nothing happens. Are my to and from’s correct? Thoughts on how to inspect the code to see what values are being passed around?
Hello, I know this is old and thank you for sharing the evaluator tip. I have followed all steps and my sensors report opposite of what they are.
The alarm.com website account reports sensors accurate as everything closed.
HA developer tools parses all sensor_status as closed. ex: Entry is Closed
Adding this sensor_status to developer tools returns “true”
value_template: “{{ state_attr(‘alarm_control_panel.alarm_com’, ‘sensor_status’)|regex_search(‘Entry
is Closed’, ignorecase=True) }}”
However with the following code in config.yaml, lovelace reports the sensor as Open
alarm_control_panel:
alarm_front_door:
friendly_name: "Front Door"
device_class: door
value_template: "{{ state_attr('alarm_control_panel.alarm_com', 'sensor_status')|regex_search('Entry is Closed', ignorecase=True) }}"
I can change the config.yaml to Door is Open and lovelace will report it as closed. But the sensor status will not change in lovelace as I open the door.
Sorry for the delay… traveling this week for the Holiday’s and all…
That post is definitely pretty old - old enough that when I compare what I originally wrote back then doesn’t match what it’s in my config right now.
I’m currently testing for “_________ is open” in the regex.
Kinda stepping into the middle of it here, so I’ll throw out some random stuff to see if any of it helps:
There’s a delay between when you open a door — or really do anything in Alarm.com — and when HA picks it up. It can be 30 seconds or longer sometimes.
Make sure you’re using the latest Alarmdotcom integration available in HACS.
Use Developer Tools to monitor your alarm_control_panel object’s ATTRIBUTES — specifically “sensor_state”. Open one door/window and then wait for it to change. Whatever you see in Developer Tools under the “Attributes” is what you need. For instance, right now mine looks like
… so my regex_search is “Z2 ENTRY DOORS is Open”. When it goes to “Open”, the binary sensor evaluates to “TRUE” and because it’s of the “door” class, it says “Open”.
Hope that helps and also hope Santa brought all kinds of cool gadgets to play with in HA.
Thank you, that explains it! Every guide that I read said to copy the exact state from developer tool attributes. It looks like you also took the “closed” in attributes and changed it to “open” in your regex search. That is now reporting correctly for me and yes, if I wait 45 seconds or so the status will change in lovelace.
Not very functional, but it does work and thank you for the help!
I don’t use it for anything where precise timing is needed. I have an automation that turns off the AC if a door or window is open for 5 minutes and another that checks if anything is open when we both leave the house. That sort of stuff.