cancel
Showing results for 
Search instead for 
Did you mean: 

Google Assistant Not Triggering onQuery for Specific Commands on Lights, AC, and Speake

abhijith007
Community Member

Hi everyone,

I’m experiencing an issue with my smart home action, where Google Assistant isn’t triggering the onQuery functions for certain voice commands related to lighting, AC, and speaker devices.

Issue:

While basic commands like “Hey Google, turn on the kitchen light” or “Hey Google, turn off the office AC” work as expected and trigger the backend, other more specific commands do not seem to hit my Cloud Function. This applies to both onQuery.

Here are the commands that don’t trigger any backend functions:

  1. "Hey Google, is the kitchen light brighter?"
  2. "Hey Google, is the kitchen light dimmer?"
  3. "Hey Google, what is the color of the kitchen light?"
  4. "Hey Google, is the kitchen light red?"
  5. "Hey Google, is the kitchen light powered ON?"
  6. "Hey Google, is the office AC powered ON?"
  7. "Hey Google, is the fan speed of the office AC low?"

Additionally, I’m facing similar issues with my speaker device commands. Commands like the following are not triggering the onQuery function either:

  1. "Hey Google, what's the volume on Sonos Office?"
  2. "Hey Google, is Sonos Office muted?"

Expected Behavior:

I expect these specific commands to trigger the onQuery function in my Cloud Function, where the device state is queried and reported back to Google Assistant.

Actual Behavior:

For all of these commands, no requests are hitting my backend onQuery . Other basic commands, such as turning the devices on or off, work perfectly and trigger the expected backend functions.

Details:

  • Project ID: psl-gva-ii
  • Device Types Involved: Light, AC, Fan, Speaker
  • Traits Implemented:
    • action.devices.traits.OnOff
    • action.devices.traits.Brightness
    • action.devices.traits.ColorSetting
    • action.devices.traits.FanSpeed
    • action.devices.traits.Volume
    • action.devices.traits.TransportControl
  • Backend: Firebase Functions
  • Relevant Functions:
    • onQuery

Steps to Reproduce:

  1. Integrate smart home devices (lights, AC, fan, speakers) using Google Smart Home APIs.
  2. Implement onQuery functions in Firebase Functions.
  3. Use voice commands like:
    • "Hey Google, is the kitchen light brighter?"
    • "Hey Google, what's the volume on Sonos Office?"
    • "Hey Google, is the fan speed of the office AC low?"

Expected Result:

Google Assistant should trigger the onQuery function to retrieve and report the state of the device.

Actual Result:

No requests are received in the onQuery functions for these specific commands, and no logs are generated in Google Cloud for these cases. However, basic commands like “Turn on kitchen light” or “Turn off office AC” trigger the backend functions as expected.

Logs / Additional Info:

  • No log entries are generated for the above-mentioned commands in Google Cloud Logs.
  • The device traits are fully defined in the SYNC response, and the devices are available and functional via Google Assistant for basic commands.

Request for Support:

Can anyone help identify why these specific commands are not triggering the necessary backend functions (onQuery)? Any guidance or troubleshooting tips would be greatly appreciated.

Thanks in advance!

1 Recommended Answer

Hi @abhijith007 ,

Since there is a similar ticket in issue tracker, I will follow up the conversation there. 

View Recommended Answer in original post

5 REPLIES 5

GoogleDevForum
Solutions Expert
Solutions Expert

Thanks for bringing this up. Can you please share the full sync response and some code snippets from your onQuery function, especially the parts that handle the query parsing and device state retrieval?

 

abhijith007
Community Member

Hi Google Support Team,

Thank you for your response. I would like to provide the additional details and code snippets you requested regarding the issue I am encountering with the onQuery function not being triggered for certain commands.

1. Full Sync Response:

Please find the complete JSON response that I receive when requesting a full sync attached to this message.

 

{
   "requestId":"17211539550413013445",
   "payload":{
      "agentUserId":"***************************",
      "devices":[
         {
            "id":"1201@40971@PH80070019081955425",
            "type":"action.devices.types.CURTAIN",
            "traits":[
               "action.devices.traits.OpenClose"
            ],
            "name":{
               "defaultNames":[
                  "Curtain"
               ],
               "name":"Curtain",
               "nicknames":[
                  "Curtain"
               ]
            },
            "deviceInfo":{
               "manufacturer":"**********",
               "model":"hs1234",
               "hwVersion":"3.2",
               "swVersion":"11.4"
            },
            "willReportState":true
         },
         {
            "id":"1136@40972@PH80070019081955425",
            "type":"action.devices.types.THERMOSTAT",
            "traits":[
               "action.devices.traits.TemperatureSetting",
               "action.devices.traits.FanSpeed",
               "action.devices.traits.OnOff"
            ],
            "name":{
               "defaultNames":[
                  "Thermostat"
               ],
               "name":"Daikin AC",
               "nicknames":[
                  "Daikin AC"
               ]
            },
            "deviceInfo":{
               "manufacturer":"**********",
               "model":"hs1234",
               "hwVersion":"3.2",
               "swVersion":"11.4"
            },
            "willReportState":true,
            "attributes":{
               "availableThermostatModes":[
                  "heat",
                  "cool",
                  "auto"
               ],
               "availableFanSpeeds":{
                  "speeds":[
                     {
                        "speed_name":"speed_low",
                        "speed_values":[
                           {
                              "speed_synonym":[
                                 "low",
                                 "slow"
                              ],
                              "lang":"en"
                           }
                        ]
                     },
                     {
                        "speed_name":"speed_medium",
                        "speed_values":[
                           {
                              "speed_synonym":[
                                 "medium"
                              ],
                              "lang":"en"
                           }
                        ]
                     },
                     {
                        "speed_name":"speed_high",
                        "speed_values":[
                           {
                              "speed_synonym":[
                                 "high"
                              ],
                              "lang":"en"
                           }
                        ]
                     }
                  ],
                  "ordered":true
               },
               "thermostatTemperatureUnit":"C",
               "commandOnlyTemperatureSetting":true
            }
         },
         {
            "id":"1056@40973@PH80070019081955425",
            "type":"action.devices.types.SPEAKER",
            "traits":[
               "action.devices.traits.OnOff",
               "action.devices.traits.Volume",
               "action.devices.traits.TransportControl"
            ],
            "name":{
               "defaultNames":[
                  "Speaker"
               ],
               "name":"sonos Office",
               "nicknames":[
                  "sonos Office"
               ]
            },
            "deviceInfo":{
               "manufacturer":"**********",
               "model":"hs1234",
               "hwVersion":"3.2",
               "swVersion":"11.4"
            },
            "willReportState":true,
            "attributes":{
               "transportControlSupportedCommands":[
                  "NEXT",
                  "PREVIOUS",
                  "PAUSE",
                  "STOP",
                  "RESUME"
               ],
               "volumeMaxLevel":100,
               "volumeCanMuteAndUnmute":true,
               "supportPlaybackState":true
            }
         },
         {
            "id":"515@40974@PH80070019081955425",
            "type":"action.devices.types.LIGHT",
            "traits":[
               "action.devices.traits.OnOff",
               "action.devices.traits.Brightness",
               "action.devices.traits.ColorSetting"
            ],
            "name":{
               "defaultNames":[
                  "Color Light"
               ],
               "name":"Hue color lamp 1",
               "nicknames":[
                  "Hue color lamp 1"
               ]
            },
            "deviceInfo":{
               "manufacturer":"**********",
               "model":"hs1234",
               "hwVersion":"3.2",
               "swVersion":"11.4"
            },
            "willReportState":true,
            "attributes":{
               "colorModel":"hsv",
               "commandOnlyBrightness":true
            }
         },
         {
            "id":"515@40975@PH80070019081955425",
            "type":"action.devices.types.LIGHT",
            "traits":[
               "action.devices.traits.OnOff",
               "action.devices.traits.Brightness",
               "action.devices.traits.ColorSetting"
            ],
            "name":{
               "defaultNames":[
                  "Color Light"
               ],
               "name":"Hue color lamp 2",
               "nicknames":[
                  "Hue color lamp 2"
               ]
            },
            "deviceInfo":{
               "manufacturer":"**********",
               "model":"hs1234",
               "hwVersion":"3.2",
               "swVersion":"11.4"
            },
            "willReportState":true,
            "attributes":{
               "colorModel":"hsv",
               "commandOnlyBrightness":true
            }
         },
         {
            "id":"515@40976@PH80070019081955425",
            "type":"action.devices.types.LIGHT",
            "traits":[
               "action.devices.traits.OnOff",
               "action.devices.traits.Brightness",
               "action.devices.traits.ColorSetting"
            ],
            "name":{
               "defaultNames":[
                  "Color Light"
               ],
               "name":"Hue color lamp 3",
               "nicknames":[
                  "Hue color lamp 3"
               ]
            },
            "deviceInfo":{
               "manufacturer":"**********",
               "model":"hs1234",
               "hwVersion":"3.2",
               "swVersion":"11.4"
            },
            "willReportState":true,
            "attributes":{
               "colorModel":"hsv",
               "commandOnlyBrightness":true
            }
         },
         {
            "id":"576@40977@PH80070019081955425",
            "type":"action.devices.types.FAN",
            "traits":[
               "action.devices.traits.OnOff",
               "action.devices.traits.FanSpeed"
            ],
            "name":{
               "defaultNames":[
                  "Fan"
               ],
               "name":"Mistral Fan",
               "nicknames":[
                  "Mistral Fan"
               ]
            },
            "deviceInfo":{
               "manufacturer":"**********",
               "model":"hs1234",
               "hwVersion":"3.2",
               "swVersion":"11.4"
            },
            "willReportState":true,
            "attributes":{
               "availableFanSpeeds":{
                  "speeds":[
                     {
                        "speed_name":"speed_low",
                        "speed_values":[
                           {
                              "speed_synonym":[
                                 "low",
                                 "slow"
                              ],
                              "lang":"en"
                           }
                        ]
                     },
                     {
                        "speed_name":"speed_medium",
                        "speed_values":[
                           {
                              "speed_synonym":[
                                 "medium"
                              ],
                              "lang":"en"
                           }
                        ]
                     },
                     {
                        "speed_name":"speed_high",
                        "speed_values":[
                           {
                              "speed_synonym":[
                                 "high"
                              ],
                              "lang":"en"
                           }
                        ]
                     }
                  ],
                  "ordered":true
               },
               "reversible":true,
               "supportsFanSpeedPercent":true,
               "commandOnlyFanSpeed":true
            }
         },
         {
            "id":"1109@40978@PH80070019081955425",
            "type":"action.devices.types.TV",
            "traits":[
               "action.devices.traits.OnOff"
            ],
            "name":{
               "defaultNames":[
                  "TV"
               ],
               "name":"LG TV",
               "nicknames":[
                  "LG TV"
               ]
            },
            "deviceInfo":{
               "manufacturer":"**********",
               "model":"hs1234",
               "hwVersion":"3.2",
               "swVersion":"11.4"
            },
            "willReportState":true
         },
         {
            "id":"128@4097@PH80070019081955425",
            "type":"action.devices.types.LIGHT",
            "traits":[
               "action.devices.traits.OnOff"
            ],
            "name":{
               "defaultNames":[
                  "Group"
               ],
               "name":"A1 Group",
               "nicknames":[
                  "A1 Group"
               ]
            },
            "deviceInfo":{
               "manufacturer":"**********",
               "model":"hs1234",
               "hwVersion":"3.2",
               "swVersion":"11.4"
            },
            "willReportState":true
         },
         {
            "id":"112@49153@PH80070019081955425",
            "type":"action.devices.types.LIGHT",
            "traits":[
               "action.devices.traits.OnOff"
            ],
            "name":{
               "defaultNames":[
                  "Zone"
               ],
               "name":"K1 Zone",
               "nicknames":[
                  "K1 Zone"
               ]
            },
            "deviceInfo":{
               "manufacturer":"**********",
               "model":"hs1234",
               "hwVersion":"3.2",
               "swVersion":"11.4"
            },
            "willReportState":true
         },
         {
            "id":"160@12289@PH80070019081955425",
            "type":"action.devices.types.SCENE",
            "traits":[
               "action.devices.traits.Scene"
            ],
            "name":{
               "defaultNames":[
                  "Simple Event"
               ],
               "name":"Abhijith",
               "nicknames":[
                  "Abhijith"
               ]
            },
            "deviceInfo":{
               "manufacturer":"**********",
               "model":"hs1234",
               "hwVersion":"3.2",
               "swVersion":"11.4"
            },
            "willReportState":true,
            "attributes":{
               "sceneReversible":true
            }
         },
         {
            "id":"160@0@PH80070019081955425",
            "type":"action.devices.types.SCENE",
            "traits":[
               "action.devices.traits.Scene"
            ],
            "name":{
               "defaultNames":[
                  "Simple Event"
               ],
               "name":"All Event",
               "nicknames":[
                  "All Event"
               ]
            },
            "deviceInfo":{
               "manufacturer":"**********",
               "model":"hs1234",
               "hwVersion":"3.2",
               "swVersion":"11.4"
            },
            "willReportState":true,
            "attributes":{
               "sceneReversible":true
            }
         }
      ]
   }
}

 


2. Code Snippets:

Below are the relevant code snippets from my onQuery function, focusing on:

Query Parsing:

I am extracting the device ID and other relevant information as follows:

 
 
const onQuery = (body) => { const deviceId = body.inputs[0].payload.devices[0].id; // Additional parsing logic... };

Device State Retrieval:

The device state is being retrieved from an external API and returning the relevant values within the query response.

The following commands also do not seem to trigger the function as expected:

"Hey Google, is my speaker mute?"
"Hey Google, what is the volume of my speaker?"
"Hey Google, did my speaker stop playing a song?"
Despite the devices being successfully discovered and controllable, the onQuery function does not seem to activate for these queries. I would appreciate your assistance in investigating why these particular queries are not being handled by the onQuery function and what additional steps or configuration might be required to support these commands.

Please let me know if any further information is needed. Thank you for your help in resolving this issue.

abhijith007
Community Member

Dear Google Support Team,

I hope you’re doing well. I’m writing to follow up on the issue I raised regarding the check commands in my Google Smart Home integration. As requested, I previously submitted the SYNC response and a code snippet for my onQuery function. However, I have not received any updates or further feedback.

To recap, the issue involves inconsistent responses from Google Assistant when querying device states. I’ve reviewed the SYNC response and the onQuery logic, but the problem persists. Could you kindly provide any insights or further guidance on the matter?

I would appreciate an update or suggestions on how to resolve this issue effectively.

Thank you for your time and support.

Best regards,

Abhijith

Hi @abhijith007 ,

Since there is a similar ticket in issue tracker, I will follow up the conversation there. 

abhijith007
Community Member

@GoogleDevForum 

We raised a support ticket with Google regarding an issue where Google Assistant does not trigger onExecute or onQuery for certain specific check commands. As per the response from the support team, this is an expected behavior according to their implementation.

We further sought clarification to confirm whether this behavior applies to commands such as:

  • "Hey Google, is the kitchen light brighter?"
  • "Hey Google, is the kitchen light dimmer?"
  • "Hey Google, what is the color of the kitchen light?"
  • "Hey Google, is the kitchen light red?"
  • "Hey Google, is the kitchen light powered on?"
  • "Hey Google, is the office AC powered ON?"
  • "Hey Google, is the fan speed of the office AC low?"

As of now, we are waiting for confirmation from Google on the above scenarios. Once clarified, we will proceed accordingly and share further updates.