[Alpha] Community-maintained Google Home integration

I've been transitioning over to Google Assistant from Alexa for a while now, and one of the biggest problems I had was the fact that the Hubitat integration with Google Home reported all of my window blinds and ceiling fans as lights. I got annoyed enough with it that I decided to write my own integration between the two.

This is a very highly customizable integration that allows the user to define how each device type appears to Google Home and how Google Home commands map to Hubitat commands and attributes.

The integration works with user-defined "device types", each of which has one or more "device traits". These "device traits" are what map Hubitat commands and attributes into a format that Google Home will understand. This is orthogonal to the device type reported by Google Home, allowing you to mix-and-match capabilities and commands while having the device appear as any type you would like.

Note that this is an alpha release, so it's probably buggy and not all of the device traits supported by Google Home are implemented in this app.

Setting It Up

Setting It Up

Sadly, the setup process is very cumbersome. It requires that you create both the app in Hubitat and a Google smart home Action.

Installing the Hubitat App

To install the Hubitat App:

  1. Navigate to "Apps Code" in Hubitat
  2. Click "New App"
  3. Paste the code from google-home-community.groovy into the editor and click save
  4. Click "OAuth"
  5. In the popup dialog, click "Enable OAuth in App"
  6. Click "Update"
  7. Click "OAuth" again
  8. Make a note of the values in the "Client ID" and "Client Secret" fields
    • Note: Using keyboard shortcuts to copy from the Client ID and Client Secret fields doesn't work in some browsers (notably Google Chrome). You may need to either right-click and copy from the context menu or type the values out manually.
  9. Navigate to "Apps" in Hubitat
  10. Click "Add User App" and select "Google Home Community"
  11. Make a note of the app's ID. This can be found in your web browser's URL bar.
    • The URL should be http://{your hub IP}/installedapp/configure/{app ID}/mainPreferences
    • The number between "configure/" and "/mainPreferences" is your app's ID
    • For example, if the URL for the app is http://192.168.0.123/installedapp/configure/12345/mainPreferences then your app ID is 12345
  12. Configure at least one device type. See Configuring Devices below for more information.
  13. Click "Done".

Creating the Google smart home Action

Before creating your Google smart home Action, you will need your Hubitat hub's ID:

  1. Navigate to the "Settings -> Hub Details" page in Hubitat
  2. Note the value under "Hub UID"

To create your Google smart home Action:

  1. Navigate to https://console.actions.google.com
  2. Click "New project"
  3. Enter a name for the project and click "Create project"
  4. Select "Smart Home" and click "Start Building"
  5. Click the "Develop" tab.
  6. On the "Invocation" screen, give your Action a name
  7. Click "Actions" in the menu
  8. Enter the following as the Fulfillment URL:
    • https://cloud.hubitat.com/api/{your hub ID}/apps/{app ID}/action
    • For example:
      • Your app ID from step 11 of the "Installing the Hubitat App" section above is 12345
      • Your Hub ID from step 2 of the previous section is b97ac781-df30-43cd-98a4-e8a9a040bada
      • Your Fulfillment URL would be https://cloud.hubitat.com/api/b97ac781-df30-43cd-98a4-e8a9a040bada/apps/12345/action
  9. Click "Account linkig" in the menu
  10. Enter the Client ID and Client Secret you got when enabling OAuth for the Google Home Community app
  11. Enter https://oauth.cloud.hubitat.com/oauth/authorize as the Authorization URL
  12. Enter https://oauth.cloud.hubitat.com/oauth/token as the Token URL
  13. Click "Next"
  14. Leave everything unchecked in the "Use your app for account linking (optional)" section and click "Next"
  15. In the "Configure your client (optional)" section, enter "app" in the Scopes box
  16. Click "Save"
  17. Click the "Test" tab
  18. In the top-right of the page, click "Settings" and ensure "On device testing" is enabled
    • Note: You may need to wait a few minutes at this point for Google's backend to get itself sorted out. If after several minutes you get a quick loading screen and bounced back to the list after step 23 below, you may need to make a trivial change (such as removing and re-adding a character from the Action's display name) and save the Action to force it to figure its life out.
  19. Open the Google Home app on your phone or tablet
  20. Tap the "+" in the top-left corner
  21. Tap "Set up device"
  22. Tap "Works with Google"
  23. In the list, find the entry [test] {your action name}
  24. Enter your Hubitat account credentials and click "Sign In"
  25. Select your hub and tap "Select"
  26. Make sure at least one device is selected to expose to Google Home
    • Note: If you do not select any devices or your selected devices have no traits defined, the linking process will fail. If that happens, go back to the Google Home Community app in Hubitat and select at least one device and then try again starting from step 18 above.
  27. Tap "Authorize"
Configuring Devices

Configuring Devices

The first step to configuring a device to link to Google Home is to define a device type. This will determine what kind of device Google Home sees devices as, what commands are available to interact with them, and how those commands will translate to Hubitat commands.

Defining a Device Type

  1. Navigate to "Apps" in Hubitat
  2. Click on the "Google Home Community" app you created
  3. Click "Define new device type"
  4. Fill in the settings on the "Device Type Definition" page. See Device Type Settings below.
  5. Select one or more device traits to add to this device type. Device traits determine what commands are available for a device type and how those commands translate to Hubitat commands. All device types must have at least one trait defined or Google Home will fail to sync your devices. See below for more information about individual device traits.
  6. Click "Next"
  7. Back on the main preferences page, click "{device type} devices" and select which devices you would like to link to Google Home using this device type
  8. Click "Done"
  9. Either pull down to refresh in the Google Home app or say "Hey Google, sync my smart home devices"
  10. The selected devices should appear in your Google Home app and be available to control using the Google assistant

Note: The same device should not be selected for multiple device types.

Device Type Settings

Each device type has the following settings:

  • Device type name: This is the display name for this device type. It will be shown in the device selector once the device type is defined.
  • Device type: A Hubitat capability that will determine which devices are available to select for this device type.
  • Google Home device type: The type of device that Google Home will see the selected devices as. Controls the icon and available controls in the Google Home app and on Google Assistant devices with screens. The "Scene" device type is special. Devices with the "Scene" type are not shown in the main Google Home app interface, but may be controlled by voice and using routines.
  • Device traits: The traits defined for this device. See Device Traits below.
  • Actions to Confirm: Only visible if the device has one or more traits with actions. The Google Assistant will ask for confirmation before performing these actions. This is primarily useful to prevent the assistant from triggering an action accidentally.
  • Actions requiring PIN: Only visible if the device has one or more traits with actions. The Google Assistant will request a PIN code before performing these actions. Useful for security-critical actions such as unlocking a lock or opening a garage door.
  • PIN Codes: Only visible if one or more actions are configured to require a PIN code. Allows you to manage the PIN codes that will be accepted for this device type.
  • Use device pincodes: Set to retrieve the pincodes from the device. Set to false to use the app pincodes. Defaults to 'false'.
    NOTE: Global pincodes are always useable.
    • Device pin code attribute: The device attribute used to query the device pincodes JSON map. Maps to the lockCodes attribute by default.
    • Device pin code value: The key value in the JSON map pointing to the user pincode. Maps to the code value by default.
Device Trait Settings

Device Traits

Google Home defines a number of device traits that you can mix-and-match to define the functionality of any particular type of device. Not all traits are currently supported by Google Home Community. The following are the currently supported device traits and their configuration parameters:

Arm/Disarm

The Arm/Disarm trait is user to control security systems. It can be controlled by saying things like "Hey Google, arm {device} to {level}" or "Hey Google, disarm {device}}" and queried by saying things like "Hey Google, is the {device} armed?". It has the following configuration parameters:

  • Armed/Disarmed Attribute: The device attribute used to query the current alarm status of the device. Maps to the securityKeypad attribute by default.
  • Current Arm Level Attribute: The device attribute used to query the current alarm level of the device. Maps to the securityKeypad attribute by default.
  • Exit Delay Value Attribute: The device attribute used to indicate how long the user has until the alarm is set. Maps to the exitAllowance attribute by default.
  • Supported Alarm Levels: The device attribute used to indicate which alarm levels are available. Available selections are "Disarm, Home, Night, Away". For each setting the following settings are available:
    • Google Home Level Names for Disarm: Comma separated list of synonyms that Google can send to set this level. Maps to the Disarm attribute by default.
    • Hubitat Command for Disarm: The device command used to set this level. Maps to the disarm attribute by default.
    • Hubitat Value for Home: The device value returned when the device is set to this level. Maps to the disarmed attribute by default.
    • Google Home Level Names for Night: Comma separated list of synonyms that Google can send to set this level. Maps to the Night attribute by default.
    • Hubitat Command for Night: The device command used to set this level. Maps to the armNight attribute by default.
    • Hubitat Value for Night: The device value returned when the device is set to this level. Maps to the armed night attribute by default.
    • Google Home Level Names for Home: Comma separated list of synonyms that Google can send to set this level. Maps to the Home attribute by default.
    • Hubitat Command for Home: The device command used to set this level. Maps to the armHome attribute by default.
    • Hubitat Value for Home: The device value returned when the device is set to this level. Maps to the armed home attribute by default.
    • Google Home Level Names for Away: Comma separated list of synonyms that Google can send to set this level. Maps to the Away attribute by default.
    • Hubitat Command for Away: The device command used to set this level. Maps to the armAway attribute by default.
    • Hubitat Value for Away: The device value returned when the device is set to this level. Maps to the armed away attribute by default.
  • Return user index: If selected, during a successful pincode challenge, the user index is returned with the Arm/Disarm commands. Defaults to 'false'. NOTE: Device must support parameters in the arm / disarm commands.

Brightness

The Brightness trait is primarily used for devices like dimmer switches and light bulbs, but can be used for any device that can be set to a level between 0% and 100%. It can be controlled by saying things like "Hey Google, set {device} to {level}" and queried by saying things like "Hey Google, what's the level of {device}?". It has the following configuration parameters:

  • Current Brightness Attribute: The device attribute used to query the current brightness level of the device. Should be in the range 0-100. Maps to the level attribute by default.
  • Set Brightness Command: A device command used to set the brightness of the device. Should accept a brightness level in the range 0-100. Maps to the setLevel command by default.

CameraStream

The CameraStream trait is used to map compatible video streams for viewing on ChromeCast enabled devices (Nest Hubs, ChromeCast, etc).

It requires a driver that maps the stream URL to the Camera Stream URL Attribute setting. Maps to settings by default.

  • This can be accomplished using one or both of the supplied drivers:
    • Hubitat Virtual Generic Camera Stream Object.groovy: Enter the complete stream URLs of all camera supported protocols in the Camera HLS stream HTTP URL, Camera MP4 stream HTTP URL, Camera dash stream HTTP URL, and/or Camera smooth stream HTTP URL input fields.
      NOTE: At least ONE URL must be set. The driver will serve up the supported streams based on the display device request.
    • Hubitat Virtual BlueIris Camera Stream Object.groovy: For use with the Blue Iris DVR. Enter the Webserver HTTP URL:Port (omit the http://), Camera Short Name, Webserver Username (Optional) and Webserver Password (Optional).
    • For both of the above drivers, select the protocol for the stream.

NOTE: These drivers offer no other functionality other than a placeholder for the stream URL. The buttons are non-functional.

Color Setting

The Color Setting trait is intended primarily for smart lights that can have their color set. It supports both full-spectrum color and color temperature. It can be controlled by saying things like "Hey Goolge, set {device} to blue" or "Hey Google, set {device} to 3500K". Color cannot currently be queried. The Color Setting trait has the following configuration parameters:

NOTE: At least one of "Full-Spectrum Color Control" and/or "Color Temperature Control" must be set.

  • Full-Spectrum Color Control: Set this if the device can be set to any color. If set, the following settings become available:
    • Hue Attribute: The device attribute used to query the current hue of the device. Maps to hue by default.
    • Saturation Attribute: The device attribute used to query the current saturation of the device. Maps to saturation by default.
    • Level Attribute: The device attribute used to query the current level/value of the device. Maps to level by default.
    • Set Color Command: A device command used to set the color of the device. Should accept a map with the keys hue, saturaton, and level. Maps to setColor by default.
  • Color Temperature Control: Set this if the device can have its color temperature set. If set, the following settings become available:
    • Minimum Color Temperature: The minimum color temperature to which the device can be set. Default is 2200.
    • Maximum Color Temperature: The maximum color temperature to which the device can be set. Default is 6500.
    • Color Temperature Attribute: The device attribute used to query the current color temperature of the device. Maps to colorTemperature by default.
    • Set Color Temperature Command: A device command used to set the color temperature of the device. Should accept an integer in the range [Minimum Color Temperature, Maximum Color Temperature]. Maps to setColorTemperature by default.

If both "Full-Spectrum Color Control" and "Color Temperature Control" are set, the following settings become available:

  • Color Mode Attribute: The device attribute used to determine if the device's color is currently set to a full-spectrum color or a color temperature. Maps to colorMode by default.
  • Full-Spectrum Mode Value: The value reported by the "Color Mode Attribute" when the device has been set to a full-spectrum color. Default is "RGB".
  • Color Temperature Mode Value: The value reported by the "Color Mode Attribute" when the device has been set to a color temperature. Default is "CT".

Dock

The Dock trait is intended to be used for devices such as robot vacuum cleaners that can be commanded to return to their charging dock. It can be controlled by saying things like "Hey Google, tell {device} to return to its dock" and queried by saying things like "Hey Google, is {device} docked?". The Dock trait has the following configuration parameters:

  • Dock Attribute: The device attribute used to determine if the device is currently docked or not. Maps to status by default.
  • Docked Value: The value of the "Docked Attribute" that indicates that the device is currently docked. Defaults to docked.
  • Dock Command: A device command used to tell the device to return to its dock. Maps to returnToDock by default.

Fan Speed

The Fan Speed trait is primarily used for fan controllers with multiple speed settings. It can be controlled by saying things like "Hey Google, set {device} to {speed}" and queried by saying things like "Hey Google, what's the {device} speed?". It has the following configuration parameters:

  • Current Speed Attribute: The device attribute used to query the current fan speed of the device. Maps to the speed attribute by default.
  • Set Speed Command: A device command used to set the fan speed of the device. Should accept one of the supported fan speeds. Maps to the setSpeed command by default.
  • Supported Fan Speeds: The set of fan speed settings that this type of device supports. If multiple settings will set the device to the same fan speed, you should only select one of them.
  • Google Home Level Names for {speed} - A comma-separated list of names that you will use to reference this fan speed when interacting with the Google Assistant. By default, the name of the speed in Hubitat is used.
  • Reversible: Select this if the fan direction can be reversed
  • Reverse Command: Only available if "Reversible" is selected. A device command that can be used to reverse the device's fan direction.

Humidity Setting

The Humidity Setting trait is used for devices that can sense and/or control the ambient humidity, such as a humidity sensor, humidifier, or dehumidifier. It can be controlled by saying things like "Hey Google, set {device} to 60%" and queried by saying things like "Hey Google, what's the humidity of {device}?" or "Hey Google, what's the humidity in {room}?". It has the following configuration parameters:

  • Humidity Attribute: The device attribute used to query the current humidity. Should return an integer between 0 and 100. Maps to the humidity attribute by default.
  • Query Only Humidity: Set to indicate that this device can only be queried for humidity and not controlled.

The following settings are only available if the "Query Only Humidity" setting is unset:

  • Humidity Setpoint Attribute: The device attribute that reports the current humidity setpoint.
  • Set Humidity Command: A device command that sets the desired humidity. Should accept an integer in the range [Minimum Setpoint, Maximum Setpoint].
  • Minimum Humidity Setpoint: The minimum humidity setpoint supported for this device type. Attempting to set the desired humidity lower will set it to this value instead. Required if "Maximum Humidity Setpoint" is specified.
  • Maximum Humidity Setpoint: The maximum humidity setpoint supported for this device type. Attempting to set the desired humidity higher will set it to this value instead. Required if "Minimum Humidity Setpoint" is specified.

Lock/Unlock

The Lock/Unlock trait is used for anything that can lock and unlock, such as doors and windows. It can be controlled by saying things like "Hey Google, lock {device}" and queried by saying things like "Hey Google, is {device} locked?". Since locks are often security-sensitive, it is recommended, though not required, that PIN code support be configured for device types implementing this trait. The Lock/Unlock trait has the following configuration parameters:

  • Locked/Unlocked Attribute: The device attribute used to query the current state of the device. Maps to the lock attribute by default.
  • Locked Value: The value that the Locked/Unlocked attribute will report when the device is locked. Defaults to "locked".
  • Lock Command: A device command used to lock the device. Should not require any parameters. Maps to lock by default.
  • Lock Command: A device command used to unlock the device. Should not require any parameters. Maps to unlock by default.

Occupancy Sensing

The Occupancy Sensing trait is used for devices that can report whether a space is occupied or not such as motion sensors. It can be queried by saying things like "Hey Google, is {room} occupied?". It has the following configuration parameters:

  • Sensor Type: The type of sensor. Most motion sensors are Passive Infrared. This doesn't seem to affect functionality at all, so don't worry too much about getting it wrong.
  • Occupancy Attribute: The device attribute used to query whether the device currently detects occupancy or not. Maps to the motion attribute by default.
  • Occupied Value: The value that the Occupancy Attribute will report when the device detects occupancy. Defaults to "active".
  • Occupied to Unoccupied Delay (seconds): The number of seconds for which the device must report no occupancy before Google Home will consider the space to be unoccupied.
  • Unoccupied to Occupied Delay (seconds): The number of seconds for which the device must report occupancy before Google Home will consider the space to be occupied. Required if "Occupied to Unoccupied Delay" is set.
  • Unoccupied to Occupied Event Threshold: The number of times the device must report the space occupied within the "Unoccupied to Occupied Delay" for Google Home to consider the space to be occupied. Required if "Unoccupied to Occupied Delay" is set.

On/Off

The On/Off trait is used for devices that have discreet on and off states such as switches or lights. It can be controlled by saying things like "Hey Google, turn on {device}" and queried by saying things like "Hey Google, is {device} on?". It has the following configuration parameters:

  • On Value: The value that the On/Off Attribute will report when the device is on. Optional if Off Value is specified. Defaults to "on".
  • Off Value: The value that the On/Off Attribute will report when the device is off. Optional if On Value is specified. Defaults to "off".
  • Control Type: This parameter determines how this device is controlled. Either with a single command that accepts different parameters for "on" and "off" or two different commands for "on" and "off".
    • Separate Commands
      • On Command: A device command used to turn the device on. Should not require any parameters. Maps to on by default.
      • Off Command: A device command used to turn the device off. Should not require any parameters. Maps to off by default.
    • Single Command
      • On/Off Command: A device command used to turn the device on or off. Should accept one parameter.
      • On Parameter: The parameter to pass to the On/Off Command to turn the device on.
      • Off Parameter: The parameter to pass to the On/Off Command to turn the device off.

Open/Close

The Open/Close trait is used for devices that can be opened and closed such as doors, blinds, vents, or valves. This trait supports both devices that can only be fully opened or closed and devices that can be partially opened. It can be controlled by saying things like "Hey Google, open {device}" or "Hey Google, open {device} 50%" and queried by saying things like "Hey Google, is {device} open?". It has the following configuration parameters:

  • Discrete Only Open/Close: Should be left unset if this device can be partially opened and set if the device can only be fully opened or closed. The other configuration parameters change depending on if this is set or not:
    • Unset:
      • Open/Close Attribute: The device attribute used to query the current state of the device. Should be in the range 0-100 with 0 being fully closed and 100 being fully open.
      • Open/Close Command: A device command used to open or close the device. Should accept a parameter in the range 0-100 representing the percentage of the way to open the device. Mapped to setPosition by default.
    • Set:
      • Open/Close Attribute: The device attribute used to query the current state of the device. Should always be either Open Value or Closed Value.
      • Open Value: The value that the Open/Close Attribute will report when the device is open. Defaults to "open".
      • Closed Value: The value that the Open/Close Attribute will report when the device is closed. Defaults to "closed".
      • Open Command: A device command used to open the device. Should not require any parameters. Maps to open by default.
      • Close Command: A device command used to close the device. Should not require any parameters. Maps to close by default.

Rotation

The Rotation trait is used for devices that can be rotated to a specific position such as slat blinds or a pivoting fan. It can be controlled by saying things like "Hey Google, rotate {device} to 30%" and queried by saying things like "Hey Google, how far is {device} rotated?". It has the following configuration parameters:

  • Current Rotation Attribute: The device attribute used to determine how far the device is currently rotated. Should be a number in the range 0-99 with 0 being rotated fully counter-clockwise and 99 being rotated fully clockwise.
  • Set Rotation Command: A device command used to rotate the device to a new position. Should accept a parameter in the range 0-99 where 0 will rotate the device fully counter-clockwise and 99 will rotate it fully clockwise.
  • Supports Continuous Rotation: This parameter should be set if the device can rotate continuously. That is, if it can continue rotating clockwise past its position 99 to get back to position 0.

Scene

This is used for controlling scenes, and should generally only be used with the "Scene" device type. It can be controlled by saying things like "Hey Google, activate {scene}" or "Hey Google, deactivate {scene}". It cannot be queried. It has the following configuration parameters:

  • Activate Command: A device command used to activate this scene. Maps to on by default.
  • Can this scene be deactivated?: Should be left unset if this scene can only be activated and set if this scene can be both activated and deactivated.
  • Deactivate Command: A device command used to deactivate this scene. Only available if the scene can be deactivated. Maps to off by default.

Sensor State

This is used for reporting sensor states such as air quality, smoke level, carbon monoxide level, filter cleanliness, water leak, etc. It can be controlled by saying things like "Hey Google, what is the filter lifetime of (device)" or "Hey Google, what is the carbon dioxide level of (device)". It has the following configuration parameters:

  • Google Home Available States: Comma separated list of available sensor states.
  • Hubitat Descriptive State Attribute: The device attribute used to query the current descriptive value of the device.
  • Google Numeric Units: Units for the sensor state if the sensor supports numerical output.
  • Hubitat Numeric Attribute: The device attribute used to query the current numerical value of the device.

SoftwareUpdate

The Software Update trait is used for devices that can have a software update. It can be controlled by saying things like "Hey Google, Software update {device}." and queried by saying things like "Hey Google, When was {device} last updated?". It has the following configuration parameters:

  • Last Software Update Unix Time Stamp Attribute: The device attribute used to indicate the last Unix time (in seconds) that the update occurred.
  • Software Update Command: A device command used to start a software update on the device.

Start/Stop

This trait is used for devices that support starting, stopping, and optionally pausing operation. It has the following configuration parameters:

  • Start/Stop Attribute: The device attribute used to determine if the is currently running. Maps to status by default.
  • Start Value: The value of the "Start/Stop Attribute" that indicates that the device is running. Defaults to "running".
  • Stop Value: The value of the "Start/Stop Attribute" that indicates that the device is currently stopped.
  • Start Command: A device command to start the device running. Maps to start by default.
  • Stop Command: A device command to stop the device.
  • Pausable: Turn this on if the device is capable of pausing and resuming operation. This is distinct from stopping and starting in that a device that has been paused will resume its operation from where it was when it was paused, while a device that is stopped will begin anew from the beginning of its operation. If this parameter is enabled, the following parameters become available:
    • Pause/UnPause Attribute: The device attribute used to determine if the device is currently paused. Maps to status by default.
    • Pause Value: The value of the "Pause/UnPause Attribute" that indicates that the device is currently paused. Defaults to "paused".
    • Pause Command: A device command used to pause the device. Maps to pause by default.

Temperature Control

This trait is intended for devices that can sense or control their own internal temperature such as a water heater or an oven. For devices that sense or control the ambient temperature, use Temperature Setting. It can be controlled by saying things like "Hey Google, set {device} to 100 degrees" and queried by saying things like "Hey Google, what's the temperature of {device}?". The temperature of these devices will not be reported when asking the Google Assistant about the temperature of a room. The Temperature Control trait has the following configuration parameters:

  • Temperature Unit: The unit that this device reports temperature in, either Fahrenheit or Celsius. Defaults to your hub's default temperature unit.
  • Current Temperature Attribute: The device attribute used to query the current temperature reading of the device. Maps to temperature by default.
  • Query Only Temperature Control: Should be set if this device can only be queried for its current temperature, and not controlled. If this setting is not set, the following configuration parameters become available:
    • Current Temperature Setpoint Attribute: The device attribute used to query the device's current setpoint.
    • Set Temperature Command: A device command used to set the desired temperature of the device.
    • Minimum Temperature Setting: The minimum temperature to which the device can be set.
    • Maximum Temperature Setting: The maximum temperature to which the device can be set.
    • Temperature Step: The amount that the desired temperature will be raised or lowered when you say "Hey Google, turn up/down {device}".

Temperature Setting

This trait is primarily used for thermostats and ambient temperature sensors. For devices that sense or control their own internal temperature, use the Temperature Control trait. It can be controlled by saying things like "Hey Google, set {device} to 75 degrees" or "Hey Google, set {device} to heat mode" and can be queried by saying things like "Hey Google, what's the temperature of {device}?". The current temperature of all devices in a room with this trait will be reported when asking the Google Assistant for the temperature of the room. It has the following configuration parameters:

  • Temperature Unit: The unit that this device reports temperature in, either Fahrenheit or Celsius. Defaults to your hub's default temperature unit.
  • Current Temperature Attribute: The device attribute used to query the current temperature reading of the device. Maps to temperature by default.
  • Query Only Temperature Setting: Set to indicate that this device can only be queried for temperature, not set.

The following settings are only available if "Query Only Temperature Setting" is unset:

  • Supported Modes: The operating modes that this device supports. For each mode, the following settings are available:
    • {Mode} Setpoint Attribute: The device attribute used to query the device's current setpoint when in {mode}. Maps to {mode}Setpoint by default. If Heat/Cool mode is selected, the settings for both Heat mode and Cool mode are available.
    • Set {Mode} Setpoint Command: A device command used to set the device's setpoint when in {mode}. Maps to set{Mode}Setpoint by default. If Heat/Cool mode is selected, the settings for both Heat mode and Cool mode are available.
    • {Mode} Hubitat Mode: The value passed to the Set Mode Command to set the device to this mode and reported by the Current Mode Attribute when the device is in this mode.
  • Set Mode Command: A device command used to set the current operating mode of the device. Should accept any of the {Mode} Hubitat Mode values.
  • Current Mode Attribute: The device attribute used to query the device's current operating mode. Should always report one of the {Mode} Hubitat Mode values.
  • Temperature Buffer: The minimum offset between the heating and cooling setpoints when in Heat/Cool mode. Not available unless Heat/Cool mode is supported. Optional.
  • Minimum Setpoint: The minimum allowed value for the device's setpoint. Optional, but must be specified if Maximum Setpoint is specified.
  • Maximum Setpoint: The maximum allowed value for the device's setpoint. Optional, but must be specified if Minimum Setpoint is specified.

Toggles

This trait is used for devices that have one or more independently togglable on/off settings. For example, a manual override of a thermostat schedule or an energy saving mode on a dryer. It can be controlled by saying things like "Hey Google, turn on {toggle} on {device}" or "Hey Google, turn off {device} {toggle}" and can be queried by saying things like "Hey Google, is {device} {toggle} on?".

Multiple toggles may be defined for a device type, each has all of the parameters defined for the On/Off trait, as well as the following:

  • Toggle Names: A comma-separated list of names that can be used to control or query this toggle. The Google Assistant will accept any of the defined names, but will always respond with the first name in the list.

Volume

This trait is used for devices that can have their volume controlled such as TVs or speakers. It can be controlled by saying things like "Hey Google, set {device} volume to 65%" or "Hey Google, turn up {device}". It has the following configuration parameters:

  • Current Volume Attribute: The device attribute used to query the current volume of the device. Should be an integer in the range 0-100. Maps to volume by default.
  • Set Volume Command: A device command used to set the desired volume. Should accept an integer parameter in the range 0-100. Maps to setVolume by default.
  • Volume Level Step: The amount by which to raise or lower the volume when requested to turn up or down the volume without requesting a specific amount. Defaults to 1.
  • Supports Mute And Unmute: Set unset this if your device cannot be muted separately from setting its volume to 0. If set, the following configuration parameters are available:
    • Mute State Attribute: The device attribute used to determine if the device is muted or not. Maps to mute by default.
    • Muted Value: The value that the Mute State Attribute will report when the device is muted. Defaults to muted.
    • Unmuted Value: The value that the Mute State Attribute will report when the device is unmuted. Defaults to unmuted.
    • Mute Command: A device command used to mute the device. Should accept no parameters. Maps to mute by default.
    • Unmute Command: A device command used to unmute the device. Should accept no parameters. Maps to unmute by default.
Global Settings

Global PIN Codes

These PIN Codes apply to all device types that have Actions requireng PIN set.
They function in the same manner as the per-device-type PIN Codes.
This allows a single user/pin combination to apply to all security actions.

  • IE: If you have both a Door Lock Device Type and a Garage Door Device Type that have the unlock and the open actions secured respectivly, these pins will apply to both device types. This removes the need to maintain the same user and pin combination for the two device types seperately.

Note that using the Global PIN Codes does not preclude the use of the per-device-type codes; that is, you can use both.
If you have users that should have access to control everything, then use the Global PIN Codes; for the other users, you can set them up on the specific device type

  • IE: Mr. Smith should have access to the entire system - setup a Global PIN; Johnny Jr. should have access to only the Door Locks - setup a user/pin on the Door Lock Device Type

Enabling Google Home Graph Support

The Google Home Graph API is used for requesting that Google update its list of devices when changes are made and for proactively pushing device events to Google to enable some Google Home features such as device-based automation triggers. Follow these steps to enable Google Home Graph API support:

  1. Enable the Google Home Graph API at: https://console.developers.google.com/apis/api/homegraph.googleapis.com/overview
  2. Create a Service Account with Role='Service Account Token Creator' at https://console.cloud.google.com/apis/credentials/serviceaccountkey
  3. From Service Accounts, go to Keys -> Add Key -> Create new key -> JSON and save the document to your device
  4. Paste the contents of the file into the "Google Service Account Authorization" field on the Hubitat app's main settings page

Once these steps are complete, both Google's Report State and Request Sync APIs will be enabled. You may optionally disable the "Push device events to Google" toggle if you do not want all of your devices' events to be proactively pushed to Google for privacy or other reasons.

Changelog
  • Feb 24 2020 - Initial release
  • Feb 24 2020 - Add the Sensor device type and the Query Only Open/Close setting to better support contact sensors.
  • Feb 27 2020 - Fix issue with devices getting un-selected when linking to Google Home
  • Feb 27 2020 - Add Setting to enable/disable debug logging
  • Feb 28 2020 - Add support for using a single command with a parameter for the OnOff trait
  • Feb 29 2020 - Fall back to using device name if device label isn't defined
  • Mar 01 2020 - Add support for the Toggles device trait
  • Mar 15 2020 - Add confirmation and PIN code support
  • Mar 15 2020 - Fix Open/Close trait when "Discrete Only Open/Close" isn't set
  • Mar 17 2020 - Add support for the Lock/Unlock trait
  • Mar 18 2020 - Add support for the Color Setting trait
  • Mar 19 2020 - Add support for ambient temperature sensors using the "Query Only Temperature Setting" attribute of the Temperature Setting trait
  • Mar 20 2020 - Add support for the Temperature Control trait
  • Mar 21 2020 - Change Temperature Setting trait to use different setpoint commands and attributes per mode
  • Mar 21 2020 - Sort device types by name on the main settings page
  • Mar 21 2020 - Don't configure setpoint attribute and command for the "off" thermostat mode
  • Mar 21 2020 - Fix some Temperture Setting and Temperature Control settings that were using the wrong input type
  • Mar 21 2020 - Fix the Temperature Setting heat/cool buffer and Temperature Control temperature step conversions from Fahrenheit to Celsius
  • Mar 29 2020 - Add support for the Humidity Setting trait
  • Apr 08 2020 - Fix timeout error by making scene activation asynchronous
  • Apr 08 2020 - Add support for the Rotation trait
  • Apr 10 2020 - Add new device types: Carbon Monoxide Sensor, Charger, Remote Control, Set-Top Box, Smoke Detector, Television, Water Purifier, and Water Softener
  • Apr 10 2020 - Add support for the Volume trait
  • Aug 05 2020 - Add support for Camera trait
  • Aug 25 2020 - Add support for Global PIN Codes
  • Oct 03 2020 - Add support for devices not allowing volumeSet command when changing volume
  • Jan 18 2021 - Fix SetTemperature command of the TemperatureControl trait
  • Jan 19 2021 - Added Dock and StartStop Traits
  • Jan 31 2021 - Don't break the whole app if someone creates an invalid toggle
  • Feb 28 2021 - Add new device types supported by Google
  • Apr 18 2021 - Added Locator Trait
  • Apr 23 2021 - Added Energy Storage, Software Update, Reboot, Media State (query untested) and Timer (commands untested) Traits. Added missing camera trait protocol attributes.
  • May 04 2021 - Fixed time remaining trait of Energy Storage
  • May 07 2021 - Immediate response mode: change poll from 5 seconds to 1 second and return PENDING response for any devices which haven't yet reached the desired state
  • May 07 2021 - Add roomHint based on Hubitat room names
  • May 07 2021 - Log requests and responses in JSON to make debugging easier
  • May 09 2021 - Handle missing rooms API gracefully for compatibility with Hubitat < 2.2.7
  • May 10 2021 - Treat level/position of 99 as 100 instead of trying to scale
  • May 20 2021 - Add a reverseDirection setting to the Open/Close trait to support devices that consider position 0 to be fully open
  • Jun 27 2021 - Log a warning on SYNC if a device is selected as multiple device types
  • Mar 05 2022 - Added supportsFanSpeedPercent trait for controlling fan by percentage
  • May 07 2022 - Add error handling so one bad device doesn't prevent reporting state of other devices
  • Jun 20 2022
    • Fixed CameraStream trait to match the latest Google API. Moved protocol support to the driver level to accommodate different camera stream sources
    • Added Arm/Disarm Trait
    • Added ability for the app to use device level pin codes retrieved from the device driver
    • Pincode challenge in the order device_driver -> device_GHC -> global_GHC -> null
    • Added support for returning the matching user position for Arm/Disarm and Lock/Unlock to the device driver
  • Jun 21 2022
    • Apply rounding more consistently to temperatures
    • Added SensorState Trait
  • Jun 23 2022 - Fix error attempting to round null
  • Sep 08 2022 - Fix SensorState labels
  • Oct 18 2022 - Added TransportControl Trait
  • Nov 30 2022 - Implement RequestSync and ReportState APIs
Frequently Asked Questions

Q: Why can't I control my device or see my sensors' readings in the Google Home app?
A: The Google Home app has touch controls for a very limited number of device types and traits. You can find the full list of supported traits on this page. All other devices can be controlled and queried only by voice.

Q: How do I set this up to control the speed of my ceiling fans in the Google Home app?
A: You can't. The Google Home app does not have any touch controls for setting fan speeds; only turning them on or off.

Any feedback is welcome. If you have a question ask it here. If you come across a bug you can post it here or open an issue on the GitHub repository.

62 Likes

This looks really interesting :smiley:
My Xiaomi contact sensors don't add to the inbuilt Google Home integration... it sounds like I could use yours to add them in, and see the status of my doors through GH.

I will give it a go later this week!

Ok so I'm up to this step, but when I click '[test] {your action name}', the Google Home app shows a spinning circle, then quits back to the list after a second or two. I don't get any prompt to enter Hubitat credentials.
Any suggestions where I might have gone wrong?

edit: and there's nothing in the Stackdriver logs

This is where mine got stuck too. After hitting it about 10 times it finally asked for my Hubitat cred's, hub and then the device list was empty so I clicked on 'all devices' and hit 'authorize'. It didn't add to the 'Linked services' in Google Home app, it's still listed under the 'Add new' section.

@cometfish You may have to wait a few minutes after creating the Action. If it still doesn't work, I've found that making a trivial change (like deleting the last character of the Action's display name and re-adding it) will prompt Google's backend to figure its life out.

@bptworld Hubitat doesn't seem to like having multiple Google integrations registered at the same time. You may have to un-link the official Hubitat integration before linking your new one.

@cometfish I just pushed a commit that adds better support for contact sensors. It adds the "Query Only Open/Close" setting to Open/Close traits so that you don't have to set open and close commands, and adds support for Google's undocumented Sensor device type.

1 Like

Ok time didn't appear to be a factor - tried again hours later, still no go.
Clicked it many times, much more than 10, so that didn't work either.
Deleting a space from the action name got it to work.

Then I got what @bptworld did - no devices listed after Hubitat login, clicked Authorize All anyway, then it went back to the GH app, and the action wasn't linked.

Hmm ok, I was hoping to have both linked side by side, at least initially (not with the same devices).
I see this in the Hubitat logs - is it not completing the sync because there are no devices?

2020-02-25 19:34:44.655 debug[requestId:2597995927316883249, payload:[devices:[]]]
2020-02-25 19:34:44.649 debug{inputs=[{intent=action.devices.SYNC}], requestId=2597995927316883249}

I got it to link - skipped to the next part, and created an actual device in the Google Home Community app in Hubitat. Then the Google Home app linked with it, and listed it under Linked Services.

It does not seem to mind having both the inbuilt Hubitat GH and your GH app (I labeled it SmartHome in the pic) running at the same time :slight_smile:
And the door sensor works great! Oddly the GH app doesn't have any way to see the status, but asking Google Assistant works:

Fantastic, I'll make sure to update the setup instructions sometime today. Thanks for helping me debug them.

And yeah, the Google Home app UI is fairly limited in the types of devices it works with. There's a list over in Google's documentation. Voice control should work for anything though.

When I go to link the service I can't seem to get past "Authorize" it shows singing in for a second or two and then disappears, the service doesn't get added. Any ideas?

@gassgs That sounds like the same issue others have had. Try skipping ahead and setting up at least one device before linking with Google Home.

I've tried that a few times, With and without devices added. And with and without the standard hubitat service linked. It never gets past signing in.

I think I'll try deleting my project on google and starting from scratch.

Can anyone else confirm this will work along with the standard Hubitat integration?

@mbudnek I can confirm that I'm having the same issues that @gassgs is experiencing. I've unlinked Hubitat completely, but now it just closes the window after authorizing. I've tried recreating the Google Action as well as the Hubitat app with no luck.

Does anyone have any suggestions who have gotten past this point?

2 Likes

@gassgs @kited64 When you first link Google Home to the app it won't work if the app doesn't return at least one device. It looks like the first time you try to link the app Hubitat will clear your device selections when it tries to update them from the devices you select while linking the app in Google Home. Try opening the app in Hubitat, re-selecting your devices, and linking a second time.

Alternatively, select at least one mode from the "Modes to expose" drop-down in the app before trying to link the app. Hubitat won't try to update that setting.

@mbudnek Thanks for the update! It seems to be trying now, but Google Home returns the error "Couldn't update the setting. Check your connection." Looking in the logs for the app I see:

Error: java.lang.NullPointerException: Cannot invoke method split() on null object on line 915 (handleAction)
Debug: {inputs=[{intent=action.devices.SYNC}], requestId=7638751123270955839}

Any idea what it's referencing? It looks like it may be an issue with the fan speed names. I've screencapped my device config below. I'm not sure what is causing it to return a null for the name.

Spoke too soon. I gave it another shot and it went through! I can't thank you enough for the help. This has been my #1 feature request for well over a year; I hope the Hubitat picks you up for your amazing work!

Still no luck for me. Do i need to disable the Standard Hubitat integration?

@gassgs No, it seems like that shouldn't be necessary. After attempting to link Google Home to the app, are your device selections in the Hubitat app preferences empty? If that's the case, the easiest thing to do is to temporarily select a mode from the "Modes to expose" dropdown. After you've linked with Google Home you can go back and un-select that mode and configure your devices as normal. When you're done just say "Hey Google, sync my smart home devices" and it will get everything in sync.

No I can see the devices that I setup. But like you mentioned it keeps clearing them from the app but then doesn't link the accounts.