AndroidTV Binding [3.2.0;4.2.0)

Try to install google video…

It should be supported on Android 6 and up. The server backend for the binding gets installed along with that app. It’s the thankful gift from Google that it’s part of the app and not in the actual OS.

I’ve pushed version 0.06.5 (74d1758) to the main thread. I’ve done some code adjustments in preparation for review to clear up some SAT issues. There should be no visible difference between the previous version and this, although a bunch has changed behind the scenes. Please report any regressions you notice when upgrading. You should NOT have to re-run PIN with this. Thanks!

I’ve pushed version 0.07 (0811ce0) to the main thread. This fixes a bug which throws an exception (it now throws a log message).

I’ve also added some additional logging to throw messages when protocol oddities happen.

Switched to this binding (as OH4.0 capable, but currently on OH3.4) from Sony binding on Sony XBR Model 65X850E. Works fine-only use the power channel. Thanks for the suggestion.

Only quirk of my situation is my wife feels the need to unplug the TV when not in use. With the Sony binding I just disabled reconnect “-1” to avoid filling the log. I believe when it was plugged in again it sent a wake on LAN, so could be controlled. I couldn’t find a lot of documentation on the Android reconnect. For now I just set the log level to warn because it was filling the log with reconnect tries. Any suggestions?

Glad to hear it’s working for you. I can probably put some logic in the binding to monitor it via icmp pings and cut off the reconnect attempts if the device is unreachable. I can just update the things offline status message at that point to indicate it.
Other bindings do similar, i can probably get that in easily enough. Probably going to be next week before I’ll have time to test it all out.

EDIT: looked at it more, I’ll see if I can also put something in to limit the messages so it only fires once instead of spamming.

1 Like

@apella12 can you give me a small snip of the logs that are spamming so I make sure I grab all of them. Thanks!


Here you go. I think it is only this one.

Thanks! Ill see what I can do to make that a little more robust next week.

1 Like

I’ve pushed version 0.08 (d95ad7b) which includes the fix for the spamming of messages as identified by @apella12

Basically, prior to actually trying to do the whole connection, we do a health check to see if we can even do a basic tcp socket establishment with the port. If we can’t, we stop until we can connect again. You will see more messages at debug and trace, but you shouldn’t be getting them under normal circumstances. To note, I’ve seen as much as a 3 minute delay happen when the device goes offline to when everything finally fails. So if you power cycle your device, or move wires, please give it a few minutes for it to all level out. Once it gets past that first 3 minutes from the initial power off it should work very fast once the device comes back online.

1 Like

Doesn’t seem to want to connect to the Formuler Z8

2023-03-24 12:36:05.499 [INFO ] [l.googletv.GoogleTVConnectionManager] - 16968a293b - Error opening GoogleTV SSL connection to 192.168.0.20:6466 Connection reset by peer (Write failed)
2023-03-24 12:37:05.629 [INFO ] [l.googletv.GoogleTVConnectionManager] - 16968a293b - Error opening GoogleTV SSL connection to 192.168.0.20:6466 Broken pipe (Write failed)
2023-03-24 12:38:05.761 [INFO ] [l.googletv.GoogleTVConnectionManager] - 16968a293b - Error opening GoogleTV SSL connection to 192.168.0.20:6466 Broken pipe (Write failed)

No, which is probably is the issue. In any event, it’s not that important. I only use the device sparingly.

On a different topic, I noticed that after I restart openHAB (a very rare occurence), I get this when sending a command to Keyboard channel on the DirecTV Stream devices:

2023-03-24 08:59:10.704 [INFO ] [tocol.googletv.GoogleTVMessageParser] - 1CD6BE44D347 - Unknown power state received. c20100

If I power cycle the devices, they reconnect and all is well. Maybe that is by design or limitation…

Yup, thats it. Just load GoogleTV onto the device from the app store. No configuration required.

Ill go dig into the code and see what could be causing that.

@kjknauss Can you do me a favor. Please but the binding logging into trace and restart OH. I’d like to see why that is happening and if something else is going on in the background. You can put it back to info after you generate that message so you don’t get flooded. Throw the output to me in a DM so we don’t flood the thread. I’ve not run into that before and I don’t have a way to replicate it here.

Do any of the other channels work? Specifically if you send commands to keypress (e.g. KEY_UP, KEY_DOWN, etc) do they work or do they spit that error also?

Hey there =)

I installed this binding today and had no problems setting it up with my Sony TV running GoogleTV :+1: Thank you for your work!

One improvement might be adding dedicated PLAY and PAUSE instead of (or in addition to KEY_PLAYPAUSE commands to KEYPRESS. I’d like the ability to have this absolute control and a Player-Item would be possible with this as well.

P.S. I really look forwards to see the volume channel being RW.

Very glad to hear it worked for you!

To be clear about the play pause, if I added KEY_PLAY and KEY_PAUSE that would work? Alternatively, you could use the KEYCODE channel. 85 to 90 and 125 to 130 cover all of the different media control options. I haven’t directly tested them all but in theory they should work just fine. The readme on the first post has the list at the bottom.

For volume, absolutely agree. My problem is simply that I haven’t identified the exact/correct command to send (I have a rough idea but just haven’t hit bullseye yet). If someone finds it, it’s a trivial amount of work to implement.

Exactly!

Good idea! I will try to implement this tomorrow with a proxy item. If it works (which I assume it does) I will send in a config for others to use. However in the long run I think it’d be great if the binding provided a Player-Item that handels this for the user. What do you think?

I don’t have a problem implementing it in the binding. I just like to make sure I understand the request before I code. Gimme a week or two and I can probably find some time to get it all in.

I posted 0.08.1 (0e87cd3) which adds KEY_PLAY and KEY_PAUSE. Let me know if that works out.

Works perfectly! Thank you =)

P.S. The formatting of the changelog is slightly messed up, I things there is a space missing in the enumeration:


Nice! For the time now this is how I implemented a Player-Item (with which you can check whether we are on the same page):

Items:

Player Multimedia_Wohnzimmer_Fernseher_Player     ""  <mediacontrol>
String Multimedia_Wohnzimmer_Fernseher_Knopfdruck                    {channel="androidtv:googletv:Multimedia_Wohnzimmer_Fernseher:keypress"}

Rule:

val String Dateiname = "Multimedia.rules"


rule "Fernseher Player"
when
    Item Multimedia_Wohnzimmer_Fernseher_Player received command
then
    val String RuleName = Dateiname + ": \"Fernseher Player\": "

    logInfo("Rule triggered", RuleName + receivedCommand)

    Multimedia_Wohnzimmer_Fernseher_Knopfdruck.sendCommand("KEY_" + receivedCommand)
    Multimedia_Wohnzimmer_Fernseher_Player.postUpdate(NULL)
end

Sitemap:

Default item=Multimedia_Wohnzimmer_Fernseher_Player

One more thing: Where do these Google Keycodes come from?
My TV supports two things I’d love to send to him:

  • Disabling the screen → continues to play the media but just audio and turns the image off
  • A button (on the remote) for toggling the subtitles. My YouTube turns subtitles on randomly (don’t know why, it’s on all devices). A button to turn these off would be nice.

Do the KEYPRESS commands get converted to a Keycode internally or might there be a way to add (the aforementioned) commands to the list?