ADT Pulse integration

@rlippmann That did the trick. Glad it was an easy fix but still appreciate the effort you put in to resolve this. Thanks!

@rlippmann issue fixed with the latest update! Thanks a lot for working on this.

Is it meant to work now? When I am trying to log in, it says that ā€œUnknown error has occurredā€. My IP is not blocked and the fingerprint is fresh and active.

@chabapj it should. Is anyone else having problems?

Also, I think Iā€™ve figured out how to get the zwave stuff to work. But, as I donā€™t have any z-wave devices connected, it will be hard for me to implement.

I have a spare switch and thermostat I can use, but I have no way to see how any of the other device types work. Does anyone care about having this functionality? I just have HA manage my z-wave through a z-wave usb controller stick.

I keep getting log on errors. Strange - I can log on without any problems on the portal website or in homebridge plugin. Tried a new fingerprint, no difference.

@chabapj did you create a 2nd account for HA to use to log in?

You can try turning on debug logging in your configuration.yaml:

logger:
  default: info
  logs: 
    pyadtpulse: debug
    custom_components.adtpulse: debug

I did create a second user account. I am getting this:

Traceback (most recent call last):
  File "/config/custom_components/adtpulse/config_flow.py", line 73, in validate_input
    raise InvalidAuth("Could not validate ADT Pulse login info")
custom_components.adtpulse.config_flow.InvalidAuth: Could not validate ADT Pulse login info

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/adtpulse/config_flow.py", line 78, in validate_input
    raise CannotConnect from ex
custom_components.adtpulse.config_flow.CannotConnect

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/adtpulse/config_flow.py", line 139, in async_step_user
    info = await self.validate_input(user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/adtpulse/config_flow.py", line 80, in validate_input
    await adtpulse.async_logout()
  File "/usr/local/lib/python3.11/site-packages/pyadtpulse/__init__.py", line 649, in async_logout
    await self._do_logout_query()
  File "/usr/local/lib/python3.11/site-packages/pyadtpulse/__init__.py", line 562, in _do_logout_query
    network: ADTPulseSite = self.site
                            ^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyadtpulse/__init__.py", line 850, in site
    raise RuntimeError(
RuntimeError: No sites have been retrieved, have you logged in yet?

Iā€™m trying to setup a new HA instance with a new ADT user, and Iā€™m getting some kind of error with authentication:

2023-12-21 19:03:26.124 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-12-21 19:03:26.125 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration adtpulse which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-12-21 19:10:48.002 ERROR (MainThread) [pyadtpulse] Authentication error encountered logging into ADT Pulse
2023-12-21 19:10:48.002 ERROR (MainThread) [custom_components.adtpulse.config_flow] Could not validate login info for ADT Pulse
2023-12-21 19:10:48.002 ERROR (MainThread) [custom_components.adtpulse.config_flow] ERROR VALIDATING INPUT
2023-12-21 19:10:48.002 ERROR (MainThread) [custom_components.adtpulse.config_flow] Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/adtpulse/config_flow.py", line 73, in validate_input
raise InvalidAuth("Could not validate ADT Pulse login info")
custom_components.adtpulse.config_flow.InvalidAuth: Could not validate ADT Pulse login info
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/config/custom_components/adtpulse/config_flow.py", line 78, in validate_input
raise CannotConnect from ex
custom_components.adtpulse.config_flow.CannotConnect
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/adtpulse/config_flow.py", line 139, in async_step_user
info = await self.validate_input(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/adtpulse/config_flow.py", line 80, in validate_input
await adtpulse.async_logout()
File "/usr/local/lib/python3.11/site-packages/pyadtpulse/__init__.py", line 649, in async_logout
await self._do_logout_query()
File "/usr/local/lib/python3.11/site-packages/pyadtpulse/__init__.py", line 562, in _do_logout_query
network: ADTPulseSite = self.site
^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyadtpulse/__init__.py", line 850, in site
raise RuntimeError(
RuntimeError: No sites have been retrieved, have you logged in yet?
2023-12-21 19:10:48.004 ERROR (MainThread) [homeassistant] Error doing job: Unclosed connector
2023-12-21 19:11:14.041 ERROR (MainThread) [custom_components.adtpulse.config_flow] ERROR VALIDATING INPUT
2023-12-21 19:11:14.041 ERROR (MainThread) [custom_components.adtpulse.config_flow] Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/adtpulse/config_flow.py", line 70, in validate_input
result = await adtpulse.async_login()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyadtpulse/__init__.py", line 615, in async_login
await self._update_sites(soup)
File "/usr/local/lib/python3.11/site-packages/pyadtpulse/__init__.py", line 297, in _update_sites
await self._initialize_sites(soup)
File "/usr/local/lib/python3.11/site-packages/pyadtpulse/__init__.py", line 327, in _initialize_sites
new_site._update_zone_from_soup(soup)
File "/usr/local/lib/python3.11/site-packages/pyadtpulse/site.py", line 372, in _update_zone_from_soup
remove_prefix(temp.get("title"), "Last Event:")
File "/usr/local/lib/python3.11/site-packages/pyadtpulse/util.py", line 63, in remove_prefix
return text[text.startswith(prefix) and len(prefix) :]
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'startswith'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/config/custom_components/adtpulse/config_flow.py", line 78, in validate_input
raise CannotConnect from ex
custom_components.adtpulse.config_flow.CannotConnect
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/adtpulse/config_flow.py", line 139, in async_step_user
info = await self.validate_input(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/adtpulse/config_flow.py", line 80, in validate_input
await adtpulse.async_logout()
File "/usr/local/lib/python3.11/site-packages/pyadtpulse/__init__.py", line 649, in async_logout
await self._do_logout_query()
File "/usr/local/lib/python3.11/site-packages/pyadtpulse/__init__.py", line 562, in _do_logout_query
network: ADTPulseSite = self.site
^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyadtpulse/__init__.py", line 850, in site
raise RuntimeError(
RuntimeError: No sites have been retrieved, have you logged in yet?
2023-12-21 19:11:14.045 ERROR (MainThread) [homeassistant] Error doing job: Unclosed connector

Anybody have any idea why this would be? Looks like maybe thereā€™s a prefix that missing, so perhaps more HTML changes in the portal?

ETA: The above represents two attempts to login initially, both failed.

@chabapj

What do you get when you turn on debug logging? I think you might both be running into the same error.

@jamesb2147 yes, it is an html change. Are you using the latest version from HACS?

All right, put a new release up which hopefully will fix this.

For future reference, itā€™s easier to log an issue on github, because otherwise I donā€™t see issues unless I specifically log into these forums.

Pulse Github Issues

Today, I managed to log in. First, I was rejected twice. Then I closed the Chrome window in which I was reading the fingerprint, and it logged me in OK. So, perhaps the portal does not like being logged in from another device at the same time?

Anyway, thank you for working on this!

Similarly, I kept notes from yesterdayā€™s attempts and used exactly the same data: username, password, and fingerprint.

Failed on first attempt, but worked on the second, and now Iā€™m in business and already have my calendar arming and disarming the system via HA. Many thanks!! :smile:

@chabapj

Yeah, you can only log into Pulse with a the same fingerprint in one place. It will kick out the other session (try logging in twice on the same browser in 2 separate tabs, and youā€™ll see).

@jamesb2147

Glad itā€™s working for you! And youā€™re welcome.

But it was not kicking me out from the other place - it was not letting me in here. I also checked the log; I can see that there were some problems overnight with the sync check format. I am not sure if this is related - motion sensors stop detecting motion until I restart HA. I will try to capture this in the logs with the debug option.

@chabapj

Yes, itā€™s related. Iā€™ve spent months trying to figure out what all those sync check errors are about. :confounded:

I also noticed in the log file that it starts getting more and more errors after ~30 minutes. Then it desperately tries to connect to adt portal - I even have a full dump of their portal HTML code in the log. There are more and more errors in the log. Then, the portal starts blocking my IP, I cannot access it in the browser. When I try to restart HA from the user interface, it hangs. I have to restart the docker container, and then everything is fine for 20-30 minutes, and then the whole cycle repeats itself.

Yes, this is what Iā€™ve been banging my head against the wall about for the last 3 months. :weary:

@rlippmann When we enable our ADT alarm form the ADT control panel it doesnā€™t update on the Home Assistant ADT card. Only a restart of home assistant clears the issue. If it is done from the ADT mobile app the card updates as it should. Any help would be appreciated.

Sorry I donā€™t have a lot of context here. Did their date format change in the site somewhere?

(\d+[-]\d+[-]\d+)

^ Looks to me like a regex with a capture group for a date (e.g. 2024-01-19 or even 19-01-2024)

Iā€™ve (finally) put an update out, which hopefully will be more stable. It also adds connection status sensors it will be easier to see whatā€™s going on internally (i.e. gateway offline, network offline, etc).

Due to the way HACS works, itā€™s a pain to update the source github repositories, so for future reference, log issues here:

ADT Pulse Integration Issues

I only use this for automations, so if anyone has any feature requests, log them there.

I was thinking of the following possibilities:

  1. modes
  2. z-wave devices (would need access to hardware to test
  3. integrating 2FA into the config flow (i.e. no more cut and paste of fingerprint)

Iā€™d love to do cameras, but they seem really complex.

As for the 2FA stuff, quite honestly, you only do it 1 time, and itā€™s pretty easy to get the fingerprint these days.