core icon indicating copy to clipboard operation
core copied to clipboard

Error installing Honeywell Lyric Integration

Open fcasarramona opened this issue 2 years ago • 15 comments

The problem

When trying to install Honeywell Lyric integration, it fails.

First, it calls the api.honeywell.com address with the fixed redirect uri=https://my.home-assistant.io/redirect/oauth

If anyone don't have my home assistant it returns an inmediate error message: "The redirect URL provided does not match the redirect URL registered for the app."

I worked around this by modifying the uri parameter to http://homeassistant.local:8123/auth/external/callback

At this point I can enter the Honeywell api web without any problems, but when finish and redirect back to homeassistant, an Error without any text shows in homeassistant web UI.

What version of Home Assistant Core has the issue?

core-2022.7.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Honeywell Lyric

Link to integration documentation on our website

https://www.home-assistant.io/integrations/lyric

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: aiohttp.server
Source: components/lyric/api.py:64
First occurred: 16:47:02 (8 occurrences)
Last logged: 17:44:52

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 168, in get
    return await super().get(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 95, in get
    result = await self._flow_mgr.async_configure(flow_id)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 277, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 359, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 303, in async_step_creation
    token = await self.flow_impl.async_resolve_external_data(self.external_data)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 169, in async_resolve_external_data
    return await self._token_request(
  File "/usr/src/homeassistant/homeassistant/components/lyric/api.py", line 64, in _token_request
    resp.raise_for_status()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 500, message='Internal Server Error', url=URL('https://api.honeywell.com/oauth2/token')

Additional information

System Health

version core-2022.7.0
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.10.5
os_name Linux
os_version 5.15.32-v8
arch aarch64
timezone Europe/Madrid
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.25.5
Stage running
Available Repositories 1072
Downloaded Repositories 6
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 8.2
update_channel stable
supervisor_version supervisor-2022.07.0
agent_version 1.2.1
docker_version 20.10.14
disk_total 3667.5 GB
disk_used 2078.2 GB
healthy true
supported true
board rpi4-64
supervisor_api ok
version_api ok
installed_addons Samba share (10.0.0), Mosquitto broker (6.1.2), File editor (5.3.3), Terminal & SSH (9.6.0), Grafana (7.6.0), Home Assistant Google Drive Backup (0.108.2)
Dashboards
dashboards 2
resources 1
views 1
mode storage
Recorder
oldest_recorder_run 6 de julio de 2022 08:08
current_recorder_run 7 de julio de 2022 13:12
estimated_db_size 68.82 MiB
database_engine sqlite
database_version 3.38.5
Sonoff
version 3.1.0 (3871c0b)
cloud_online 3 / 4
local_online 3 / 3

fcasarramona avatar Jul 07 '22 15:07 fcasarramona

lyric documentation lyric source (message by IssueLinks)

Hey there @timmo001, mind taking a look at this issue as it has been labeled with an integration (lyric) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

I gave up on this months ago. It was installed but had/have an automation to check if the connection is still present. But the integration is constantly giving problems. I have my T6 connected through the HomeKit Controller.

pluim003 avatar Jul 08 '22 07:07 pluim003

I gave up on this months ago. It was installed but had/have an automation to check if the connection is still present. But the integration is constantly giving problems. I have my T6 connected through the HomeKit Controller.

It worked for me until may. Then a lot of integrations relaying on internet connection stop working properly until version 2022.7.0 solved it except for Lyric than need a reconfiguration. Tried to unsinstall and install again, but I can't anymore.

fcasarramona avatar Jul 08 '22 09:07 fcasarramona

After updating to core-2022.7.1, still the same issues.

fcasarramona avatar Jul 08 '22 09:07 fcasarramona

I decided to give it another try. On the developer-site of Honeywell I removed the old app, created a new one. Put the client id and secret key in secrets.yaml, modified the redirect-url and it seems to be working again (in 2022.7.1). Can't tell about 2022.7.0.

pluim003 avatar Jul 08 '22 10:07 pluim003

The integration just broke for me on 2022.8.0.dev0 (I'm running from git), also noticed the response url is wrong as well (where does https://my.home-assistant.io/redirect/oauth even come from? Is this part of the cloud based integration? What happens, like in my case, you aren't using the cloud based access to HASS?) changing the redirect_uri gets me to log in, but then I get permission denied for type internal.

{"status":401,"message":"Error getting user devices: Unauthorized","type":"internal"}

Ended up changing the auth information in .storage which just broke the integration, which was thankfully enough to get me a remove button. Removed it and tried to re-create it and got the same above issues.

So I think there's probably 2 issues at play:

  1. the URI from config isn't settable and is inherently broken. Somewhere (not sure where since it looks like it's inheriting it) it's making use of MY_AUTH_CALLBACK_PATH instead of asking or doing something else. This is obviously problematic for users not making use of the cloud access to their home assistant setup
  2. I'm guessing with the recent Residio changes that something has happened with API access. Since mine was working until recently it may involve old tokens expiring and new tokens not being able to work. It's unclear (to me anyway) what the path forward on that front is.

I haven noticed that the HomeKit integration has gotten SUBSTANTIALLY better, and honestly at this point the Lyric/Resideo remote API seems superfluous and a subset of what can be used from the HomeKit integration. I'd actually argue in favor of deprecating this entirely on that basis.

warthog9 avatar Jul 27 '22 20:07 warthog9

Following up on the URI issue go to https://my.home-assistant.io and set your instances URL there, and then when you create the lyric app put in https://my.home-assistant.io/redirect/oauth for the callback instead of what you'd normally use.

warthog9 avatar Jul 27 '22 21:07 warthog9

@warthog9 I suspect the current issues I'm seeing (same error message as yours) are due to an "Unplanned partial outage." I'm not seeing anything online, but in the Resideo app, there's a warning message. It's not the first time this has happened (HA outage and a warning in the app but nowhere else) in the last week or so.

andrewstuart avatar Jul 27 '22 21:07 andrewstuart

Following up on the URI issue go to https://my.home-assistant.io and set your instances URL there, and then when you create the lyric app put in https://my.home-assistant.io/redirect/oauth for the callback instead of what you'd normally use.

This fixed my issue. Able to delete the old and add it back again. Thanks for the steps.

simplelnx avatar Jul 28 '22 02:07 simplelnx

I have different error message today: {"code":400, "message":"The redirect URL provided does not match the redirect URL registered for the app."}

Anyone have the same issue?

AFumi39 avatar Jul 28 '22 08:07 AFumi39

I have the same again. Also found out that the Honeywell-app has a new name Residio.

pluim003 avatar Jul 28 '22 08:07 pluim003

Finally I managed to complete the procedure (I removed integration and trying to add again), but at the end a popup on HA web page simply says "Error". Even if the procedure now seems go well.

This is the error in the logs: 2022-07-28 12:17:26 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 168, in get return await super().get(request, flow_id) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 95, in get result = await self._flow_mgr.async_configure(flow_id) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 277, in async_configure result = await self._async_handle_step( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 359, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 303, in async_step_creation token = await self.flow_impl.async_resolve_external_data(self.external_data) File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 169, in async_resolve_external_data return await self._token_request( File "/usr/src/homeassistant/homeassistant/components/lyric/api.py", line 64, in _token_request resp.raise_for_status() File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 500, message='Internal Server Error', url=URL('https://api.honeywell.com/oauth2/token')

AFumi39 avatar Jul 28 '22 10:07 AFumi39

Ok, now works! Unlike what official page https://www.home-assistant.io/integrations/lyric says, you cannot use <HOME_ASSISTANT_URL>/auth/external/callback as callback url, because the integration fails afterward. You have to use https://my.home-assistant.io/redirect/oauth and try more and more, until it works till the end.

AFumi39 avatar Jul 28 '22 10:07 AFumi39

I have two Lyric Rounds and both connected through the integration but it will not allow me to change anything and comes back with the following error:

Logger: homeassistant.components.lyric.climate Source: components/lyric/climate.py:308 Integration: Honeywell Lyric (documentation, issues) First occurred: August 8, 2022 at 11:17:11 PM (3 occurrences) Last logged: 10:26:55 AM

{'request': {'method': 'POST', 'url': 'https://api.honeywell.com/v2/devices/thermostats/TCC-2452244?apikey=2nj42Cn0FNSAUxFAzDcaTqSY7V1ajhT0&locationId=165881', 'headers': {'Authorization': 'Bearer LEj6epjztWGRlZmCGD4IhApZvPio', 'Content-Type': 'application/json'}, 'json': {'mode': 'Cool', 'heatSetpoint': 66, 'coolSetpoint': 75.0, 'autoChangeoverActive': False}}, 'response': {'code': 400, 'message': "'EmergencyHeatActive' is required."}, 'status': 400} {'request': {'method': 'POST', 'url': 'https://api.honeywell.com/v2/devices/thermostats/TCC-2452244?apikey=2nj42Cn0FNSAUxFAzDcaTqSY7V1ajhT0&locationId=165881', 'headers': {'Authorization': 'Bearer M2gtGnGCkcL9p8yefsHlGOW7P9nJ', 'Content-Type': 'application/json'}, 'json': {'mode': 'Cool', 'heatSetpoint': 66, 'coolSetpoint': 75.0, 'autoChangeoverActive': False}}, 'response': {'code': 400, 'message': "'EmergencyHeatActive' is required."}, 'status': 400} {'request': {'method': 'POST', 'url': 'https://api.honeywell.com/v2/devices/thermostats/TCC-2452244?apikey=2nj42Cn0FNSAUxFAzDcaTqSY7V1ajhT0&locationId=165881', 'headers': {'Authorization': 'Bearer SaPmO1Q5WMZT4nxhcQToQv5EYpnX', 'Content-Type': 'application/json'}, 'json': {'mode': 'Cool', 'heatSetpoint': 66, 'coolSetpoint': 75.0, 'autoChangeoverActive': False}}, 'response': {'code': 400, 'message': "'EmergencyHeatActive' is required."}, 'status': 400}

This seems to be an older integration and several people have worked on this on github:

Lyric Honeywell Round API Issues #63403 https://github.com/home-assistant/core/issues/63403 Fix lyric climate #67018 https://github.com/home-assistant/core/pull/67018

Not sure 67018 passed all of the test to be integrated in the March 2022 update but nothing seems to have changed

Anyway to get an update?

mdavidthomas avatar Aug 09 '22 22:08 mdavidthomas

I recently followed the guide for the Lyric integration and found out that i created the api app on link https://developer.honeywellhome.com/ , when the integration trying to connect to the api, it is trying to connect to webpage https://api.honeywell.com/ ... there it is asking for credentials, and i cannot login there using user from previous page

Mio3000 avatar Aug 24 '22 16:08 Mio3000

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.

github-actions[bot] avatar Nov 22 '22 17:11 github-actions[bot]