How to use roomHint and structureHint with smarthome actions on Google - actions-on-google

We are currently setting un a Smarthome action, and we would like to provide roomHint on the first sync (not on request sync) as it's really tedious to set up rooms on the first sync, but it does not work.
We tried to name rooms in english and also in italian, (as it's not really clear from the documentation if there is a list on room names that we can use?) but no way.
So can you please give us a hint how to use the roomHint field?
Also in the API doc we've found structureHint, does it work? The documentation for SYNC intent does not mention this field.
Here is our SYNC intent with one device and room, we took office from the example JSON:
{
"requestId": "3582198904737125163",
"payload": {
"agentUserId": "xyz#qwertyz.com",
"devices": [
{
"id": "deviceID",
"type": "action.devices.types.LIGHT",
"traits": [
"action.devices.traits.OnOff"
],
"name": {
"name": "Lampadina",
"defaultNames": [
"Lampadina_XYZ"
],
"nicknames": [
"Lampadina"
]
},
"willReportState": false,
"customData": {
"modelType": "DEVICE"
},
"roomHint": "office"
}
]
}
}
Thanks

Unfortunately, I believe the structureHint is only in the HomeGraph API sync response.
It cannot be used in the Sync intent.
If someone can tell me I'm wrong and how to use it, you'd be a hero.

Related

TemperatureSetting "What's the temperature in my living room ?" sometimes answers weird stuff

I recently released a Smart Home action for interacting with our thermostats. This device type is Thermostat and the single implemented trait is TemperatureSetting.
When I ask my home assistant "What's the temperature in the living room ?", sometimes it answers good, sometimes it answers "Ok, this device has been updated" (this is a translation from my language so it may not be the accurate answer).
Checking the logs on my server, I can see the QUERY intent responses being made.
The following QUERY response provokes a "The temperature in your living room is 20.5 degrees" answer:
{
"aa0c2504f896": {
"status": "SUCCESS",
"online": true,
"thermostatMode": "heat",
"thermostatTemperatureAmbient": 20.7,
"thermostatTemperatureSetpoint": 20.5
}
}
This one provokes "Ok, this device has been updated" :
{
"aa0c2504f896": {
"status": "SUCCESS",
"online": true,
"thermostatMode": "heat",
"thermostatTemperatureAmbient": 20.7,
"thermostatTemperatureSetpoint": 19.5
}
}
I can reproduce it by changing the setpoint 1° lower, as shown by the previous logs. When doing so, the EXECUTE intent sends a ReportState request, so the HomeGraph API is updated synchronously.
Am I doing something wrong ?
Edit:
It happens every time the setpoint and the ambient temperature are different (in a 0.5 degrees interval). The Google Home UI always renders it correctly, it is the voice control that answers something wrong.
Here is also my SYNC payload :
{
"requestId": "5878230358273544341",
"payload": {
"agentUserId": "3101066d-b012-4780-8d77-7297aaea4e37",
"devices": [
{
"id": "aa0c2504f896",
"type": "action.devices.types.THERMOSTAT",
"traits": [
"action.devices.traits.TemperatureSetting"
],
"name": {
"defaultNames": [
"Thermostat COMAP"
],
"name": "Thermostat salon"
},
"willReportState": true,
"attributes": {
"availableThermostatModes": [
"heat",
"on"
],
"thermostatTemperatureRange": {
"minThresholdCelsius": 4,
"maxThresholdCelsius": 30
},
"thermostatTemperatureUnit": "C"
},
"deviceInfo": {
"manufacturer": "COMAP",
"model": "Thermostat",
"swVersion": "1143"
}
}
]
}
}
The query and sync payload provided by you looks good. We have updated the thermostat implementation throughout the last year and it works much better with floating points. If this issue still persists, I recommend creating a ticket on the public issue tracker.
There can also be one more reason as to why you have been encountering this issue. It might be also due to the local language, there can be a possibility that the Google Assistant hasn’t still incorporated the full compatibility for this particular language. Our NLU team is constantly working on incorporating these language capabilities into the system.

TemperatureControl trait confusion

I have just started with Google Actions. The first trait we want to support is the temperature reading from my device. It's not a thermostat so we'll need to use TemperatureControl trait (readonly-sensor, no control) .
The issue is that after implementing TemperatureControl, I can't request Google Assistant to read out the temperature. Has anyone encountered similar issue? I have search the topic on TemperatureControl, seems there was none similar issue reported. Thanks in advance.
The more detail flow is:
ask "What's the temperature in Bedroom?"
I receive a QUERY intent in my backend server and responded with Ambient Temperature
but, the answer is "Sorry I can't reach the bedroom right now. Please try again"
After that, I tried to add HumiditySetting Trait to verify my SYNC/ QUERY validity.
This is working.
ask "What's the Humidity level in Bedroom?"
I receive a QUERY intent in my backend server and responded with Ambient Humidity. Actually it's the same response as in the case of Temperature.
but, the answer is "the bedroom has a current humidity reading of xx%"
My SYNC Response is validated with https://developers.google.com/assistant/smarthome/tools/validator
Below is a sample:
{
"requestId": "10692316150281033205",
"payload": {
"agentUserId": "1-5671",
"devices": [
{
"id": "3466",
"type": "action.devices.types.CAMERA",
"traits"[
"action.devices.traits.HumiditySetting",
"action.devices.traits.TemperatureControl"
],
"name": {
"defaultNames": [
"bedroom"
],
"name": "bedroom",
"nicknames": [
"bedroom"
]
},
"willReportState": true,
"roomHint": null,
"deviceInfo": null,
"otherDeviceIds": null,
"customData": {
"deviceId": "CQAMNGF"
},
"attributes": {
"temperatureUnitForUX": "C",
"queryOnlyHumiditySetting": true,
"queryOnlyTemperatureControl": true
}
}
],
"errorCode": null
}
}
I found the issue.
I was using thermostatTemperatureSetpoint and thermostatTemperatureAmbient in Query response.
After changing them back to temperatureSetpointCelsius
temperatureAmbientCelsius, it works.

Google Home dialogFlow V2 API mediaResponse not working

I decided to upgrade my Google Assistant action to use "dialogFlow V2 API" and my webhook returns an object like this
{
"fulfillmentText": "Testing",
"fulfillmentMessages": [
{
"text": {
"text": [
"fulfillmentMessages text attribute"
]
}
}
],
"payload": {
"google": {
"richResponse": {
"items": [
{
"mediaResponse": {
"mediaType": "AUDIO",
"mediaObjects": [
{
"name": "mediaResponse name",
"description": "mediaResponse description",
"largeImage": {
"url": "https://.../640x480.jpg"
},
"contentUrl": "https://.../20183832714.mp3"
}
]
},
"simpleResponse": {
"textToSpeech": "simpleResponse: testing",
"ssml": "simpleResponse: ssml",
"displayText": "simpleResponse displayText"
}
}
]
}
}
},
"source": "webhook-play-sample"
}
But I get an error message saying my action it is not available, is mediaResponse supported by V2?, should I format my object differently?, also, when I remove "mediaResponse" object works just fine and the assistant will speak the simpleResponse part.
This action was re-created this Mid March 2018 and I read about May deadline and that is why I decide to upgrade to V2, do you think I should go back to V1, I know I will have to delete it and re-created but that is fine. This is a link to the JSON object I see in the debug tab. Thanks once again
I set "API V2" in my action dialogFlow console, this is a screenshot of that setting
Here is an screenshoot of my action's integration -> Google Assistant
Thanks Allen, Yes I do have "expectUserResponse": false, I added the suggestion object you recommended but, unfortunately nothing changed, I am still getting this error
Simulator debug tag details
First of all - this is not a problem with Dialogflow V2. You also seem to be confusing the sunset of Actions on Google V1 with the release of Dialogflow V2 - they are two different creatures completely. If your project was using AoG V1, there would be a setting on the Actions integration screen, and thee isn't.
It is fine if you want to move to Dialogflow V2, but it isn't required. Media definitely works under Dialogflow V2.
The array of items must include a simpleResponse item first, before any of the other items in the RichResponse. (You also shouldn't include both ssml and textToSpeech - just one of them.) You also don't need the fulfillmentText and fulfillmentMessages components, since those are provided by the richResponse.
You also need to include suggestions chips unless you have set expectUserResponse to false. Somewhere in the simulator debug is probably a block that says
{
"name": "MalformedResponse",
"debugInfo": "expected_inputs[0].input_prompt.rich_initial_prompt: Suggestions must be provided if media_response is used..",
"subDebugEntryList": []
}
So something more like this should work:
{
"payload": {
"google": {
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "simpleResponse: testing",
"displayText": "simpleResponse displayText"
},
"mediaResponse": {
"mediaType": "AUDIO",
"mediaObjects": [
{
"name": "mediaResponse name",
"description": "mediaResponse description",
"largeImage": {
"url": "https://.../640x480.jpg"
},
"contentUrl": "https://.../20183832714.mp3"
}
]
}
}
]
"suggestions": [
{
"title": "This"
},
{
"title": "That"
}
]
}
}
},
"source": "webhook-play-sample"
}

Actions on Google Smart Home Skill: Room Hint / Home Graph

The documentation at https://developers.google.com/actions/smarthome/create-app#actiondevicessync mentions that the roomHint field of the JSON response to the sync request can be used to have Google automatically assign devices to correct rooms.
However, no matter what I return in that field, the user still has to manually assign every device to a room and I cannot get Google to automatically recognize the correct room using this roomHint field
Here's an example response:
{
"requestId": "500166151965294748",
"payload": {
"devices": [
{
"id": "9",
"type": "action.devices.types.LIGHT",
"traits": [
"action.devices.traits.OnOff"
],
"name": {
"name": "Light"
},
"willReportState": false,
"roomHint": "Attic"
}
]
}
}
Right now supplying a value for the roomHint is not used by the HomeGraph to determine which room this device is in.

ACRCloud external meta data and IDs not returning

When making valid requests to http://ap-southeast-1.api.acrcloud.com/v1/identify I get successful responses, however both external_ids and external_metadata always come back as empty objects.
Example response:
{
"external_ids": {},
"play_offset_ms": 97480,
"external_metadata": {},
"label": "Universal Music Ltd.",
"release_date": "2012-01-01",
"album": {
"name": "The Love Club EP"
},
"title": "Royals",
"duration_ms": "190185",
"genres": [
{
"name": "Pop"
}
],
"acrid": "b748d828aba29c699f732bd660123bae",
"result_from": 3,
"artists": [
{
"name": "Lorde"
}
]
}
Anyone know why all my identifications wouldn't contain this data?
Please select the 3rd party ID integration while creating the projects.