Closed Piedro1 closed 4 years ago
hmm, enabling the Google Home Graph API does seem to help a bit :-). Now I'm just receiving "bad request" error's. Looking further. Thanks.
You'll want to make sure these settings are set correctly, and that you have downloaded the service account file from Google after enabling API access for HomeGraph. Google has docs (linked in that doc) that specify how to set up the API access, etc.
Outside of that, make sure you have done an initial sync... the Google design here leaves something to be desired, so if you haven't done a "sync my devices" for a device before it starts sending updates to homeGraph, home graph won't KNOW about it and will reject the request.
How can I do a "Sync my devices"?
"Hey google, sync my devices"
LOL.
As per "https://developers.google.com/assistant/smarthome/develop/report-state" I tried oauthplayground, to obtain an "AgentID". One instruction is to define the scope "devices" and then to "Authorize API's". Homeautio then responds with an error: "Invalid scope". What should I do?
You lost me. I'm not sure what you are changing anymore, as you have no capability to mess with report state service scopes from this app.
Ah I think I see what you are trying to do. That is unnecessary. Just set he agentUserId field to whatever value you want in the config file. That setting is used both as your agentUserId for the app SYNC as well as for the GoogleHomeGraph calls. Its done that way purposefully so you don't have to manually make sure two settings match.
Thanks, this works (almost completely :-) ). Now I'm getting "not found" messages, which I will have to look into.
HomeGraph Update still failing. I'm still getting "Not Found" responses. "Sync", "Query" and "Execute" work Ok. How can I troubleshoot this?
Hmm I see my own working ok... it could be related to something device specific I suppose. Can you supply the device's config from your device config file?
This is the config of one of the devices:
(I have two, but both get the same response)
{ "google/home/leeslamp": { "id": "google/home/leeslamp", "type": "action.devices.types.LIGHT", "disabled": false, "willReportState": true, "roomHint": "Woonkamer", "name": { "defaultNames": [], "name": "Leeslamp", "nicknames": [] }, "deviceInfo": null, "traits": [ { "trait": "action.devices.traits.OnOff", "attributes": null, "commands": { "action.devices.commands.OnOff": { "on": "cmnd/powerplug-01/POWER" } }, "state": { "on": { "topic": "state/powerplug-01/POWER", "googleType": "bool", "valueMap": [ { "mqtt": "on", "type": "value", "google": true }, { "mqtt": "off", "type": "value", "google": false } ] } } } ], "customData": null } }
This is part of the log file:
2020-04-30 21:33:57.628 +02:00 [Information] MQTT message received for topic "state/powerplug-01/POWER": "ON" 2020-04-30 21:33:57.757 +02:00 [Information] Start processing HTTP request "POST" https://oauth2.googleapis.com/token 2020-04-30 21:33:57.761 +02:00 [Information] Sending HTTP request "POST" https://oauth2.googleapis.com/token 2020-04-30 21:33:57.886 +02:00 [Information] Received HTTP response after 125.0468ms - OK 2020-04-30 21:33:57.889 +02:00 [Information] End processing HTTP request after 131.5531ms - OK 2020-04-30 21:33:57.892 +02:00 [Information] Start processing HTTP request "POST" https://homegraph.googleapis.com/v1/devices:reportStateAndNotification 2020-04-30 21:33:57.894 +02:00 [Information] Sending HTTP request "POST" https://homegraph.googleapis.com/v1/devices:reportStateAndNotification 2020-04-30 21:33:58.136 +02:00 [Information] Received HTTP response after 241.9288ms - NotFound 2020-04-30 21:33:58.139 +02:00 [Information] End processing HTTP request after 247.0723ms - NotFound 2020-04-30 21:33:58.141 +02:00 [Warning] Google Home Graph update failed for devices: google/home/leeslamp
Does it have something to with case sensitivity? For example: the device sends "ON", and in the device config it says "mqtt": "on". I tried changing this specific one, but that didn't work. Maybe there are other cases?
The value in the value map is case sensitive, yes, and should match the actual value sent in the MQTT message. That COULD cause a bad request if you don't have a valid map config, as if it can't find one that matches, and a simple type conversion to the Google type doesn't work, it'll be set to NULL.
The NotFound though isn't a bad request,that sounds more like HomeGraph doesn't know about the device at all (i.e., a failed SYNC). If your initial SYNC is failing because you aren't sending a valid response due to misconfigured ValueMap, that might be the issue.
In the next version, I'm going to add a button that lets you output the exact SYNC payload for running through the google verification tool, but until then, we're just going to have to review your configs here until you get it right. Whats hte other device look like?
The other one looks like this:
"google/home/ledstriptrap": { "id": "google/home/ledstriptrap", "type": "action.devices.types.LIGHT", "disabled": false, "willReportState": true, "roomHint": "Hal", "name": { "defaultNames": [], "name": "ledstrip", "nicknames": [] }, "deviceInfo": { "manufacturer": "Some Company", "model": "Some Model", "hwVersion": "1.0", "swVersion": "1.0" }, "traits": [ { "trait": "action.devices.traits.OnOff", "attributes": null, "commands": { "action.devices.commands.OnOff": { "on": "cmnd/LEDSTRIP/POWER" } }, "state": { "on": { "topic": "state/LEDSTRIP/POWER", "googleType": "bool", "valueMap": [ { "mqtt": "on", "type": "value", "google": true }, { "mqtt": "off", "type": "value", "google": false }, { "mqtt": "0", "type": "value", "google": false } ] } } }, { "trait": "action.devices.traits.Brightness", "attributes": null, "commands": { "action.devices.commands.BrightnessAbsolute": { "brightness": "cmnd/LEDSTRIP/Dimmer/" } }, "state": { "brightness": { "topic": "state/LEDSTRIP/Dimmer", "googleType": "numeric", "valueMap": [ { "mqttMin": 1.0, "mqttMax": 100.0, "type": "range", "google": true } ] } } }, { "trait": "action.devices.traits.ColorSetting", "attributes": { "colorModel": "hsv", "colorTemperatureRange": { "temperatureMinK": 2000, "temperatureMaxK": 9000 }, "commandOnlyColorSetting": false }, "commands": { "action.devices.commands.ColorAbsolute": { "color.name": "cmnd/LEDSTRIP/Color", "color.temperature": "cmnd/LEDSTRIP/temperatureK", "color.spectrumRGB": "cmnd/LEDSTRIP/spectrumRGB", "color.spectrumHSV.hue": "google/home/LEDSTRIP/HSBColor/hue", "color.spectrumHSV.saturation": "google/home/LEDSTRIP/HSBColor/saturation", "color.spectrumHSV.value": "google/home/LEDSTRIP/HSBColor/value" } }, "state": { "color.name": { "topic": "state/LEDSTRIP/Color", "googleType": "string", "valueMap": null }, "color.temperatureK": { "topic": "state/LEDSTRIP/temperatureK", "googleType": "numeric", "valueMap": null }, "color.spectrumRGB": { "topic": "state/LEDSTRIP/SpectrumRGB", "googleType": "numeric", "valueMap": null }, "color.spectrumHsv.hue": { "topic": "state/LEDSTRIP/SpectrumHsv/hue", "googleType": "numeric", "valueMap": null }, "color.spectrumHsv.saturation": { "topic": "state/LEDSTRIP/SpectrumHsv/saturation", "googleType": "numeric", "valueMap": null }, "color.spectrumHsv.value": { "topic": "state/LEDSTRIP/SpectrumHsv/value", "googleType": "numeric", "valueMap": null } } } ], "customData": null } }
I did a "sync my devices" again and am getting "Bad Request" responses again. Now changing the mqtt-valueMap values, to see if that helps.
Nice... I added the example "zway/diningRoom/diningRoomLight" as is, which works like a charm...
Now we're getting somewhere. Thanks so far. I'll close the issue again.
Trouble shooting these should be a little easier when I add the ability to see what Google sees for the SYNC intent. Unfortunately, they don't supply any sort of logging or anything else to help you here (which is frankly ridiculous). I'd definitely put my money on the ValueMaps being off though originally for you.
Looking forward to try that update.
Finally got around to releasing it, it should have a new entry on the main device list page to grab the current SYNC response for validation.
Thanx, i've tried it and it works really nice.
Hello all, I'm trying to update the Home Graph, but see a response in the log file that the update is "forbidden".
" 2020-04-20 14:54:06.164 +02:00 [Information] Start processing HTTP request "POST" https://homegraph.googleapis.com/v1/devices:reportStateAndNotification 2020-04-20 14:54:06.168 +02:00 [Information] Sending HTTP request "POST" https://homegraph.googleapis.com/v1/devices:reportStateAndNotification 2020-04-20 14:54:06.182 +02:00 [Information] Received HTTP response after 122.3534ms - Forbidden 2020-04-20 14:54:06.185 +02:00 [Information] End processing HTTP request after 128.3185ms - Forbidden 2020-04-20 14:54:06.188 +02:00 [Warning] Google Home Graph update failed for devices: google/home/ledstriptrap 2020-04-20 14:54:06.212 +02:00 [Information] Received HTTP response after 43.5534ms - Forbidden 2020-04-20 14:54:06.214 +02:00 [Information] End processing HTTP request after 50.1539ms - Forbidden 2020-04-20 14:54:06.216 +02:00 [Warning] Google Home Graph update failed for devices: google/home/ledstriptrap" "
I created a service account and put the information in appsettings.Production.json, which seems to work. Any ideas?
Kind regards, Piet