TemperatureControl trait confusion - actions-on-google

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.

Related

Purchase event has been uploaded via Offline Conversions API, but the Event Set does not show any data

I followed the guide here: https://developers.facebook.com/docs/marketing-api/offline-conversions
Unlike "regular" Event Sets, which includes a "Test Events" tab in its dashboard, offline event sets don't seem to have this feature. You must either upload a CSV or call the API.
However, the offline event set shows no data coming from the API at all; the history tab only shows the CSV uploads, which were "last received 10 days ago". It doesn't even include the test upload I made today.
Is this a bug? How long should I wait for the data to appear in the events manager for my offline event?
Sample call
POST https://graph.facebook.com/v15.0/<offline_event_set_id>/events?access_token=<system_user_access_token>
{
"upload_tag": "store_data",
"data": [
{
"match_keys": {
"em": "<hashed>",
"ph": "<hashed>"
},
"currency": "PHP",
"value": 100,
"event_id": "test",
"event_name": "Purchase",
"event_time": "1669633380",
"custom_data": {
"event_source": "in_store"
},
"action_source": "physical_store",
"order_id": "test",
"data_processing_options": []
}
]
}
The response is as follows:
{"id":"<offline_event_set_id>","num_processed_entries":1}
Which seems to indicate that the event was uploaded successfully. But that event never shows up in the Overview tab of that offline event set.
Would appreciate any insights/guides elsewhere/answers, I've spent a few days on this with no success.
The "error": I was encoding the event_time as a string, whereas Facebook expects this value to be an integer. After updating my POST body to correct that, the events started showing up within minutes in the Overview tab.
{
"upload_tag": "store_data",
"data": [
{
"match_keys": {
"em": "<hashed>",
"ph": "<hashed>"
},
"currency": "PHP",
"value": 100,
"event_id": "test",
"event_name": "Purchase",
"event_time": 1669633380, // <-- The only change was removing the quotes
"custom_data": {
"event_source": "in_store"
},
"action_source": "physical_store",
"order_id": "test",
"data_processing_options": []
}
]
}
I really wish Facebook had returned some kind of error or warning, but at least I found the issue. Be careful with your data types, people!

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.

How to use roomHint and structureHint with smarthome 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.

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.

Actions on Google - smart home - how to make Google Home response properly when smart home device is offline?

My smart home app can control my smart home devices already.
However, I can't make Google Home to say like "your device is offline" when the smart home device is offline.
Google Home always says "ok, turning device_name on.".
According to the document and Node.js example provided by Google, I tried 2 kinds of error response:
{
"requestId": "xxxxxxx",
"payload": {
"commands": [{
"ids": ["456"],
"status": "ERROR",
"errorCode": "deviceoffline"
}]
}
}
{
"requestId": "xxxxxxx",
"payload": {
"commands": [{
"ids": ["456"],
"status": "OFFLINE",
"errorCode": "deviceoffline"
}]
}
}
But both are not working.
Please enlighten me. Thanks.
2017/08/02 update:
offline status is working on QUERY, like "Is device_name on?".
Not working on EXEC, like "Turn on device_name".
You missed out online parameter in the JSON. Here is an example of offline
{
"ids": ["456"],
"status": "ERROR",
"errorCode": "deviceTurnedOff",
"online": false
}