]> git.basschouten.com Git - openhab-addons.git/commitdiff
[androidtv] Adds gtvEnabled Option (#15317)
authormorph166955 <53797132+morph166955@users.noreply.github.com>
Mon, 31 Jul 2023 21:37:56 +0000 (16:37 -0500)
committerGitHub <noreply@github.com>
Mon, 31 Jul 2023 21:37:56 +0000 (23:37 +0200)
* Adds gtvEnabled

---------

Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
bundles/org.openhab.binding.androidtv/README.md
bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/AndroidTVBindingConstants.java
bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/AndroidTVHandler.java
bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/googletv/GoogleTVConfiguration.java
bundles/org.openhab.binding.androidtv/src/main/resources/OH-INF/i18n/androidtv.properties
bundles/org.openhab.binding.androidtv/src/main/resources/OH-INF/thing/thing-types.xml

index f53cc9dfae943fa0de19ed3a73a42235dcd02127..229a0af58456168a94e5fa9446ced6c260f61025 100644 (file)
@@ -37,6 +37,7 @@ There are three required fields to connect successfully to a ShieldTV.
 | 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       |
+| gtvEnabled       | boolean | Enable/Disable the GoogleTV protocol  | true    | no       | no       |
 
 ```java
 Thing androidtv:shieldtv:livingroom [ ipAddress="192.168.1.2" ]
index 0838f1753e64de616ac879c00def349efc3c0aef..8b7889f005daa7000f4b74f0809844ec6d2e9a8d 100644 (file)
@@ -50,6 +50,7 @@ public class AndroidTVBindingConstants {
 
     // List of all config properties
     public static final String PROPERTY_IP_ADDRESS = "ipAddress";
+    public static final String PROPERTY_GTV_ENABLED = "gtvEnabled";
 
     // List of all static String literals
     public static final String PIN_REQUEST = "REQUEST";
index 851b29393f74b9df89e8cf8760763d914cc8572d..7a967ddbee45108ac90c3ebd92837147f18a8cf4 100644 (file)
@@ -157,6 +157,7 @@ public class AndroidTVHandler extends BaseThingHandler {
 
         GoogleTVConfiguration googletvConfig = getConfigAs(GoogleTVConfiguration.class);
         String ipAddress = googletvConfig.ipAddress;
+        boolean gtvEnabled = googletvConfig.gtvEnabled;
 
         if (ipAddress.isBlank()) {
             updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
@@ -164,7 +165,9 @@ public class AndroidTVHandler extends BaseThingHandler {
             return;
         }
 
-        googletvConnectionManager = new GoogleTVConnectionManager(this, googletvConfig);
+        if (THING_TYPE_GOOGLETV.equals(thingTypeUID) || gtvEnabled) {
+            googletvConnectionManager = new GoogleTVConnectionManager(this, googletvConfig);
+        }
 
         if (THING_TYPE_SHIELDTV.equals(thingTypeUID)) {
             ShieldTVConfiguration shieldtvConfig = getConfigAs(ShieldTVConfiguration.class);
@@ -239,6 +242,9 @@ public class AndroidTVHandler extends BaseThingHandler {
                     shieldtvConnectionManager.handleCommand(channelUID, command);
                     return;
                 }
+            } else if (googletvConnectionManager == null) {
+                shieldtvConnectionManager.handleCommand(channelUID, command);
+                return;
             }
         }
 
index cb0f4d005a83bf2cd66650b592a895d5430fc841..3b6b485f42a0ddc50ee63fe69dad0f1d91e6438d 100644 (file)
@@ -14,6 +14,8 @@ thing-type.androidtv.shieldtv.description = Nvidia ShieldTV
 
 thing-type.config.androidtv.googletv.delay.label = Delay
 thing-type.config.androidtv.googletv.delay.description = Delay between messages
+thing-type.config.androidtv.googletv.gtvEnabled.label = Enable GoogleTV
+thing-type.config.androidtv.googletv.gtvEnabled.description = Enable the GoogleTV Protocol
 thing-type.config.androidtv.googletv.heartbeat.label = Heartbeat Frequency
 thing-type.config.androidtv.googletv.heartbeat.description = Frequency of heartbeats
 thing-type.config.androidtv.googletv.ipAddress.label = Hostname
@@ -28,6 +30,8 @@ thing-type.config.androidtv.googletv.reconnect.label = Reconnect Delay
 thing-type.config.androidtv.googletv.reconnect.description = Delay between reconnection attempts
 thing-type.config.androidtv.shieldtv.delay.label = Delay
 thing-type.config.androidtv.shieldtv.delay.description = Delay between messages
+thing-type.config.androidtv.shieldtv.gtvEnabled.label = Enable GoogleTV
+thing-type.config.androidtv.shieldtv.gtvEnabled.description = Enable the GoogleTV Protocol
 thing-type.config.androidtv.shieldtv.heartbeat.label = Heartbeat Frequency
 thing-type.config.androidtv.shieldtv.heartbeat.description = Frequency of heartbeats
 thing-type.config.androidtv.shieldtv.ipAddress.label = Hostname
@@ -63,6 +67,7 @@ channel-type.androidtv.player.label = Player
 channel-type.androidtv.player.description = Player Control
 
 # custom thing status
+
 offline.protocols-starting = Protocols Starting
 offline.googletv-address-not-specified = googletv address not specified
 offline.shieldtv-address-not-specified = shieldtv address not specified
@@ -81,4 +86,3 @@ offline.runtime-exception = Runtime exception
 offline.user-forced-pin-process = User Forced PIN Process
 offline.unknown = Unknown
 online.online = Online
-
index 7cd1853be8ca4e76a00609095269d0a94955651e..e7e383fdaeddb9b2ea12f385d412a90ca0f571cf 100644 (file)
                                <description>Delay between messages</description>
                                <default>0</default>
                        </parameter>
+                       <parameter name="gtvEnabled" type="boolean">
+                               <label>Enable GoogleTV</label>
+                               <description>Enable the GoogleTV Protocol</description>
+                               <default>true</default>
+                       </parameter>
                </config-description>
 
        </thing-type>
                                <description>Delay between messages</description>
                                <default>0</default>
                        </parameter>
+                       <parameter name="gtvEnabled" type="boolean">
+                               <label>Enable GoogleTV</label>
+                               <description>Enable the GoogleTV Protocol</description>
+                               <default>true</default>
+                       </parameter>
                </config-description>
 
        </thing-type>