Discussion: openHAB Google Assistant v4 - Breaking changes incoming

checked with state ON and OFF - still no progress :wink:
Removed House definition from Google Home, then re-added.
What else can I check ?

Hi Michael
after switching back and forth beetwen oh 3.x and 4.x I have on my goolge account orphaned items (26 items) - not connected to any home and room. Now I have OH with just one item - but google is still asking about orphaned items
 do you know how to remove them (they appear aftes ‘sync devices’ with error can’t load status, but I am unable to click on them
??
some logs


22:05:03.715 [TRACE] [.io.openhabcloud.internal.CloudClient] - {"error":{"message":"Item gBedroom_Thermostat does not exist!","http-code":404}}
22:05:03.718 [TRACE] [.io.openhabcloud.internal.CloudClient] - Sent content to request 5311427
22:05:03.720 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onComplete: 5311427
22:05:03.721 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Finished responding to request 5311427
22:05:03.828 [TRACE] [.io.openhabcloud.internal.CloudClient] - Socket.IO Packet: EVENT (2)
22:05:03.830 [DEBUG] [.io.openhabcloud.internal.CloudClient] - on(): request
22:05:03.832 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Got request 5311428
22:05:03.834 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Path /rest/items/gKitchen_Thermostat
22:05:03.835 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Method GET
22:05:03.837 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Headers: {"host":"myopenhab.org","accept":"application/json","user-agent":"openhab-cloud/0.0.1"}
22:05:03.839 [TRACE] [.io.openhabcloud.internal.CloudClient] - Body
22:05:03.840 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Query {"metadata":"ga,synonyms"}
22:05:03.843 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Request method is GET
22:05:03.845 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header host = myopenhab.org
22:05:03.847 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header accept = application/json
22:05:03.848 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header user-agent = openhab-cloud/0.0.1
22:05:03.854 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onHeaders 5311428
22:05:03.856 [TRACE] [.io.openhabcloud.internal.CloudClient] - Sent headers to request 5311428
22:05:03.859 [TRACE] [.io.openhabcloud.internal.CloudClient] - {"headers":{"Transfer-Encoding":"chunked","Server":"Jetty(9.4.46.v20220331)","Date":"Mon, 22 Apr 2024 20:05:03 GMT","Content-Type":"application/json"},"responseStatusCode":404,"responseStatusText":"OK","id":5311428}
22:05:03.864 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 5311428, content size 80
22:05:03.866 [TRACE] [.io.openhabcloud.internal.CloudClient] - {"error":{"message":"Item gKitchen_Thermostat does not exist!","http-code":404}}
22:05:03.868 [TRACE] [.io.openhabcloud.internal.CloudClient] - Sent content to request 5311428
22:05:03.870 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onComplete: 5311428
22:05:03.871 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Finished responding to request 5311428
22:05:03.933 [TRACE] [.io.openhabcloud.internal.CloudClient] - Socket.IO Packet: EVENT (2)
22:05:03.935 [DEBUG] [.io.openhabcloud.internal.CloudClient] - on(): request
22:05:03.937 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Got request 5311429
22:05:03.939 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Path /rest/items/gLowerBathroom_Thermostat
22:05:03.942 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Method GET
22:05:03.949 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Headers: {"host":"myopenhab.org","accept":"application/json","user-agent":"openhab-cloud/0.0.1"}
22:05:03.951 [TRACE] [.io.openhabcloud.internal.CloudClient] - Body
22:05:03.952 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Query {"metadata":"ga,synonyms"}
22:05:03.959 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Request method is GET
22:05:03.961 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header host = myopenhab.org
22:05:03.962 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header accept = application/json
22:05:03.964 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header user-agent = openhab-cloud/0.0.1
22:05:03.971 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onHeaders 5311429
22:05:03.974 [TRACE] [.io.openhabcloud.internal.CloudClient] - Sent headers to request 5311429
22:05:03.975 [TRACE] [.io.openhabcloud.internal.CloudClient] - {"headers":{"Transfer-Encoding":"chunked","Server":"Jetty(9.4.46.v20220331)","Date":"Mon, 22 Apr 2024 20:05:03 GMT","Content-Type":"application/json"},"responseStatusCode":404,"responseStatusText":"OK","id":5311429}
22:05:03.977 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 5311429, content size 86
22:05:03.979 [TRACE] [.io.openhabcloud.internal.CloudClient] - {"error":{"message":"Item gLowerBathroom_Thermostat does not exist!","http-code":404}}
22:05:03.981 [TRACE] [.io.openhabcloud.internal.CloudClient] - Sent content to request 5311429
22:05:03.983 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onComplete: 5311429
22:05:03.989 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Finished responding to request 5311429

It is not possible unlink OpenHUB service from my Google account also - after click UNLINK - I see error message but there is no any evidence of this call in OH logs

I can remove OH from this list https://myaccount.google.com/connections - but it doesn’t remove openHUB service from Google Home apk


UPDATE: it self fixed after 24 hrs :wink:

Looking forward to this and to the improved fan modes!! @michikrug quick question, what will happen to Ui setups?


For example, I used the metadata to setup my thermostats. They will now be called thermostatmodes.
Will they change automatically? Will i have new a new metadata there called “thermostatmodes”?

You will have to change them manually. Until MainUI is updated with the new set of known tags, you’ll have to click the “code” tab and change to use any new tags not in the list.

2 Likes

Excellent, thanks!

Update is rolled out. :partying_face:

Please report any issues. :sunglasses:

5 Likes

I’ve just lost my light in assistant.
This is configured as a SpecialColorLight group.
New sync did clear it from my devices. Relinking/reauthenticating only (re-)adds a configured temperature sensor. No further devices are exposed.

Is there a required configuration change for SpecialColorLight?

I tried to enable debug logging but I’m not exactly sure what to look for. There seems to be a general /rest/items/ request and (at least) one for the sensor /rest/item/sensor. Nothing for my light.

Current item configuration is:

Group:Switch:OR(ON,OFF) light_wohnzimmer "Wohnzimmer-Licht" <lightbulb> (bRoom_Wohnzimmer) ["Lightbulb"] {
    ga="SpecialColorLight" [ colorUnit="kelvin", colorTemperatureRange="2700,6500", roomHint="Wohnzimmer" ]
}
Switch light_wohnzimmer_switch "Status" <switch> (light_wohnzimmer) ["Switch", "Light"] {
    channel="mqtt:topic:light_wohnzimmer_eglo1:state",
    ga="lightPower"
}
Color light_wohnzimmer_color "Farbe" <colorlight> (light_wohnzimmer) ["Control", "Light"] {
    channel="mqtt:topic:light_wohnzimmer_eglo1:color",
    ga="lightColor"
}
Dimmer light_wohnzimmer_brightness "Helligkeit" (light_wohnzimmer) ["Level"] {
    channel="mqtt:topic:light_wohnzimmer_eglo1:brightness",
    ga="lightBrightness"
}
Number light_wohnzimmer_colortemp "Farbtemperatur" (light_wohnzimmer) ["Control", "ColorTemperature"] {
    channel="mqtt:topic:light_wohnzimmer_eglo1:color_temp",
    ga="lightColorTemperature"
}

For my ceiling fans, it looks like google is sending 0, 1, 2, 3 for OFF, low, medium, high/ON respectively despite carrying over my prior speeds defined as 0, 50, 75, and 100 in the config change from “speeds” to “fanSpeeds”. IIRC Google used to send 100 for ON which is why I went with the bigger numbers. I switched back to 0-3 and things are working.

My only complaint about 0-3 is that google has it shown in the google home app as a % out of 100. I don’t know if thats something the openhab side influences, but its pretty much impossible to set the speed there. At one point I recall it being a handy selector between low/medium/high.

Anything chane about the syntax on speeds? Mine for example was:

config:
  fanSpeeds: 0=off:zero,50=low,75=medium,100=high:on

Thanks for reporting. I guess I found the issue with that.
As you are using a group with a specific type “Group:Switch:OR(ON,OFF)” the group is falsely detected as “Switch” and thus does not appear.
Until I do a proper code fix for that, you could remove the group type to make it work.

I tested in my setup the following item:

Dimmer MyFan "Ceiling Fan" { ga="Fan" [ fanSpeeds="0=off:zero,50=low,75=medium,100=high:on", ordered=true ] }

It worked as expected. I could tell “Set the speed of Ceiling Fan to medium” and it set it to 75.
Also Google Home is providing me a proper working 0-100 speed control reflecting the actual number.
So I am unsure what the problem might be.

Can you share more of your item configuration?

Sure, I also have a dimmer item with meta data.

I’m in 4.1.2 on a Pi4. I configured both the item and metadata through the WebUI. The Item ‘MasterFan’ code is:

label: Master Fan
type: Dimmer
category: ""
groupNames:
  - Master
tags: []

The GA metadata code is:

value: Fan
config:
  fanSpeeds: 0=off,50=low,75=medium,100=high:on
  ordered: true
  lang: en

When I ask google to set the master fan speed to medium the log shows:

2024-06-02 08:46:26.509 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'MasterFan' received command 2
2024-06-02 08:46:26.512 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'MasterFan' updated to 2

I know switching from speed to fanSpeeds made an impact as after the V4 swtich over google would only understand “turn the fan on/off”. It would say “that device isn’t setup yet” if I asked to set a speed. Once I converted, I have only seen it send 0-3 when commanding a speed. I can use the slider to send higher values via the google home app, but the voice assistant seems to stick to 0-3. I’ve tried reconnecting Google to openhab a couple times without any change in behavior.

Strange. I copied your whole item definition and it just works normally.

Could you try creating another item with the same setup but a different item name, to make sure that no broken config is persisted connected with the item?

I made a new dimmer item called “TestFan” added metadata and it indeed sent the 75 as expected. Interestingly the MasterFan started working at 50-75-100 too. Im thinking this has more to do with when google actually recognizes changes to fanSpeeds. I removed the test fan after switching the others and now they’re all working at 50-75-100. Seems like google doesn’t update the speeds unless an item is added/removed vs changed, even relinking didnt do it.

Any comments on the % slider vs a low/medium/high selector in the google home app? Is that all on google?

Thanks, indeed after removing the aggregate function the light is again available in Google Home.

1 Like

For a mode selection control, you would have to specify modes using a more complex fan setup, e.g.:

Group MasterFan ... 

value: Fan
config:
  fanSpeeds: 0=off,50=low,75=medium,100=high:on
  ordered: true
  lang: en
  fanModeName: Mode
  fanModeSettings: 0=off,50=low,75=medium,100=high

and add three child items:

Number with ga fanMode
Switch with ga fanPower
Dimmer/Number with ga fanSpeed

mode and speed would act without any relation per default as mode != speed.
But you could link both in your own openHAB setup.

I’ll have to play around with that. Thanks for the info/example!

Are you able to reproduce that if you only change your fanSpeeds on an existing item, that google doesn’t match the corresponding change? (ie it continues sending the prior values)

If so, maybe its worth mentioning the work around of making a new item with metadata in the migration guide. My guess is it defaults to 0-3, which is pretty typical. So, only folks using alternative values, like me will notice.

Just tested it. I not even have to sync again. It works right out of the box with the newly assigned value in openHAB.

[EDIT] wait, I might have to test that other case, having speeds before and then change it

[EDIT2] with the old speeds config given, google assistant just responds with “I don’t understand”
after changing to fanSpeeds and syncing it works again as expected

[EDIT3] and no, there is no default for fan speeds :slight_smile:

I’m also playing with the newly added options for the airpurifers! with the modes and sensors this is now getting very powerful!
Quick question, is there any possibility of exposing in google home the number item, as a number, instead of the %?
Take your example above, you have fanspeed= 75 100 etc. And your google home screenshot you have at 70%.
My device wants 1 2 3 4 to control the fan speed., not a %. I did change the item from dimmer, to a number, and now it doesn’t disappear from google home, but, it still shows a percentage, instead of the options mapped in the fanspeed field.

(it’s a bit late over here, I hope I made sense.)

Good point. So far only experimented with percentage values and thus “enforced” those too.
There is a setting in the Google world that is called “supportsFanSpeedPercent” which I always set to true. When not doing so and just providing fanSpeeds the following UI pops up:

This should fulfil your needs. :smiley:
Will work on an option to change the default behavior.

[EDIT] when selecting an existing speed option, this is then also shown at “Fan speed”, so “low” instead of “40”

2 Likes

Fantastic!! This is exactly it! Thank you for trying it :slight_smile:
Can you do one final test for my sanity? Are those values “low” “medium” “high” what is sent to openhab when you select them?
So for example, if you choose “low”, in google home you see “low” like you just said, but is “low” also sent to openhab?

Edit: by the way, is there also a configuration for fans/purifiers that have a independent on/off switch?:face_with_monocle:
The on/off button on google home always says that it’s not supported, so I convert the 0 from the % to off in the switch item, but I suppose that there must be a way to account for this?