Alarm.com List Index Out of Range

@aechelon, I checked again that I could login with my uid and pwd, that works and it only sees the one panel.

I put the uid and pwd direct in the configuration.yaml and commented out the secret calls.

I am getting this, though I use to at least get the status. Tried pulling from HACS again as well.

2020-03-28 10:26:40 ERROR (MainThread) [pyalarmdotcomajax.pyalarmdotcomajax] Unable to extract ajax key from Alarm.com
2020-03-28 10:26:40 ERROR (MainThread) [homeassistant.components.alarm_control_panel] Error while setting up alarmdotcomajax platform for alarm_control_panel
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/config/custom_components/alarmdotcomajax/alarm_control_panel.py", line 74, in async_setup_platform
    await alarmdotcom.async_login()
  File "/config/custom_components/alarmdotcomajax/alarm_control_panel.py", line 120, in async_login
    await self._alarm.async_login()
  File "/usr/local/lib/python3.7/site-packages/pyalarmdotcomajax/pyalarmdotcomajax.py", line 123, in async_login
    self._ajax_headers["ajaxrequestuniquekey"] = resp.cookies["afg"].value
KeyError: 'afg'

The version of HA I am running is 0.106.6 if that matters…

UPDATE: I was able to get this working by commenting everything out and starting from just the first 3 parameters @aechelon. I think the issue is I cut and paste the force_bypass, no_entry_delay and silent_alarming from the git page and there must be some hidden characters that it doesn’t like.

Did you ever get a resolution to this? I am now getting this same exact error after upgrading from 0.104 to 0.107:

Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/pyalarmdotcom/pyalarmdotcom.py”, line 188, in async_login
self.state = tree.select(self.ALARM_STATE)[0].get_text()
IndexError: list index out of range

I’ve been unable to find any other recent reports of this, nor was anything listed in breaking changes for 0.105-0.107 that I could find. I tried removing the integration in configuration.yaml, rebooting, adding back and rebooting again, but I still have the same result. Nothing else changed with my config other than the upgrade, but my alarm status is tied to a number of other automations, so I’d love to find out if someone else has experienced this and what the solution might be.

@aechelon, thanks for reply, my system connected via wifi and LTE, I am able to see with in a couple of second the sensor changes in the alarm.com app and alarm.com website, but not in home assistant developer tools section. But when I arm or disarmed on the alarm panel, I am able to see the changes with in 20 second in the home assistant.

I am getting something similar. Have verified user/pass, have commented out !secret and added directly to config to ensure… no clue:

Logger: pyalarmdotcomajax.pyalarmdotcomajax
Source: custom_components/alarmdotcomajax/alarm_control_panel.py:170
First occurred: 8:24:56 PM (315 occurrences)
Last logged: 8:28:04 PM

Error executing Arm+Stay, logging in and trying again...

UPDATE: Got it working, not entirely sure what I did but it seems to be related to some of the optional parameters. Also can’t get code to work in config… which is fine, not hard to type it in.

UPDATE 2: My idiocy… did not realize that the code parameter was separate from the code on alarm.com

I have an ethernet add on to my alarm in addition to the cellular connection and I’m in a similar boat. Sensors are very slow to update (door is usually closed before the open registers, unless a door is left open for like 30 seconds to a minute. However, Arming and disarming is darn near instantaneous.

@newlinux @Thileep, I found some references (search for pollTimeoutSeconds here, also this thread) that indicate that providers such as alarm.com may automatically disable accounts that poll too frequently.

That said, it looks like platform alarmdotcomajax inherits the scan_interval parameter from the alarm_control_panel base component.

Setting the scan_interval to 15s worked in my configuration – the update occurred within 15s of the Alarm.com app reflecting the change.

 # Alarm.com
 alarm_control_panel:
   platform: alarmdotcomajax
   username: !secret alarmdotcom_login
   password: !secret alarmdotcom_password
   scan_interval: 00:00:15

I don’t need that kind of granularity from my alarm sensors so I disabled the option after the test.

Use at your own risk!

I have tried, but it did not do anything, still same. what I see, when I open the door, the home assistant and alarm.com website detected the door opened after 30 sec to one minute, when I close the door it detected with in 30 second. however when I open the door again with in 30 second the home assistant and alarm.com website not even detected the door was opened until 2 mins or more. My alarm monitoring company is Stanley security, I don’t know who do I speak with Stanley or alarm.com about the alarm sensor status sync issue with alarm.com web site.

Just my experience. With the old integration, I got alerts from both alarm.com and home assistant when doors were left open. The alarm.com notification, while not instantaneous, was always quicker than the home assistant one. The home assistant one was anywhere between 15 to 30 seconds after the alarm.com one. My point being, I don’t think these sensors are meant, even at the alarm.com level to detect a quick open and close. They are more for detecting when a door is left open.

I also have noticed that alarm/disarm is MUCH more responsive with the new alarmdotcomajax custom integration. I think you need to realize that it is what it is. The sensors read the state of the alarm.com entity. So, the alarm.com entity needs to update and then the sensor needs to read the info, update, and then do whatever.

I am very happy with the recent improvements in the custom integration and am hopeful it with make it into Home Assistant as a full integration. Thank you

1 Like

THIS. YES. :100:

I was actually going to post something similar. Agree with all of it.

If I wanted to know INSTANTANEOUS opens/closes, personally, I would invest in additional (duplicate?) sensors (Zwave?) for the doors / locations I cared most about.

Some people build entire alarms w/ ONLY this method. Personally, I’m with @pdobrien3 and enjoy the automations I create where I can arm at night if I forget, or in the morning if I forget after I leave for work, or give me alerts if a door has been left open for too long. Anyhow, just my $.02 and I enjoy / understand / use it for what it is.

thanks @pdobrien3

Awesome! This is great work!

Been using this now for 12 days and it’s been rock solid. The silent arming is fantastic! Thanks @aechelon and @uvjustin for all your work.

1 Like

Anybody try that konnected.io thing? Sounds like a good fit and avoids duplicate sensors if you alarm system is wired.

Hello Thank you for help. Unfortunately, after adding the custom component through HACS and restarting the alarm panel doesn’t show among the entities. Nor I can added to Lovelace.

Here is my config:

alarm_control_panel:
  - platform: alarmdotcomajax
    username: user
    password: pass
    name: Alarm.com

Please note previously I just lost my integration after updating to 0.107 hence now I am trying the custom integration.

Added this through HACS. I keep getting this error:

Logger: pyalarmdotcomajax.pyalarmdotcomajax
Source: custom_components/alarmdotcomajax/alarm_control_panel.py:170 
First occurred: 3:43:33 PM (172 occurrences) 
Last logged: 3:46:17 PM

Error executing Arm+Stay, logging in and trying again...

My Config

# Frontpoint Alarm
alarm_control_panel:
  - platform: alarmdotcomajax
    name: alarm_com
    username: !secret frontpoint_username
    password: !secret frontpoint_password
    code: "1234"
    force_bypass: "true"
    no_entry_delay: "home"
    silent_arming: "home"

It does see my state accordingly.

So what did you do exactly? I have the same exact problem.
Thanks

Start by omitting the code line and setting the last 3 values to false. Do a HA restart and see how it reacts.

Got it to work by just deleting the first 2 options.

 force_bypass: "true"
    no_entry_delay: "home"

Thanks
I left code in. That works.

Currently running 106.2 and looking to upgrade to 107.7 - ran the Check Home Assistant configuration App and received the following errors:

INFO:homeassistant.util.package:Attempting install of pyalarmdotcomajax==0.1.2
ERROR:homeassistant.util.package:Unable to install package pyalarmdotcomajax==0.1.2: ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d_do6t_k/pyalarmdotcomajax/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d_do6t_k/pyalarmdotcomajax/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-d_do6t_k/pyalarmdotcomajax/pip-egg-info
         cwd: /tmp/pip-install-d_do6t_k/pyalarmdotcomajax/
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-d_do6t_k/pyalarmdotcomajax/setup.py", line 4, in <module>
        import pyalarmdotcomajax
      File "/tmp/pip-install-d_do6t_k/pyalarmdotcomajax/pyalarmdotcomajax/__init__.py", line 3, in <module>
        from .pyalarmdotcomajax import Alarmdotcom
      File "/tmp/pip-install-d_do6t_k/pyalarmdotcomajax/pyalarmdotcomajax/pyalarmdotcomajax.py", line 5, in <module>
        from bs4 import BeautifulSoup
    ModuleNotFoundError: No module named 'bs4'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Failed config
  General Errors: 
    - Platform error alarm_control_panel.alarmdotcomajax - Requirements for alarmdotcomajax not found: ['pyalarmdotcomajax==0.1.2'].

Running on a NUC Ubuntu/Docker setup. Integration is running / behaving just fine, so unsure if this will be an issue if I try to upgrade.

Running under Supervisor but this custom component is working as expected for me on 0.107.7