openHAB Google Assistant Integration v2.0

Hello Kim,

I have added 2 screenshots. One is showing the Items that are added without explicit tagging and the second one is showing one specific.

EDIT:
Thank you @rpwong! This was the issue. I have removed the tags and the lights disappeared. I understand the backwards compatibility, but for someone new this is confusing.

Best regards,
Oliver

I would have totally loved to remove that deprecated tag stuff, but there were some people who still wanted it for backward compatibility reasons :confused:

Should we add some hint in the documentation?

I dont think so. Both tags are still working. In this case he must have forgot the old version :slight_smile:

He didnā€™t know about it, because he hadnā€™t used it before. Anyone whoā€™s new to GA integration wonā€™t have reason to know about tags if they only read the latest documentation. Lots of people donā€™t even know you can look back through versions of documentation.

I think thereā€™d be value in a note saying that metadata replaces the original method of tagging, but that method still works. It could link to the 2.5 documentation.

Where did the tags came from then?

All I can go on are these statements:

Iā€™m not sure how you can read these and think that he had an old GA integration and forgot how it works. Itā€™s certainly possible that he tried it before and left the tags, but thatā€™s nowhere to be found in his own words.

The tags came from the Home Builder. I havenā€™t even started using them for anything reasonable yet. A hint in the documentation would be great.

A setting switch with default ā€œonā€ to deactivate the old functionality would be awesome btw.

Your right.
I was searching for the cause of the tags beeing there.

I have never used Home Builder, but if it add the tags. Ofcouse there would be a need of a note in the GA integration doc.

Iā€™ve been trying for a while to get openhab and google assistant working but had no success. I have issues connecting the account and when I remove all my item files and this works, I then have issues syncing my devices after adding my item files back.

Iā€™ve tried everything I can think of. Multiple VM and docker instances to test, removing all binding and items and adding them back. I even stood up my own openhab cloud instance and deployed the google smarthome skills and the results were the same.

Here is an dummy items file I have been playing with to see if I can figure out where the issue is coming from. When the file only contains the dummy groups and dummy items, everything works fine. After adding the UPS items google refuses to sync. I can remove some of the UPS items and get sync working again, but there is not logic to which items I remove or add back in.

Any advice?

Group gRoot "gRoot" 
Group gLevel1 "gLevel1" (gRoot)
Group gLevel2 "gLevel2" (gLevel1)
Group gLevel3 "gLevel3" (gLevel2)
Group gLevel4 "gLevel4" (gLevel3)
Group gLevel5 "gLevel4" (gLevel4)
Group gLevel6 "gLevel4" (gLevel5)

Group gRoot1 "gRoot1" (gRoot)
Group gRoot2 "gRoot2" (gRoot1)
Group gRoot3 "gRoot3" (gRoot2)
Group gRoot4 "gRoot4" (gRoot3)
Group gRoot5 "gRoot5" (gRoot4)
Group gRoot6 "gRoot6" (gRoot5)

Switch dummyLight "Dummy Light" <light> (gLevel1) { ga="Switch" }
//Switch dummySwitch "Dummy Switch" (gLevel6,gRoot4)



//Network UPS Tools (NUT) 
String i_Basement_Ups_2_Status "UPS 2 Status [MAP(ups-status.map):%s]" <energy> (gLevel3,gRoot5) {channel="networkupstools:ups:ups2:upsStatus"}
String i_Basement_Ups_2_StatusString "UPS 2 StatusString [%s]" <energy> (gLevel3,gRoot5) {channel="networkupstools:ups:ups2:upsStatus"}
Number:Time i_Basement_Ups_2_Runtime "UPS 2 Battery Runtime [%.1f s]" <poweroutlet_au> (gLevel3,gRoot5) {channel="networkupstools:ups:ups2:batteryRuntime"}
Number:Dimensionless i_Basement_Ups_2_Load "UPS 2 Load [%.1f %%]" <heating> (gLevel3,gRoot5) {channel="networkupstools:ups:ups2:upsLoad"}
Number:Dimensionless i_Basement_Ups_2_Charge "UPS 2 Charge [%.1f %%]" <batterylevel> (gLevel3,gRoot5) {channel="networkupstools:ups:ups2:batteryCharge"}

String i_Basement_Ups_3_Status "UPS 3 Status [MAP(ups-status.map):%s]" <energy> (gLevel3,gRoot5) {channel="networkupstools:ups:ups3:upsStatus"}
String i_Basement_Ups_3_StatusString "UPS 3 StatusString [%s]" <energy> (gLevel3,gRoot5) {channel="networkupstools:ups:ups3:upsStatus"}
Number:Time i_Basement_Ups_3_Runtime "UPS 3 Battery Runtime [%.1f s]" <poweroutlet_au> (gLevel3,gRoot5) {channel="networkupstools:ups:ups3:batteryRuntime"}
Number:Dimensionless i_Basement_Ups_3_Load "UPS 3 Load [%.1f %%]" <heating> (gLevel3,gRoot5) {channel="networkupstools:ups:ups3:upsLoad"}
Number:Dimensionless i_Basement_Ups_3_Charge "UPS 3 Charge [%.1f %%]" <batterylevel> (gLevel3,gRoot5) {channel="networkupstools:ups:ups3:batteryCharge"}

String i_Basement_Ups_4_Status "UPS 4 Status [MAP(ups-status.map):%s]" <energy> (gLevel4,gRoot5) {channel="networkupstools:ups:ups4:upsStatus"}
String i_Basement_Ups_4_StatusString "UPS 4 StatusString [%s]" <energy> (gLevel4,gRoot5) {channel="networkupstools:ups:ups4:upsStatus"}
Number:Time i_Basement_Ups_4_Runtime "UPS 4 Battery Runtime [%.1f s]" <poweroutlet_au> (gLevel4,gRoot5) {channel="networkupstools:ups:ups4:batteryRuntime"}
Number:Dimensionless i_Basement_Ups_4_Load "UPS 4 Load [%.1f %%]" <heating> (gLevel4,gRoot5) {channel="networkupstools:ups:ups4:upsLoad"}
Number:Dimensionless i_Basement_Ups_4_Charge "UPS 4 Charge [%.1f %%]" <batterylevel> (gLevel4,gRoot5) {channel="networkupstools:ups:ups4:batteryCharge"}

String i_Basement_Ups_5_Status "UPS 5 Status [MAP(ups-status.map):%s]" <energy> (gLevel5,gRoot5) {channel="networkupstools:ups:ups5:upsStatus"}
String i_Basement_Ups_5_StatusString "UPS 5 StatusString [%s]" <energy> (gLevel5,gRoot5) {channel="networkupstools:ups:ups5:upsStatus"}
Number:Time i_Basement_Ups_5_Runtime "UPS 5 Battery Runtime [%.1f s]" <poweroutlet_au> (gLevel5,gRoot5) {channel="networkupstools:ups:ups5:batteryRuntime"}
Number:Dimensionless i_Basement_Ups_5_Load "UPS 5 Load [%.1f %%]" <heating> (gLevel5,gRoot5) {channel="networkupstools:ups:ups5:upsLoad"}
Number:Dimensionless i_Basement_Ups_5_Charge "UPS 5 Charge [%.1f %%]" <batterylevel> (gLevel5,gRoot5) {channel="networkupstools:ups:ups5:batteryCharge"}

*Edit: Updated the groups on the UPS items with the dummy groups tested

This is a strange one.
I just did a test by adding all your UPS items to my items files.
Everything just works fine. Just some warnings because I do not have the map file. But this has no influence to the GA integration.

So far I have no idea what could cause your problems here. :frowning:

Have you tried using a completely separate items file for your dummy items? Itā€™s possible thereā€™s some caching going on, so if you start fresh (e.g. donā€™t reuse the same item names for your dummies), you might have success.

@rpwong - I typically have a different items file for each binding. UPS items are normally on their own file so this was tested.

@michikrug - Today Iā€™ve done a fresh install of openhab on a new VM, new openhabcloud account and new google account. Iā€™m using openhabian on ubuntu 20.04. Options selected in openhabian for install are Packages, Zulu 64, OpenHAB Stable, System Tweaks, Samba, LogViewer, Bash&VIM. No luck again. I was able to connect to google assistant with only one item but it wonā€™t sync once I add the minimal config below. Iā€™ve also now seen that this isnā€™t only just for the UPS items, it can be for any list of items that I add.

Help is really appreciated as Iā€™ve invested a lot of time into openhab and money into google devices.

runtime.cfg

org.openhab.ephemeris:dayset-weekend=[SATURDAY,SUNDAY]
org.openhab.ephemeris:dayset-school=[MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY]
org.eclipse.smarthome.core.localeprovider:language=en
org.eclipse.smarthome.core.localeprovider:region=au
org.eclipse.smarthome.inbox:autoApprove=false
org.eclipse.smarthome.links:autoLinks=false
org.eclipse.smarthome.core.i18nprovider:language=en
org.eclipse.smarthome.core.i18nprovider:region=AU
org.eclipse.smarthome.core.i18nprovider:measurementSystem=SI
org.eclipse.smarthome.core.i18nprovider:timezone=Australia/Melbourne
org.eclipse.smarthome.core.i18nprovider:location=-xx.xxxxxxxxxxxxxx,xxx.xxxxxxxxxxxxxx

addons.cfg

package = minimal
remote = true
legacy = true
binding = http1,exec,expire1,networkupstools
ui = basic,paper,restdocs
persistence =
action = 
transformation = exec,javascript,jsonpath,map,regex,scale,xpath,xslt
voice = 
misc = openhabcloud

nut-ups.things

Thing networkupstools:ups:ups2 [ device="ups2", host="10.xx.xx.xx", port=3493, username="username", password="password", refresh=30 ]
Thing networkupstools:ups:ups3 [ device="ups3", host="10.xx.xx.xx", port=3493, username="username", password="password", refresh=30 ]
Thing networkupstools:ups:ups4 [ device="ups4", host="10.xx.xx.xx", port=3493, username="username", password="password", refresh=30 ]
Thing networkupstools:ups:ups5 [ device="ups5", host="10.xx.xx.xx", port=3493, username="username", password="password", refresh=30 ]

dummy.items

Group gRoot "gRoot" 
Group gLevel1 "gLevel1" (gRoot)
Group gLevel2 "gLevel2" (gLevel1)
Group gLevel3 "gLevel3" (gLevel2)
Group gLevel4 "gLevel4" (gLevel3)
Group gLevel5 "gLevel4" (gLevel4)
Group gLevel6 "gLevel4" (gLevel5)
Group gRoot1 "gRoot1" (gRoot)
Group gRoot2 "gRoot2" (gRoot1)
Group gRoot3 "gRoot3" (gRoot2)
Group gRoot4 "gRoot4" (gRoot3)
Group gRoot5 "gRoot5" (gRoot4)
//Group gRoot6 "gRoot6" (gRoot5)
Switch dummyLight "Dummy Light" <light> (gLevel1) { ga="Switch" }
//Switch dummySwitch "Dummy Switch" (gLevel6,gRoot4)

//Network UPS Tools (NUT) 
String i_Basement_Ups_2_Status "UPS 2 Status [MAP(ups-status.map):%s]" <energy> (gLevel2,gRoot5) {channel="networkupstools:ups:ups2:upsStatus"}
String i_Basement_Ups_2_StatusString "UPS 2 StatusString [%s]" <energy> (gLevel2,gRoot5) {channel="networkupstools:ups:ups2:upsStatus"}
Number:Time i_Basement_Ups_2_Runtime "UPS 2 Battery Runtime [%.1f s]" <poweroutlet_au> (gLevel2,gRoot5) {channel="networkupstools:ups:ups2:batteryRuntime"}
Number:Dimensionless i_Basement_Ups_2_Load "UPS 2 Load [%.1f %%]" <heating> (gLevel2,gRoot5) {channel="networkupstools:ups:ups2:upsLoad"}
Number:Dimensionless i_Basement_Ups_2_Charge "UPS 2 Charge [%.1f %%]" <batterylevel> (gLevel2,gRoot5) {channel="networkupstools:ups:ups2:batteryCharge"}

String i_Basement_Ups_3_Status "UPS 3 Status [MAP(ups-status.map):%s]" <energy> (gLevel3,gRoot5) {channel="networkupstools:ups:ups3:upsStatus"}
String i_Basement_Ups_3_StatusString "UPS 3 StatusString [%s]" <energy> (gLevel3,gRoot5) {channel="networkupstools:ups:ups3:upsStatus"}
Number:Time i_Basement_Ups_3_Runtime "UPS 3 Battery Runtime [%.1f s]" <poweroutlet_au> (gLevel3,gRoot5) {channel="networkupstools:ups:ups3:batteryRuntime"}
Number:Dimensionless i_Basement_Ups_3_Load "UPS 3 Load [%.1f %%]" <heating> (gLevel3,gRoot5) {channel="networkupstools:ups:ups3:upsLoad"}
Number:Dimensionless i_Basement_Ups_3_Charge "UPS 3 Charge [%.1f %%]" <batterylevel> (gLevel3,gRoot5) {channel="networkupstools:ups:ups3:batteryCharge"}

String i_Basement_Ups_4_Status "UPS 4 Status [MAP(ups-status.map):%s]" <energy> (gLevel4,gRoot5) {channel="networkupstools:ups:ups4:upsStatus"}
String i_Basement_Ups_4_StatusString "UPS 4 StatusString [%s]" <energy> (gLevel4,gRoot5) {channel="networkupstools:ups:ups4:upsStatus"}
Number:Time i_Basement_Ups_4_Runtime "UPS 4 Battery Runtime [%.1f s]" <poweroutlet_au> (gLevel4,gRoot5) {channel="networkupstools:ups:ups4:batteryRuntime"}
Number:Dimensionless i_Basement_Ups_4_Load "UPS 4 Load [%.1f %%]" <heating> (gLevel4,gRoot5) {channel="networkupstools:ups:ups4:upsLoad"}
Number:Dimensionless i_Basement_Ups_4_Charge "UPS 4 Charge [%.1f %%]" <batterylevel> (gLevel4,gRoot5) {channel="networkupstools:ups:ups4:batteryCharge"}

String i_Basement_Ups_5_Status "UPS 5 Status [MAP(ups-status.map):%s]" <energy> (gLevel5,gRoot5) {channel="networkupstools:ups:ups5:upsStatus"}
String i_Basement_Ups_5_StatusString "UPS 5 StatusString [%s]" <energy> (gLevel5,gRoot5) {channel="networkupstools:ups:ups5:upsStatus"}
Number:Time i_Basement_Ups_5_Runtime "UPS 5 Battery Runtime [%.1f s]" <poweroutlet_au> (gLevel5,gRoot5) {channel="networkupstools:ups:ups5:batteryRuntime"}
Number:Dimensionless i_Basement_Ups_5_Load "UPS 5 Load [%.1f %%]" <heating> (gLevel5,gRoot5) {channel="networkupstools:ups:ups5:upsLoad"}
Number:Dimensionless i_Basement_Ups_5_Charge "UPS 5 Charge [%.1f %%]" <batterylevel> (gLevel5,gRoot5) {channel="networkupstools:ups:ups5:batteryCharge"}

openhab.logs
log:set DEBUG org.openhab.io.openhabcloud

2020-05-29 11:47:35.800 [DEBUG] [io.openhabcloud.internal.CloudClient] - on(): request
2020-05-29 11:47:35.801 [DEBUG] [io.openhabcloud.internal.CloudClient] - Got request 359121
2020-05-29 11:47:35.802 [DEBUG] [io.openhabcloud.internal.CloudClient] - {"host":"myopenhab.org","accept":"application/json","user-agent":"openhab-cloud/0.0.1"}
2020-05-29 11:47:35.802 [DEBUG] [io.openhabcloud.internal.CloudClient] - Request method is GET
2020-05-29 11:47:35.803 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty set header host = myopenhab.org
2020-05-29 11:47:35.804 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty set header accept = application/json
2020-05-29 11:47:35.804 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty set header user-agent = openhab-cloud/0.0.1
2020-05-29 11:47:35.877 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty finished receiving response header
2020-05-29 11:47:35.882 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent headers to request 359121
2020-05-29 11:47:35.882 [DEBUG] [io.openhabcloud.internal.CloudClient] - {"headers":{"Transfer-Encoding":"chunked","Server":"Jetty(9.4.20.v20190813)","Content-Type":"application/json"},"responseStatusCode":200,"responseStatusText":"OK","id":359121}
2020-05-29 11:47:35.883 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 16266
2020-05-29 11:47:35.884 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:35.884 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 16384
2020-05-29 11:47:35.885 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:35.886 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 118
2020-05-29 11:47:35.887 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:35.924 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 16376
2020-05-29 11:47:35.927 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:35.928 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 16384
2020-05-29 11:47:35.929 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:35.930 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 8
2020-05-29 11:47:35.930 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:35.969 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 16376
2020-05-29 11:47:35.970 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:35.971 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 16384
2020-05-29 11:47:35.972 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:35.972 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 8
2020-05-29 11:47:35.973 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:35.997 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 16376
2020-05-29 11:47:36.002 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:36.003 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 16384
2020-05-29 11:47:36.003 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:36.004 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 8
2020-05-29 11:47:36.005 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:36.013 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 16376
2020-05-29 11:47:36.018 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:36.019 [DEBUG] [io.openhabcloud.internal.CloudClient] - Jetty received response content of size 12636
2020-05-29 11:47:36.020 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 359121
2020-05-29 11:47:36.023 [DEBUG] [io.openhabcloud.internal.CloudClient] - Finished responding to request 359121

By change is there any plans to implement the ā€œsmart home media remoteā€ device type (https://developers.google.com/assistant/smarthome/guides/remotecontrol) ? or is it possibly added but undocumented?
Thank you for all your hard work! Much appreciated!

@Woogi, I think you posted in the wrong topic. This oneā€™s for Google Assistant integration, not Alexa. :wink:

damn,ā€¦thx

@michikrug - I may have found the cause of my issues. My items are in a number of nested groups and often with multiple group (location, type and function groups) and the api query to sync uses recursive. Could this cause a timeout or conflict in one of the functions.

Iā€™ve also seen a weird behavior with the API. it doesnā€™t seem to filter based on the metadata value.
https://myopenhab.org/rest/items?metadata=ga&recursive=true
Is this meant to return all items or only those with the specified metadata?

Ah, good catch.
The query will return all items and also print the metadata values for ā€œgaā€.
Also the recursive option will resolve all nested hierarchies. This indeed could take long and become huge with complex structures. :frowning:

You can only filter for type, tags and name. Metadata only selects values to attach.

For getting features like Thermostats work, we need the child elements.

Is the full list also syncā€™ed into MyOpenHAB or is it simply passed through to the google functions? If it wonā€™t impact the general functionality of MyOpenHAB, I would consider raising this (api get items filter by metadata) as a feature request as it would reduce the amount of data being piped through MyOpenHAB, reducing system resources, increasing speed and possible saving some cash along the way.

There already appears to be something along these lines.

However, Iā€™ve no ideas how to use the metadata selector. I tried a few things I thought might work but I always got back all of my Items. Some research would need to take place to figure out how to structure the metadata selector. Maybe itā€™s just a stub for a future capability.

Afaik openHAB cloud (MyOpenHAB) only proxies the local items to a public reachable endpoint.
So yes, a feature request would make sense there.