Setting up a TV with Google Assistant Integration

This is working. Thank you for your support.

2021-05-11 20:56:24.438 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘TV_LG_Channel’ received command 3

2021-05-11 20:56:24.439 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘TV_LG_Channel’ changed from 1 to 3

So the first value is the value the item channel will receive. The second is the value for google assistant. But what is the 3rd parameter for?

I use it with new Sony TV binding. On/Off, volume, mute works fine. My next one will be input selector and channels.

channelNumber=channelCode=channelName

The channelNumber can be used in commands and is the one that is always send to openHAB.

The channelCode is required by Google as a unique identifier.

The channelName should be a human friendly name to be used.

So I am a bit unsure why the code is used and not the name…

See Actions on Google Smart Home  |  Google Developers and Actions on Google Smart Home  |  Google Developers

Hey thanks for reporting. I am also using the Sony Binding.
How does volume mute work for you? Is it actually activating the mute switch or is it incrementally decreasing the volume to zero? At my setup it is the latter which is quite annoying. It takes quite a lot of time and it “misses” some volume down steps so that it ends at volume 5 or 6…

It is activation the mute switch:

Group    gTV       "Sony TV Zsombor"     <television>  (gFirstroom) ["Television"] { ga="TV" [ volumeDefaultPercentage="20", levelStepSize="10", volumeMaxLevel="100", transportControlSupportedCommands="NEXT,PREVIOUS,PAUSE,RESUME", availableInputs="hdmi1=xbox,hdmi2=settopbox", availableChannels="1=Channel1=NBC,2=Channel2=CBS", roomHint="Zsombor room" ] }
Switch              SONYKD49XH9505AudioMuteSpeaker                                 "Mute speaker"      (gTV)  ["Switch"]                {channel="sony:scalar:d43a2af79a30:audio#mute-speaker", ga="tvMute" }

Hey Eric,

since you are obviously german could you tell me what you’re saying to your assistant to put on a tv channel in german? Mine always says it can not help me or starts playing videos of “ARD” on youtube. I tried various availableChannels definitions. Everything else like tvApplications is working fine though…

Thanks in advance.

Anybody else here, who is able to control his TV channels in german?

For me its working fine with saying “Schalten den [Name des Geräts] auf ARD”

Example config for testing:

Switch TvMute "TV Mute" (TVGroup) { ga="tvMute" }
Switch TvPower2 "TV Power" (TVGroup) { ga="tvPower" }
String TvChannel "TV Channel" (TVGroup) { ga="tvChannel" }
String TvInput "TV Input" (TVGroup) { ga="tvInput" }
Number TvVolume "TV Volume" (TVGroup) { ga="tvVolume" }
Player TvTransport "TV Transport" (TVGroup) { ga="tvTransport" }
Group TVGroup "Bildgeber" { ga="TV" [ availableInputs="tv=TV,hdmi1=HDMI1,hdmi2=HDMI2", availableChannels="20=channel1=Channel 1:ARD,10=channel2=Channel 2:ZDF" ] }

Thanks for your help. After lots of try and error i found the reason.
My config was ok, but i think there is a bug. Either in the implementation or in the documentation.

The doc says that the tvTransport item was optional, but at least for the tvChannels it is not.

(optional) transportControlSupportedCommands="NEXT,PREVIOUS,PAUSE,RESUME"

After setting up the transport item (even though i didn’t configure it in the TVGroup) switching channels with your command works fine.

Maybe you can try out at your setup. Comment out the player item and check if you can switch tv channels…

Thanks for the update. Will check this case. :+1:t2:

1 Like

Initially I had the same problem: “… starts playing videos of“ ARD ”on youtube”. My TV was called “Wohnzimmer TV”. Alter removing the word “TV” from the TV name, I changed the name to “Sunrise”, it started working. I wonder, if google gets confused by the word “TV”. However, I cannot remember at what time I added the transport item.

At the moment my TV is just called TV and it’s working.
But i also suspected that and tried “Fernseher” and “Bildgeber” from michikrugs example to find out that all names work…

Thanks! I had the same problem on two TVs, added the tvTransport item and now it’s working correctly! (Was corretctly working on a third TV where I “accidentally” added the tvTransport from the beginning)
The strange thing is that for those two TVs before it worked correctly from the Nest Hub Max screen but not with voice command…

Great! I got this working also, pretty cool to tell your tv to switch the channel to RTL 4 for example.

Got a question, does anyone know how to use these:

transportControlSupportedCommands=“NEXT,PREVIOUS,PAUSE,RESUME”

I can say “Zet TV op Pause” < set tv on pause. And that works. The same works for “speel” < play. But the other ones don’t react. I check the log, but NEXT and PREVIOUS don’t work. And not sure how to say it. Switch TV to Next ? Or Switch a channel up? (all in dutch ofcource) It doesn’t work either way.

Hope someone can point me in the right direction.

1 Like

Hi there,

I have a weird experience with Google and selecting channels.
Most channels I have setup which end with a Number are “most of the time” not recognized. I have an answer from Google saying: I have searched “Channel” but this content is not available or cannot be played at this time.
I have tried to put different names for theses channels (ie: ARD3:ARDDREI:ARDTHREE) but nothing works!
After switching the TV OFF, it works the Channel is recognized by Google Home, but if I ask the same sentence again → this content is not available or cannot be played at this time

I have also tried to put ackNeeded=FALSE or checkState=false for the TV Group without luck. This drives me crazy…

Hello,

I just had a fresh look at Google’s documentation for TVs.
It seems they adjusted the required traits, which could explain your behaviors, that e.g. a transport is also required.

I already created some adjusted code that I will publish soon.

Regarding the issue of switching channels, I have to say that at my end it works pretty well.
Tested with e.g. NBC, Disney Plus, …

1 Like