Yet another Google Home Linking Problem Thread (Problem was large item amount & timeout - fixed on server side)

Dear Openhabians,

i have spent quite a while digging through google home linking threads, where people have various issues linking their Google Home Account with Openhab.

A lot of them concern the outdated “tags-method” but some of them also exist with the new metadata approach.

So before I state my problem, here is what I found out up to now:

  • Myopenhab.org cloud must be connected and set to notification and remote access - items don’t need to be exposed explicitly
    image
  • There must exist at least one item that has
    ** a label
    ** metadata in the ga namespace with appropriate type
Switch TestLight "Test Light" { ga="Switch" }
  • In google home, add openhab as thrid-party service, it will take you to myopenhab.org and you are prompted to grant google access
  • Google home should take you back to a screen where you can choose rooms for all detected devices (items)
  • If you don’t have a valid item, it will take you back to the “link third party” screen
  • Ask google to sync my devices in order to get updated item information

Now for my problem:
System: rpi3b+ OH3.2.0 M3
I think i have followed all those instructions above - when I query

https://myopenhab.org/rest/items/TestLight?metadata=ga

I get:

{"link":"https://myopenhab.org/rest/items/TestLight","state":"OFF","metadata":{"ga":{"value":"Switch"}},"editable":false,"type":"Switch","name":"TestLight","label":"Test Light","tags":[],"groupNames":[]}

As far as I understand, this is also queried in the linking process. Unfortunately, when I try to link my openhab account, google home will display “Linking your openHAB account” and then revert to the linking page where openhab is still in the list under “link new”.

I have two suspicions and it would be awesome if you could help me out here:

  • Some of my other items (those without ga metadata) interfere, maybe somwhere a label is missing or a weird tag? Can that be an issue?
  • When I query the item list from myopenhab.org it takes a solid minute as I have a lot of items (981), the “linking your openHAB account” display disappears after around twenty seconds. Could there be a timeout involved?

How can I quickly search for items without label, or filter Items with a certain namespace in the metadata?

I would be very happy if someone could point me in the right direction. I know there are plenty of “google home linking problem” threads out there…

Thank you so much,

Bob

Timeouts could be indeed a problem. I will try to increase it to above 60 seconds. Currently it’s even set to 10s, which is probably fine for commands and single queries but could indeed interrupt initial syncs.
Besides that the setup looks fine for now.

Edit: Changed the timeout to 120s

1 Like

Thank you so much!! It didn’t work right now but I guess the change will take some time to go through, right? It showed the linking message for 10secs when I tried it.

All the best,

Bob

Edit: It worked! Even though the message disappeared after 10 seconds, the connection appeared a little later. Again, thank you so much!

Edit2: For others with that problem, I had to try 2 or three times to link openhab in Google home (without deleting the links under Google account linking or myopenhab.org), eventually my devices showed up.

1 Like

One more question: “sync my devices” works once fore me, but after that Google keeps telling me “Something went wrong and I’m unable to control your home”.
All I can do is disconnect all accounts and link again.

Could that also be timeout related?

Thank you so much!

Could you name some quite specific item names of your setup so that I can dig deeper in the logs?!

Yes of course!
Here are some: DachlukeBad_BlindsControl with label “Badluke”, DachlukeOG_BlindsControl with label “Dachluke”, XPLUG1 with label “Heizstrahler”.

I will trigger a sync at 20:20 (Berlin TZ).

Thank you so much for your amazing support!

Edit: Done

First tipp to potentially avoid issues: assign a value to your TestLight (or remove the metadata link)

Items without a value aka NULL will throw an error when querying them. I assume Google will do a QUERY right after the SYNC.

[EDIT] I do not see any QUERY request after the SYNC for your devices

1 Like

It had an OFF value all along, but I can try removing it…
Edit: I removed it, but it didn’t help… I think all the other items should also have a valid state

So I saw your SYNC request and it went through without any issues adding 20 items within 18 seconds.

That’s the thing, it should be more by now.
I just added another item WS_SZ_Contact but it won’t sync.
I guess I have to check my myopenhab rest output if it shows up on that in the first place.
Maybe that’s where it goes wrong…

Check PM for a more detailed log excerpt

1 Like

For completeness:
The current assumption is that the initial SYNC after adding an account is not hardly limited in terms of timeouts.
Every SYNC afterwards seem to throw a “DEADLINE_EXCEEDED” error after probably 10 seconds.

1 Like

Ok to give an update here, it is definitely connected to the rest API speed of your local openhab installation. I had almost 1000 items and it was very slow. I now deleted items and things that I do not necessarily need and with about 900 items my whole openhab is suddenly super snappy.
It seems like there is a critical mass when it all slows down.

Now device sync runs like a charm!

Nice, really happy to hear that you were able to strip down that amount of items and it now works as expected.

1 Like