Search code examples
google-assistant-sdkgoogle-smart-home

Modelling Smart Home devices with Google Assistant SDK on a Ubuntu VM - available Device Types?


I am trying to model a smart home environment using Google Assistant SDK on a Ubuntu VM desktop. I would like to model all the Device Types listed in the developer documentation here https://developers.google.com/actions/smarthome/guides/ and investigate the commands for controlling them. However, when I attempted to create a device model for CAMERA I received an error message stating that the available Device Types are limited to LIGHT, SWITCH and OUTLET. Does anyone know whether / how it is possible to expand the list of available Device Types in the set-up as described?


Solution

  • Right now, the other device types are not supported. The reason is because of Types versus Traits.

    A type is a pretty generic description of what the device is: a lightbulb, an outlet, or a switch. This description is more useful in cases where you're doing remote execution. Phrases like "Turn on my lights" will obtain all devices of that type. With the Assistant SDK, remote execution is not supported at the moment, so the actual type you use is less important.

    A trait is a piece of metadata that describes an action that can be done to a device. "Turn on", "turn red", or "set the brightness to 20%" are all things that relate to different traits.

    These same types and traits also exist within the context of the Smart Home API, where the devices themselves don't have the Assistant embedded inside, but still exist and work within the ecosystem through cloud-to-cloud integrations.

    When I am building a camera, the specification discusses how to return specific properties along with a SYNC intent.

    "attributes": {
        "cameraStreamSupportedProtocols": ["hls", "dash"],
        "cameraStreamNeedAuthToken": true,
        "cameraStreamNeedDrmEncryption": false
      }
    

    When registering devices with the Assistant SDK, there is no SYNC request for you to return these properties. Thus, a device with the Assistant SDK is unable to know these values when a user sends an EXECUTE intent.

    The same is the case for some other device types like a Thermostat. As there is no SYNC or QUERY intent supported in the SDK, the Assistant will not know how to handle actions that require additional setup or parameters.

    At the moment, the Assistant SDK only supports a subset of types and traits available to Smart Home devices.

    If you do want to have a device that works with both Assistant SDK and additional traits like CameraStream, you will need to have two pathways/scripts.

    • First is the actual Assistant SDK integration, which will handle the audio input and output without any traits registered to that model
    • You will also need to have a Smart Home cloud integration which will support the CAMERA type and alert your client when a camera-related command is called.

    This does have the downside of needing to indirectly talk about your camera, ie. "Show front door camera". However, it would give you the ability to do both. The Assistant SDK does use your account, so any Smart Home commands will work in addition to other types of queries.

    If, instead you only want to model different device types without having each embed the Google Assistant in each one, then you can get away with creating each device type and just building a cloud-based integration.