Core: honeywell fails with: UnboundLocalError: local variable 'location' referenced before assignment

Created on 25 Sep 2019  路  10Comments  路  Source: home-assistant/core

[EDITED]

Home Assistant release with the issue: 99.2

Last working Home Assistant release (if known): 98.4

Operating environment (Hass.io/Docker/Windows/etc.): N/A

Component/platform: honeywell (Climate)

Description of problem: Entities no longer found in HA after newest version update. Reports: Entity not available: climate.bedroom_hvac. Appears the newest update 99.2 has broken the Honeywell climate platform integration with Home Assistant on US-based Honeywell Total Connect Comfort (TCC) climate systems. The integration worked with issue prior to the update.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

climate:
  - platform: honeywell
    username: !secret honeywell_user
    password: !secret honeywell_password
    region: us
    scan_interval: 600

Traceback (if applicable):

ERROR:somecomfort:Failed to process location `2608604`: missing success element
Traceback (most recent call last):
  File "__main__.py", line 204, in <module>
    sys.exit(main())
  File "__main__.py", line 201, in main
    _main(session)
  File "__main__.py", line 156, in _main
    session=session)
  File "/home/dbonnes/home-assistant/venv/lib/python3.6/site-packages/somecomfort/client.py", line 385, in __init__
    self._discover()
  File "/home/dbonnes/home-assistant/venv/lib/python3.6/site-packages/somecomfort/client.py", line 49, in wrapper
    return fn(*args, **kwargs)
  File "/home/dbonnes/home-assistant/venv/lib/python3.6/site-packages/somecomfort/client.py", line 509, in _discover
    self._locations[location.locationid] = location
UnboundLocalError: local variable 'location' referenced before assignment

Possible solution: The vendor may require you to re-confirm acceptance of their terms-and-conditions.

To check, logon to: https://www.mytotalconnectcomfort.com/portal and accept the terms and conditions, this has solved the problem for some people.

honeywell

Most helpful comment

I dunno why, but is working for me now. Only thing I did was logon to: https://www.mytotalconnectcomfort.com/portal

... and accept the terms and conditions, maybe that, or the vendor just fixed something else.

All 10 comments

Hass.io OS environment.

Hey there @zxdavb, mind taking a look at this issue as its been labeled with a integration (honeywell) you are listed as a codeowner for? Thanks!

Please check your-install.tld/developer-tools/logs, there's probably more info in there.

You didn't provide a Traceback...

However, I do get an UnboundLocalError, but even with HA version 0.98.4:

(venv) dbonnes@vm-builder:~/home-assistant$ cat ~/.homeassistant/.HA_VERSION
0.98.4

Unfortunately, the issue appears to be with with the client library, somecomfort:

(venv) dbonnes@vm-builder:~/home-assistant/venv/lib/python3.6/site-packages/somecomfort$ python __main__.py --username ${USERNAME} --password ${PASSWORD}
ERROR:somecomfort:Failed to process location `2608604`: missing success element
Traceback (most recent call last):
  File "__main__.py", line 204, in <module>
    sys.exit(main())
  File "__main__.py", line 201, in main
    _main(session)
  File "__main__.py", line 156, in _main
    session=session)
  File "/home/dbonnes/home-assistant/venv/lib/python3.6/site-packages/somecomfort/client.py", line 385, in __init__
    self._discover()
  File "/home/dbonnes/home-assistant/venv/lib/python3.6/site-packages/somecomfort/client.py", line 49, in wrapper
    return fn(*args, **kwargs)
  File "/home/dbonnes/home-assistant/venv/lib/python3.6/site-packages/somecomfort/client.py", line 509, in _discover
    self._locations[location.locationid] = location
UnboundLocalError: local variable 'location' referenced before assignment

The Developer log shows the following errors:

Error while setting up platform honeywell
September 24, 2019, 9:10 PM components/honeywell/climate.py (ERROR)

Failed to process location `1894345`: missing success element
September 24, 2019, 9:09 PM components/honeywell/climate.py (ERROR)

I definitely had a working library with version 98.2, although I thought I was up to date with 98.4 prior to the 99.2 update. I am unaware of any means to check the previous version or roll back to the last working version.

The issue appears to be with the vendor's website.

I am using teh client library outsideof HA, and I get the exact same error message:

python somecomfort/__main__.py --username ${USERNAME} --password ${PASSWORD}

Immediately before the following exception, we have

data = {'Redirect': '/portal/Home/TermsAndConditions'}

Then you get this exception:

Traceback (most recent call last):
  File "somecomfort/__main__.py", line 204, in <module>
    sys.exit(main())
  File "somecomfort/__main__.py", line 201, in main
    _main(session)
  File "somecomfort/__main__.py", line 156, in _main
    session=session)
  File "/home/dbonnes/clients/somecomfort/venv/lib/python3.6/site-packages/somecomfort/client.py", line 391, in __init__
    self._discover()
  File "/home/dbonnes/clients/somecomfort/venv/lib/python3.6/site-packages/somecomfort/client.py", line 49, in wrapper
    return fn(*args, **kwargs)
  File "/home/dbonnes/clients/somecomfort/venv/lib/python3.6/site-packages/somecomfort/client.py", line 511, in _discover
    location = Location.from_api_response(self, raw_location)
  File "/home/dbonnes/clients/somecomfort/venv/lib/python3.6/site-packages/somecomfort/client.py", line 343, in from_api_response
    for dev in devices]
  File "/home/dbonnes/clients/somecomfort/venv/lib/python3.6/site-packages/somecomfort/client.py", line 343, in <listcomp>
    for dev in devices]
  File "/home/dbonnes/clients/somecomfort/venv/lib/python3.6/site-packages/somecomfort/client.py", line 83, in from_location_response
    self.refresh()
  File "/home/dbonnes/clients/somecomfort/venv/lib/python3.6/site-packages/somecomfort/client.py", line 89, in refresh
    if not data['success']:
KeyError: 'success'

Which itself is caught by an except in the client library, and causing the UnboundLocalError thus:

(venv) dbonnes@vm-builder:~/clients/somecomfort$ python somecomfort/__main__.py --username ${USERNAME} --password ${PASSWORD}
ERROR:somecomfort:Failed to process location `2608604`: missing success element
Traceback (most recent call last):
  File "somecomfort/__main__.py", line 204, in <module>
    sys.exit(main())
  File "somecomfort/__main__.py", line 201, in main
    _main(session)
  File "somecomfort/__main__.py", line 156, in _main
    session=session)
  File "/home/dbonnes/clients/somecomfort/venv/lib/python3.6/site-packages/somecomfort/client.py", line 385, in __init__
    self._discover()
  File "/home/dbonnes/clients/somecomfort/venv/lib/python3.6/site-packages/somecomfort/client.py", line 49, in wrapper
    return fn(*args, **kwargs)
  File "/home/dbonnes/clients/somecomfort/venv/lib/python3.6/site-packages/somecomfort/client.py", line 509, in _discover
    self._locations[location.locationid] = location
UnboundLocalError: local variable 'location' referenced before assignment

I definitely had a working library with version 98.2, although I thought I was up to date with 98.4 prior to the 99.2 update. I am unaware of any means to check the previous version or roll back to the last working version.

I checked several previous versions, including 0.98.4 as indicated above.

Sorry, the vendor (Honeywell) appears to have recently changed their responses, and (not unreasonably) the client (which hasn't changed for years) can't manage, and subsequently HA can't manage.

[EDIT] : Hang on, seems to be working now...

I dunno why, but is working for me now. Only thing I did was logon to: https://www.mytotalconnectcomfort.com/portal

... and accept the terms and conditions, maybe that, or the vendor just fixed something else.

Awesome!!! I did the same thing and restarted HA... issue resolved. I attempted several reboots yesterday, including router reboot without resolution. I logged into https://www.mytotalconnectcomfort.com/portal to verify is was not a vendor website issue and also accepted the new terms. Didn't think to reboot HA after that, until now and can verify that was indeed the solution. Thanks for your input zxdavb!!!.

I can confirm the same thing. Was getting the same errors, which led me to search for a solution and to this thread. Upon logging into the https://www.mytotalconnectcomfort.com/portal site and accepting the latest T&C's message (even though it says that was last updated Oct 2018), upon next restart of HA, my Honeywell thermostat integration is back and working perfectly! Thank you for your efforts in making and maintaining this integration, it's very much appreciated!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arangates picture arangates  路  3Comments

i-am-shodan picture i-am-shodan  路  3Comments

coolriku picture coolriku  路  3Comments

Elmardus picture Elmardus  路  3Comments

flsabourin picture flsabourin  路  3Comments