HueEmulation and Google Home support

Similar question to Tommy.

Been reading this thread and others, and trying to set up a Google Home I just got as a present to work with OH2. It looks like this is the way to go, but getting confused over which parts to use.

Simple setup

  • have 3-4 ZWave devices being controlled through OH2.
  • using chromecast binding to talk to the GoogleHome, and it can play text on the GH device

Getting confused as to whether or not to use the Hue binding, the HA-Bridge solution, etc.

I would like to be able to ask it to control the lights (for now, more later), and it seems this is best thread for this endeavor. Am I correct? Is there a better thread?

@jackdw @tdsheppard77
Ill have a go at trying to let you know how to get your Google Home talking to Openhab.

So firstly - this only works with Openhab2.
You do not use the HA-Bridge nor do you the “Hue Emulation” installed in PaperUI (Add-ons/Misc ) - this version is older and does not contain all the bits needed for Google Home.
So if you have those, remove them.

The most current version ( as of today ) is the one available in this post:

specifically this jar:
http://t0yen.asuscomm.com/org.openhab.io.hueemulation-2.0.0-SNAPSHOT.jar

This you need to install into your Openhab2 addons directory.
For me, this is in /usr/share/openhab2/addons/

If this is successful, then in PaperUI - Configuration/Services/IO there should be a “Hue Emulation” - Click On Configure and “Enable Device Pairing”…set this to “Pairing Enabled”

Now you need to update your linux to forward port 80 back into OpenHab.
This post above explains it:

In short run this:

iptables -t nat -A PREROUTING -p tcp -d 192.168.1.6 --dport 80 -j DNAT --to-destination 192.168.1.2:8080

making any respective changes to your IP address.

Then lastly…for each of your items which you want to control via Google Home, you need to add tags:
( taken from the original binding wiki )
Switch TestSwitch1 “Kitchen Switch” [ “Switchable” ]
Switch TestSwitch2 “Bathroom” [ “Lighting” ]
Dimmer TestDimmer3 “Hallway” [ “Lighting” ]
Number TestNumber4 “Temperature Set Point” [ “TargetTemperature” ]

Add these tags and on the OH2 side i think you are done… ( i dont think any restarts are required.)

So then on your Android or IOS device within the “Home” app, select your Google Home device, click on the 3 dots, then “Settings”, “Home Control” - and go through the “Link the Philips Hue” wizard… it should find your Openhab Hue Emulator instance, and the devices ( items) you tagged.
Add them to rooms within the App if you want …this basically allows you to group items together so you can simple say “OK Google Turn on the kitchen lights” and as you can imagine all lights in the Kitchen "room"should turn on.

I personally, only control my zwave lights using Google Home. so the only tag i need to add is [ “Lighting” ]
I did have my garage door added, but then , understandably, i found that the command “Ok Google - turn off all the lights” also activated the garage door…not ideal.

There is a minor “bug” in the binding in that once you add a tag to the item, the binding associates that item into the emulation config, so if you later remove the tag the binding gets upset until you add the tag back… so if you need to clear the binding config, then simply delete the files in /var/lib/openhab2/hueemulation and restart OpenHab.

Hope this helps… its very cool when you get it working…and also bloody annoying when you’re entertaining and all your friends kids keep saying “OK google Turn on/off lights /play xyz song”… makes the house look like a nightclub! :wink:

1 Like

Also dont forget that you can use your Google Home to advise you any alerts eg: At 8pm, mine will anounce that ive left the garage door open
How to do this is found in here:

I got everything except the forwarding working. I’m still new to Linux.
When i run the iptables command it said no such command.

What OS version are you running? I use debian - in no linux expert either, but there may be an equvalent command on the version you are using

Very straightforward, ran into issue, but straightforward.

  • grabbed jar and placed it into addons directory
  • went to paper ui, and under Configuration | Services | IO it was listed
  • “Enable Device Pairing” set to “Pairing Enabled”, “Optional Discovery Address” and “Optional Discovery Port” left blank
  • Pressed save, and verified that Paper UI and saw “service configuration updated” bottom left.
  • Running on Win7, so did some research, and the equivalent of your port redirect is: “netsh interface portproxy add v4tov4 listenport=80 listenaddress=192.168.xx.yy connectport=8080 connectaddress=192.168.xx.yy”
  • Verified that by eliminating the :8080 in the url for the paper UI, and verifying it works properly
  • Follow the steps on the google home app that you mention, and when I try and add the philips hue, it asks me to press the link button to pair and it spins “forever”

In following the information, if I go to http://192.168.xx.yy/api/discovery.xml I find:

{“lights”:{“1”:{“state”:{“on”:true,“bri”:255,“hue”:0,“sat”:0,“xy”:[0.0,0.0],“ct”:500,“alert”:“none”,“effect”:“none”,“colormode”:“ct”,“reachable”:true},“type”:“Dimmable light”,“name”:“Office Light”,“modelid”:“LWB004”,“manufacturername”:“Philips”,“swversion”:“1.15.0_r18729”,“productid”:“Philips-LWB014-1-A19DLv3”,“pointsymbol”:{“1”:“none”,“2”:“none”,“3”:“none”,“4”:“none”,“5”:“none”,“6”:“none”,“7”:“none”,“8”:“none”}}}}

Am I missing a step? And hope this helps others…

I dunno. I used the openHabian to install it. so it’s Raspbian. Got this from the login screen.

Release = Raspbian GNU/Linux 8 (jessie)
Kernel = Linux 4.4.0-1-rpi2
Platform = Raspberry Pi 3 Model B Rev 1.2

Got that working before I tried the rest of the stuff. That was pretty seamless.

Is there any way to change the voice it speaks with? Is there any way to resume what you were doing before when you are done?

@tdsheppard77 - I would have thought iptables is available on Raspbian which is the basis of openHABian

All i can think of is that you may need to add sudo
ie:

sudo iptables -t nat -A PREROUTING -p tcp -d 192.168.1.6 --dport 80 -j DNAT --to-destination 192.168.1.2:8080

@ThomDietrich - Any ideas why @tdsheppard77 would be unable to run the iptables command - hes using openHABian.

@jackdw - “Change the voice it speaks with” - You mean a male or female voice? or language?

You can set the spoken language but not as far as im aware male or female.

I dont know of a way to make it resume what it was doing before any announcements, I dont personally use it to play content on, at least not typically when i want it alerting me. Try saying “resume” or something like this…

Because the iptables administration package is not installed by default. :ghost:

@tdsheppard77 please execute sudo apt install iptables

Tried this again tonight and still not seeing the device, even though I can hit the end point.

Is there some trick to the Hue Emulator to make sure that the Google Home device can see it?

THANK YOU!!! After installing iptables I was able to run the command and now it works.

Many thanks @ThomDietrich and @greg

good stuff!

Hopefully all this will be rolled into the binding in due course.

Hope this helps figure out what the issue is.

Running Android 7 on my phone, default settings, latest update (jan 20 I believe).

Before running the pairing app on my phone from Google Home, I added this line to the logging config:

log4j.logger.org.openhab.io.hueemulation = TRACE, event, osgi:*

And I see a number of devices from existing machines broadcasting and such. When I hit the pair button in the google home-> hue bridge… nothing.

However, if I go to another program, UPNPBrowser, when I hit scan, it sends out the SSDP packet right away and I can see it in the logs.

Is it possible that the hue bridge is now using some other method of communication, hence the emulator is no longer working for me?

Perhaps try resetting your Google Home ?
Do you have an option of setting OH up on Linux?

Not at the moment… have a box ready to go, but won’t have any concentrated time for the next 2-3 months due to work and family commitments.

The thing that gets me is: from what I read here, I expected the Hue App as part of the google home setup to send a SSDP SEARCH to discover… the rest that I have read here supports that.

When I start the Google Home app, I see a SSDP SEARCH go out, probably to locate the Google Home itself. But after that no dice… will try resetting.

I’m not sure if I’m doing something wrong here but here are the steps I’ve completed so far.

  1. Grabbed the latest .jar file from this thread.

  2. Went to PaperUI and found configuration under Configuration->Service->IO. Set Enable Device Pairing" to Pairing Enabled"

  3. Hit save and “Service Configuration Updated” showed on screen.

  4. Went to Home.items file and added this:

    Switch TestSwitch “Google Home Test Switch” [“Switchable”]

  5. Log file showed that my network status device link was removed, so I went to the BasicUI and it won’t load.

  6. Looked in console and found that all things in the home.items file were removed and now only paperUI works.

  7. Went to /var/lib/openhab2/hueemulation to look for items file and all that’s there is a udn file.

Did I declare something wrong? I don’t get syntax errors in the editor or in the logger when I save. I did have some initial trouble getting the .jar to run, I had to restart OpenHAB twice before my other bindings would run without throwing exceptions. Anything else I need to be doing?

Thanks,
Matt

The other strange thing I notice is that when I put the .jar file into my addons folder and restart openhab the log file gives me this error:

10:42:43.528 [ERROR] [urce.impl.DefaultResourceDescription] - /var/lib/openhab2/Home.things (No such file or directory)

When clearly the file is there, and then it won’t parse the file. Do I have a conflict with another binding? The other bindings I’m using are insteonPLM, harmonyhub, mqtt, nest, and chromecast

Everyone else seems to be having luck with this but I’m a little stuck. Any help is appreciated. Thanks! And just in case it’s pertinent, I’m running on a RPI3 with all the latest updates.

So I got to the point where the google home will pair with the emulator but it won’t discover any of the devices. I went to the ipaddress/api/discovery.xml and it show’s this:

{"lights":{},"scenes":{},"groups":{"1":{"action":{"on":false,"bri":0,"hue":0,"sat":0,"effect":"none","ct":0,"alert":"none","reachable":true},"lights":[],"name":"AGroup","type":"Room","class":"Other"}},"schedules":{},"sensors":{},"rules":{},"config":{"portalservices":false,"gateway":"192.168.1.150","mac":"B8:27:EB:A9:AB:80","swversion":"01036659","apiversion":"1.15.0","linkbutton":true,"ipaddress":"192.168.1.150","proxyport":0,"swupdate":{"updatestate":0,"checkforupdate":false,"devicetypes":{},"text":"","notify":false,"url":""},"netmask":"255.255.255.0","name":"Philips hue","dhcp":true,"UTC":"2017-02-08T23:09:16","proxyaddress":"none","localtime":"2017-02-08T18:09:16","timezone":"America/New_York","zigbeechannel":"6","modelid":"BSB002","bridgeid":"B827EBFFFEA9AB80","factorynew":false,"whitelist":{"88d74b29365345c9b64c4aa27b7da187":{"lastUseDate":"2017-02-08T17:55:40","createDate":"2017-02-08T17:55:40","name":"auto insert user"},"LZ4fRmwJqDjlyvGKG1B6UYHHv1VkkVZ7UywiYhi2":{"lastUseDate":"2017-02-08T18:02:16","createDate":"2017-02-08T18:02:16","name":"auto insert user"},"5d0a60e5a3194e3fb42be6003f6041b0":{"lastUseDate":"2017-02-08T17:57:33","createDate":"2017-02-08T17:57:33","name":"auto insert user"},"discovery.xml":{"lastUseDate":"2017-02-08T18:09:16","createDate":"2017-02-08T18:09:16","name":"auto insert user"},"a0104a4eeff44ef7afa6553160a34503":{"lastUseDate":"2017-02-08T18:05:15","createDate":"2017-02-08T18:05:15","name":"auto insert user"},"b95140d3b39246d8a3d90b687c529738":{"lastUseDate":"2017-02-08T17:57:33","createDate":"2017-02-08T17:57:33","name":"auto insert user"},"9d9cab6f045141869a2319a93af9a453":{"lastUseDate":"2017-02-08T18:05:15","createDate":"2017-02-08T18:05:15","name":"auto insert user"},"c095a2a9acbd4408a0e9a2720e197f16":{"lastUseDate":"2017-02-08T17:55:40","createDate":"2017-02-08T17:55:40","name":"auto insert user"}}}}

and when I look in the items file in the huemulation folder on the raspberry pi I see:

{"1":"TestSwitch"}

I only declared that one device so that makes sense but is there a reason the home won’t discover it?

Thanks,
Matt