From 6b6372e95c62dfae711e6413ca76b4d2a8664de8 Mon Sep 17 00:00:00 2001 From: Christian Wild <40909464+wildcs@users.noreply.github.com> Date: Thu, 6 Jan 2022 12:29:44 +0100 Subject: [PATCH] [tapocontrol] fix "device not found" with L510/L530 hw rev2 / add L920 and P110 things (#11967) * [tapocontrol] P110 and L920 Things added * [tapocontrol] Fixed L510/L530 Series Bug with HW-Rev2.0 Signed-off-by: Christian Wild --- .../org.openhab.binding.tapocontrol/README.md | 28 +++++++++---------- .../internal/TapoDiscoveryService.java | 1 + .../constants/TapoThingConstants.java | 21 ++++++++------ .../internal/structures/TapoDeviceInfo.java | 2 +- .../OH-INF/i18n/tapocontrol.properties | 14 ++++++---- .../thing/{L510_Series.xml => L510.xml} | 4 +-- .../thing/{L530_Series.xml => L530.xml} | 4 +-- .../src/main/resources/OH-INF/thing/L900.xml | 4 +-- .../src/main/resources/OH-INF/thing/L920.xml | 23 +++++++++++++++ .../src/main/resources/OH-INF/thing/P105.xml | 2 +- .../src/main/resources/OH-INF/thing/P110.xml | 23 +++++++++++++++ 11 files changed, 91 insertions(+), 35 deletions(-) rename bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/{L510_Series.xml => L510.xml} (91%) rename bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/{L530_Series.xml => L530.xml} (91%) create mode 100644 bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L920.xml create mode 100644 bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/P110.xml diff --git a/bundles/org.openhab.binding.tapocontrol/README.md b/bundles/org.openhab.binding.tapocontrol/README.md index 77074f476..843f7cc58 100644 --- a/bundles/org.openhab.binding.tapocontrol/README.md +++ b/bundles/org.openhab.binding.tapocontrol/README.md @@ -6,13 +6,13 @@ This binding adds support to control Tapo (Copyright © TP-Link Corporation Limi The following Tapo-Devices are supported -### P100/P105 SmartPlug (WiFi) +### P100/P105/P110 SmartPlug (WiFi) * Power On/Off * Wi-Fi signal (SignalStrength) * On-Time (Time in seconds device is switched on) -### L510_Series dimmable SmartBulb (WiFi) +### L510(Series) dimmable SmartBulb (WiFi) * Light On/Off * Brightnes (Dimmer) 0-100 % @@ -20,7 +20,7 @@ The following Tapo-Devices are supported * Wi-Fi signal (SignalStrength) * On-Time (Time in seconds device is switched on) -### L530_Series MultiColor SmartBulb (WiFi) +### L530(Series) MultiColor SmartBulb (WiFi) * Light On/Off * Brightnes (Dimmer) 0-100 % @@ -29,7 +29,7 @@ The following Tapo-Devices are supported * Wi-Fi signal (SignalStrength) * On-Time (Time in seconds device is switched on) -### L900 MultiColor LightStrip (WiFi) +### L900/L920 LED-LightStrip (WiFi) * Light On/Off * Brightnes (Dimmer) 0-100 % @@ -79,14 +79,14 @@ The thing has the following configuration parameters: All devices support some of the following channels: -| group | channel |type | description | things supporting this channel | -|-----------|----------------- |------------------------|------------------------------|---------------------------------| -| actuator | output | Switch | Power device on or off | P100, P105,L510, L530, L900 | -| | brightness | Dimmer | Brightness 0-100% | L510, L530, L900 | -| | colorTemperature | Number | White-Color-Temp 2500-6500K | L510, L530, L900 | -| | color | Color | Color | L530, L900 | -| device | wifiSignal | system.signal-strength | WiFi-quality-level | P100, P105, L510, L530, L900 | -| | onTime | Number:Time | seconds output is on | P100, P105, L510, L530, L900 | +| group | channel |type | description | things supporting this channel | +|-----------|----------------- |------------------------|------------------------------|---------------------------------------------| +| actuator | output | Switch | Power device on or off | P100, P105, P110, L510, L530, L900, L920 | +| | brightness | Dimmer | Brightness 0-100% | L510, L530, L900 | +| | colorTemperature | Number | White-Color-Temp 2500-6500K | L510, L530, L900 | +| | color | Color | Color | L530, L900 | +| device | wifiSignal | system.signal-strength | WiFi-quality-level | P100, P105, P110, L510, L530, L900, L920 | +| | onTime | Number:Time | seconds output is on | P100, P105, P110, L510, L530, L900, L920 | ## Channel Refresh @@ -102,8 +102,8 @@ To minimize network traffic the default refresh-rate is set to 30 seconds. This ``` tapocontrol:bridge:myTapoBridge "Cloud-Login" [ username="you@yourpovider.com", password="verysecret" ] tapocontrol:P100:myTapoBridge:mySocket "My-Socket" [ ipAddress="192.168.178.150", pollingInterval=30 ] -tapocontrol:L510_Series:myTapoBridge:whiteBulb "white-light" [ ipAddress="192.168.178.151", pollingInterval=30 ] -tapocontrol:L530_Series:myTapoBridge:colorBulb "color-light" [ ipAddress="192.168.178.152", pollingInterval=30 ] +tapocontrol:L510:myTapoBridge:whiteBulb "white-light" [ ipAddress="192.168.178.151", pollingInterval=30 ] +tapocontrol:L530:myTapoBridge:colorBulb "color-light" [ ipAddress="192.168.178.152", pollingInterval=30 ] tapocontrol:L900:myTapoBridge:myLightStrip "light-strip" [ ipAddress="192.168.178.153", pollingInterval=30 ] ``` diff --git a/bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/TapoDiscoveryService.java b/bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/TapoDiscoveryService.java index 12bd4ea07..1926e5b2b 100644 --- a/bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/TapoDiscoveryService.java +++ b/bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/TapoDiscoveryService.java @@ -193,6 +193,7 @@ public class TapoDiscoveryService extends AbstractDiscoveryService implements Th String deviceModel = device.get(CLOUD_PROPERTY_MODEL).getAsString(); deviceModel = deviceModel.replaceAll("\\(.*\\)", ""); // replace (DE) deviceModel = deviceModel.replace("Tapo", ""); + deviceModel = deviceModel.replace("Series", ""); deviceModel = deviceModel.trim(); deviceModel = deviceModel.replace(" ", "_"); return deviceModel; diff --git a/bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/constants/TapoThingConstants.java b/bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/constants/TapoThingConstants.java index faa22611a..4f8620629 100644 --- a/bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/constants/TapoThingConstants.java +++ b/bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/constants/TapoThingConstants.java @@ -36,9 +36,11 @@ public class TapoThingConstants { public static final String DEVICE_BRIDGE = "bridge"; public static final String DEVICE_P100 = "P100"; public static final String DEVICE_P105 = "P105"; - public static final String DEVICE_L510E = "L510_Series"; - public static final String DEVICE_L530E = "L530_Series"; + public static final String DEVICE_P110 = "P110"; + public static final String DEVICE_L510 = "L510"; + public static final String DEVICE_L530 = "L530"; public static final String DEVICE_L900 = "L900"; + public static final String DEVICE_L920 = "L920"; public static final String DEVICE_UNIVERSAL = "Test_Device"; /*** LIST OF SUPPORTED DEVICE DESCRIPTIONS ***/ @@ -52,17 +54,20 @@ public class TapoThingConstants { public static final ThingTypeUID BRIDGE_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_BRIDGE); public static final ThingTypeUID P100_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_P100); public static final ThingTypeUID P105_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_P105); - public static final ThingTypeUID L510E_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_L510E); - public static final ThingTypeUID L530E_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_L530E); + public static final ThingTypeUID P110_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_P110); + public static final ThingTypeUID L510_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_L510); + public static final ThingTypeUID L530_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_L530); public static final ThingTypeUID L900_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_L900); + public static final ThingTypeUID L920_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_L920); public static final ThingTypeUID UNIVERSAL_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_UNIVERSAL); /*** SET OF SUPPORTED UIDS ***/ public static final Set SUPPORTED_BRIDGE_UIDS = Set.of(BRIDGE_THING_TYPE); - public static final Set SUPPORTED_SMART_PLUG_UIDS = Set.of(P100_THING_TYPE, P105_THING_TYPE); - public static final Set SUPPORTED_WHITE_BULB_UIDS = Set.of(L510E_THING_TYPE); - public static final Set SUPPORTED_COLOR_BULB_UIDS = Set.of(L530E_THING_TYPE); - public static final Set SUPPORTED_LIGHT_STRIP_UIDS = Set.of(L900_THING_TYPE); + public static final Set SUPPORTED_SMART_PLUG_UIDS = Set.of(P100_THING_TYPE, P105_THING_TYPE, + P110_THING_TYPE); + public static final Set SUPPORTED_WHITE_BULB_UIDS = Set.of(L510_THING_TYPE); + public static final Set SUPPORTED_COLOR_BULB_UIDS = Set.of(L530_THING_TYPE); + public static final Set SUPPORTED_LIGHT_STRIP_UIDS = Set.of(L900_THING_TYPE, L920_THING_TYPE); public static final Set SUPPORTED_THING_TYPES_UIDS = Collections .unmodifiableSet(Stream .of(SUPPORTED_BRIDGE_UIDS, SUPPORTED_SMART_PLUG_UIDS, SUPPORTED_WHITE_BULB_UIDS, diff --git a/bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/structures/TapoDeviceInfo.java b/bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/structures/TapoDeviceInfo.java index 641d3578b..1ca699bc5 100644 --- a/bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/structures/TapoDeviceInfo.java +++ b/bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/structures/TapoDeviceInfo.java @@ -166,7 +166,7 @@ public class TapoDeviceInfo { } public String getModel() { - return model.replace(" ", "_"); + return model.replace(" Series", ""); } public String getNickname() { diff --git a/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/i18n/tapocontrol.properties b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/i18n/tapocontrol.properties index 57d88f6ed..b0586bc6b 100644 --- a/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/i18n/tapocontrol.properties +++ b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/i18n/tapocontrol.properties @@ -5,16 +5,20 @@ binding.tapocontrol.description = Control your TAPO-SmartHome Devices # thing types -thing-type.tapocontrol.L510_Series.label = L510 Series White-Bulb -thing-type.tapocontrol.L510_Series.description = Tapo Smart dimmable White-Light-Bulb -thing-type.tapocontrol.L530_Series.label = L530 Series Color-Bulb -thing-type.tapocontrol.L530_Series.description = Tapo Smart Multicolor Light-Bulb +thing-type.tapocontrol.L510.label = L510 Series White-Bulb +thing-type.tapocontrol.L510.description = Tapo Smart dimmable White-Light-Bulb +thing-type.tapocontrol.L530.label = L530 Series Color-Bulb +thing-type.tapocontrol.L530.description = Tapo Smart Multicolor Light-Bulb thing-type.tapocontrol.L900.label = L900 LightStrip -thing-type.tapocontrol.L900.description = Tapo Smart Multicolor Light-Lightstrip +thing-type.tapocontrol.L900.description = Tapo Smart LED-Lightstrip +thing-type.tapocontrol.L920.label = L920 LightStrip +thing-type.tapocontrol.L920.description = Tapo Smart Multicolor LED-Lightstrip thing-type.tapocontrol.P100.label = P100 SmartPlug thing-type.tapocontrol.P100.description = Tapo Smart Wifi Plug thing-type.tapocontrol.P105.label = P105 SmartPlug thing-type.tapocontrol.P105.description = Tapo Mini Smart Wifi Plug +thing-type.tapocontrol.P110.label = P110 SmartPlug +thing-type.tapocontrol.P110.description = Tapo Smart Monitoring Wifi Plug thing-type.tapocontrol.bridge.label = Cloud-Login thing-type.tapocontrol.bridge.description = Cloud Connector. Acts as device-bridge diff --git a/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L510_Series.xml b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L510.xml similarity index 91% rename from bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L510_Series.xml rename to bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L510.xml index ff9687116..d6a47a053 100644 --- a/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L510_Series.xml +++ b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L510.xml @@ -4,8 +4,8 @@ xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0" xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> - - + + diff --git a/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L530_Series.xml b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L530.xml similarity index 91% rename from bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L530_Series.xml rename to bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L530.xml index 4f94a2416..679cbb364 100644 --- a/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L530_Series.xml +++ b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L530.xml @@ -4,8 +4,8 @@ xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0" xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> - - + + diff --git a/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L900.xml b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L900.xml index 36b2c0614..d6948c8f7 100644 --- a/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L900.xml +++ b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L900.xml @@ -4,14 +4,14 @@ xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0" xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> - + - Tapo Smart Multicolor Light-Lightstrip + Tapo Smart LED-Lightstrip diff --git a/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L920.xml b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L920.xml new file mode 100644 index 000000000..d62285c82 --- /dev/null +++ b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/L920.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + Tapo Smart Multicolor LED-Lightstrip + + + + + macAddress + + + + diff --git a/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/P105.xml b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/P105.xml index f3819cea1..e567d790b 100644 --- a/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/P105.xml +++ b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/P105.xml @@ -4,7 +4,7 @@ xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0" xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> - + diff --git a/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/P110.xml b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/P110.xml new file mode 100644 index 000000000..7eb4bff2c --- /dev/null +++ b/bundles/org.openhab.binding.tapocontrol/src/main/resources/OH-INF/thing/P110.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + Tapo Smart Monitoring Wifi Plug + + + + + macAddress + + + +