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
73.83k stars 30.91k forks source link

Nest Integration fails in opaque ways #43316

Closed samuelalexmclean closed 3 years ago

samuelalexmclean commented 4 years ago

The problem

I'm trying to use the new nest API (SDM) via the vanilla Nest integration. I've defined an external URL in the settings FE, of the form https://my.domain - this URL is accessible and points to my Home Assistant install from on or off my local network. I've added some stuff to my yaml (below).

When I go to the Integrations screen -> "Add" -> Nest, it just says "Aborted".

I can auth and control my devices via the command line, and I can see all my events popping into the pubsub queue in Cloud Console.

Environment

System Health arch x86_64 chassis desktop dev false docker true docker_version 19.03.13 hassio true host_os Ubuntu 20.04.1 LTS installation_type Home Assistant Supervised os_name Linux os_version 5.4.0-52-generic python_version 3.8.6 supervisor 2020.11.0 timezone Australia/Sydney version 0.117.6 virtualenv false

Problem-relevant configuration.yaml


nest:
  client_id: redacted
  client_secret: redacted
  project_id: redacted
  subscriber_id: nest-sub

Traceback/Error logs

I'm not really sure where to look. Any pointers?

Additional information

The bug here is 20% "I would like to get my integration working", and 80% "the error should provide a little more information, or reference the log location".

probot-home-assistant[bot] commented 4 years ago

nest documentation nest source (message by IssueLinks)

probot-home-assistant[bot] commented 4 years ago

Hey there @awarecan, @allenporter, mind taking a look at this issue as its been labeled with an integration (nest) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

allenporter commented 4 years ago

@samuelalexmclean all for adding more debug messages here. I have a pending PR #43271 to add a bunch of new error messages and https://github.com/home-assistant/home-assistant.io/pull/15638 to add additional documentation, however I don't think they'll help this flow.

My impression is this part of the flow is only using "off the shelf" config flow stuff, so maybe we can peer into that by adding something like this to configuration.yaml will get us some better log entries about what is going wrong:

logger:
  default: info
  logs:
    homeassistant.components.nest: debug
    homeassistant.helpers.config_entry_flow: debug
    homeassistant.helpers.config_entry_oauth2_flow: debug

I agree about correcting with better error messages when we see what is up. I believe this may happen if an error message is raised but the error key is not in strings.json like what was resolved in https://github.com/home-assistant/core/pull/42423

samuelalexmclean commented 4 years ago

Thanks @allenporter! I tried both your logger config and the version on the docs. Unfortunately I can't see anything helpful in there:

cat /usr/share/hassio/homeassistant/home-assistant.log | grep nest
2020-11-19 21:27:01 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'ssdp', 'cast', 'automation', 'history', 'zone', 'mqtt', 'tts', 'media_source', 'default_config', 'mobile_app', 'group', 'nest', 'updater', 'met', 'counter', 'map', 'google_assistant', 'device_tracker', 'sun', 'daikin', 'tag', 'scene', 'input_boolean', 'system_health', 'homekit_controller', 'timer', 'input_select', 'logbook', 'script', 'input_datetime', 'input_number', 'input_text', 'zeroconf'}
2020-11-19 21:27:01 INFO (MainThread) [homeassistant.setup] Setting up nest
2020-11-19 21:27:01 INFO (MainThread) [homeassistant.setup] Setup of domain nest took 0.0 seconds

Just to check I'm looking in the right place I peppered some random logging calls through my local version of config_flow and it is indeed working, I must just be hitting a path that doesn't cause a log entry on failure. I'll keep playing around and see what I can find... and if I don't get anywhere, maybe a version or two down the line your extra error handling stuff will save my bacon.

Thanks for pointing me at the logger config, that's enough for me to start poking around.

allenporter commented 4 years ago

Ok my first hunch then is something url related

allenporter commented 4 years ago

I would suggest adding more logging anywhere with a "raise NoURLAvailableError"

samuelalexmclean commented 3 years ago

After updating to 0.118.2 the "Aborted" modal now includes "No URL available. For information about this error, check the help section" (the help section doesn't help me much, but that's a separate issue). As far as I'm conerned this FR is obsolete, but if the context-free "Aborted" dialogue has been rearing its head elsewhere, this might be worth re-opening.