diff --git a/bundles/org.openhab.binding.androidtv/README.md b/bundles/org.openhab.binding.androidtv/README.md index f53cc9dfae9..229a0af5845 100644 --- a/bundles/org.openhab.binding.androidtv/README.md +++ b/bundles/org.openhab.binding.androidtv/README.md @@ -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" ] diff --git a/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/AndroidTVBindingConstants.java b/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/AndroidTVBindingConstants.java index 0838f1753e6..8b7889f005d 100644 --- a/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/AndroidTVBindingConstants.java +++ b/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/AndroidTVBindingConstants.java @@ -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"; diff --git a/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/AndroidTVHandler.java b/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/AndroidTVHandler.java index 851b29393f7..7a967ddbee4 100644 --- a/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/AndroidTVHandler.java +++ b/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/AndroidTVHandler.java @@ -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; } } diff --git a/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/googletv/GoogleTVConfiguration.java b/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/googletv/GoogleTVConfiguration.java index 91fb0d685a5..ab65718629d 100644 --- a/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/googletv/GoogleTVConfiguration.java +++ b/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/googletv/GoogleTVConfiguration.java @@ -32,4 +32,5 @@ public class GoogleTVConfiguration { public boolean shim; public boolean shimNewKeys; public String mode = ""; + public boolean gtvEnabled; } diff --git a/bundles/org.openhab.binding.androidtv/src/main/resources/OH-INF/i18n/androidtv.properties b/bundles/org.openhab.binding.androidtv/src/main/resources/OH-INF/i18n/androidtv.properties index cb0f4d005a8..3b6b485f42a 100644 --- a/bundles/org.openhab.binding.androidtv/src/main/resources/OH-INF/i18n/androidtv.properties +++ b/bundles/org.openhab.binding.androidtv/src/main/resources/OH-INF/i18n/androidtv.properties @@ -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 - diff --git a/bundles/org.openhab.binding.androidtv/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.androidtv/src/main/resources/OH-INF/thing/thing-types.xml index 7cd1853be8c..e7e383fdaed 100644 --- a/bundles/org.openhab.binding.androidtv/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.androidtv/src/main/resources/OH-INF/thing/thing-types.xml @@ -71,6 +71,11 @@ Delay between messages 0 + + + Enable the GoogleTV Protocol + true + @@ -137,6 +142,11 @@ Delay between messages 0 + + + Enable the GoogleTV Protocol + true +