Official Google Assistant Integration for openHAB

Hi,

I’m having some difficulty controlling my devices in Google Routines. I have a number of “Switchable” and “Lighting” tagged items, each with an associated rule that issues a simple sendHttpGetRequest to an internal server that has a json interface. For example:

rule "Living Room Lamp"
when
	Item LR_Lamp_1 changed
then
	if (LR_Lamp_1.state == ON)
		sendHttpGetRequest("http://192.168.8.8/JSON?request=xxxxxxxx")
	else
		sendHttpGetRequest("http://192.168.8.8/JSON?request=xxxxxxxx")
end

This works great when simply asking Google to turn on (or off) a given device. However, when I try to add a device control action to a routine by clicking “Adjust lights, plugs, and more” in the routine and selecting “Turn on” for a given device, Google Home says “Sorry, I am unable to reach xxxxxx right now. Please try again”. I’ve confirmed that the action request never gets logged in my openHAB cloud account “Event log”.

I get the same error when modifying one of the predefined routines, or by creating a new custom routine.

Someone else mentioned previously in this thread that they too were getting this error, but I didn’t see a reply. Any pointers would be most appreciated… thx.

Yes,
I am targeting for a deployment (after testing) these days to production. Hope it will solve the issue…

BR mehmet

1 Like

@MARZIMA,
Can you provide a example for the thermostat with a working heating/cooling mode?

I don’t think there is a working configuration yet @aart - I tried all combinations in my post above. Especially for the heat/cool mode, the two setpoint tags need to be split out into separate controllable tags. I did raise an issue on Github so hopefully it’ll get sorted out in an upcoming release.

Dear Everyone!

The integration works fine for me,but I have a little concern. I have added some new lights to my openhab, it works fine. Updated the config through Google Home by issuing the sync openhab command. It updated everything, however I can’t see the new lights in the app… I can say commands and it will toggle the switch, but I can’t select room for these new lights, etc… Are there any workaround for that? Or I have unlink and re-link openhab with Google Home?

Thanks

@MARZIMA
can we add
thermostatHumidityAmbient ( Float 0-100) please?
I have thermostat with Humidity value to read…

So after sample command
“What is kitchen thermostat inside ?”

Response should be:
"Heating is set to [thermostatTemperatureSetpoint], with current temperature of [thermostatTemperatureAmbient] and humidity of [thermostatHumidityAmbient]

Hi,

I’m experiencing the same thing. Using Google Routines I set two thermostats (two temperature setpoints) and one virtual switch when waking up or going to bed. Up till recently these actions in Google Routines did get executed just fine for me although Google Routines reported 3 errors on the 3 actions:

‘It looks like openHAB is unavailable right now’ (3 times)

or

‘Sorry, I couldn’t reach openHAB (2x). It looks like openHAB is unavailable right now’.

Needless to say that these actions are performing well when trying to set them through Google Assistant (I have no Google Home) directly. Also when asking for the temperature in the room I get a perfect answer back on heating/cooling mode, the current temperature and the temperature setpoint. All is well.

But ‘sync openHAB’ or ‘sync devices’ is currently not working for me anymore. ‘Sync Philips Hue’ is still working fine. openHAB servers seem to be up and running and I only have Lighting, Switchable and Themostat tags in my openHAB setup. I can’t help but feel that something is still missing / is reporting incorrect values back to Google Assistant / Routines.

Especially the ‘sync openHAB’ not working for me anymore is worrying as I don’t want to have to relink my openHAB setup (85 devices to put in rooms, give nicknames etc).

1 Like

@aart

GA uses the following modes: off, on, heat, cool, heatcool (e.g. auto). Currently the OH Action currently supports translating the OH ZWave format (0,1,2,3) to the above so it can tell you the current mode.

Changing the mode is a little it trickier since it would need to use GA’s convention and translate to what the item expects (some are Numbers and some are string). I am not sure of all conventions that thermostats use in OH, but if we can confirm it may be possible to add.

Ryan

@Roberto2, @MARZIMA

This was a miss on my part, I think I added Humidity later on when I was working on the commit and left it out of one section of the code (where GA parses the members of a thermostat group).

When I tested, if you have a Thermostat Humidity item (as float) it should return 0-100 (as %). If you do not have a Humidity item in the thermostat group it will say “cannot reach [x] Thermostat”.

This will need to be tested and such before deployed and added to production.

Ryan

It is possoble for item “homekit:HeatingCoolingMode” have CUSTOM modes?
like OFF, NOFROST, ECO, COMFORT, COMFORT+" ?

hi,

is it possible to turn a string into a switch in some way? so i can control my projector by voice?

see below , i have a couple of simple items working in openhab and now i’m able to use google home to switch the wemo on and off.

After reading into on here I understand that i can’t make the string switchable. So i was wondering if there is a way round this. maybe i could make a rule or something that would reference the string and turn it into a voice controllable switch? Can anyone point me in the right direction or direct me to a thread that might help?

default.items

default.sitemap

thanks

@Roberto2

“homekit:HeatingCoolingMode” is just the item tag to tell Google the purpose of that item. On the Openhab side there can be multiple varieties (some of which you mentioned). However, on the Google side they all ultimately need to fit into: off, on, heat, cool, heatcool (e.g. auto) to work. Ideally, you’d want to have this item report/accept one of these values for the Thermostat to function correctly on Google Assistant.

For instance: Google will not know “Change Thermostat to Comfort” since it’s not programmed into the official Google Temperature Setting Trait

A workaround for now, may be to have an item Switch for “Comfort Mode” (example), then have a rule in OH2 that when you say “Hey Google Turn Comfort Mode ON/OFF” that rule will change the appropriate parameters within OH2 and the smart device. I do this for “Guest Mode” and “Work From Home” and it works. It’s not 100% ideal, but we have to work within the boundaries of what Google has designed and doing so will be time intensive.

Not perfect, but hope that helps!

Ryan

Create a Switch Item with the switchable tag. Create a Rule that triggers when the Switch Item receives a command. In the Rule send the appropriate String to the Projector Item.

1 Like

Hi Rich, thanks for your response,

first off, is this the correct place for me to be asking these type of questions or should i be posting elsewhere?
i’ve been reading posts and guides all day about this but i’m not really getting it. i think i’m missing a few major steps.

can you recommend anywhere else i can learn about rules other than https://docs.openhab.org/configuration/rules-dsl.html

I’ll keep reading in the meantime.

default.sitemap

default.rules

my map file

default.items

i feel like the channel is not needed here wrong for this because i want it to work from the rule? how does openhab know to use a rule i created, do i need to add a line to the item or sitemap to point to the rule?

i was getting this in the log earlier but now im not so does that mean my syntax is now correct

anything else you can advise or reading material you can recommend is much appreciated.

thanks

bob

@skimdankish

Hi Ryan
Thank you for explanation… (very much)
I have 12 thermostats so I would like to have one Google Assistant Item per thermostat :slight_smile:
Having 12 thermostats + 12 x 4 Items = 48 for heating modes looks wired …

Temp solution used by me is groups with TWO ITEMS: “CurrentTemperature” and “TargetTemperature”
I can read current temperature and set mode using TargetTemerature (modes 0,1,2,3 in my case)

My questions are:
1.when we can expect release with commited code for [thermostatHumidityAmbient]?
2. there will be support for Rollershutters (I know I can use SWITCH or DIM) ?

Great work!

  1. I would use the default upper case ON and OFF instead of on and off or even powerswitch_POWER_**.
  2. Why do you map the values two times?
    On = projectorswitch_POWER_ON = 38000,0,…
  3. If you need the same mapping for multiple items use the map file. Otherwise I would just put it in the item definition.
  4. It is sendCommand(projectorswitch, ON) not send command(projectorswitch_POWER_ON)

There might be more errors in your config, but this is what caught my eye. :wink:

It is probably better to post a new thread for questions like these.

Then copy and paste the code into your post. Many of us use our phones and screenshots after impossible to read. It is also much easier to copy your coffee and fix what is wrong instead of making us retype everything.

Use code fences: How to use code fences

The rules page is the documentation for the rules but based on the errors Christoph identified I think what you need to do is pay really close attention to the docs and examples. Everything matters including spaces and case. Use VSCode to help identify does as you type.

Install the demo package and look at those rules. Make small changes to set how it changes things.

I also recommend reading the beginner’s tutorial and the concepts section of the users guide because you lack an understanding of how the pieces of OH work together. For example, devices are represented as Things. Each part of the device is represented by a Channel. Items link to Channels. Rules work with Items. If your Item is not linked to a Channel your Item can’t talk to the device.

That is what the Item projectorswitch changed from OFF to ON means. That tells OH to run the role when that event occurs in that item.

1 Like

@rlkoshak lkoshak
Hi

It is possible to ask Google Assistant about Item Value except those with tag [“CurrentTemperature”]?
For example ask about switch status? ON/OFF?

Questions like these frustrate me. In the amount of time it took you to type in this question and I to find out the answer you could have just Said “Hey google, are my lights on?” and gotten your answer.

The answer is “yes” btw.

12 Likes

Everything was working fine but today I tried too issue a command too Google and its saying it can’t contact openhab trying to sync devices gets same response anyone else having problems?

I have also unlinked openhab from Google assistant and can’t relink its saying can’t change setting