AndroidTV Binding [3.2.0;4.2.0)

@OMR were you able to get your thing online with the new code release or are you still having the issue?

Thank You for this binding… I love it. It works great for onscreen remotes.

Haven’t been able to try yet.
The TV is at my cabin. Could be a few more weeks …

@morph166955 i have a Sony Bravia KDX running Android TV, i am not able to make this work:

14:44:24.370 [INFO ] [ol.googletv.GoogleTVConnectionManager] - 9C305B768D04 - Error opening GoogleTV SSL connection to bravia01:6466 Connection reset by peer
14:44:31.751 [INFO ] [ol.googletv.GoogleTVConnectionManager] - 9C305B768D04 - Error opening GoogleTV SSL connection to 192.168.1.14:6467 Connection reset

Seems like port 6466 is not open, this is my NMAP:

PORT     STATE    SERVICE
53/tcp   open     domain
80/tcp   filtered http
8008/tcp filtered http
8009/tcp filtered ajp13
8443/tcp filtered https-alt
9000/tcp filtered cslistener
9080/tcp filtered glrpc

I tried to use 8443 and it times out, ideas?

It looks like you dont have the google video app installed.

Google TV is installed

Edit: actually port is open, still debugging the connection, cant get the PIN request to work

Is the binding now working?

I can get the pin code show up, then when i send it:

16:32:07.725 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'TV_soggiorno_9C305B768D04_Pin_Code' received command 5EC3C0
16:32:07.730 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'TV_soggiorno_9C305B768D04_Pin_Code' predicted to become NULL
16:32:20.338 [WARN ] [se.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: undefined
16:32:32.864 [WARN ] [se.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: undefined
16:32:51.736 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'TV_soggiorno_9C305B768D04_Pin_Code' received command 5EC3C0
16:32:51.742 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'TV_soggiorno_9C305B768D04_Pin_Code' predicted to become NULL

And it never binds, but its something!!
@Fabrizio_Valtorta thanks for your widget, quite useful

It looks like something is wrong with your item configuration.

Let me try from scratch (item was automatically discovered)

Edit: it worked! thanks @morph166955 this is awesome! so i had to:

  • Remove the binding
  • Add it again, logs are showing SSL error, ignored that
  • Sent the REQUEST command when TV was on and not in TV mode
  • Waited for PIN (which might take a while)
  • Entered

Nice!!

Everything seems to work fine except volume, i now have to understand how to use the app channel to properly map a few buttons to open netflix… but everything else just awesome

1 Like

Hello.

I have the following problem. When my TV goes to standby, the Thing goes offline. So far so good. Yet, after a day or two the Thing seems to fail to reconnect. I have to disable and reenable it to make it work again.

My configuration:

UID: androidtv:googletv:tv
label: GoogleTV
thingTypeUID: androidtv:googletv
configuration:
  ipAddress: 192.168.178.44
  reconnect: 60

How long are you giving it to reconnect once it comes out of standby? Theres a backoff to prevent flooding.

App is readonly unless on the shield.

Hi Eric.

It is normal for the thing to go offline. You need to:

  1. enable Wake On Lan on your TV;
  2. install Network Binding (you can find it in the list of official bindings);
  3. add a “Pingable Network Device” thing via Network Binding and setting IPv4 and MAC addresses.

At this point you can create a rule that, when you press the power button of your widget, sends a WOL packet via MAC. This is my rule:

val actions = getActions("network", "network:pingdevice:Thing_Network_AndroidTV_Status")

  if (actions === null) {
    logInfo("actions", "Actions not found, check thing ID")
    return
} else {
    actions.sendWakeOnLanPacketViaMac()
}

Even after minutes nothing happens.

Thanks for the tip Fabrizio. But will that solve my problem? If I understand you correctly, this will allow me to turn on the TV using the widget. But my use case is different: when I turn on the TV using its remote, then OpenHab should (reliably!) automatically connect to it and trigger a rule.

My problem is that sometimes this works as intended, but after a few days at the latest, the binding fails to reconnect to the TV when it is turned on.

I have a similar setup and the rule works using the remote. The only difference is that when the network binding detects “ON” I refresh the android TV. My wife likes to unplug the TV when not in use. My rule then runs to turn the room lights on or off with the TV (via remote). Never use the widget.

rule "Sony Refresh when plugged in"
when
    Item GreatRoomSonyTV_Online changed to ON
then
    SonySimpleIP_Power.sendCommand ("REFRESH")
end

Note: Item was from the Sony binding before I ported over to the Android and didn’t change the name. Used the same logic with the network binding.

Please put the bunding logging into trace and send me what it’s saying.

Excuse me but I understood that you were unable to turn on the TV and, subsequently, the thing disassociated itself.
I honestly don’t know what caused this loss of connection. It is a token-based association and therefore should maintain it. I would tell you to try deleting the thing, the binding and the AndroidTV configuration folder on the OpenHAB server (found under /var/lib/openhab/ or /userdata), and then reinstalling the binding and rebinding.

Let’s hold off on deleting the thing and rebuilding. Nothing that he’s said indicates that there’s an issue with the association. The trace log should give us an indication of what’s happening. My guess is that one of the scheduled tasks is stalling somewhere after a day or two which is causing the issue.