home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.65k stars 30.41k forks source link

Honeywell Total Connect alarm control panel device missing after upgrade #47032

Closed jhampson-dbre closed 3 years ago

jhampson-dbre commented 3 years ago

The problem

After upgrading to core-2021.3.0b0, I am unable to see the Total Connect alarm control panel device. Per the breaking change for Total Connect in the release notes:

"To support user equipment that requires the entry of a usercode in addition to username and password, now all users must configure a usercode. This can be done by updating the integration in the User Interface".

When my alarm control panel disappeared after the upgrade, I figured that I should have done this configuration change for usercode before updating the the beta release, so I deleted the integration, restarted Home Assistant, and then added the integration. However, after re-adding the integration and providing a usercode, the alarm control panel is still not showing under devices even after multiple restarts. I'm unable to find any obvious related error messages in the logs.

What is version of Home Assistant Core has the issue?

core-2021.3.0b0

What was the last working version of Home Assistant Core?

core-2021.2.3

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Total Connect

Link to integration documentation on our website

https://rc.home-assistant.io/integrations/totalconnect/

Example YAML snippet

# Put your YAML below this line

Anything in the logs that might be useful for us?

# Put your logs below this line
➜  /config grep -i total ./home-assistant.log
2021-02-24 21:33:57 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'input_number', 'timer', 'input_text', 'system_health', 'harmony', 'ssdp', 'totalconnect', 'map', 'media_source', 'remote', 'ipp', 'history', 'binary_sensor', 'upnp', 'roku', 'brother', 'homekit_controller', 'my', 'sun', 'sensor', 'lyric', 'dhcp', 'cast', 'ffmpeg', 'vizio', 'tasmota', 'zone', 'logbook', 'script', 'automation', 'skybell', 'zeroconf', 'default_config', 'group', 'mqtt', 'updater', 'arlo', 'withings', 'input_select', 'tts', 'blueprint', 'switch', 'ozw', 'mobile_app', 'glances', 'scene', 'tplink', 'cover', 'counter', 'zha', 'tag', 'smartthings', 'input_datetime', 'met', 'input_boolean'}
2021-02-24 21:33:58 INFO (MainThread) [homeassistant.setup] Setting up totalconnect
2021-02-24 21:33:58 INFO (MainThread) [homeassistant.setup] Setup of domain totalconnect took 0.0 seconds
2021-02-24 21:34:15 INFO (MainThread) [homeassistant.components.alarm_control_panel] Setting up alarm_control_panel.totalconnect
jhampson-dbre commented 3 years ago

so maybe I'm wrong.i found the alarm control panel, it just wasn't listed under devices or entities of the Total Connect integration, but maybe this is the expected behavior? not sure if it was this way in 2021.02.3.

part of my confusion is I found no obvious way update integration config to add a usercode after the update like the release notes indicate.

jhampson-dbre commented 3 years ago

Let me summarize my feedback for Total Connect

  1. Breaking change in release notes indicates that a usercode is now required and can be configured in the UI. I found no way to reconfigure the integration after updating, resulting in "device not found" error for the alarm panel on Lovelace dashboard. Does this need to be configured before updating? Or is the only way to reconfigure to delete and re-add the Total Connect integration?
  2. I ended up deleting and re-adding the integration. The integration instructions say to search for "Honeywell Total Connect Alarm" on Configuration>Integrations, but this returns no results. As it is currently, the integration is searchable by "Total Connect".
  3. When configuring the the add-on after re-adding, it prompts to input a usercode, but the input box is prefilled with a location code, and is label with "location" image
  4. When entering the passcode, it was initially rejected, even though the usercode was correct. I had to enable "Prompt for usercode" in the Total Connect web portal before Home Assistant would accept the usercode as valid. image
  5. After that, I expected to see an alarm control panel device/entity listed under the Total Connect integration, but it only showed the contact sensor entities. Since the alarm control panel was missing after the upgrade, I incorrectly assumed that having no alarm control panel device/entity listed under the Total Connect integration meant that the alarm control panel was still missing. However, I realized that it was actually showing on the dashboard again. I thought the alarm control panel should show as a device/entity of the Total Connect integration, but it is showing the integration as "Alarm control panel". Not sure if this is the expected behavior, but it seems unintuitive. image
austinmroczek commented 3 years ago

@jhampson-dbre thanks for the detailed feedback. I'll see what I can do to make it easier for folks.

gibwar commented 3 years ago

I, too, had a struggle with upgrading from the latest 2021.2 to 2021.3.2 today. I saw the note in the breaking changes and expected a way to add a user code. I ended up hacking a solution together that allowed me to upgrade without needing to remove the component and reinstall as I didn't want to have to set everything up again (or have entities change). I prefer hard-mode, so my setup is running HA Core on Debian 10 in a systemd-nspawn container (similar to docker), however I don't think that's relevant to the error/process.

After the initial upgrade I had the following error in my logs:

Mar 07 16:10:54 home-assistant hass[441]: 2021-03-07 16:10:54 WARNING (MainThread) [homeassistant.components.totalconnect] No usercodes in TotalConnect configuration
Mar 07 16:10:54 home-assistant hass[441]: 2021-03-07 16:10:54 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Total Connect for totalconnect
Mar 07 16:10:54 home-assistant hass[441]: Traceback (most recent call last):
Mar 07 16:10:54 home-assistant hass[441]:   File "/srv/ha-2021.03/lib/python3.8/site-packages/homeassistant/config_entries.py", line 248, in async_setup
Mar 07 16:10:54 home-assistant hass[441]:     result = await component.async_setup_entry(hass, self)  # type: ignore
Mar 07 16:10:54 home-assistant hass[441]:   File "/srv/ha-2021.03/lib/python3.8/site-packages/homeassistant/components/totalconnect/__init__.py", line 51, in async_setup_entry
Mar 07 16:10:54 home-assistant hass[441]:     await hass.config_entries.flow.async_init(
Mar 07 16:10:54 home-assistant hass[441]:   File "/srv/ha-2021.03/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 133, in async_init
Mar 07 16:10:54 home-assistant hass[441]:     result = await self._async_handle_step(
Mar 07 16:10:54 home-assistant hass[441]:   File "/srv/ha-2021.03/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 216, in _async_handle_step
Mar 07 16:10:54 home-assistant hass[441]:     result: Dict = await getattr(flow, method)(user_input)
Mar 07 16:10:54 home-assistant hass[441]:   File "/srv/ha-2021.03/lib/python3.8/site-packages/homeassistant/components/totalconnect/config_flow.py", line 117, in async_step_reauth
Mar 07 16:10:54 home-assistant hass[441]:     self.usercodes = config[CONF_USERCODES]
Mar 07 16:10:54 home-assistant hass[441]: KeyError: 'usercodes'

I expected the warning, based on the breaking change, however the error prevented the integration from initializing entirely. I assumed based on the text of the change that I would be able to find options for the existing integration to add a user code as needed, but could only rename the integration and had the default "System Options" dialog enabling adding new entities, which is currently on.

Looking at the code in the ConfigFlow.py, I was able to find the missing key was usercodes. Hoping I could manually add the missing field in hopes of triggering some sort of UI (based on the fact the method throwing was called async_step_reauth) I first searched the .storage directory for the username and found two entries. Seeing that the password is also loaded from this config, I grepped for a portion of the password and found a single entry. I added a new entry in the data node with usercodes: {} (I noticed usercodes was a dictionary). I restarted HA and got the following warning:

Mar 07 17:08:59 home-assistant hass[633]: 2021-03-07 17:08:59 WARNING (SyncWorker_3) [root] No usercode for location <my-location-id>.

I used the documentation for the integration and confirmed the value in <my-location-id> above matched my location in the URL on the website. However, no reauthentication dialog UI popped up nor was I able to find anything related on the integration page. At this point, all of the integration appeared to work, the API calls worked and states started showing back up.

Wanting to fix the warning and seeing the schema validation described it as location id : str, I added the location id and the current user code as a string, like this, replacing <my-location-id> and <code> with the correct location id and numeric user code:

{
  "data": {
    "password": "my password",
    "username": "my user name",
    "usercodes": {
      "<my-location-id>": "<code>"
    }
}

Started HA back up again and no warnings and everything appears to work!


I wanted to share this in case anyone else comes across this issue when upgrading and doesn't want to uninstall and reinstall the integration like me. I wonder if it would be possible to extend the integration with an options page (like denonavr, hue, and nut) to expose the username/password/usercodes as needed.

Thank you so much for managing and maintaining this integration!

tekstein commented 3 years ago

I'm also having an issue with total connect after updating HA. I had the exact same thing happen as reference by jhampson-dbre. I removed my integration with HA and can't get the total connect to re-integrate at all. When I input my user name and passoword it says "aborted". I've try integrating from HA and the HA integration website with out any luck. I'm running core-2021.3.2. Anybody have any suggestions?

Screen Shot 2021-03-08 at 9 00 35 PM Screen Shot 2021-03-08 at 9 00 57 PM
gibwar commented 3 years ago

@tekstein is there anything in the logs? I would guess with a failure like that there should be something in there. Also, just in case, you should clear your cache to make sure you're running the latest frontend JavaScript as the setup did change to support the user code addition.

tekstein commented 3 years ago

I've cleared the cache and still no luck. here is a few screen shots of the logs

Screen Shot 2021-03-08 at 11 06 16 PM Screen Shot 2021-03-08 at 11 06 44 PM
tekstein commented 3 years ago

I just updated the core to 2021.3.3. I can now input my user name and password, but now I get user location error. This is the same user id location I found on the TC website and what I used before having issues. Any ideas for a fix?

Screen Shot 2021-03-08 at 11 31 17 PM Screen Shot 2021-03-08 at 11 33 26 PM
jhampson-dbre commented 3 years ago

delete the location code from the input box and put the user code there. the label is wrong/misleading. before that, log in to total connect website first and make sure you have "prompt for user code" enabled (see screenshot above). see points 3 and 4 in my earlier comment for additional detail.

austinmroczek commented 3 years ago

@tekstein I'd also recommend creating an secondary account (within the TotalConnect website) that has the bare minimum permissions. Right now you're trying to use an account that has full administrative permissions, which you don't need for Home Assistant. That would remove the 3rd, 4th and 5th warning messages you show.

austinmroczek commented 3 years ago

@jhampson-dbre numbers below are in response to your comments above

1) Sorry I should have been more clear on the release notes. The intended way was to delete and then re-add the integration.

2) The adjustment to simply "Total Connect" was a last minute update on the code side that didn't make it into the documentation. I'll get that fixed.

3) This is indeed where to put the usercode. I need to make this more clear to users, and not confuse them with the location ID.

4) Would you mind double-checking that "prompt for user code" is required? Mine is working without it, and I never ran into this during testing. It's possible this is an idiosyncrasy with your hardware (or mine....hard to tell when I have a test case of one).

5) I'm pretty sure this is just how Home Assistant works. That wasn't a choice I made in the code.

I'm sorry this is causing issues for so many folks. I hope to have some patches in this weekend.

tekstein commented 3 years ago

Perfect! Thanks! austinmroczek and jhampson-dbre. This fixed my issue! Keep up the great work!

jhampson-dbre commented 3 years ago

I disabled the "prompt for usercode" setting, deleted the integration, re-configured it and it went through successfully with it disabled that time. when I originally did it though, it rejected it several times. The first time after enabling "prompt for usercode" it worked. I did notice that enabling it for the HA user enabled it for all users, so maybe it's some scenario that only impacts certain Total Connect account/device configurations.

regarding point 5, it may have always been that way and I just never noticed until it disappeared from the dashboard. still, I think there should be a way to associate it to the Total Connect integration, but definitely not an urgent issue.

Edit: If I understand correctly, and it's entirely possible I don't, async_register_entity_service can be called to register the alarm to Total Connect integration. https://developers.home-assistant.io/docs/dev_101_services#entity-services

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.