Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[shieldtv] Initial Contribution - NVIDIA ShieldTV #13934

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
5adabc2
Created shieldtv bundle.
morph166955 Dec 2, 2022
aa5998e
Created binding folder.
morph166955 Dec 2, 2022
a256c14
Basic framework
morph166955 Dec 11, 2022
e39b55c
Added protocol folder
morph166955 Dec 11, 2022
83e8c5a
Added more foundational bits
morph166955 Dec 12, 2022
52e6c24
Added X509 and other connection handler pieces
morph166955 Dec 12, 2022
353d134
Added channels to thing-types.xml
morph166955 Dec 12, 2022
16e508f
RAW data passing encoding issue resolved. PIN process successful via
morph166955 Dec 12, 2022
2fe785d
Added PIN support.
morph166955 Dec 13, 2022
8a1fabd
Fixed alignment issues on read.
morph166955 Dec 13, 2022
e6e0563
Updated several packet reply structures
morph166955 Dec 14, 2022
bb0a97b
PIN Certificate Process Working
morph166955 Dec 15, 2022
fe1786c
Significant changes to read thread. Keypress basic functionality
morph166955 Dec 17, 2022
a9ee9f9
Added structure for STARTAPP
morph166955 Dec 17, 2022
66d4c72
Fix conflict with pom.xml
morph166955 Dec 17, 2022
afb8ff6
Merge branch 'openhab:main' into shieldtv
morph166955 Dec 17, 2022
cc6b018
Updated README. Updated thing-types.xml. Cleaned up logging
morph166955 Dec 17, 2022
ad4c213
Spotless Applied.
morph166955 Dec 17, 2022
7597da2
Fixed bad xml in thing-types.xml
morph166955 Dec 17, 2022
b55c393
Added app control. Updated readme. Updated keepalive. Updated reader
morph166955 Dec 18, 2022
f54cddd
Fixed issue with readme file
morph166955 Dec 18, 2022
7b13521
Merge branch 'openhab:main' into shieldtv-beta
morph166955 Dec 18, 2022
2329d64
Merge pull request #2 from morph166955/shieldtv-beta
morph166955 Dec 19, 2022
f677622
Consolidates startapp and currentapp to just app.
morph166955 Dec 19, 2022
d75faf9
PIN process revamped. All certificates handled natively.
morph166955 Dec 20, 2022
3ed1340
Fixed issue with running inside container. Updated to JKS keystore.
morph166955 Dec 20, 2022
e717897
Fixed JKS in 2 more places.
morph166955 Dec 20, 2022
acf7ec5
Push to 4.0.0-SNAPSHOT
morph166955 Dec 20, 2022
f2de168
Merge branch 'openhab:main' into shieldtv
morph166955 Dec 20, 2022
08af6bb
Moved devicename to thing properties.
morph166955 Dec 20, 2022
954b7ea
Removed devicename from README and thing-types.xml
morph166955 Dec 20, 2022
a2f06ab
Fixed Device Name
morph166955 Dec 20, 2022
bb5bd39
Fixed comments.
morph166955 Dec 20, 2022
4f5a047
Removed advanced from regular channels.
morph166955 Dec 27, 2022
9e55727
First attempt at mdns discovery.
morph166955 Dec 28, 2022
cbdc295
Simplified for debugging.
morph166955 Dec 28, 2022
4729e4f
Added return value back to createResult()
morph166955 Dec 29, 2022
380d7f4
Changed Component
morph166955 Dec 29, 2022
cb4abfe
mDNS Discovery
morph166955 Dec 29, 2022
abfcf0e
Merge pull request #3 from morph166955/shieldtv-mdns
morph166955 Dec 29, 2022
9e699aa
Merge branch 'openhab:main' into shieldtv
morph166955 Jan 5, 2023
f719db2
Fixes copywrite. Adds dispose().
morph166955 Jan 7, 2023
52fddfb
Merge branch 'openhab:main' into shieldtv
morph166955 Jan 7, 2023
4ea52b2
Working app decoder.
morph166955 Jan 8, 2023
43b65da
Adds appname and appurl. Adds KEY_POWERON and KEY_GOOGLE.
morph166955 Jan 10, 2023
bb57afc
Merge pull request #4 from morph166955/shieldtv-beta
morph166955 Jan 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
/bundles/org.openhab.binding.serial/ @MikeJMajor
/bundles/org.openhab.binding.serialbutton/ @kaikreuzer
/bundles/org.openhab.binding.shelly/ @markus7017
/bundles/org.openhab.binding.shieldtv/ @morph166955
/bundles/org.openhab.binding.siemensrds/ @andrewfg
/bundles/org.openhab.binding.silvercrestwifisocket/ @jmvaz
/bundles/org.openhab.binding.sinope/ @chaton78
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,11 @@
<artifactId>org.openhab.binding.shelly</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.shieldtv</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.siemensrds</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.shieldtv/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This content is produced and maintained by the openHAB project.

* Project home: https://www.openhab.org

== Declared Project Licenses

This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.

== Source Code

https://github.com/openhab/openhab-addons
98 changes: 98 additions & 0 deletions bundles/org.openhab.binding.shieldtv/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# ShieldTV Binding

This binding emulates the Nvidia ShieldTV Android App to interact with an Nvidia ShieldTV for purposes of remote control.

## Supported Things

This binding supports a single thing type:

- **shieldtv** - The ShieldTV

## Discovery

Discovery is not currently part of this binding but is on the roadmap. This will be updated as updates are committed.

## Binding Configuration

This binding does not require any special configuration files.

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

## Thing Configuration

There are three required fields to connect successfully to a ShieldTV.

| Name | Type | Description | Default | Required | Advanced |
|------------------|---------|---------------------------------------|---------|----------|----------|
| ipAddress | text | IP address of the device | N/A | yes | no |
| keystore | text | Location of the Java Keystore | N/A | no | no |
| keystorePassword | text | Password of the Java Keystore | N/A | no | no |

```java
Thing shieldtv:shieldtv:livingroom [ ipAddress="192.168.1.2" ]
```

## Channels

| Channel | Type | Read/Write | Description |
|------------|--------|------------|-----------------------------|
| keypress | String | RW | Manual Key Press Entry |
| pincode | String | RW | PIN Code Entry |
| devicename | String | RO | Device Common Name |
| app | String | RW | App Control |

```java
String ShieldTV_KEYPRESS "KEYPRESS [%s]" { channel = "shieldtv:shieldtv:livingroom:keypress" }
String ShieldTV_PINCODE "PINCODE [%s]" { channel = "shieldtv:shieldtv:livingroom:pincode" }
String ShieldTV_DEVICENAME "DEVICENAME [%s]" { channel = "shieldtv:shieldtv:livingroom:devicename" }
String ShieldTV_APP "APP [%s]" { channel = "shieldtv:shieldtv:livingroom:app" }

```

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_PLAYPAUSE
- KEY_REWIND
- KEY_FORWARD
- KEY_POWER

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)

APP will display the currently active app as presented by the ShieldTV.
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.

## Pin Code Process

For the ShieldTV 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 ShiledTV. A 6 digit PIN should be displayed on the screen.

To complete the PIN process, send the PIN displayed to the pincode channel. The display should return back to where it was originally.

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

```java
Thing shieldtv:shieldtv:livingroom [ ipAddress="192.168.1.2", ]
```

```java
String ShieldTV_KEYPRESS "KEYPRESS [%s]" { channel = "shieldtv:shieldtv:livingroom:keypress" }
String ShieldTV_PINCODE "PINCODE [%s]" { channel = "shieldtv:shieldtv:livingroom:pincode" }
String ShieldTV_DEVICENAME "DEVICENAME [%s]" { channel = "shieldtv:shieldtv:livingroom:devicename" }
String ShieldTV_APP "APP [%s]" { channel = "shieldtv:shieldtv:livingroom:app" }

```

32 changes: 32 additions & 0 deletions bundles/org.openhab.binding.shieldtv/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>3.4.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.shieldtv</artifactId>

<name>openHAB Add-ons :: Bundles :: ShieldTV Binding</name>

<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.52</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.52</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.shieldtv-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

<feature name="openhab-binding-shieldtv" description="ShieldTV Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.shieldtv/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright (c) 2010-2022 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.shieldtv.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.ThingTypeUID;

/**
* The {@link ShieldTVBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Ben Rosenblum - Initial contribution
*/
@NonNullByDefault
public class ShieldTVBindingConstants {

private static final String BINDING_ID = "shieldtv";

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_SHIELDTV = new ThingTypeUID(BINDING_ID, "shieldtv");

// List of all Channel ids
public static final String CHANNEL_KEYPRESS = "keypress";
public static final String CHANNEL_PINCODE = "pincode";
public static final String CHANNEL_RAW = "raw";
public static final String CHANNEL_RAWMSG = "rawmsg";
public static final String CHANNEL_APP = "app";
public static final String CHANNEL_DEVICENAME = "devicename";
// List of all config properties
public static final String IPADDRESS = "ipAddress";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Copyright (c) 2010-2022 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.shieldtv.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

/**
* The {@link ShieldTVConfiguration} class contains fields mapping thing configuration parameters.
*
* @author Ben Rosenblum - Initial contribution
*/
@NonNullByDefault
public class ShieldTVConfiguration {

/**
* Sample configuration parameters. Replace with your own.
*/
public @Nullable String ipAddress;
public int port = 8987;
public int reconnect;
public int heartbeat;
public @Nullable String keystore;
public @Nullable String keystorePassword;
public int delay = 0;
}
Loading