Official Google Assistant Integration for openHAB

@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

Sounds like the same problem here Google Home Error linking openHAB account

1 Like

Yh sounds like the same problem looks like it didn’t receive no replys

Recent post so it might sort itself out if someone else is experiencing it

Looking at the myopenhab it says my setup is offline and went offline earlier today

Did you turn it off and on? Happened to me once. I think I just restarted the service, maybe the computer, then it went back to normal. I assumed myopenhab.org was just down for the first day before I realized.

I have fixed it now restarted openhab and Google home

Removed openhab from Google assistant
Removed google assistant from my openhab site
Readded working now

Hi All

As a total newbie to OpenHab, I’ve been having a terrible job getting my head around how to add tags (as my system was configured using PaperUI, rather than text files).

I followed this post (mentioned by adam_e) and have added my own experience / tips to the bottom of it (May 22nd 2018)

[Apply tags to items added/linked in Paper UI - #11 by oklona]

I hope it helps someone else.

@rlkoshak
I couldn’t work out what you were referring to when you kept questioning if I had linked things to items.
I think I’ve got my head around it now.

To give my feedback, It seems like if I left OpenHab2 in Simple Mode and let it create Items from Things automatically, I was unable to edit the Items later.

So although it a bit of a long winded process, I’m finding that creating Items as I add Things not only makes it easier in the future, but the names I choose make more sense.

One tiny observation, which might be due to me using a SnapShot build (Circa 1283),

When I add a Thing, then open the Thing’s channels to link to an Item.
I have to create a New Item each time, but clicking “Link” doesn’t link the newly created Item.

It appears to create the Item because if I click Cancel, then try to Link the channel of the Thing again, the new Item appears in the list and can be linked.

Hi @ALL,

I ve deployed the latest state of the openHAB Action to production for the upcoming openHAB 2.3 Release. There is now a USAGE.md file as a user guide, so this is actually the right docs to read if you just wanna use the openHAB action. The current version brings in also a fix for the tagging issue. Thanks to @skimdankish for the thermostat contribution.

Would be cool if you guys test, if all remains ok and possibly those with Tagging issues could check if we
magically solved your issue :slight_smile:

BR Mehmet

5 Likes

Hi @MARZIMA

For the thermostat mode, what are the Strings allowed?
Should they be uppercase, lowercase, does it accept both?

Thanks

1 Like

Anybody been able to get Google Assistant to read text from a String in OpenHab?

Such as:
“Google, what show is running on Kodi?”

And it would respond by reading the text from my item:
String kodi_title “Kodi Show [%s]”

Thanks.
I gather the ChromeCast reads the text for you in the room (instead of your phone running google assistant).

I am looking for Google Assistant to give me the information.
Similar to how i would ask if a switch is On or Off.

Ah sorry, I misunderstood your ask. As far as I know there is no way to ‘push’ text to the assistant to have it read out. The closest I have seen is using IFTTT to reply to a request with whatever text you enter in the IFTTT applet, or whatever it’s called these days, but that requires you to ask the assistant something first to elicit the response.