core
core copied to clipboard
Unable to sync devices with result code: 404
The problem
After updating the devices won't sync with HA and google anymore
What version of Home Assistant Core has the issue?
Home Assistant 2022.10.0b3
What was the last working version of Home Assistant Core?
Home Assistant 2022.10
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
No response
Link to integration documentation on our website
https://rc.home-assistant.io/integrations/google_assistant
Diagnostics information
Logger: homeassistant.components.websocket_api.http.connection
Source: components/google_assistant/button.py:51
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 13:03:20 (4 occurrences)
Last logged: 13:24:49
[139638782490800] Unable to sync devices with result code: 404, check log for more info.
[139640230191088] Unable to sync devices with result code: 404, check log for more info.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 202, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 207, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/button/__init__.py", line 116, in _async_press_action
await self.async_press()
File "/usr/src/homeassistant/homeassistant/components/google_assistant/button.py", line 51, in async_press
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Unable to sync devices with result code: 404, check log for more info.
Example YAML snippet
project_id: "ha-goggle-95614"
service_account:
private_key: "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-END PRIVATE KEY-----\n"
client_email: "xxxxxxx.iam.gserviceaccount.com"
report_state: true
exposed_domains:
- switch
- light
- script
- media_player
Anything in the logs that might be useful for us?
No response
Additional information
No response
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)
google_assistant documentation google_assistant source (message by IssueLinks)
Was working 2 days ago with 2022.9.6, however it is still not working with 2022.9.6; even after going through all the setup steps again.
May be a duckdns issue:, see #79424
look here https://intodns.com/duckdns.org
If you were using duckdns, this issue was resolved yesterday.
Hello, I have the same problem using qnap ddns. Do you know how duckdns managed to solve this? I guess there could be a change on Googles side?
Solved for me if it can help some mates : Last version of QTS enabled firewall, that restricted access to my region, and prevented google to connect. Disabled the region rule and now it's ok !
I have the same issue. When I test GET https://homegraph.googleapis.com/v1/devices:requestSync I get a 404 error. When I test POST https://homegraph.googleapis.com/v1/devices:requestSync I get a 403 error. Is it possible that HA is using GET rather than POST? The google documentation says POST should be used. https://developers.google.com/assistant/smarthome/reference/rest/v1/devices/requestSync
It looks to me like the call is made in async_call_homegraph_api, using .post on line 197, perhaps someone can mitmproxy the traffic?
https://github.com/home-assistant/core/blob/ca905a8c054fbab18b58428cab99f6e7b06ff7ad/homeassistant/components/google_assistant/http.py#L188
https://github.com/home-assistant/core/blob/ca905a8c054fbab18b58428cab99f6e7b06ff7ad/homeassistant/components/google_assistant/http.py#L197
I'm not 100% sure it's the same issue, but I had the same error messages in the log and solved after several hours of debugging.
HA uses the agentUserId (in the homegraph API call) of the user currently logged into the HA webinterface when you press the Synchronize Devices button. In my case that was NOT the same user I used to login to HA when adding the device in the Google Home app the first time.
The service call allows you to set the right agentUserId:
service: google_assistant.request_sync
data:
agent_user_id: xxxxxx
I'm not 100% sure it's the same issue, but I had the same error messages in the log and solved after several hours of debugging.
HA uses the agentUserId (in the homegraph API call) of the user currently logged into the HA webinterface when you press the Synchronize Devices button. In my case that was NOT the same user I used to login to HA when adding the device in the Google Home app the first time.
The service call allows you to set the right agentUserId:
service: google_assistant.request_sync data: agent_user_id: xxxxxx
I tried that, but still get 404 error.
Logging in to the HA host, I tried the following two commands:
curl -v https://homegraph.googleapis.com/v1/devices:requestSync # this is a GET and curl -v -d "foo" https://homegraph.googleapis.com/v1/devices:requestSync # this is a POST
The GET version returns 404
➜ ~ curl -v https://homegraph.googleapis.com/v1/devices:requestSync
* Trying 216.58.211.10:443...
* Connected to homegraph.googleapis.com (216.58.211.10) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted h2
* Server certificate:
* subject: CN=upload.video.google.com
* start date: Oct 17 08:18:30 2022 GMT
* expire date: Jan 9 08:18:29 2023 GMT
* subjectAltName: host "homegraph.googleapis.com" matched cert's "*.googleapis.com"
* issuer: C=US; O=Google Trust Services LLC; CN=GTS CA 1C3
* SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* h2h3 [:method: GET]
* h2h3 [:path: /v1/devices:requestSync]
* h2h3 [:scheme: https]
* h2h3 [:authority: homegraph.googleapis.com]
* h2h3 [user-agent: curl/7.83.1]
* h2h3 [accept: */*]
* Using Stream ID: 1 (easy handle 0x7fb7d75e91b0)
> GET /v1/devices:requestSync HTTP/2
> Host: homegraph.googleapis.com
> user-agent: curl/7.83.1
> accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 404
However, the PUT version returns 403 (since I did't provide auth)
➜ ~ curl -v -d "foo" https://homegraph.googleapis.com/v1/devices:requestSync
* Trying 216.58.211.10:443...
* Connected to homegraph.googleapis.com (216.58.211.10) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted h2
* Server certificate:
* subject: CN=upload.video.google.com
* start date: Oct 17 08:18:30 2022 GMT
* expire date: Jan 9 08:18:29 2023 GMT
* subjectAltName: host "homegraph.googleapis.com" matched cert's "*.googleapis.com"
* issuer: C=US; O=Google Trust Services LLC; CN=GTS CA 1C3
* SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* h2h3 [:method: POST]
* h2h3 [:path: /v1/devices:requestSync]
* h2h3 [:scheme: https]
* h2h3 [:authority: homegraph.googleapis.com]
* h2h3 [user-agent: curl/7.83.1]
* h2h3 [accept: */*]
* h2h3 [content-length: 3]
* h2h3 [content-type: application/x-www-form-urlencoded]
* Using Stream ID: 1 (easy handle 0x7fb23cc531b0)
> POST /v1/devices:requestSync HTTP/2
> Host: homegraph.googleapis.com
> user-agent: curl/7.83.1
> accept: */*
> content-length: 3
> content-type: application/x-www-form-urlencoded
>
* We are completely uploaded and fine
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 403
< vary: X-Origin
< vary: Referer
< vary: Origin,Accept-Encoding
< content-type: application/json; charset=UTF-8
< date: Sun, 06 Nov 2022 08:04:02 GMT
< server: ESF
< cache-control: private
< x-xss-protection: 0
< x-frame-options: SAMEORIGIN
< x-content-type-options: nosniff
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=25920
00; v="46,43"
< accept-ranges: none
<
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"status": "PERMISSION_DENIED"
}
}
* Connection #0 to host homegraph.googleapis.com left intact
I just got hit with this issue as well. I made no changes near the time of incident. The issue's appearance was sudden and I went from going about my day with a working connection to suddenly not. I primarily noticed because my lights started showing as inactive/disconnected in Google Home. Same errors and messages as d-d. I'm running Home Assistant v2022.11.2 with Docker v20.10.17 on Ubuntu Server v22.04.1.
After banging my head I was able to resolve this issue. It was as 'simple' as reconnecting my "Home Integrations" project in the Google Home app. I had reconfigured and just about blown everything away by the time I got to this.
@DeepSpaceK9 I am getting this every 1-2 weeks now. Super annoying.
FYI I was also having this issue and reconnecting the test application in Google Home corrected it for me.
I have the same problem but when I try reconnecting the test application in Google Home I get "could not reach ..."
After a lot of trouble shooting and reading other github issues about similar issues, I eventually determined that Google's traffic was not reaching my nginx servers. Some others have mentioned issues with geo-blocking firewalls. However my firewall was unchanged and passing all tcp/443 from anywhere. I proceeded to tcpdump what arrived at the external firewall interface, and found that the last thing that was seen was the "POST /auth/login_flow" request. Then nothing. By now I wanted to eliminate if there was something upstream in the way of Google, so I moved my entire nginx/Home Assistant to another network at a friend, and tried the exact same setup. Now the requests from Google were visible and the integration worked as it should:
"POST /auth/token HTTP/1.1" 200 344 "-" "OpenAuth"
"POST /api/google_assistant HTTP/1.1" 200 1230 "-" "Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)"
Conclusion: The problem for me was network related and the manual Home Assistant manual google account linking worked as it should.
I hope this can help someone else in the same situation. Look for the above Google requests in your logs. If they are not there, make sure they get to your system.
+1 getting 404 and unable to sync, even resetting test didn't fix it
Getting this in 22.12.07
Getting this in 22.12.07
+1 - It appears as though I can successfully log in to Home Assistant when I add the integration through the "Set up a device" menu in Google Home, but afterward it displays an error saying it "could not reach [my Home Assistant instance]". The logs in Google Cloud show BACKEND_FAILURE_URL_ERROR
+1 to @d-d it's likely network issue. I swapped home router to "modern" one which had one of opinionated NAT accelerators, and started the same sad journey. Disabling the NAT accelerator (bypass of packet inspection they call it) solved issue. Nothing on Google / hassio changed.
It's Def not a network issue my side. Might be something the Google side tbh.
However I found using a new device to do the sync worked. Using an old device even reinstalling the app didn't help had to be a new device. Worked after that.
I'm not 100% sure it's the same issue, but I had the same error messages in the log and solved after several hours of debugging.
HA uses the agentUserId (in the homegraph API call) of the user currently logged into the HA webinterface when you press the Synchronize Devices button. In my case that was NOT the same user I used to login to HA when adding the device in the Google Home app the first time.
The service call allows you to set the right agentUserId:
service: google_assistant.request_sync data: agent_user_id: xxxxxx
This did the trick. Sync button is not using the google account ID but the current user ID. How to test it: "Developer Tools" -> "Services" -> "Google Assistant: Request sync" and use the code by @sander1988 (quoted part) Replace "xxxxxx" with the correct ID.
Get ID: Go to "Settings" -> "People" -> "Users" and click your google user to get the correct ID.
So the button in UI should use the correct ID or should be configurable.
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.