How can I leverage the additional sensors HA monitors in Alarm.com?

I’m new to HA and I must say this is an awesome forum – lots of helpful people here.

Here’s what I’d like to accomplish: I have integrated Alarm.com with HA and I can Arm/Disarm the environment with no problems.

I noticed the HA integration also monitors the window/doors/motion sensors in alarm.com.

I’ve had no success figuring out how to leverage these sensors to automate and trigger other z-wave devices. My example would be turning on a light when there’s motion from the Alarm.com sensor.

Any help figuring this out would be much appropriated.

I tried the following but getting config check errors in the automation.yaml. I’m not sure what’s missing?

- alias: Office
  trigger:
    platform: template
    value_template: "{{ alarm_control_panel.alarm_com, 'sensor_status', 'Office Motion Detector is Activated') }}"
  action:
    service: light.office_lights
    entity_id": light.office_lights

Invalid config for [automation]: extra keys not allowed @ data[‘action’][0][‘entity_id"’]. Got None invalid template (TemplateSyntaxError: unexpected ‘)’) for dictionary value @ data[‘trigger’][0][‘value_template’]. Got None

You have an errant double quote (") next to entity_id , last line of your actions.

Your template is not configured correctly. As there could be more than one state reported in sensor_status you are going to need to use the string in method. Try this for the template:

"{{ 'Office Motion Detector is Activated' in state_attr('alarm_control_panel.alarm_com', 'sensor_status') }}"

Personally I’d make a bunch of binary template sensors to match on the expected strings in sensor_status. You can then just use the binary sensors in state triggers in your automations. You also get nice feedback as you are able to see the sensors in the front end. Like this:

binary_sensor
  - platform: template
    sensors:
      office_motion_detector:
        friendly_name: Office Motion Detector
        entity_id: alarm_control_panel.alarm_com
        value_template: "{{ 'Office Motion Detector is Activated' in state_attr('alarm_control_panel.alarm_com', 'sensor_status') }}"
        device_class: motion
      master_bathroom_window:
        friendly_name: Master Bathroom Window
        entity_id: alarm_control_panel.alarm_com
        value_template: "{{ 'Master Bathroom Window is Open' in state_attr('alarm_control_panel.alarm_com', 'sensor_status') }}"
        device_class: opening

etc…

More device classes:

If you don’t have one that matches, just leave device_class: out of the sensor config.

2 Likes

Thanks for the help. I’m going to follow your suggestion and create some sensors. I’m not sure how often the ‘sensor_status’ gets updated. Is there a way to change the polling to get close to real-time updates?

I had a look at the source and I could be wrong but I don’t think the component polls, I think updates are pushed from alarm.com

@tom_l

On a separate thread I was chatting with @FlyGuy62N and @walrus_parka and we tested a sensor as well as a binary_sensor configuration. I’m not sure what the difference is.

Both options worked but I noticed there was a lag between opening and closing a sensor with both solutions.

  1. It took ~2 minutes for the UI to recognized the window being opened from a close state
  2. It took 20 seconds for the UI to recognized the window being closed from an opened state

I’m looking for a way to shorten the time for item #1

I’m new to this forum and HA so sure how to loop you into that conversation. Since you looked at the code I wanted to keep you updated on my progress.

Here’s a link to that conversation: Interpreting Alarm.com Sensor State

Any feedback would be much appreciated.

Thanks

Hey @JohnB

Those times are just gonna be what they are. Here’s what’s happening in the background…

  1. The window is opened/closed (“state event”)… tic-toc
  2. Your alarm box tells AdC’s web site about the event… tic-toc
  3. AdC queues the update for the next time your HA box logs in. … tic-toc
  4. Your HA logs in and gets the latest updates.

There could be seconds or longer between each. For my use case that we’ve been discussing, the lag doesn’t matter.

If you want it to be faster, you’ll need a local sensor that talks directly to your HA. A ZWave sensor would do it, but then you have sensors on the same physical object to do the same thing.

AlarmDecoder might work but I don’t have any time with one of those.

@FlyGuy62N

Thanks for description of what is happening in the background. I have a couple of use cases similar to yours so this solution is very helpful.

I’ll look into the other suggestions you mentioned.

Thanks @tom_l and @walrus_parka for your help as well.

Has anyone had any luck tapping in to smoke or CO sensors? As far as I know, the only way to see the sensor_status attribute if smoke or CO is detected would be to actually set it off, and that’s not exactly easy to do. I’m wondering if I can just use something like this?

value_template: "{{ 'smoke' in state_attr('alarm_control_panel.alarm_com', 'sensor_status') }}"

I don’t even really care which room detects smoke/CO. I really just want one sensor for the entire house. Thoughts?

I am having issues also here. I have intergrated ADC to the point where I can arm and disarm. I can also see the sensors status’s in developer tools. here is my yml config for one zone.

binary_sensor:
  - platform: template
    sensors:
      # Contact Sensor
        alarm_Living Room Door:
          friendly_name: "Living Room Door"
          device_class: door
          value_template: "{{ state_attr('alarm_control_panel.alarm_com', 'sensor_status')|regex_search('Living Room Door is Closed', ignorecase=True) }}"

I keep getting this error:
Invalid config for [alarm_control_panel.alarmdotcom]: [binary_sensor] is an invalid option for [alarm_control_panel.alarmdotcom]. Check: alarm_control_panel.alarmdotcom->binary_sensor. (See ?, line ?).

Can anyone see anything wrong here?

It is the name your are giving your sensor. You have uppercase and spaces. I don’t think either are allowed. Try alarm_living_room_door:.

I finally got it working