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.7k stars 30.82k forks source link

Manual setup of Google assistant integration broken #74351

Closed Barsonax closed 1 year ago

Barsonax commented 2 years ago

The problem

After it was working for months Google assistant integration with homeassistant now seems to be broken. I also cannot re add homeassistant in google home because after logging in I get this message: photo_2022-07-03_15-05-46

Iam running homeassistant on docker in a pi behind a reverse proxy. Iam still able to reach my homeasisstant instance with https from a external network so there doesn't seem to be any connectivity issue.

What version of Home Assistant Core has the issue?

Home Assistant Core 2022.6.7

What was the last working version of Home Assistant Core?

Home Assistant Core 2022.6.7

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Google assistant

Link to integration documentation on our website

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

Diagnostics information

No logs available

Example YAML snippet

google_assistant:
  project_id: foobar
  service_account: !include service_account.json
  report_state: true
  expose_by_default: false

Anything in the logs that might be useful for us?

No logs available

Additional information

No response

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

google_assistant documentation google_assistant source (message by IssueLinks)

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

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

elupus commented 2 years ago

There aught to be something in your log.

DusBus commented 2 years ago

Same here, have spent several hours troubleshooting this without any significant progress.

Others have stated that adding a logo and some more information (privacy policy etc.) did the trick but I also tried all of that and nothing changed.

I even started from scratch and worked through the entire documentation again but same thing, fails with "Could not reach xyz"

Barsonax commented 2 years ago

There aught to be something in your log.

Checked it again and there's nothing related to google_assistant. No call to graph api or something like that.

Others have stated that adding a logo and some more information (privacy policy etc.) did the trick but I also tried all of that and nothing changed.

Yup tried that one as well.

It so weird as it was working fine for months. During that time the pi was restarted several times. Now since a couple of days it stopped working. Maybe something changed on googles end?

DusBus commented 2 years ago

I was in the process of moving all my smarthome stuff to homeassistant but wanted to make sure that google assistant is working before changing anything. Did the whole jazz with reverse proxy etc. etc. to make sure that everything works as intended with a test instance of homeassistant (that was a few weeks back). I then reinstalled home assistant from scratch and left everything else (the rev proxy in particular) as it was. I first simply copied over the working config with all the keys n stuff but since it didn't work, I started over with an entirely new project on Google Actions. unfortunately still no luck.

I just tried again and checked the logs, there is absolutely nothing (related to gassistant) in there. Or am I looking in the wrong place?

Settings -> System -> Logs

elupus commented 2 years ago

Sounds strange. Mine is still working. But i`ve not set it up a-new in some time. But I don't think anything changed there.

Do you even get redirected to the loginscreen in home assistant when you try to relink?

DusBus commented 2 years ago

Do you even get redirected to the loginscreen in home assistant when you try to relink?

Yes. Basically:

What I find curious is that the custom icon I have set for the app does not show up in the list. I'm not sure if that's normal but something I thought was odd. Also, although I have deleted the old app in Actions, it's still in the list after 24h+.

fishamic commented 2 years ago

The funny thing is that account is somehow "linked" image but same error popup. Tried just google home for the very first time and got this timing ;)

balloob commented 2 years ago

Make sure you are running the latest version of the local SDK JS: https://github.com/NabuCasa/home-assistant-google-assistant-local-sdk/releases

fishamic commented 2 years ago

Make sure you are running the latest version of the local SDK JS: https://github.com/NabuCasa/home-assistant-google-assistant-local-sdk/releases

Is this something additional? i run self-hosted HA without HA Cloud /NabuCasa and tried to get simple turning my zigbee devices which are not Tuya/Sonoff ones...(they are easily add via their apps)

Barsonax commented 2 years ago

Make sure you are running the latest version of the local SDK JS: https://github.com/NabuCasa/home-assistant-google-assistant-local-sdk/releases

Iam using the docker container so one would expect it already uses the correct version of that sdk

Barsonax commented 2 years ago

Just upgraded to 2022.7.0 but this is still not working nothing is being logged either when I try to add google assistant to homeassistant again.

When I input wrong credentials on purpose I do see a login attempt being logged

elupus commented 2 years ago

The local sdk is something you upload on the action console, when you set up the project on googles site.

Barsonax commented 2 years ago

The local sdk is something you upload on the action console, when you set up the project on googles site.

Oh you mean this part of the instructions? https://www.home-assistant.io/integrations/google_assistant/#enable-local-fulfillment

I just did that again but still not working. Maybe needs some time so will try again later.

elupus commented 2 years ago

The section called "Enable Local Fullment"

Barsonax commented 2 years ago

The section called "Enable Local Fullment"

I linked the wrong link, it was supposed to be https://www.home-assistant.io/integrations/google_assistant/#enable-local-fulfillment

DusBus commented 2 years ago

Wait, isn't this an optional step? As far as I understand it's supposed to work without enabling local fulfillment as well.

I too updated to 2022.7 but still... no luck.

Barsonax commented 2 years ago

Wait, isn't this an optional step? As far as I understand it's supposed to work without enabling local fulfillment as well.

I too updated to 2022.7 but still... no luck.

Yes it's optional, I just tried it out because iam running out of options πŸ˜…

DusBus commented 2 years ago

Same here, the WAF is dropping rapidly and I'm running out of excuses... The shiny new dashboards are only going to distract my SO for a limited amount of time πŸ˜‚

I was hoping it to just magically fix itself but I feel like that's not gonna happen. Unfortunately I'm still too much of a newcomer to HA and have literally no idea how to dive deeper or how to get my hands on some debug logs to maybe figure out what's going on.

lygris commented 2 years ago

I have a similiar issue I believe. My integration is working but state reporting is not. I'm continually getting the follow errors but devices are syncing.

Request for https://homegraph.googleapis.com/v1/devices:reportStateAndNotification failed: 404 Request for https://homegraph.googleapis.com/v1/devices:requestSync failed: 404

EDIT Realized I created my service account in the wrong GCP project, created a new one in the correct project and enabled homegraph and it's working now

Barsonax commented 2 years ago

Same here, the WAF is dropping rapidly and I'm running out of excuses... The shiny new dashboards are only going to distract my SO for a limited amount of time πŸ˜‚

I was hoping it to just magically fix itself but I feel like that's not gonna happen. Unfortunately I'm still too much of a newcomer to HA and have literally no idea how to dive deeper or how to get my hands on some debug logs to maybe figure out what's going on.

Even though I got more HA 'experience', I even have a job as software engineer, iam in the dark with this problem. It's hard to figure out what's going wrong without logging (checked HA and Google Cloud console but both empty).

I have been running HA for almost 2 years now, the google assistant integration was working fine for almost a year until it mysteriously broke.

There are so many more things that can break when you have a cloud based integrations like this. Looking into local based alternatives now but with voice there are not so much alternatives.

DusBus commented 2 years ago

Just tried it with 2022.7.1 and .2 but issue still persists. Wasn't expecting much since I didn't see anything related to it in the release notes but... one can have hope πŸ˜‰

What I find curious is that we don't see more people complaining about it being broken. Is it working for some? Is this integration just not used by many?

elupus commented 2 years ago

Try creating a new project in the action console. I've had to do that in the past.

DusBus commented 2 years ago

Try creating a new project in the action console. I've had to do that in the past.

That was basically the first thing I tried, after I ran into this issue for the first time. Started from scratch, cleaned all the related config from HA etc. Still, no luck.

oywino commented 2 years ago

It seems I have a similar issue: image I'm running HA in docker. This happened after upgrading from 6.7 to 7.0 I also tried 7.1 and 7.2 but to no avail. Reverting back to 6.7 did'nt quite solve the problem. I also had to completely restore a backup of the old config folder. Then everything is ok again as long as I stay at 6.7

elupus commented 2 years ago

It seems I have a similar issue: image I'm running HA in docker. This happened after upgrading from 6.7 to 7.0 I also tried 7.1 and 7.2 but to no avail. Reverting back to 6.7 did'nt quite solve the problem. I also had to completely restore a backup of the old config folder. Then everything is ok again as long as I stay at 6.7

Your issue is different. Can you open a new issue on that with the errors in log.

oywino commented 2 years ago

Your issue is different. Can you open a new issue on that with the errors in log.

Oops - sorry, I just reverted back and restored the previous config - so I guess the log is gone 😒

devoncrouse commented 2 years ago

+1 for the last couple months with each HA version - have tried completely removing/configuring from scratch the Google Home, app, service account (or no device sync), etc. per the manual setup instructions and this thread. Everything's accessible externally with a valid certificate and CloudFlare proxy disabled; I get the expected "405: Method Not Allowed" on the raw fulfillment URL.

I'm using Nginx proxy manager for SSL -> non-SSL backend. Websockets + HTTP/2 are enabled, no custom configuration.

devoncrouse commented 2 years ago

It looks like the authentication is actually successful when attempting to add the [test] app in Home - I don't see anything after the POST /auth/token :face_exhaling:

# 172.16.8.22 - HA internal IP
# 172.30.33.6 - nginx container IP
# 8123 - HA non-SSL port

ssh root@172.16.8.22 -p 22222 "docker run --rm --net=host d97jro/tcpdump tcpdump -i hassio -U -w - port 8123 and host 172.16.8.22 and host 172.30.33.6 2>/dev/null" | wireshark -k -i -

GET /auth/authorize?response_type=code&client_id=https://oauth-redirect.googleusercontent.com/r/APPNAME&redirect_uri=https://oauth-redirect.googleusercontent.com/r/APPNAME&scope=email+name&state=LONGANDENCODED HTTP/1.1
HTTP/1.1 200 OK
<!DOCTYPE html><html><head><title>Home Assistant</title>...

GET /auth/providers HTTP/1.1
HTTP/1.1 200 OK
[{"name": "Home Assistant Local", "id": null, "type": "homeassistant"}]

GET /manifest.json HTTP/1.1
HTTP/1.1 200 OK
{"background_color": "#FFFFFF", "description": "Home automation platform...

POST /auth/login_flow HTTP/1.1
{"client_id":"https://oauth-redirect.googleusercontent.com/r/APPNAME","handler":["homeassistant",null],"redirect_uri":"https://oauth-redirect.googleusercontent.com/r/APPNAME"}
HTTP/1.1 200 OK
{"type": "form", "flow_id": "HASH", "handler": ["homeassistant", null], "step_id": "init", "data_schema": [{"type": "string", "name": "username", "required": true}, {"type": "string", "name": "password", "required": true}], "errors": {}, "description_placeholders": null, "last_step": null}

POST /auth/login_flow/HASH HTTP/1.1
{"username":"USER","password":"PASSWORD","client_id":"https://oauth-redirect.googleusercontent.com/r/APPNAME"}
HTTP/1.1 200 OK
{"version": 1, "type": "create_entry", "flow_id": "HASH", "handler": ["homeassistant", null], "title": "Home Assistant Local", "description": null, "description_placeholders": null, "result": "HASH"}

POST /auth/token HTTP/1.1
grant_type=authorization_code&code=HASH&redirect_uri=https://oauth-redirect.googleusercontent.com/r/APPNAME&client_id=https://oauth-redirect.googleusercontent.com/r/APPNAME&client_secret=unused
HTTP/1.1 200 OK
{"access_token": "TOKEN", "token_type": "Bearer", "refresh_token": "TOKEN", "expires_in": 1800, "ha_auth_provider": "homeassistant"}
elupus commented 2 years ago

Hmm. Shouldnt state be part of the token response here? @balloob

Tacchi1983 commented 2 years ago

I had the "could not reach error" too, but then i found something under the settings of home assistant - people/persons - ure user . There is a setting "can only login from local network "(translated from my language, so can be bit different). I unchecked this option and then i could link the test again and everyting worked again. Maybe this is not the problem for all u guys , but this did the trick for me. Grtz

balloob commented 2 years ago

@elupus the /auth/token returns a correct token response so that seems to work ok.

fishamic commented 2 years ago

I had the "could not reach error" too, but then i found something under the settings of home assistant - people/persons - ure user . There is a setting "can only login from local network "(translated from my language, so can be bit different). I unchecked this option and then i could link the test again and everyting worked again. Maybe this is not the problem for all u guys , but this did the trick for me. Grtz

None of my ppl or users has limit to login only from local network. Is "ure" user name of some entry? I don't have one. thanks for help!

elupus commented 2 years ago

I just did a re-link on my development instance and that did work fine. So it can work at least.

I'm still very very interested in the issue @oywino had, could you guys check so you don't have that issue as well? Look in your integrations list.

elupus commented 2 years ago

Could you guys also limit the number of devices you sync to a single simple device. Setting expose_by_default: false and just expose a single device as per: https://www.home-assistant.io/integrations/google_assistant/#yaml-configuration

Seems somewhat unlikely to be the cause. But it will be waiting for the first device sync right after linking is completed.

oywino commented 2 years ago

I'm still very very interested in the issue @oywino had, could you guys check so you don't have that issue as well?

I discovered that this error I had seems to be a direct consequence of an error during HA restart caused by a very simple indentation fault (typo) in the configuration.yaml file.
For some reason, after updating HA to 7.x the Check Configuration no longer catches such syntax errors, which in turn allows HA to restart. But during restart, as soon as it hits the faulty part of the configuration.yaml it seems like the rest of the file is skipped, and as a result not only the mentioned Google integration failed to load, but several others as well, including custom dashboards etc.

DusBus commented 2 years ago

Could you guys also limit the number of devices you sync to a single simple device. Setting expose_by_default: false and just expose a single device as per: https://www.home-assistant.io/integrations/google_assistant/#yaml-configuration

Seems somewhat unlikely to be the cause. But it will be waiting for the first device sync right after linking is completed.

Just tested that, exposed only one device but sadly no luck.

For me the Google Home integration does not indicate an error, everything looks normal. Just as a side note, I'm running the most recent version of HA.

devoncrouse commented 2 years ago

No luck here either with expose_by_default: false and only light or only switch in exposed_domains. Also tried a new Google App from another user in the same Home with the same result. The integration appears normally in Home Assistant, with 1 service and 1 entity for report_state: true + service account or just 1 service for report_state: false. As reported earlier, each time I make the attempt, the account will show linked in the Google Test Simulator, even after selecting Unlink in between.

image

image

devoncrouse commented 2 years ago

I did also try a single device as follows with the same result:

google_assistant:
  project_id: APP_NAME
  report_state: false
  expose_by_default: false
  entity_config:
    light.office_floor_lamp:
      expose: true
      room: Office
pdobrien3 commented 2 years ago

i am adding this here because i have been following this thread and on some level i think it is relevant although i dont have the know-how to prove it.

https://github.com/NabuCasa/home-assistant-google-assistant-local-sdk/issues/23

https://github.com/NabuCasa/home-assistant-google-assistant-local-sdk/issues/20

it appeared to me that the issue was google minis, but i am not sure. do any of you have google minis in your setup?

if i am adding confusion to the mix, i will kindly bow out.

devoncrouse commented 2 years ago

To further narrow this down, because I was starting to suspect bad state somewhere on the Google account side:

I created a new Google account/email, unplugged the one Mini we do have, cleared Android cache + storage on the Home app, created a new Home for the account with nothing in it, created a new Actions on Google project for the new account, and still got the same behavior. This was using the previous config with updated project_id and only one entity exposed.

The only thing left I can think to try is a completely fresh install of Home Assistant somewhere - going to take me some time to get to that. I'm happy to try anything to further troubleshoot on the current host if there's anything that might help.

it will be waiting for the first device sync right after linking is completed.

@elupus can you clarify this? Should I be seeing another inbound call after /auth/token? The error in the Home app occurs immediately after the successful authentication. Are you or @DusBus or @Barsonax using SSL/nginx in front of your instances?

elupus commented 2 years ago

The next thing you should see is a execute request to: https://[YOUR HOME ASSISTANT URL:PORT]/api/google_assistant to get devices. So check your reverse proxy access logs.

devoncrouse commented 2 years ago

No sign of an incoming call to the /api/google_assistant fulfillment URL in nginx access/error logs - only the auth flow. I've opened an issue on https://developers.google.com/assistant/smarthome/support to see if I can find anything from that end.

damiano75 commented 2 years ago

Hi all, I think I have the same problem. I have Google Assistant manually configured, in the past it worked normally. Now I'm not able to add my project to Google Home app, so I used my 1 month trial subscription to Nabu Casa but I have the same issue with Home Assistant Cloud by Nabu Casa. So I think the problem isn't the configuration but the Google Assistant integration (manual or automatic)

damiano75 commented 2 years ago

Hi all, I think I have the same problem. I have Google Assistant manually configured, in the past it worked normally. Now I'm not able to add my project to Google Home app, so I used my 1 month trial subscription to Nabu Casa but I have the same issue with Home Assistant Cloud by Nabu Casa. So I think the problem isn't the configuration but the Google Assistant integration (manual or automatic)

I connected my project again, now it is linked but it doesn't see any scenes and scripts...

Taomyn commented 2 years ago

Yeah I was able to relink my project again late yesterday, around 24hrs ago, and it was able to see all the devices and scenes from before, but they all appear as offline in Home. The strange thing is that I can tell Google to perform an action on them and they work, just can't use the buttons in the app itself.

I'm also seeing issues getting my TCL TV app to re-link and it's similar, it keeps telling me I have no devices in the account when I have the one for the TV, yet it appears in Home, although it's on-line unlike the HA ones.

julianjwong commented 2 years ago

When relinking via the Google Home app do all the devices need to be reassigned to rooms? Takes me ages to do as Google Home app is very slow. But might need to try as my Google assistant integration has stopped too.

Edit: problem resolved. My router switched to 4G LTE backup and was therefore running CGNAT hence why my Google assistant wasn't working. Rebooted the router and it works again

vautieri commented 2 years ago

Same issues here.. worked for over a year and now tts does not work. If I go to media and try to send a trs message to a device it also fails not finding the media service to play

DusBus commented 2 years ago

Also did another test run but nothing has changed, still unable to link.