diff --git a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/AwtrixLightBindingConstants.java b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/AwtrixLightBindingConstants.java index 9f62a9e48f099..268290f42a9a0 100644 --- a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/AwtrixLightBindingConstants.java +++ b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/AwtrixLightBindingConstants.java @@ -47,6 +47,7 @@ public class AwtrixLightBindingConstants { public static final String PROP_APPID = "appid"; public static final String PROP_APPLOCKTIMEOUT = "appLockTimeout"; public static final String PROP_APPNAME = "appname"; + public static final String PROP_APP_CONTROLLABLE = "useButtons"; public static final String PROP_BASETOPIC = "basetopic"; public static final String PROP_DISCOVERDEFAULT = "discoverDefaultApps"; public static final String PROP_FIRMWARE = "firmware"; diff --git a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/BridgeConfigOptions.java b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/BridgeConfigOptions.java index 71a1ac9b08006..2880204760361 100644 --- a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/BridgeConfigOptions.java +++ b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/BridgeConfigOptions.java @@ -12,6 +12,8 @@ */ package org.openhab.binding.mqtt.awtrixlight.internal; +import java.math.BigDecimal; + import org.eclipse.jdt.annotation.NonNullByDefault; /** @@ -24,5 +26,5 @@ public class BridgeConfigOptions { public String basetopic = "awtrix"; public int appLockTimeout = 10; public boolean discoverDefaultApps = false; - public int lowBatteryThreshold = 25; + public BigDecimal lowBatteryThreshold = new BigDecimal(25); } diff --git a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/discovery/AwtrixLightBridgeDiscoveryService.java b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/discovery/AwtrixLightBridgeDiscoveryService.java index d8758126f91ec..cf5f691d23951 100644 --- a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/discovery/AwtrixLightBridgeDiscoveryService.java +++ b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/discovery/AwtrixLightBridgeDiscoveryService.java @@ -17,6 +17,7 @@ import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.AWTRIX_APP; import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.PROP_APPID; import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.PROP_APPNAME; +import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.PROP_APP_CONTROLLABLE; import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.PROP_UNIQUEID; import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.THING_TYPE_APP; @@ -91,7 +92,8 @@ void publishApp(ThingUID connectionBridgeUid, String bridgeHardwareId, String ba String appId = bridgeHardwareId + "-" + appName; thingDiscovered(DiscoveryResultBuilder .create(new ThingUID(new ThingTypeUID(BINDING_ID, AWTRIX_APP), connectionBridgeUid, appName)) - .withBridge(connectionBridgeUid).withProperty(PROP_APPID, appId).withProperty(PROP_APPNAME, appName) + .withBridge(connectionBridgeUid).withProperty(PROP_APPID, appId) + .withProperty(PROP_APP_CONTROLLABLE, false).withProperty(PROP_APPNAME, appName) .withRepresentationProperty(PROP_APPID).withLabel("Awtrix App " + appName).build()); } } diff --git a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/discovery/AwtrixLightDiscoveryService.java b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/discovery/AwtrixLightDiscoveryService.java index 92223e93c9d1f..849b2191a8de2 100644 --- a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/discovery/AwtrixLightDiscoveryService.java +++ b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/discovery/AwtrixLightDiscoveryService.java @@ -18,9 +18,7 @@ import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.FIELD_BRIDGE_FIRMWARE; import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.FIELD_BRIDGE_TYPE; import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.FIELD_BRIDGE_UID; -import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.PROP_APPLOCKTIMEOUT; import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.PROP_BASETOPIC; -import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.PROP_DISCOVERDEFAULT; import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.PROP_FIRMWARE; import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.PROP_UNIQUEID; import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.PROP_VENDOR; @@ -118,7 +116,6 @@ void publishClock(ThingUID connectionBridgeUid, String baseTopic, String vendor, .create(new ThingUID(new ThingTypeUID(BINDING_ID, AWTRIX_CLOCK), connectionBridgeUid, hardwareUid)) .withBridge(connectionBridgeUid).withProperty(PROP_VENDOR, vendor).withProperty(PROP_FIRMWARE, firmware) .withProperty(PROP_UNIQUEID, hardwareUid).withProperty(PROP_BASETOPIC, baseTopic) - .withProperty(PROP_APPLOCKTIMEOUT, 10).withProperty(PROP_DISCOVERDEFAULT, false) .withRepresentationProperty(PROP_UNIQUEID).withLabel("Awtrix Clock " + name).build()); } } diff --git a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/handler/AwtrixLightBridgeHandler.java b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/handler/AwtrixLightBridgeHandler.java index 7c3934dee6227..93e5bc7a40460 100644 --- a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/handler/AwtrixLightBridgeHandler.java +++ b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/handler/AwtrixLightBridgeHandler.java @@ -204,7 +204,7 @@ public void initialize() { this.basetopic = config.basetopic; this.appLockTimeout = config.appLockTimeout; this.discoverDefaultApps = config.discoverDefaultApps; - this.lowBatteryThreshold = new BigDecimal(config.lowBatteryThreshold); + this.lowBatteryThreshold = config.lowBatteryThreshold; this.channelPrefix = thing.getUID() + ":"; logger.debug( "Configured handler with baseTopic {}, channelPrefix {}, appLockTimeout {}, discoverDefaultApps {}", @@ -332,15 +332,15 @@ public Collection> getServices() { } public void reboot() { - this.sendMQTT(TOPIC_REBOOT, "", false); + this.sendMQTT(this.basetopic + TOPIC_REBOOT, "", false); } public void playSound(String melodyName) { - this.sendMQTT(TOPIC_SOUND, "{\"sound\":\"" + melodyName + "\"}", false); + this.sendMQTT(this.basetopic + TOPIC_SOUND, "{\"sound\":\"" + melodyName + "\"}", false); } public void upgrade() { - this.sendMQTT(TOPIC_UPGRADE, "", false); + this.sendMQTT(this.basetopic + TOPIC_UPGRADE, "", false); } public void setAppDiscoveryCallback(AwtrixLightBridgeDiscoveryService awtrixLightBridgeDiscoveryService) { diff --git a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/resources/OH-INF/config/config.xml b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/resources/OH-INF/config/config.xml index bcb706ea8ff1f..49850a2535d5b 100644 --- a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/resources/OH-INF/config/config.xml +++ b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/resources/OH-INF/config/config.xml @@ -21,7 +21,7 @@ recommended to ignore them during app discovery. false - + Threshold for issuing a low battery warning. 25 @@ -37,7 +37,7 @@ false diff --git a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/resources/OH-INF/thing/thing-types.xml index 252f0c2831e75..f4dd6eb3f71b6 100644 --- a/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.mqtt.awtrixlight/src/main/resources/OH-INF/thing/thing-types.xml @@ -59,15 +59,16 @@ + + + - - - + @@ -75,7 +76,6 @@ -