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)
- Resolves [androidtv] ShieldTV Protocol Exception when App Updates · Issue #15632 · openhab/openhab-addons · GitHub
- Resolves [androidtv] Detection of Protocol v1 · Issue #15631 · openhab/openhab-addons · GitHub
- Resolves [androidtv] Setting port thing configuration on ShieldTV causes protocol failure · Issue #16198 · openhab/openhab-addons · GitHub
- Resolves [androidtv] Discovery does not properly track representation-property · Issue #16223 · openhab/openhab-addons · GitHub
Version 1.06 (2108e5d)
- Adds PhilipsTV
- Resolves [androidtv] googletv.GoogleTVMessageParser GoogleTV Error Message · Issue #15153 · openhab/openhab-addons · GitHub
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