Alarm.com List Index Out of Range

Correct.

The old integration used a different interface which has now been deprecated… Hence this thread.

@aechelon thank you! Got it working and thanks for the info.

1 Like

@aechelon, thank you, finally I am able to use alarm.com again. everything working Ok, except sensor status, sometimes 45 second delay, sometimes even longer, eg: when I open the door the alarm.com detect the door open right way, but home assistant getting status 45 second or one minute after. sometimes not even detect the door opened

@Thileep, the interval between status updates is largely dependent on the alarm system hardware.

In my experience, cell-based alarm systems – particularly those on older 2G and 3G networks – have update intervals in the range of 30-60s. Newer systems on 5G networks and systems that are dual-path-capable (WiFi+Cell) have update intervals in the range of 1s-5s. YMMV also depending your location, cell signal strength, and data bandwidth though.

@aechelon any debuging tips? I thought I had this working but…

I am using secrets.yaml to store username, password and code. When I have code enabled I get this.

2020-03-28 09:25:15 WARNING (MainThread) [custom_components.alarmdotcomajax.alarm_control_panel] Wrong code entered

2020-03-28 09:25:34 ERROR (MainThread) [pyalarmdotcomajax.pyalarmdotcomajax] Error executing Arm+Stay, logging in and trying again...

The code is correct as I typed it into the alarm it and it works, but when I enter it into the interface I get above.

When code is commented out I get when trying to arm home.

2020-03-28 09:28:35 ERROR (MainThread) [frontend.js.latest.202002205] https://hassio.local:8123/frontend_latest/chunk.b5b99c32e8fe08e69155.js:3748:712 Uncaught TypeError: Cannot set property 'value' of null

2020-03-28 09:28:35 ERROR (MainThread) [pyalarmdotcomajax.pyalarmdotcomajax] Error executing Arm+Stay, logging in and trying again... 

And then after a while a bunch of these

2020-03-28 09:33:21 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pyalarmdotcomajax/pyalarmdotcomajax.py", line 257, in _send
    raise aiohttp.ClientError
aiohttp.client_exceptions.ClientError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pyalarmdotcomajax/pyalarmdotcomajax.py", line 257, in _send
    raise aiohttp.ClientError
aiohttp.client_exceptions.ClientError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1253, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 198, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 402, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 590, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 433, in _handle_entity_call
    await result
  File "/config/custom_components/alarmdotcomajax/alarm_control_panel.py", line 170, in async_alarm_arm_home
    await self._alarm.async_alarm_arm_stay()
  File "/usr/local/lib/python3.7/site-packages/pyalarmdotcomajax/pyalarmdotcomajax.py", line 279, in async_alarm_arm_stay
    await self._send("Arm+Stay", forcebypass, noentrydelay, silentarming)
  File "/usr/local/lib/python3.7/site-packages/pyalarmdotcomajax/pyalarmdotcomajax.py", line 265, in _send
    await self.async_alarm_arm_stay()

File "/usr/local/lib/python3.7/site-packages/pyalarmdotcomajax/pyalarmdotcomajax.py", line 279, in async_alarm_arm_stay
    await self._send("Arm+Stay", forcebypass, noentrydelay, silentarming)
  File "/usr/local/lib/python3.7/site-packages/pyalarmdotcomajax/pyalarmdotcomajax.py", line 261, in _send
    await self.async_login()
  File "/usr/local/lib/python3.7/site-packages/pyalarmdotcomajax/pyalarmdotcomajax.py", line 84, in async_login
    tree = BeautifulSoup(text, "html.parser")
  File "/usr/local/lib/python3.7/site-packages/bs4/__init__.py", line 325, in __init__
    self._feed()
  File "/usr/local/lib/python3.7/site-packages/bs4/__init__.py", line 399, in _feed
    self.builder.feed(self.markup)
  File "/usr/local/lib/python3.7/site-packages/bs4/builder/_htmlparser.py", line 339, in feed
    parser.feed(markup)
  File "/usr/local/lib/python3.7/html/parser.py", line 111, in feed
    self.goahead(0)
  File "/usr/local/lib/python3.7/html/parser.py", line 179, in goahead
    k = self.parse_html_declaration(i)
  File "/usr/local/lib/python3.7/html/parser.py", line 270, in parse_html_declaration
    self.handle_decl(rawdata[i+2:gtpos])
  File "/usr/local/lib/python3.7/site-packages/bs4/builder/_htmlparser.py", line 235, in handle_decl
    self.soup.endData()
  File "/usr/local/lib/python3.7/site-packages/bs4/__init__.py", line 508, in endData
    self.object_was_parsed(o)
  File "/usr/local/lib/python3.7/site-packages/bs4/__init__.py", line 517, in object_was_parsed
    previous_element = self._most_recent_element
  File "/usr/local/lib/python3.7/site-packages/bs4/element.py", line 1367, in __getattr__
    return self.find(tag)
  File "/usr/local/lib/python3.7/site-packages/bs4/element.py", line 1676, in find
    l = self.find_all(name, attrs, recursive, text, 1, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/bs4/element.py", line 1703, in find_all
    return self._find_all(name, attrs, text, limit, generator, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/bs4/element.py", line 704, in _find_all
    strainer = SoupStrainer(name, attrs, text, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/bs4/element.py", line 1856, in __init__
    self.text = self._normalize_search_value(text)
  File "/usr/local/lib/python3.7/site-packages/bs4/element.py", line 1861, in _normalize_search_value
    if (isinstance(value, str) or isinstance(value, Callable) or hasattr(value, 'match')
  File "/usr/local/lib/python3.7/abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)
RecursionError: maximum recursion depth exceeded in comparison

@Aussie, it looks like login is failing. I don’t think it has anything to do with the code, although I would get everything working without the code first.

Test by passing the credentials without using !secret. If that works, then your !secret notation is incorrect. If it doesn’t work then it likely has something to do with the credentials you’re using.

From there I’d test adding one feature at a time… Once you’ve verified that login is working properly without using !secret notation you can try using !secret. Once !secret is working you can try setting the code, and so on with the other parameters.

@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.