This page is part of archived documentation for openHAB 2.5. Go to the current stable version

# Google Assistant Action

Google Assistant is Google’s virtual personal assistant and uses Actions on Google as the platform for "Actions" (software applications) to extend the functionality of the Google Assistant. Users engage Google Assistant in conversation to get things done, like controlling their devices and things at home. You can use the officially certified openHAB Action for Google Assistant to easily manage and control your smart home by conversational experiences between you and your openHAB smart home powered by voiced commands.

This guide describes step by step how to use the openHAB Google Assistant Smart Home Action (opens new window). The openHAB Action links your openHAB setup through the (opens new window) cloud service to the Google Assistant platform (for technical insights, please refer to this guide (opens new window) to read more about setup options and development information).

With the Action you can voice control your openHAB items and it supports lights, plugs, switches, thermostats and many more. The openHAB Action comes with multiple language support like English, German or French language.

# General Configuration Instructions

# Requirements

# Item configuration

In openHAB 2 items are exposed via metadata (opens new window).

Currently the following metadata values are supported (also depending on Googles API capabilities):

  • Switch / Dimmer / Color { ga="Light" }
  • Switch { ga="Switch" [ inverted=true ] } (all Switch items can use the inverted option)
  • Switch { ga="Outlet" }
  • Switch { ga="Coffee_Maker" }
  • Switch { ga="WaterHeater" }
  • Switch { ga="Fireplace" }
  • Switch { ga="Valve" }
  • Switch { ga="Sprinkler" }
  • Switch { ga="Vacuum" }
  • Switch { ga="Scene" }
  • Switch { ga="Lock" [ tfaAck=true ] }
  • Switch { ga="SecuritySystem" [ tfaPin="1234" ] }
  • Dimmer { ga="Speaker" }
  • Switch / Dimmer { ga="Fan" [ speeds="0=away:zero,50=default:standard:one,100=high:two", lang="en", ordered=true ] } (for Dimmer the options have to be set)
  • Switch / Dimmer { ga="Hood" }
  • Switch / Dimmer { ga="AirPurifier" }
  • Rollershutter { ga="Awning" [ inverted=true ] } (all Rollershutter items can use the inverted option)
  • Rollershutter { ga="Blinds" }
  • Rollershutter { ga="Curtain" }
  • Rollershutter { ga="Door" }
  • Rollershutter { ga="Garage" }
  • Rollershutter { ga="Gate" }
  • Rollershutter { ga="Pergola" }
  • Rollershutter { ga="Shutter" }
  • Rollershutter { ga="Window" }
  • Group { ga="Thermostat" [ modes="..." ] }
  • Number { ga="thermostatTemperatureAmbient" } as part of Thermostat group
  • Number { ga="thermostatHumidityAmbient" } as part of Thermostat group
  • Number { ga="thermostatTemperatureSetpoint" } as part of Thermostat group
  • Number / String { ga="thermostatMode" } as part of Thermostat group
  • String { ga="Camera" [ protocols="hls,dash" ] }

* All Rollershutter devices can also be used with a Switch item with the limitation of only supporting open and close states.

Example item configuration:

Switch KitchenLights "Kitchen Lights" <light> (gKitchen) { ga="Switch" }
Dimmer BedroomLights "Bedroom Lights" <light> (gBedroom) { ga="Light" }
Color LivingroomLights "Livingroom Lights" <light> (gLivingroom) { ga="Light" }
Switch SceneMovie "Livingroom Scene Movie" (gLivingroom) { synonyms="Movie Scene", ga="Scene" }
Switch CristmasTree "Cristmas Tree" (gLivingroom) { ga="Outlet" }
Switch DoorLock "Door Lock" { ga="Lock" }

//Thermostat Setup (Google requires a mode, even if you manually set it up in openHAB)
Group g_HK_Basement_TSTAT "Basement Thermostat" { ga="Thermostat" [ useFahrenheit=true ] }
Number HK_Basement_Mode "Basement Heating/Cooling Mode" (g_HK_Basement_TSTAT) { ga="thermostatMode" }
Number HK_Basement_Setpoint "Basement Setpoint" (g_HK_Basement_TSTAT) { ga="thermostatTemperatureSetpoint" }
Number HK_Basement_Temp "Basement Temperature" (g_HK_Basement_TSTAT) { ga="thermostatTemperatureAmbient" }
Number HK_Basement_Humid "Basement Humidity" (g_HK_Basement_TSTAT) { ga="thermostatHumidityAmbient" }

Item labels are not mandatory in openHAB, but for the Google Assistant Action they are absolutely necessary!

It is the "label text" (e.g. "Kitchen Lights" for example above) and not the item's name that will be available to you via voice commands or in the Google Home app, so make it unique and easy to say!

If you do not want to adjust your labels to be human spellable, you can use the "name" config option in the metadata: [ name="Kitchen Lights" ]. This will overwrite the label as the device's name.

Furthermore, you can state synonyms for the device name: Switch KitchenLight "Kitchen Lights" { synonyms="Top Light", ga="Light" }.

To ease setting up new devices you can add a room hint: [ roomHint="Living Room" ].

NOTE: metadata is not (yet?) available via paperUI. Either you create your items via ".items" files, or you can:

  • add metadata via console:
smarthome:metadata add BedroomLights ga Light
  • add metadata using the REST API:
PUT /rest/items/BedroomLights/metadata/ga

  "value": "Light"

# Special item configurations

# Two-Factor-Authentication

For some actions, Google recommends to use TFA (Two-Factor-Authentication) to prevent accidential or unauthorized triggers of sensitive actions. See Two-factor authentication  |  Actions on Google Smart Home (opens new window).

The openHAB Google Assistant integration supports both ackNeeded and pinNeeded. You can use both types on all devices types and traits.

ackNeeded: "A two-factor authentication that requires explicit acknowledgement (yes or no) and can also use trait states as response feedback. This challenge type is not recommended for security devices and traits."

pinNeeded: "A two-factor authentication that requires a personal identification number (PIN), which is ideal for security devices and traits."


Switch DoorLock "Front Door" { ga="Lock" [ tfaAck=true ] }
Switch HouseAlarm "House Alarm" { ga="SecuritySystem" [ tfaPin="1234" ] }

# Thermostats

Thermostat requires a group of items to be properly configured to be used with Google Assistant. The default temperature unit is Celsius. { ga="Thermostat" }

To change the temperature unit to Fahrenheit, add the config option [ useFahrenheit=true ] to the thermostat group. To set the temperature range your thermostat supports, add the config option [ thermostatTemperatureRange="10,30" ] to the thermostat group.

There must be at least three items as members of the group:

  • (Mandatory) Mode: Number (Zwave THERMOSTAT_MODE Format) or String (off, heat, cool, on, ...). { ga="thermostatMode" }
  • (Mandatory) Temperature Ambient: Number. { ga="thermostatTemperatureAmbient" }
  • (Mandatory) Temperature Setpoint: Number. { ga="thermostatTemperatureSetpoint" }
  • (Optional) Temperature Setpoint High: Number. { ga="thermostatTemperatureSetpointHigh" }
  • (Optional) Temperature Setpoint Low: Number. { ga="thermostatTemperatureSetpointLow" }
  • (Optional) Humidity Ambient: Number. { ga="thermostatHumidityAmbient" }

If your thermostat does not have a mode, you should create one and manually assign a value (e.g. heat, cool, on, etc.) to have proper functionality.

To map the default thermostat modes of Google (opens new window) (on, off, heat, cool, etc.) to custom ones for your specific setup, you can use the modes config option on the thermostat group. E.g. [ modes="off=OFF:WINDOW_OPEN,heat=COMFORT:BOOST,eco=ECO,on=ON,auto" ] will enable the following five modes in Google Home "off, heat, eco, on, auto" that will be translated to "OFF, COMFORT, ECO, ON, auto". You can specify alternative conversions using the colon sign, so that in the former example "BOOST" in openHAB would also be translated to "heat" in Google. For the translation of Google modes to openHAB always the first option after the equal sign is used. By default the integration will provide "off,heat,cool,on,heatcool,auto,eco".

You can also set up a Thermostat for using it as a temperature sensor. To do so, create a Thermostat group and only add one item member as "thermostatTemperatureAmbient".

# Fans

Fans (and similar device types, like AirPurifier or Hood) support the FanSpeed trait. With that you will be able to set up and use human speakable modes, e.g. "fast" for 100% or "slow" for 25%.

To set up those modes use a Dimmer item and the following metadata config: [ speeds="0=away:zero,50=default:standard:one,100=high:two", lang="en", ordered=true ].

speeds will be a comma-separated list of modes with a percentage number followed by an equal sign and different aliases for that mode after a colon. So here both "high" and "two" would set the speed to 100%. You are also able to define the language of those aliases. The option ordered will tell the system that your list is ordered and you will then be able to also say "faster" or "slower" and Google will use the next or previous speed.

# Blinds and similar devices

Blinds should always use the Rollershutter item type. Since Google and openHAB use the oposite percentage value for "opened" or "closed", the action will tranlate this automatically. If the values are still inverted in your case, you can state the [ inverted=true ] option for all Rollershutter items.

# Setup & Usage on Google Assistant App

  • Make sure Google Play Services is up to date.
  • Visit "Google Home" app entry in Google Play Store on Android.
  • Set up the voice-activated speaker, Pixel, or Android phone (version 6+) with the same account.
  • Make sure you're the correct user.
  • Start the updated Google Home app on your phone.
  • Go to the settings part: Account > Settings.

openHAB Google App

  • Go to the home control part: Assistant > Home control.

openHAB Google App

  • Press the + button.

openHAB Google App

  • Select openHAB.

openHAB Google App

openHAB Google App

  • Allow Google access to your account.

openHAB Google App openHAB Google App

  • You will now be able to see your previously configured items and devices. Assign them to a room. Press Done.

openHAB Google App openHAB Google App

  • You can now control those devices from the Google Assistant.

openHAB Google App openHAB Google App

# Example Voice Commands

Here are some example voice commands:

  • Turn on Office Lights.
  • Dim/Brighten Office Lights (increments 15%).
  • Set Office Lights to 35%.
  • Open/Close the blinds
  • Turn off Pool Waterfall.
  • Turn on House Fan.
  • Turn on Home Theater Scene.
  • Set Basement Thermostat to 15 degrees.
  • What is the current Basement Thermostat Temperature?

# Frequently Asked Question

My New items did not appear in the Google Home app.

  • Say: Hey Google, sync my devices.

I'm not able to connect openHAB to Google Home.

  • Check, recheck and after that check again your items!
  • The items that you want to expose to Google Assistant should have the right metadata assigned.
  • The items that you want to expose to Google Assistant must have a item label! Item Definition and Syntax (opens new window)
  • If you expose thermostats make sure than you have:
    • A group item with the metadata value { ga="Thermostat" }
    • A number or string item with the metadata value { ga="thermostatMode" } as part of the thermostat group
    • A number item with the metadata value { ga="thermostatTemperatureAmbient" } as part of the thermostat group
    • A number item with the metadata value { ga="thermostatTemperatureSetpoint" } as part of the thermostat group
    Group g_HK_Basement_TSTAT "Basement Thermostat" { ga="Thermostat" [ useFahrenheit=true ] }
    Number HK_Basement_Mode "Basement Heating/Cooling Mode" (g_HK_Basement_TSTAT) { ga="thermostatMode" }
    Number HK_Basement_Setpoint "Basement Setpoint" (g_HK_Basement_TSTAT) { ga="thermostatTemperatureSetpoint" }
    Number HK_Basement_Temp "Basement Temperature" (g_HK_Basement_TSTAT) { ga="thermostatTemperatureAmbient" }
  • If none of the above solutions works for you:
    • Remove all the metadata.
    • Make a new .item file with 1 item to expose.
    Switch TestLight "Test Light" { ga="Switch" }
    • Relink your account.