Simple way to use Google Home with IFTTT and myopenHAB

I figured out how to simplify my IFTTT configuration and now I can use Google Home to control all lights in my house with a single IFTTT applet. I accomplished this by sending commands from IFTTT to a item called VoiceCommand using the example at After exposing the VoiceCommand item, I created an applet by doing the following:

  1. From “My Applets”, select “New Applet”
  2. Press “this”, search for “Google Assistant” , and select it
  3. Select “Say a phrase with a text ingredient”
  4. Under “What do you want to say?”, enter “Turn $” and then press “Create Trigger”
  5. Now press “that”, search for “openHAB”, and select it
  6. Select “Send a command”
  7. Under “Which item”, select “VoiceCommand”, under “Command to Send” enter “Turn {{TextField}}” and press “Create Action”
  8. Press the “Finish” Button.

Other phrases that I have implemented are Open and Close. I don’t have dim working yet since i want to say something like “OK Google, Dim the kitchen lights to 50%”, and haven’t figured how to parse out the numeric value.


Interesting. I haven’t tried using VoiceCommand as a trigger. I simply created a applet for each light (2 for each actually, one for on and one for off).

That’s what I also did originally, an added benefit is the same voice commands work with the Android app.

I was researching VoiceCommand and watching this tutorial:

It seems like the process simply takes the work off of making multiple applets in IFTTT and instead creating multiple individual rules. I don’t see how this makes it any more or less convenient. Am I missing something? I very may well be, I’m not familiar at all with the VoiceCommand option.

I created a single rule with multiple if statements. I found this simple and easier to maintain than many applets.

Ok, thanks. I wasn’t sure if I was missing something. To me IFTTT is just a temporary setup until (hopefully) Google opens up direct actions and OpenHab can tie in directly.

This may seem silly, but did you have to do anything special to get VoiceCommand to appear in I have used it with IFTTT for over a year with my.openhab, but since the switch, I can’t get it to appear. I have added to openhabcloud:expose=, and the one other item that I have exposed is appearing.

Thanks in advance!

I’m using OH1 and in my .items file I have:

String VoiceCommand

And in in openhab.cfg I have:


You might need to restart OH1 also.

Yep, exactly the same, and I’ve restarted several times. Thanks.

Well, one more restart and then forcing a value into it seems to have fixed it. Thanks, @ranielsen!

Sorry, I missed that. I had to force value also.

I’m thinking about trying this for OH2. How do you force a value into VoiceCommand?

I have a startup rule:

rule Startup
        System started

Thanks, got it working. When items are exposed to they will only show up once there has been an update to the item. That’s why a forced value was needed. I believe there should be no reason to force a value anymore once the items is fully exposed.

Like you said, this creates a problem with items that contains numbers (dimmers, thermostat setpoints, volume). I’m not sure which way is better due to that.

I can’t admit to understand, but have you looked at the git page here:

The rules seem to have a way to parse for numbers, be it decimals or percent. I’m more of a copy and paste coder but maybe there is a way to use these in conjunction so that Google Assistant pushes to text phrase but the rule parses out the number.

An update…

I tried switching to HueEmulation with Google Home, but IFTTT is as responsive and works better in general. I also have more control of what happens with rules vs names of devices. I was surprised since there are a couple of additional hops with IFTTT.

FYI, this also works with Google Assistant on android phones.

@ranielsen or anyone, would you mind sharing your rule that you use for processing? I have found a few examples but they all error out on me.

I have the data getting from my Google Home to IFTT and to MyOpenHAB and to my local install but it dies on the rule

@p0lar, here’s part of my rule:

rule "Voice control"
    Item VoiceCommand received command
    var String command = VoiceCommand.state.toString.toLowerCase
    logInfo("voice control","VoiceCommand received " + command)

    var String cmd = null
    if (command.contains("on")) {
        cmd = "ON"
    } else if (command.contains("off")) {
        cmd = "OFF"
    } else if (command.contains("open")) {
        cmd = "OPEN"
    } else if (command.contains("close") || (command.contains("shut")) {
        cmd = "CLOSE"

    if (cmd == "ON" || cmd == "OFF") {
        // main floor
        if (command.contains("living room") || command.contains("main floor")) {
            sendCommand(mLivingLights, cmd)
            sendCommand(mLivingLamp, cmd)

        if (command.contains("dining room") || command.contains("main floor")) {
            sendCommand(mDiningLights, cmd)
    } else if (cmd == "OPEN" || cmd == "CLOSE") {
        // garage
        if (command.contains("garage door")) {
            if (cmd == "OPEN") {
                sendCommand(garageDoorOpen, ON)
            } else if (cmd == "CLOSE") {
                sendCommand(garageDoorClose, ON)

Cool Thanks. that works better :slight_smile:
now to write one that does not need an IF for each word :slight_smile:

Glad it helps, Please share the one that doesn’t use an if for each word!