actions-on-googlegoogle-smart-home

How to show current garage door state on Google Home?


I have implemented a google actions backend that successfully communicates with Google Home/Assistant to open/close my garage door.

The SYNC replies with one device:

{
  "requestId": "XXX",
  "payload": {
    "agentUserId": "XXX",
    "devices": [
      {
        "id": "XXXX",
        "type": "action.devices.types.GARAGE",
        "traits": [
          "action.devices.traits.OpenClose"
        ],
        "name": {
          "name": "Garage XXXX"
        },
        "willReportState": false,
        "roomHint": "garage",
        "attributes": {
          "discreteOnlyOpenClose": true,
          "commandOnlyOpenClose": false,
          "openDirection": [
            "UP",
            "DOWN"
          ]
        },
        "deviceInfo": {
          "manufacturer": "XXX"
        }
      }
    ]
  }
}

When I open the app, I receive a QUERY:

{
  "inputs": [
    {
      "intent": "action.devices.QUERY",
      "payload": {
        "devices": [
          {
            "id": "XXX"
          }
        ]
      }
    }
  ],
  "requestId": "XXX"
}

to which I reply:

{
  "requestId": "XXX",
  "payload": {
    "agentUserId": "XXX",
    "devices": {
      "XXX": {
        "online": true,
        "status": "SUCCESS",
        "openPercent": 0
      }
    }
  }
}

I think I did right by answering that my device is a garage door, and I report that it's currently closed. However the app does not show a button to trigger an open/close action.

How can I have the app show a button like a light switch? Currently when I click on the device in the app, it just displays information (like the vendor, device name, etc) but no button and no actionable thing.

It does work though when I speak "open the garage", and the garage door opens successfully when I process the EXECUTE.


Solution

  • Not all device types and traits support the UI control at the moment. You can find the list of supported device types and traits on the google smart home documentation: developers.google.com/assistant/smarthome/develop/… .

    I would also recommend opening up a feature request on the public issue tracker in this regard so that we can place it on our future development roadmap for feature enhancements.