AndroidTV Binding [3.2.0;4.2.0)

jar updated to fix a small issue with keepalives.

Hi

Someone more that can help with testing :slight_smile:

I have tried to setup my Philips 50PUS7373/12 (Android 8) but don’t get a pin code on TV

  1. Copy org.openhab.binding.androidtv-3.2.0-4.0.0-SNAPSHOT-152e942.jar to Add-On Folder
  2. Create Android-TV-Thing
  3. Link Item GoogleTV_Pin_Code to Channel Pin Code
  4. Send “REQUEST” in API Explorer
  • Trace attached (from the very beginning)
  • Files in /var/lib/openhab/androidtv I have deleted, but did not help

→ Not sure if port 1926 is really needed?
→ I have installed Philips TV (2016+) Binding but this should not be an issue?

openhab.log (61.9 KB)

Hey @michaeljoos! Thanks for trying it out. I would try to not use the port number in the configuration. It looks like that could be related to something Philips specific. The binding attempts by default to connect to the googletv video server on port 6466 which should be standard across any googletv installation. What you should see is a connection attempt to 6466, a rejection for certificate_unknown, and then a connection attempt to 6467. At that time you should be able to send REQUEST to the PIN channel and get a code. Once you submit the OSD code to the channel you should see the connection to 6467 close and a new connection to 6466 open. Assuming everything works, you should see a ton of messages back and forth indicating that PIN was successful. The thing should also come online at this time.

I’ve updated the main thread with the googletv version and I’ve pushed the changes into the PR so everything is nice and tidy now. Marketplace should update from this.

1 Like

Thanks! One step further now.

Binding does not like special characters :slight_smile: Removed /12 from network name 50PUS7373/12 and then auto discovery did work immediately!

Port number removed. But still there is an issue with certificate and error with SSL connection.

2023-02-27 21:28:40.101 [DEBUG] [l.googletv.GoogleTVConnectionManager] - Returning empty certificate for getAcceptedIssuers
2023-02-27 21:28:40.135 [INFO ] [l.googletv.GoogleTVConnectionManager] - Error opening GoogleTV SSL connection: Datenübergabe unterbrochen (broken pipe) (Write failed)

openhab.log (5.6 KB)

Interesting. Your TV isn’t spitting the normal certificate_unknown error. Can you please make sure you have updated the google video app on your tv (or confirm it’s installed)? If so what version is it on?

Also to note the getAcceptedIssuers being empty is absolutely normal and expected.

Under addons I have two folders. One named shieldtv and the other androidtv. Is that normal?

Again the ShieldTV is not connected and I receive an ERROR:HANDLER message on the state of the device. I used the command provided by @mhilbush and this time the prompt returned no message.

I then installed the new binding and the Shield turned to OFF LINE. In “things” the INBOX diplays the Shield as it has to be installed.

No. What’s in those folders?

I only have “Google Play Filme” (com.google.android.videos).
Do you mean this App? If yes, then it’s version 4.38.35.15-tv

Everything is up to date.

It had various keys. I have deleted the folders suspecting that this could be part of the issue I was having. I am now proceeding with a fresh re-install and configuration of the Shield. I will finish tomorrow if possible as here it is 22:30 and have another long busy day tomorrow.

Perfect. That’s what im running. I’ll go look in the code to see where this is stalling out. We look for a specific error to fire the PIN connection. It could possibly be the android version. Ill get back to you once I can align the errors to the code.

Please try this jar. https://github.com/morph166955/openhab-addons/releases/download/androidtv-beta/org.openhab.binding.androidtv-3.2.0-4.0.0-SNAPSHOT-force1.jar

This is a test for this specific issue, everyone else please don’t grab this one.

Once you get started, please send “FORCE” to the PIN channel and it will force a connection to the PIN server. Then do “REQUEST”. Then send the PIN.

Were the folders in addons or just the generic userdata folder? We did change the folder name when we went from shieldtv to androidtv for the keystores. Otherwise the binding jar should just be in the addons folder, no sub folders I’m aware of (unsure if the marketplace creates folders or not).

Thanks for new jar!

:+1: :muscle:

Status for Philips 50PUS7373/12:

  • Autodiscovery → OK (remove special characters in network name)
  • Pairing → OK (for this device FORCE and REQUEST needed)
  • Power → OK
  • Volume → OK (readable only)
  • App → OK (readable only)
  • Mute → Not tested yet

Other question: The PhilipsTV-Binding does have WakeOnLan support. Also something you think can be implemented in future?

NICE! I’ll see if I can write something into the binding to account for devices that don’t send the traditional certificate_unknown that we’ve been seeing (this is what usually triggers the PIN pieces we had to use FORCE for).

As for WOL, what’s the use case in respect to this? We maintain a connection to the device when it’s in a “powered off” state, which is more exactly a standby state. Does the Philips kill the connection when it’s powered off? I don’t see why we couldn’t do some kind of WOL functionality, but I’d like to understand how it applies.

Yes, the TV goes into a deep sleep mode (0.3 W) and when I switch it on, nothing happens.

My use case is Alexa :slight_smile: “Alexa, switch on TV”, “Alexa, switch on YouTube”, etc.

With WOL we can wake up the TV, switch ON and send the App-Command.

Is there a reason to not use the WOL part of the network binding? I do something similar with my xbox and use that and a rule to send the WOL.

My fear is, when the tv goes deep sleep the binding will go offline. So there has to be some kind of understanding that the tv went into deep sleep as we just see the port close.

Yes, you are right. Can be done with Network Binding.
Now I remember that I had this setup, too. But later I have switched with WOL enabled in binding.

I can do a few tests the next days.

I think as long as you have macAddress set on the network you can do it.

This is what I use.

Thing network:pingdevice:xbox360 [ hostname="192.168.1.10", macAddress="12:34:56:78:90:ab" ]
Switch  WOL_XBOX        "XBOX WOL [%s]"

rule "WOL XBOX"
when
        Item WOL_XBOX received command ON
then
        val actions = getActions("network", "network:pingdevice:xbox360")
        if (actions === null) {
                logInfo("actions", "Actions not found, check thing ID")
        } else {
                actions.sendWakeOnLanPacket()
                Thread::sleep(500)
                actions.sendWakeOnLanPacket()
        }
        Thread::sleep(500)
        WOL_XBOX.postUpdate(OFF)

end

I’ve just pushed to 0.06.1 (df2f6a6) on the main thread.

Most of this is behind the scenes bug fixes.

To note for the googletv folks, I’ve updated the PIN process so it should force the connection if the user sends REQUEST and the main connection is in a funky state (this removes the need for FORCE for the Phillips). Some platforms don’t seem to send nice error messages that we can trigger on so this should assume that the user is looking to run the process. It is possible you may have to send REQUEST twice to get the OSD to pop up. I can’t test this on my system so I’d love to know this works on some other users.

To note on discovery, I’ve changed the generated ID to be the mac address to try to remove the issue seen above with bad characters. In theory this should fix the issue.

There are also some things cleaned up on the threads and keepalives.