AndroidTV Binding [3.2.0;4.2.0)

That’s the Google Home app, not the Google TV app. I suspect that the Home app uses the Cast API, since that’s already in place for older Chromecasts and Nest devices. Maybe the Chromecast binding would give some clues as to how volume is controlled in Android TV?

The volume controls in the Google TV app show up as buttons when you go into the “TV Remote” screen.

Do the commands get encrypted before being sent? If not I might be able to dump the command via Wireshark :thinking:


So this might no be the same API the AndroidTV binding is using…?

As @rpwong correctly identified this is the Google Home App. However I just searched the Google Play Store for “Google TV” and installed this app.

Is this the correct one?
It is also able to control the volume absolutely:

However this also looks like the cast API to me


(Still thinking about whether we might be able to see the command in a Wireshark dump)

I’m pretty sure that’s the cast API. I have considered pulling it in as well for media control but haven’t for a few reasons. Yes, GTV is encrypted. However there is actually a MITM proxy built into the binding we can use to decrypt the stream if we need. If you want to be more certain, you can Wireshark and see what ports it’s running on.

If I recall correctly, the Home app was designed specifically for Chromecasts, so it has always used that API to interact with Android TVs (seeing them purely as Cast devices).

image

Yep, that’s the Cast API.

I’m fairly certain that the Chromecast binding is still using v2 of the Cast API. Since it continued to work, no one has put time into implementing v3 (which was released in 2017).

So…I guess if you wanted to go deeper down the rabbit hole, you could turn this into a replacement for the Chromecast binding as well. :wink:

But I’m not actually requesting that, because you’ve already put in a ton of effort for which we’re grateful!

1 Like

Just checking in with everyone. With the exception of the issue on some of the DirecTV boxes, is anyone having any kind of issues or instability? Mine have been online for weeks with no issues here so I’m really hoping we’ve hit a good stable point.

Nope. It’s been running very stable for weeks.

Thanks!

I sometimes see that the binding is reconnecting to the TV for some reason

18:58:18 (15. 04.)    Thing 'androidtv:googletv:Multimedia_Wohnzimmer_Fernseher' changed from ONLINE to OFFLINE: GoogleTV: reconnecting
18:58:18 (15. 04.)    Thing 'androidtv:googletv:Multimedia_Wohnzimmer_Fernseher' changed from OFFLINE: GoogleTV: reconnecting to OFFLINE: GoogleTV: I/O Error
18:58:50 (15. 04.)    Thing 'androidtv:googletv:Multimedia_Wohnzimmer_Fernseher' changed from OFFLINE: GoogleTV: I/O Error to OFFLINE: GoogleTV: Initializing
18:58:50 (15. 04.)    Thing 'androidtv:googletv:Multimedia_Wohnzimmer_Fernseher' changed from OFFLINE: GoogleTV: Initializing to OFFLINE: GoogleTV: reconnecting
18:58:50 (15. 04.)    Thing 'androidtv:googletv:Multimedia_Wohnzimmer_Fernseher' changed from OFFLINE: GoogleTV: reconnecting to OFFLINE: GoogleTV: I/O Error
18:58:50 (15. 04.)    Thing 'androidtv:googletv:Multimedia_Wohnzimmer_Fernseher' changed from OFFLINE: GoogleTV: I/O Error to OFFLINE: GoogleTV: Initializing
18:58:53 (15. 04.)    Multimedia_Wohnzimmer_Fernseher - Login Successful
18:58:53 (15. 04.)    Thing 'androidtv:googletv:Multimedia_Wohnzimmer_Fernseher' changed from OFFLINE: GoogleTV: Initializing to ONLINE

but besides that the connection and features are rock solid and work fine.:+1: . See all fernseher.log (22.2 KB) if you want to see how often this happens.

The only thing I’d love to see is absolute volume control… but thats a known issue ^^

That’s interesting. Any chance of a network issue? IO Error generally implies that it can’t connect to the device. Just to confirm, you’re on the most recent version posted correct? Is the device wired or wireless?

No concerns for me, but I do have a question: will app control be possible with Google TV, or will that remain read-only?

I’m not too concerned about it, which is why I haven’t asked before. Sorry if I’ve missed seeing a previous post addressing it. This thread has gotten a bit long. :wink:

I’ve posted an updated jar v0.10 (5eb0a06). This is likely the last jar prior to the binding being merged into 4.0. It should be completely stable. It includes the commits from the review, please report any regressions.

@rpwong my apologies I didn’t see this message. The problem is simply that I don’t have any frame of reference for what the commands needs to be to do that. The protocol stack supports it. If I can figure out what the commands are, it’s a very trivial amount of code to add to the binding.

1 Like

No worries. Maybe add it to the wish list and we can talk about it in the future? Like I said, I’m not too concerned, but if it’s possible we might as well look into it. I’ll help you as much as I can.

Thanks!

Both are listed at the bottom of the main post.

1 Like

Maybe you can get a hint from Philips TV Binding?

The app control worked for me with this binding. I know it’s Philips specific, but maybe this can give some direction?

1 Like

Unfortunately, it’s two different protocols entirely. The same problem holds true with the Sony TVs.

That said, given that we have the structure already to handle multiple protocols (like Shield), I have considered adding specific thing types for those with that separate protocol channel to handle the stuff GoogleTV doesn’t. I’ve been holding off on that until we merge in as I really don’t want to introduce any additional complexity to the binding before it’s merged. Given that the other bindings do exist though, I don’t have a reason to not pull (part of) them in at a later time to handle the specific things that we can’t do today. It would be one at a time obviously as we slowly integrate them.

2 Likes

First I need to commend you on this binding. Looks great and hope I can get it working on my side.
Having some issues with the pin as it does not appear on my tv as expected. I have a Xiaomi Mi Android TV stick (year: 2022, model: MiTV-AYFR0)
Steps I followed:

  1. Updated .thing file to include googletv and updated to my IP address.
  2. Added the Google_TV items to my .items file.
  3. Installed the AndroidTV binding from the Main UI menu.
  4. Discover the things. 2 Things appear namely GoogleTV and Mi TV Stick.
  5. Both Things are offline at this stage.
  6. Send the following through the CLI: openhab:send GoogleTV_PINCODE REQUEST.
    Below the openhab.log file.
2023-04-27 10:59:00.120	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:00.132	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:00.623	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:00.624	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Opening GoogleTV SSL connection to 192.168.1.12:6466
2023-04-27 10:59:00.634	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:00.720	[DEBUG] [l.googletv.GoogleTVConnectionManager]	Assuming server certificate is valid
2023-04-27 10:59:00.721	[TRACE] [l.googletv.GoogleTVConnectionManager]	Subject DN: CN=atvremote/soul/soul/MiTV-AYFR0/10:38:1F:3B:73:C5
2023-04-27 10:59:00.722	[TRACE] [l.googletv.GoogleTVConnectionManager]	Issuer DN: CN=atvremote/soul/soul/MiTV-AYFR0/10:38:1F:3B:73:C5
2023-04-27 10:59:00.723	[TRACE] [l.googletv.GoogleTVConnectionManager]	Serial number: 1635909714552
2023-04-27 10:59:00.723	[DEBUG] [l.googletv.GoogleTVConnectionManager]	Returning empty certificate for getAcceptedIssuers
2023-04-27 10:59:00.764	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Message reader thread started 6466
2023-04-27 10:59:00.765	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Command sender thread started 6466
2023-04-27 10:59:00.778	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - GoogleTV PIN Process Incomplete
2023-04-27 10:59:00.779	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - startChildConnectionManager parent config: 6466 NORMAL false
2023-04-27 10:59:00.780	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - startChildConnectionManager child config: 6467 PIN false
2023-04-27 10:59:00.786	[TRACE] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Initializing SSL Context
2023-04-27 10:59:00.791	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Message reader thread exiting 6466
2023-04-27 10:59:01.137	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:01.265	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:03.146	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:03.647	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:04.283	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:04.652	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:04.788	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:05.154	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:05.666	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: true - Logged In: false
2023-04-27 10:59:05.793	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:06.672	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:06.797	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:07.176	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Opening GoogleTV SSL connection to 192.168.1.12:6466
2023-04-27 10:59:07.290	[DEBUG] [l.googletv.GoogleTVConnectionManager]	Assuming server certificate is valid
2023-04-27 10:59:07.292	[TRACE] [l.googletv.GoogleTVConnectionManager]	Subject DN: CN=atvremote/soul/soul/MiTV-AYFR0/10:38:1F:3B:73:C5
2023-04-27 10:59:07.294	[TRACE] [l.googletv.GoogleTVConnectionManager]	Issuer DN: CN=atvremote/soul/soul/MiTV-AYFR0/10:38:1F:3B:73:C5
2023-04-27 10:59:07.295	[TRACE] [l.googletv.GoogleTVConnectionManager]	Serial number: 1635909714552
2023-04-27 10:59:07.297	[DEBUG] [l.googletv.GoogleTVConnectionManager]	Returning empty certificate for getAcceptedIssuers
2023-04-27 10:59:07.299	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:07.340	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Message reader thread started 6466
2023-04-27 10:59:07.341	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Command sender thread started 6466
2023-04-27 10:59:07.347	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - GoogleTV PIN Process Incomplete
2023-04-27 10:59:07.348	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - startChildConnectionManager parent config: 6466 NORMAL false
2023-04-27 10:59:07.349	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - startChildConnectionManager child config: 6467 PIN false
2023-04-27 10:59:07.352	[TRACE] [l.googletv.GoogleTVConnectionManager]	theater - Initializing SSL Context
2023-04-27 10:59:07.356	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Message reader thread exiting 6466
2023-04-27 10:59:07.802	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:07.842	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:08.304	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:08.846	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:09.351	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:10.357	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:10.860	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:11.363	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:11.823	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:12.374	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:12.426	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: true - Logged In: false
2023-04-27 10:59:13.379	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:13.428	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:14.385	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:14.432	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:14.934	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:15.155	[TRACE] [.androidtv.internal.AndroidTVHandler]	theater - Command received at handler: pincode REQUEST
2023-04-27 10:59:15.156	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Command received: pincode
2023-04-27 10:59:15.157	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Command received: pincode
2023-04-27 10:59:15.391	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:15.436	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:15.893	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
2023-04-27 10:59:16.440	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false

Hope someone can help. Thank you.

@jabez01 Thank you for giving it a try! I have a few thoughts

  1. Please confirm you have GoogleTV installed on the device. The link is on the main thread. When we see “Online: false” that means that we are having an issue opening a basic connection to the device.
2023-04-27 10:59:00.120	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Device Health - Online: false - Logged In: false
2023-04-27 10:59:00.132	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Device Health - Online: false - Logged In: false
  1. It looks like you have the same IP address configured for 2 devices. Do you have multiple things configured?
2023-04-27 10:59:00.624	[DEBUG] [l.googletv.GoogleTVConnectionManager]	10381F3B73C5 - Opening GoogleTV SSL connection to 192.168.1.12:6466
2023-04-27 10:59:07.176	[DEBUG] [l.googletv.GoogleTVConnectionManager]	theater - Opening GoogleTV SSL connection to 192.168.1.12:6466
  1. Is everything on the same network or do you have VLANs/firewalls/etc?

Hi!
Thank you very much for the awesome binding and for sharing your hardwork. I really apreciate it.
Here goes my feedback, Everything works perfect and as expected in my Nvidia Shield except for one thing. I realize that for most people using openhab and this binding the intended use case is to exclusively use a mobile device as their remote controler. For me however that is not the case I use openhab to have an API and do some automations but I still use my Harmony remote control and some time the nvidia remote controler.

The problem is that when I do a search in my Shield it no longer lets me use the on screen keyboard. It keeps telling me to use my device’s keyboard. This only happens if and when openhab is using this binding. Is there any way you could think I could fix this?

@morph166955 thank you for the quick feedback. About the questions:

  1. I have ‘Google Play Movies and TV’ installed. From an earlier message in this thread I believe I have the correct app.
  2. I have only 1x thing in my Things file:
Thing androidtv:googletv:theater [ ipAddress="192.168.1.12" ]

However, 2 Things were discovered namely GoogleTV and Mi TV Stick (10381F3B73C5). I also tried to connect with both running (as per the openhab.log I posted) or either one of them disabled.

  1. OH and the device are on the same VLAN.