DewGew/Domoticz-Google-Assistant

Can't sync devices - 404 error

RunnicFusion opened this issue · 10 comments

After updating my docker image to the latest DZGA release (1.23.10) my inslations stopped working. Previously my installation was running fine. Prevously I had 1.23.2 installed.

Things i've tried:

  • Created new google actions console app
  • Created new google cloud project + enabled HomeGraph API + crreated new service account
  • Imported newe json file as smart-home-key.json
  • Changed clientId and clientSecret a few times
  • Opened google home on my phone and try to re-link to new app (error after logging in from google interface; can't reach error)
  • Removed some key's and tried to re-add them trough the web UI to prevent json format issues
  • Removed .token folder + relogging; folder is created but no lock any further

When pressing sync button this error will display:
Error: Page not found!: 404 Client Error: Not Found for url: https://homegraph.googleapis.com/v1/devices:requestSync

Log file:

2023-08-24 17:10:39 - INFO - Connecting to Domoticz on http://192.168.1.18:8080
2023-08-24 17:10:39 - DEBUG - Starting new HTTP connection (1): 192.168.1.18:8080
2023-08-24 17:10:39 - DEBUG - http://192.168.1.18:8080 "GET /json.htm?type=command¶m=addlogmessage&message=Connected%20to%20Google%20Assistant%20with%20DZGA%20v1.23.10 HTTP/1.1" 200 49
2023-08-24 17:10:40 - DEBUG - Popen(['git', 'version'], cwd=/, universal_newlines=False, shell=None, istream=None)
2023-08-24 17:10:40 - DEBUG - <pid.posix.PidFile object at 0x7fabecb7cd10> entering setup
2023-08-24 17:10:40 - DEBUG - <pid.posix.PidFile object at 0x7fabecb7cd10> create pidfile: /run/.pid
2023-08-24 17:10:40 - DEBUG - <pid.posix.PidFile object at 0x7fabecb7cd10> check pidfile: /run/.pid
2023-08-24 17:10:40 - INFO - ========
2023-08-24 17:10:40 - INFO - Started DZGA v1.23.10 server at port 3030
2023-08-24 17:10:40 - INFO -  
2023-08-24 17:10:40 - INFO -    Visit http://localhost:3030/settings to access the user interface
2023-08-24 17:10:40 - INFO -  
2023-08-24 17:10:40 - INFO - =========
2023-08-24 17:10:40 - INFO - Visit the Actions on Google console at http://console.actions.google.com
2023-08-24 17:10:40 - INFO - Under Develop section, replace the fulfillment URL in Actions with:
2023-08-24 17:10:40 - INFO -    https://[your public url]/smarthome
2023-08-24 17:10:40 - INFO -  
2023-08-24 17:10:40 - INFO - In Account linking, set the Authorization URL to:
2023-08-24 17:10:40 - INFO -    https://[your public url]/oauth
2023-08-24 17:10:40 - INFO -  
2023-08-24 17:10:40 - INFO - Then set the Token URL to:
2023-08-24 17:10:40 - INFO -    https://[your public url]/token
2023-08-24 17:10:40 - INFO -  
2023-08-24 17:10:40 - INFO - Finally press 'SAVE' and then 'TEST' button
2023-08-24 17:10:40 - INFO - =======
2023-08-24 17:10:40 - DEBUG - Starting new HTTP connection (1): 192.168.1.18:8080
2023-08-24 17:10:40 - DEBUG - http://192.168.1.18:8080 "GET /json.htm?type=command¶m=getdevices&plan=0&filter=all&used=true HTTP/1.1" 200 22
2023-08-24 17:10:40 - ERROR - Error in  getting devices and settings
2023-08-24 17:10:59 - ERROR - Failed login from 77.169.245.219
2023-08-24 17:11:08 - ERROR - Failed login from 77.169.245.219
2023-08-24 17:25:09 - DEBUG - Starting new HTTPS connection (1): accounts.google.com:443
2023-08-24 17:25:09 - DEBUG - https://accounts.google.com:443 "POST /o/oauth2/token HTTP/1.1" 200 None
2023-08-24 17:25:09 - DEBUG - Starting new HTTPS connection (1): homegraph.googleapis.com:443
2023-08-24 17:25:09 - DEBUG - https://homegraph.googleapis.com:443 "POST /v1/devices:requestSync HTTP/1.1" 404 None
2023-08-24 17:06:47 - DEBUG - http://192.168.1.18:8080 "GET /json.htm?type=command¶m=getdevices&plan=0&filter=all&used=true HTTP/1.1" 200 22
2023-08-24 17:06:47 - ERROR - Error in  getting devices and settings
2023-08-24 17:07:07 - DEBUG - Starting new HTTPS connection (1): accounts.google.com:443
2023-08-24 17:07:07 - DEBUG - https://accounts.google.com:443 "POST /o/oauth2/token HTTP/1.1" 200 None
2023-08-24 17:07:07 - DEBUG - Starting new HTTPS connection (1): homegraph.googleapis.com:443
2023-08-24 17:07:07 - DEBUG - https://homegraph.googleapis.com:443 "POST /v1/devices:requestSync HTTP/1.1" 404 None

When clicking trough Google Cloud platform's log explorer it shows me that:

{
insertId: "1qzvxgfg1hnix6y"
jsonPayload: {
syncLog: {1}}
logName: "projects/dzga-gateway-64472/logs/assistant_smarthome%2Fassistant_smarthome_logs"
receiveTimestamp: "2023-08-24T16:37:47.300582445Z"
resource: {2}
severity: "ERROR"
timestamp: "2023-08-24T16:37:47.300582445Z"
}
{
insertId: "6nzqy6b1t"
jsonPayload: {
@type: "type.googleapis.com/google.identity.accountlinking.type.AccountLinkingError"
request: {4}
step: "AUTH_CODE_EXCHANGE"
}
logName: "projects/dzga-gateway-64472/logs/accountlinking-pa.googleapis.com%2Ferror"
receiveTimestamp: "2023-08-24T16:56:40.906997459Z"
resource: {2}
severity: "ERROR"
timestamp: "2023-08-24T16:56:40.849Z"
}
{
insertId: "6nzqy6b1u"
jsonPayload: {
@type: "type.googleapis.com/google.identity.accountlinking.type.AccountLinkingError"
errorReason: "Can't parse the response. The response needs to be JSON format."
response: {2}
step: "AUTH_CODE_EXCHANGE"
}
logName: "projects/dzga-gateway-64472/logs/accountlinking-pa.googleapis.com%2Ferror"
receiveTimestamp: "2023-08-24T16:56:40.906997459Z"
resource: {2}
severity: "ERROR"
timestamp: "2023-08-24T16:56:40.849Z"
}

ps: looks like I can't rollback because of the tags on: https://hub.docker.com/r/dewgew/domoticz-google-assistant
Only latest, develop and beta are set. Can't rollback to for example 1.23.7.

Some of the details in the Google cloud logs are collapsed which will have the actual response codes from DZGA and will help to identify the actual issue, especially the response: {2} in the insertId: "6nzqy6b1u" section

Some of the details in the Google cloud logs are collapsed which will have the actual response codes from DZGA and will help to identify the actual issue, especially the response: {2} in the insertId: "6nzqy6b1u" section

Do you mean I need to provide more details to fill-in missing string.format {X} placeholders? Not very familiar with the way how Google Cloud's logs are working and how to get relevant details out of it.

There should be a button "Expand nested fields" which should allow you to see all of the log details like this snippet from my earlier logs, the important bit being the body and status, which can then be matched to the DZGA code to identify the actual error.

jsonPayload: { @type: "type.googleapis.com/google.identity.accountlinking.type.AccountLinkingError" errorReason: "Can't parse the response. The response needs to be JSON format." response: { body: "incorrect client data" status: 400 } step: "AUTH_CODE_EXCHANGE" }

Allright. Will check and see if I van find more relevant information.

Do you have any other suggestions for me right now?

With expanding nested fields on:
{ "insertId": "c7wnz8f1rpy24", "jsonPayload": { "syncLog": { "syncs": [ { "requestId": "5422424344015623184", "status": "unknownError", "httpLatencyMsec": "226" } ] } }, "resource": { "type": "assistant_action_project", "labels": { "project_id": "dzga-gateway-64472" } }, "timestamp": "2023-08-24T20:37:20.749305228Z", "severity": "ERROR", "logName": "projects/dzga-gateway-64472/logs/assistant_smarthome%2Fassistant_smarthome_logs", "receiveTimestamp": "2023-08-24T20:37:20.749305228Z" }

It needs to be one of the log entries with
step: "AUTH_CODE_EXCHANGE" and
errorReason: "Can't parse the response. The response needs to be JSON format."

The only details needed are the response: section

See also issues when calling the Domoticz json api endpoint. So not sure if something goes wrong on that side also. Endpoint always returns Err as state.

Closing issue. Issue was:

  • my Domoticz installation was running on 2023.1 instead of 2023.2.
  • DZGA 1.23.10 needs Domoticz 2023.2 because of API changes for endpoinhts like json.htm?type=command=getdevices&plan=0&filter=all&used=true

Issue was; my docker image wasn't update correctly and using older (2023.1) version... :( Sorry for not noticing version difference until now.

Right now the new endpoints seems to work as expected so DZGA can fetch my devices and also connect to Google Home app.