AndroidTV Binding [3.2.0;4.2.0)

This binding is designed to emulate different protocols to interact with the AndroidTV platform.

I would GREATLY appreciate feedback from users even if to just confirm that it’s working as expected. Please include device model and software version so I can add it to the readme as confirmed working.

AndroidTV Binding

This binding is designed to emulate different protocols to interact with the AndroidTV platform.
Currently it emulates the Google Video App to interact with a variety of AndroidTVs for purposes of remote control.
It also currently emulates the Nvidia ShieldTV Android App to interact with an Nvidia ShieldTV for purposes of remote control.
It also currently emulates the PhilipsTV App to interact with a 2016+ PhilipsTV for purposes of remote control.

Supported Things

This binding supports two thing types:

  • googletv - An AndroidTV running Google Video
  • shieldtv - An Nvidia ShieldTV
  • philipstv - A 2016+ Philips TV

Discovery

All relevant thing types should be added automatically to the inbox through the mDNS discovery process.

In the case of the ShieldTV or PhilipsTV, openHAB will likely create an inbox entry for both a GoogleTV and a ShieldTV or PhilipsTV device.
Only the ShieldTV or PhilipsTV device should be configured, the GoogleTV can be ignored.
There is no benefit to configuring two things for a ShieldTV or PhilipsTV device.
This could cause undesired effects.

Binding Configuration

This binding does not require any special configuration files.

This binding does require a PIN login process (documented below) upon first connection.

This binding requires GoogleTV to be installed on the device (https://play.google.com/store/apps/details?id=com.google.android.videos)

Thing Configuration

The is one required field to connect to the devices. All other fields are optional.

Name Type Description Default Required Advanced
ipAddress text IP address of the device N/A yes no
googletvPort text TCP Port for GoogleTV 6466 no no
shieldtvPort text TCP Port for ShieldTV 8987 no no
philipstvPort text TCP Port for PhilipsTV 1926 no no
keystore text Location of the Java Keystore N/A no no
keystorePassword text Password of the Java Keystore N/A no no
gtvEnabled boolean Enable/Disable the GoogleTV protocol true no no
Thing androidtv:shieldtv:livingroom [ ipAddress="192.168.1.2" ]
Thing androidtv:googletv:theater [ ipAddress="192.168.1.3" ]
Thing androidtv:philipstv:bedroom [ ipAddress="192.168.1.4" ]

Channels

Channel Type Description GoogleTV ShieldTV PhilipsTV
keyboard String Keyboard Data Entry RW RW RW
keypress String Manual Key Press Entry RW RW RW
keycode String Direct KEYCODE Entry RW RW RW
pincode String PIN Code Entry RW RW RW
app String App Control RO RW RW
appname String App Name N/A RW RW
appurl String App URL N/A RO N/A
appicon Image App Icon N/A N/A RO
player Player Player Control RW RW RW
power Switch Power Control RW RW RW
volume Dimmer Volume Control RO RO RW
mute Switch Mute Control RW RW RW
tvChannel String TV Channel Control N/A N/A RW
brightness Dimmer Brightness Control N/A N/A RW
contrast Dimmer Contrast Control N/A N/A RW
sharpness Dimmer Sharpness Control N/A N/A RW
searchContent String Google Assistant search N/A N/A RW
ambilightPower Switch Ambilight power control N/A N/A RW
ambilightHuePower Switch Ambilight + Hue power control N/A N/A RW
ambilightStyle String Ambilight Style plus algorithm used N/A N/A RW
ambilightColor Color Color for all Ambilight Sides N/A N/A RW
ambilightLeftColor Color Color for left Ambilight Side N/A N/A RW
ambilightRightColor Color Color for right Ambilight Side N/A N/A RW
ambilightTopColor Color Color for top Ambilight Side N/A N/A RW
ambilightBottomColor Color Color for bottom Ambilight Side N/A N/A RW
String ShieldTV_KEYBOARD "KEYBOARD [%s]" { channel = "androidtv:shieldtv:livingroom:keyboard" }
String ShieldTV_KEYPRESS "KEYPRESS [%s]" { channel = "androidtv:shieldtv:livingroom:keypress" }
String ShieldTV_KEYCODE "KEYCODE [%s]" { channel = "androidtv:shieldtv:livingroom:keycode" }
String ShieldTV_PINCODE  "PINCODE [%s]" { channel = "androidtv:shieldtv:livingroom:pincode" }
String ShieldTV_APP "APP [%s]" { channel = "androidtv:shieldtv:livingroom:app" }
String ShieldTV_APPNAME "APPNAME [%s]" { channel = "androidtv:shieldtv:livingroom:appname" }
String ShieldTV_APPURL "APPURL [%s]" { channel = "androidtv:shieldtv:livingroom:appurl" }
Player ShieldTV_PLAYER "PLAYER [%s]" { channel = "androidtv:shieldtv:livingroom:player" }
Switch ShieldTV_POWER "POWER [%s]" { channel = "androidtv:shieldtv:livingroom:power" }
Dimmer ShieldTV_VOLUME "VOLUME [%s]" { channel = "androidtv:shieldtv:livingroom:volume" }
Switch ShieldTV_MUTE "MUTE [%s]" { channel = "androidtv:shieldtv:livingroom:mute" }

String PhilipsTV_KEYBOARD "KEYBOARD [%s]" { channel = "androidtv:philipstv:bedroom:keyboard" }
String PhilipsTV_KEYPRESS "KEYPRESS [%s]" { channel = "androidtv:philipstv:bedroom:keypress" }
String PhilipsTV_KEYCODE "KEYCODE [%s]" { channel = "androidtv:philipstv:bedroom:keycode" }
String PhilipsTV_PINCODE  "PINCODE [%s]" { channel = "androidtv:philipstv:bedroom:pincode" }
String PhilipsTV_APP "APP [%s]" { channel = "androidtv:philipstv:bedroom:app" }
String PhilipsTV_APPNAME "APPNAME [%s]" { channel = "androidtv:philipstv:bedroom:appname" }
Image  PhilipsTV_APPICON "APPICON [%s]" { channel = "androidtv:philipstv:bedroom:appicon" }
Player PhilipsTV_PLAYER "PLAYER [%s]" { channel = "androidtv:philipstv:bedroom:player" }
Switch PhilipsTV_POWER "POWER" { channel = "androidtv:philipstv:bedroom:power" }
Dimmer PhilipsTV_VOLUME "VOLUME [%s]" { channel = "androidtv:philipstv:bedroom:volume" }
Switch PhilipsTV_MUTE "MUTE [%s]" { channel = "androidtv:philipstv:bedroom:mute" }
String PhilipsTV_TVCHANNEL "TVCHANNEL [%s]" { channel = "androidtv:philipstv:bedroom:tvChannel" }
String PhilipsTV_SEARCHCONTENT "SEARCH CONTENT [%s]" { channel = "androidtv:philipstv:bedroom:searchContent" }
Switch PhilipsTV_AMBILIGHTPOWER "AMBILIGHT POWER [%s]" { channel = "androidtv:philipstv:bedroom:ambilightPower" }
Switch PhilipsTV_AMBILIGHTHUEPOWER "AMBILIGHT HUE POWER [%s]" { channel = "androidtv:philipstv:bedroom:ambilightHuePower" }
Switch PhilipsTV_AMBILIGHTLOUNGEPOWER "AMBILIGHT LOUNGE POWER" { channel = "androidtv:philipstv:bedroom:ambilightLoungePower" }
String PhilipsTV_AMBILIGHTSTYLE "AMBILIGHT STYLE" { channel = "androidtv:philipstv:bedroom:ambilightStyle" }
Color PhilipsTV_AMBILIGHTALLCOLOR "ALL SIDES AMBILIGHT COLOR [%s]" { channel = "androidtv:philipstv:bedroom:ambilightColor" }
Color PhilipsTV_AMBILIGHTLEFTCOLOR "LEFT SIDE AMBILIGHT COLOR [%s]" { channel = "androidtv:philipstv:bedroom:ambilightLeftColor" }
Color PhilipsTV_AMBILIGHTRIGHTCOLOR "RIGHT SIDE AMBILIGHT COLOR [%s]" { channel = "androidtv:philipstv:bedroom:ambilightRightColor" }
Color PhilipsTV_AMBILIGHTTOPCOLOR "TOP SIDE AMBILIGHT COLOR [%s]" { channel = "androidtv:philipstv:bedroom:ambilightTopColor" }
Color PhilipsTV_AMBILIGHTBOTTOMCOLOR "BOTTOM SIDE AMBILIGHT COLOR [%s]" { channel = "androidtv:philipstv:bedroom:ambilightBottomColor" }
Dimmer PhilipsTV_BRIGHTNESS "BRIGHTNESS [%s]" { channel = "androidtv:philipstv:bedroom:brightness" }
Dimmer PhilipsTV_CONTRAST "CONTRAST [%s]" { channel = "androidtv:philipstv:bedroom:contrast" }
Dimmer PhilipsTV_SHARPNESS "SHARPNESS [%s]" { channel = "androidtv:philipstv:bedroom:sharpness" }

String GoogleTV_KEYBOARD "KEYBOARD [%s]" { channel = "androidtv:googletv:theater:keyboard" }
String GoogleTV_KEYPRESS "KEYPRESS [%s]" { channel = "androidtv:googletv:theater:keypress" }
String GoogleTV_KEYCODE "KEYCODE [%s]" { channel = "androidtv:googletv:theater:keycode" }
String GoogleTV_PINCODE  "PINCODE [%s]" { channel = "androidtv:googletv:theater:pincode" }
String GoogleTV_APP "APP [%s]" { channel = "androidtv:googletv:theater:app" }
Player GoogleTV_PLAYER "PLAYER [%s]" { channel = "androidtv:googletv:theater:player" }
Switch GoogleTV_POWER "POWER [%s]" { channel = "androidtv:googletv:theater:power" }
Dimmer GoogleTV_VOLUME "VOLUME [%s]" { channel = "androidtv:googletv:theater:volume" }
Switch GoogleTV_MUTE "MUTE [%s]" { channel = "androidtv:googletv:theater:mute" }

KEYPRESS will accept the following commands as strings (case sensitive):

  • KEY_UP
  • KEY_DOWN
  • KEY_RIGHT
  • KEY_LEFT
  • KEY_ENTER
  • KEY_HOME
  • KEY_BACK
  • KEY_MENU
  • KEY_PLAY
  • KEY_PAUSE
  • KEY_PLAYPAUSE
  • KEY_STOP
  • KEY_NEXT
  • KEY_PREVIOUS
  • KEY_REWIND
  • KEY_FORWARD
  • KEY_POWER
  • KEY_GOOGLE
  • KEY_VOLUP
  • KEY_VOLDOWN
  • KEY_MUTE
  • KEY_SUBMIT

The list above causes an instantanious “press and release” of each button.
If you would like to manually control the press and release of each you may append _PRESS and _RELEASE to the end of each.
(e.g. KEY_FORWARD_PRESS or KEY_FORWARD_RELEASE)

You may also send an ASCII character as a single letter to simulate a key entry (e.g KEY_A, KEY_1, KEY_z).
Use KEY_SUBMIT when full text entry is complete to tell the shield to process the line.
KEY_SUBMIT is automatically sent by KEYBOARD when a command is sent to the channel.

APP will display the currently active app as presented by the AndroidTV.
You may also send it a command of the app package name (e.g. com.google.android.youtube.tv) to start/change-to that app.

KEYCODE values are listed at the bottom of this README.
NOTE: Not all KEYCODES work on all devices. Keycodes above 255 have not been tested.

Command Line Access

All String type channels may receive commands from inside the karaf cli, even if there are no items configured.

This can be particularly useful for the Pin Code Process as well as for testing.

Syntax:

openhab> openhab:androidtv <thingUID> <channel> <command>

Example usage:

openhab> openhab:androidtv androidtv:googletv:theater keypress KEY_POWER

Pin Code Process

For the AndroidTV to be successfully accessed an on-screen PIN authentication is required on the first connection.

To begin the PIN process, send the text “REQUEST” to the pincode channel while watching your AndroidTV.

CLI Example Usage:

openhab> openhab:androidtv androidtv:googletv:theater pincode REQUEST

A 6 digit PIN should be displayed on the screen.

To complete the PIN process, send the PIN displayed to the pincode channel.

CLI Example Usage:

openhab> openhab:androidtv androidtv:googletv:theater pincode abc123

The display should return back to where it was originally.

If you are on a ShieldTV or PhilipsTV you must run that process a second time to authenticate the GoogleTV protocol stack.

This completes the PIN process.

Upon reconnection (either from reconfiguration or a restart of OpenHAB), you should now see a message of “Login Successful” in openhab.log

Full Example

Thing androidtv:shieldtv:livingroom [ ipAddress="192.168.1.2" ]
Thing androidtv:googletv:theater [ ipAddress="192.168.1.3" ]
Thing androidtv:philipstv:bedroom [ ipAddress="192.168.1.4" ]
String ShieldTV_KEYBOARD "KEYBOARD [%s]" { channel = "androidtv:shieldtv:livingroom:keyboard" }
String ShieldTV_KEYPRESS "KEYPRESS [%s]" { channel = "androidtv:shieldtv:livingroom:keypress" }
String ShieldTV_KEYCODE "KEYCODE [%s]" { channel = "androidtv:shieldtv:livingroom:keycode" }
String ShieldTV_PINCODE  "PINCODE [%s]" { channel = "androidtv:shieldtv:livingroom:pincode" }
String ShieldTV_APP "APP [%s]" { channel = "androidtv:shieldtv:livingroom:app" }
String ShieldTV_APPNAME "APPNAME [%s]" { channel = "androidtv:shieldtv:livingroom:appname" }
String ShieldTV_APPURL "APPURL [%s]" { channel = "androidtv:shieldtv:livingroom:appurl" }
Player ShieldTV_PLAYER "PLAYER [%s]" { channel = "androidtv:shieldtv:livingroom:player" }
Switch ShieldTV_POWER "POWER [%s]" { channel = "androidtv:shieldtv:livingroom:power" }
Dimmer ShieldTV_VOLUME "VOLUME [%s]" { channel = "androidtv:shieldtv:livingroom:volume" }
Switch ShieldTV_MUTE "MUTE [%s]" { channel = "androidtv:shieldtv:livingroom:mute" }

String PhilipsTV_KEYBOARD "KEYBOARD [%s]" { channel = "androidtv:philipstv:bedroom:keyboard" }
String PhilipsTV_KEYPRESS "KEYPRESS [%s]" { channel = "androidtv:philipstv:bedroom:keypress" }
String PhilipsTV_KEYCODE "KEYCODE [%s]" { channel = "androidtv:philipstv:bedroom:keycode" }
String PhilipsTV_PINCODE  "PINCODE [%s]" { channel = "androidtv:philipstv:bedroom:pincode" }
String PhilipsTV_APP "APP [%s]" { channel = "androidtv:philipstv:bedroom:app" }
String PhilipsTV_APPNAME "APPNAME [%s]" { channel = "androidtv:philipstv:bedroom:appname" }
Image  PhilipsTV_APPICON "APPICON [%s]" { channel = "androidtv:philipstv:bedroom:appicon" }
Player PhilipsTV_PLAYER "PLAYER [%s]" { channel = "androidtv:philipstv:bedroom:player" }
Switch PhilipsTV_POWER "POWER" { channel = "androidtv:philipstv:bedroom:power" }
Dimmer PhilipsTV_VOLUME "VOLUME [%s]" { channel = "androidtv:philipstv:bedroom:volume" }
Switch PhilipsTV_MUTE "MUTE [%s]" { channel = "androidtv:philipstv:bedroom:mute" }
String PhilipsTV_TVCHANNEL "TVCHANNEL [%s]" { channel = "androidtv:philipstv:bedroom:tvChannel" }
String PhilipsTV_SEARCHCONTENT "SEARCH CONTENT [%s]" { channel = "androidtv:philipstv:bedroom:searchContent" }
Switch PhilipsTV_AMBILIGHTPOWER "AMBILIGHT POWER [%s]" { channel = "androidtv:philipstv:bedroom:ambilightPower" }
Switch PhilipsTV_AMBILIGHTHUEPOWER "AMBILIGHT HUE POWER [%s]" { channel = "androidtv:philipstv:bedroom:ambilightHuePower" }
Switch PhilipsTV_AMBILIGHTLOUNGEPOWER "AMBILIGHT LOUNGE POWER" { channel = "androidtv:philipstv:bedroom:ambilightLoungePower" }
String PhilipsTV_AMBILIGHTSTYLE "AMBILIGHT STYLE" { channel = "androidtv:philipstv:bedroom:ambilightStyle" }
Color PhilipsTV_AMBILIGHTALLCOLOR "ALL SIDES AMBILIGHT COLOR [%s]" { channel = "androidtv:philipstv:bedroom:ambilightColor" }
Color PhilipsTV_AMBILIGHTLEFTCOLOR "LEFT SIDE AMBILIGHT COLOR [%s]" { channel = "androidtv:philipstv:bedroom:ambilightLeftColor" }
Color PhilipsTV_AMBILIGHTRIGHTCOLOR "RIGHT SIDE AMBILIGHT COLOR [%s]" { channel = "androidtv:philipstv:bedroom:ambilightRightColor" }
Color PhilipsTV_AMBILIGHTTOPCOLOR "TOP SIDE AMBILIGHT COLOR [%s]" { channel = "androidtv:philipstv:bedroom:ambilightTopColor" }
Color PhilipsTV_AMBILIGHTBOTTOMCOLOR "BOTTOM SIDE AMBILIGHT COLOR [%s]" { channel = "androidtv:philipstv:bedroom:ambilightBottomColor" }
Dimmer PhilipsTV_BRIGHTNESS "BRIGHTNESS [%s]" { channel = "androidtv:philipstv:bedroom:brightness" }
Dimmer PhilipsTV_CONTRAST "CONTRAST [%s]" { channel = "androidtv:philipstv:bedroom:contrast" }
Dimmer PhilipsTV_SHARPNESS "SHARPNESS [%s]" { channel = "androidtv:philipstv:bedroom:sharpness" }

String GoogleTV_KEYBOARD "KEYBOARD [%s]" { channel = "androidtv:googletv:theater:keyboard" }
String GoogleTV_KEYPRESS "KEYPRESS [%s]" { channel = "androidtv:googletv:theater:keypress" }
String GoogleTV_KEYCODE "KEYCODE [%s]" { channel = "androidtv:googletv:theater:keycode" }
String GoogleTV_PINCODE  "PINCODE [%s]" { channel = "androidtv:googletv:theater:pincode" }
String GoogleTV_APP "APP [%s]" { channel = "androidtv:googletv:theater:app" }
Player GoogleTV_PLAYER "PLAYER [%s]" { channel = "androidtv:googletv:theater:player" }
Switch GoogleTV_POWER "POWER [%s]" { channel = "androidtv:googletv:theater:power" }
Dimmer GoogleTV_VOLUME "VOLUME [%s]" { channel = "androidtv:googletv:theater:volume" }
Switch GoogleTV_MUTE "MUTE [%s]" { channel = "androidtv:googletv:theater:mute" }

Google Keycodes

Google Keycodes can be found at the bottom of the readme file found at

Changelog

Version 1.07 (d478d97)

Version 1.06 (2108e5d)

Version 1.05 (16816e3) - Available 4.0.0 RELEASE

  • Bug fixes

Version 1.04 (d23b28a) - Available 4.0.0 SNAPSHOT #3540

  • Adds i18n enhancements
  • Updates shim for easier use
  • Bug fixes

Version 1.03 (01b82f7)

  • Updates for GoogleTV
  • Multiple bug fixes

Version 1.02 (d1cc1c7)

  • Adds CLI interface

Version 1.01 (c1873ce)

  • Updates Crypto Library

Version 1.00 (012d855) - Available 4.0.0 SNAPSHOT #3513

  • Final review updates pending PR merge

Version 0.11.1 (7d7ce37)

  • Minor logging updates

Version 0.11 (8b79ccc)

  • Updates for GoogleTV 4.39

Version 0.10.1 (a777e94)

  • Fixes Array Exception

Version 0.10 (5eb0a06)

  • Updates from wborn and jlaur reviews

Version 0.09.2 (6403d26)

  • Fixes issue with late login error

Version 0.09.1 (1223d93)

  • Changes logging levels

Version 0.09 (3f6800c)

  • Adds PLAYER channel

Version 0.08.1 (0e87cd3)

  • Adds KEY_PLAY and KEY_PAUSE

Version 0.08 (d95ad7b)

  • Adds servicePing to protocols

Version 0.07 (0811ce0)

  • Fixes exception from individual app updates
  • Adds additional logging
  • Adds backwards compatibility to pom

Version 0.06.5 (74d1758)

  • Minor bug fixes and code updates

Version 0.06.4 (2d02a80)

  • Fixes keepalive bug causing reconnect before PIN completes

Version 0.06.3 (1fa8869)

  • Fixes IPv6 issue with discovery

Version 0.06.2 (c6f7682)

  • Small update to PIN process for misbehaving devices
  • Updated jar to align with Karaf 4.4.3 update

Version 0.06.1 (df2f6a6)

  • Bug updates
  • Logger updates

Version 0.06 (152e942)

  • Adds googletv protocol to binding.

Version 0.05.2 (1fd00be)

  • Fixes regression from appdb fixes in PIN process

Version 0.05.1 (eb1eeb0)

  • Adds KEY_SUBMIT
  • Sorts appNameDB for DynamicCommand metadata

Version 0.05 (3dd2aa1)

  • Adds KEYBOARD and KEY_(ASCII Character)
  • More appdb fixes
  • Updates to parser to avoid issues

Version 0.04.1 (dafb2a9)

  • Adds DynamicCommandDescriptionProvider
  • Fixes appdb bugs
  • Adds periodic scheduled updates

Version 0.03 (53740f7)

  • Thing status reworked
  • Bug fixes

Version 0.02 (94ebc2f)

  • Adds KEY_VOLUP, KEY_VOLDOWN, KEY_MUTE
  • Optimizes message handler

Version 0.01 (342d4f9)

  • Initial merge in from shieldtv to androidtv

To-Do

  • GoogleTV: Make VOLUME R/W
  • GoogleTV: Make APP R/W

Resources

https://github.com/morph166955/openhab-addons/releases/download/androidtv-beta/org.openhab.binding.androidtv-3.2.0-4.2.0-SNAPSHOT-d478d97.jar

7 Likes

Very interesting. I would like to test it, but would need some info on the keystore, mainly where to find it and how to setup the password. Thank you.

EDIT: I’ve pulled the readme file into the original thread to make it easier for people to access.

EDIT2: Keystore commands are unnecessary after v0.3.

Updated to version 0.2.

Updated to version 0.3

Updated to version 0.5

This is the final draft as submitted on https://github.com/openhab/openhab-addons/pull/13934 for review and merge.

Hello,

Many thanks for this binding. As you requested feedback, here is mine :+1:

I have Model P2897 (shield TV 2017, android version 11, shield version 9.1.1.), on openHAB 3.4, and it works (mostly).
Retro engineering this is a real accomplishment, bravo !

I said “mostly”, because the app channel is never receiving the current application.
(But I can send commands to it and the app launch, and it’s the most important point !).
I debugged it on my dev environnment, and the reader thread never receive the message starting with “08ec07”. It receives the other messages although.

I also tested to send some remote command with the key press channel and it also works.

Also, the mdns discovery didn’t work. But it seems it didn’t make it to the 3.4 release ? Only 4.0 ? (it’s not a request to include it, I know keeping two versions is cumbersome)

If I can make some recommandations :smile: :

  • the channel are all “advanced”, is it mistake ? If I guess correclty, the “advanced” channels should be deviceName and the raw channels, but not pin code, app name and key.
  • I was deceived by the thing status after creation, before sending PIN. I thought it was broken, because it was stuck in “Offline - initializing”. Maybe you could use the ThingStatusDetail.CONFIGURATION_PENDING status ?

Again, thanks for your work !

Thank you for giving it a test and I’m glad it’s (mostly) working.

Can you confirm the version number you’re seeing on the cli? The channels being incorrectly marked as advanced was fixed and committed a few days ago and that should have been pulled into the 3.4.0 release. I have had reports of successful auto discovery so let’s definitely make sure you’re on the right image. As it sits right now they should have full parity between 3.4.0 and 4.0.0.

As far as the current app, this is going to sound dumb, but did you check after sending a key press? There’s a weird anomaly where the shield doesnt send that string until after a key press is sent to the device. I’m not sure why it does that, but I’ve seen it be flaky several times.

I can definitely update the thing status a little differently before the PIN process. I’ll make a note and commit it in the next round.

You are right, I hadn’t the right version.
I built it directly from git (commit e717897d8d27fe26b140a59c81dff80ce1a190bb, branch shieldtv-3.4.0).
The mDns is working with the build in the marketplace.

As far as the current app, this is going to sound dumb, but did you check after sending a key press?

You are also right ! It works now. Strange bug, indeed !

Thanks

Gotcha. Please definitely ignore the shieldtv-3.4.0 branch on my github. It’s not up to date with all of the current commits. To build the 3.4.0 builds I’m pulling from the 3.4 branch off of openhab directly and adding the binding in from my 4.0.0 branch (with the version number changed back so it compiles correctly).

Glad to hear the app is working now. The protocol is not the best. I am going to work on adding more support for the apps in a future release. Theres a few things I can do but they require some substantial time that I haven’t had yet.

Installed and working. Here are the specifics.

Year: 2019
Name: Shield TV Pro
Model: P2897
Android Ver: 11
Shield Ver: 9.1.1
OH Ver: 4.0.0

Thanks for the support!

Thank you! I’ve updated the chart above with the info. I’ve also added a note about the oddity of the app info not being sent from the shield until a key is pressed. The next version (to be done after the PR review is done and merged) is going to attempt to make the app bits a little more robust. There is a large dump of data pertaining to the apps that I haven’t had time to decode and implement yet. Eventually I want to create a small table that will provide the end users with more information about the apps.

Many, many thanks,

I also confirm it working with Openhab 3.4, on a 2017 Shield TV (P2897). Made some HABPanel buttons and now have a pseudo-remote control working.

Some smaller issues:

  • Discovery did not work but manually added the thing via IP address and that worked like a charm
  • the APP chanel does not always work (shows the Launcher app most of the time, even when the app is eg Netflic)
  • sending app package names to switch to them works for some (eg the youtube example, or com.netflix.ninja) but not for others (eg Kodi). Haven’t figured out why yet. I get the package names when selecting an application and getting its Information; that may not be the most reliable way.

But again, these are minor things so great stuff !!

It does not seem to be necessary. At least, I left it open (just passed the IP information from my shield) and everything seems to work.
Edit: sorry, missed morph166955’s reply saying the same (blush)

I will absolutely agree that the app messages are flaky. This is unfortunately because the shield isn’t reliable in sending the app name. Just to confirm, had you recently restarted OH or anything like that when it wasnt working? There is a known issue where it won’t send app data until there is a keypress sent to the shield. If you set logging to trace you should see the messages come in and get parsed to confirm if they’re being sent or not.

As a note, the next version should be more robust on the app side. There is a database sent out which I haven’t had the time to inplement yet. I have noticed that some of the app names seem to be slightly different than what they require to fire. Kodi may be one of those.

As far as discovery, did you click the scan button to force a discovery to go? I have noticed that it doesn’t send the requisite mdns message very often. Hitting scan makes OH send a request which it usually replies to. Also, just to confirm, your OH is on the same network as the shield correct? mdns has issues crossing vlans on some networks.

Just to note, I have pulled the current 4.0.0 code base into the shieldtv-3.4.0 branch. There will be a breaking change coming at some point when the core crypto updates to 4.0.0 are implemented and then applied to the shieldtv binding. This isn’t happening soon, but when it does I will likely do a final compile and sunset the 3.4.0 releases.

1 Like

Hi,
I’m not very familiar with github. I put the .jar file into my addons folder of
oh 3.4. The binding doesn’t even show up in my ui after reboot. Perhaps it has something to do with that oh 4.0 stuff…I would love use and test the binding with my shield. Is it possible to put a link to the latest .jar file for oh 3.4 here so that I can download and copy it to my
addons folder?
Best wishes!

STOP! Now I see it! I’ll give it a try :grinning:

Hi again,

works wonderfully with my shield tv pro bought last year,
same one like mhilbushe’s one P2897 Android 11, Shield Ver 9.1.1.
The Keycommands even seem to react a bit faster than in the
android debug Binding.
However, wouldn’t it be usefull to let openhab know wether the
shield is running or not? The KEY_POWER toggles the ON/OFF.
So for me it’s a bit hard to use this in rules. In the android binding
there are different keys for “Power_Off and Power_On”. So I can
either start e.g. Netflix with the shield being off or change to Netflix while the shield is powered on by using one trigger button.
Anyway thanks a lot for this great work!

Glad to hear that is working! I completely agree on the power. The problem is that the android app only has a power toggle so i couldn’t capture the power state. This first release is strictly to mirror what the app does. It is on my todo list to basically brute force the command chain to see if i can stumble on the direct buttons as well as to trigger any kind of state messages. In also considering pulling in the ADB code to get the info i can’t get from the protocol.