]> git.basschouten.com Git - openhab-addons.git/commitdiff
[tapocontrol] Color values must be int, not decimal (#14656)
authorArne Seime <seime@users.noreply.github.com>
Sat, 1 Apr 2023 14:46:02 +0000 (16:46 +0200)
committerGitHub <noreply@github.com>
Sat, 1 Apr 2023 14:46:02 +0000 (16:46 +0200)
* Send int values to API, not decimal
* Added missing channels in README for L920 + minor thing file config

Signed-off-by: Arne Seime <arne.seime@gmail.com>
bundles/org.openhab.binding.tapocontrol/README.md
bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/constants/TapoThingConstants.java
bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/device/TapoLightStrip.java
bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/device/TapoSmartBulb.java
bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/device/TapoUniversalDevice.java
bundles/org.openhab.binding.tapocontrol/src/main/java/org/openhab/binding/tapocontrol/internal/structures/TapoDeviceInfo.java
bundles/org.openhab.binding.tapocontrol/src/test/java/org/openhab/binding/tapocontrol/internal/device/TapoUniversalDevice.java
bundles/org.openhab.binding.tapocontrol/src/test/java/org/openhab/binding/tapocontrol/internal/structures/TapoDeviceInfo.java

index dde816d52580aaa6c301dc8f8f7be61e39e894b0..aa5cc900adf9eb02e8e597dbd2cb32c06fcce5bc 100644 (file)
@@ -70,9 +70,9 @@ All devices support some of the following channels:
 |           | output1          | Switch                 | Power socket 1 on or off            | P300                                                             |
 |           | output2          | Switch                 | Power socket 2 on or off            | P300                                                             |
 |           | output3          | Switch                 | Power socket 3 on or off            | P300                                                             |
-|           | brightness       | Dimmer                 | Brightness 0-100%                   | L510, L530, L610, L630, L900                                     |
-|           | colorTemperature | Number                 | White-Color-Temp 2500-6500K         | L510, L530, L610, L630, L900                                     |
-|           | color            | Color                  | Color                               | L530, L630, L900                                                 |
+|           | brightness       | Dimmer                 | Brightness 0-100%                   | L510, L530, L610, L630, L900, L920                               |
+|           | colorTemperature | Number                 | White-Color-Temp 2500-6500K         | L510, L530, L610, L630, L900, L920                                     |
+|           | color            | Color                  | Color                               | L530, L630, L900, L920                                                 |
 | effects   | fxName           | String                 | Active lightning effect (readonly)  | L530                                                             |
 | device    | wifiSignal       | Number                 | WiFi-quality-level                  | P100, P105, P110, P115, L510, L530, L610, L630, L900, L920, L930 |
 |           | onTime           | Number:Time            | seconds output is on                | P100, P105, P110, P115, L510, L530, L900, L920, L930             |
index a97b9aebb39418e9984e01ec5d02e908ab0c8f23..d64570ea8f9ac2b348e4446d984f52686a5fa6cf 100644 (file)
@@ -111,7 +111,7 @@ public class TapoThingConstants {
     public static final String CLOUD_JSON_KEY_TYPE = "deviceType";
 
     /*** DEVICE JSON STRINGS (DEVICE) ***/
-    public static final String JSON_KEY_BRIGHTNES = "brightness";
+    public static final String JSON_KEY_BRIGHTNESS = "brightness";
     public static final String JSON_KEY_COLORTEMP = "color_temp";
     public static final String JSON_KEY_FW = "fw_ver";
     public static final String JSON_KEY_HUE = "hue";
index aa01fb72b204e932145c159df1bd04c160e277dd..29f1a9c59e0bc309b59b6d1f607082070912b7e4 100644 (file)
@@ -121,7 +121,7 @@ public class TapoLightStrip extends TapoDevice {
         } else {
             HashMap<String, Object> newState = new HashMap<>();
             newState.put(JSON_KEY_ON, true);
-            newState.put(JSON_KEY_BRIGHTNES, newBrightness);
+            newState.put(JSON_KEY_BRIGHTNESS, newBrightness);
             connector.sendDeviceCommands(newState);
         }
     }
@@ -134,9 +134,9 @@ public class TapoLightStrip extends TapoDevice {
     protected void setColor(HSBType command) {
         HashMap<String, Object> newState = new HashMap<>();
         newState.put(JSON_KEY_ON, true);
-        newState.put(JSON_KEY_HUE, command.getHue());
-        newState.put(JSON_KEY_SATURATION, command.getSaturation());
-        newState.put(JSON_KEY_BRIGHTNES, command.getBrightness());
+        newState.put(JSON_KEY_HUE, command.getHue().intValue());
+        newState.put(JSON_KEY_SATURATION, command.getSaturation().intValue());
+        newState.put(JSON_KEY_BRIGHTNESS, command.getBrightness().intValue());
         connector.sendDeviceCommands(newState);
     }
 
index ee9475a817c8338b683df328ebbfe924433dda26..578dbaf00aa12b8ec2b588cb422a9fe569eb4612 100644 (file)
@@ -118,7 +118,7 @@ public class TapoSmartBulb extends TapoDevice {
         } else {
             HashMap<String, Object> newState = new HashMap<>();
             newState.put(JSON_KEY_ON, true);
-            newState.put(JSON_KEY_BRIGHTNES, newBrightness);
+            newState.put(JSON_KEY_BRIGHTNESS, newBrightness);
             connector.sendDeviceCommands(newState);
         }
     }
@@ -133,7 +133,7 @@ public class TapoSmartBulb extends TapoDevice {
         newState.put(JSON_KEY_ON, true);
         newState.put(JSON_KEY_HUE, command.getHue().intValue());
         newState.put(JSON_KEY_SATURATION, command.getSaturation().intValue());
-        newState.put(JSON_KEY_BRIGHTNES, command.getBrightness().intValue());
+        newState.put(JSON_KEY_BRIGHTNESS, command.getBrightness().intValue());
         newState.put(JSON_KEY_LIGHTNING_DYNAMIC_ENABLE, false);
         connector.sendDeviceCommands(newState);
     }
index 12e7771726c258f46796ee41001d70a8de2be128..083e73f45f550ff0dfc59f123eebdbc97955911f 100644 (file)
@@ -125,7 +125,7 @@ public class TapoUniversalDevice extends TapoDevice {
         } else {
             HashMap<String, Object> newState = new HashMap<>();
             newState.put(JSON_KEY_ON, true);
-            newState.put(JSON_KEY_BRIGHTNES, newBrightness);
+            newState.put(JSON_KEY_BRIGHTNESS, newBrightness);
             connector.sendDeviceCommands(newState);
         }
     }
@@ -140,7 +140,7 @@ public class TapoUniversalDevice extends TapoDevice {
         newState.put(JSON_KEY_ON, true);
         newState.put(JSON_KEY_HUE, command.getHue());
         newState.put(JSON_KEY_SATURATION, command.getSaturation());
-        newState.put(JSON_KEY_BRIGHTNES, command.getBrightness());
+        newState.put(JSON_KEY_BRIGHTNESS, command.getBrightness());
         connector.sendDeviceCommands(newState);
     }
 
index 38d3bce342522f28580e4fcba2853cc38c5a9ea0..91dc1a6f54c446201a69abdf30b63be5711c0111 100644 (file)
@@ -84,7 +84,7 @@ public class TapoDeviceInfo {
     }
 
     private void setData() {
-        this.brightness = jsonObjectToInt(jsonObject, JSON_KEY_BRIGHTNES);
+        this.brightness = jsonObjectToInt(jsonObject, JSON_KEY_BRIGHTNESS);
         this.colorTemp = jsonObjectToInt(jsonObject, JSON_KEY_COLORTEMP, BULB_MIN_COLORTEMP);
         this.deviceId = jsonObjectToString(jsonObject, JSON_KEY_ID);
         this.deviceOn = jsonObjectToBool(jsonObject, JSON_KEY_ON);
index 7663a1ada928239489c9d741b5d6bcb2a97c6af7..257466f5ec7b4b275ea5c24251321f8c33d84a78 100644 (file)
@@ -125,7 +125,7 @@ public class TapoUniversalDevice extends TapoDevice {
         } else {
             HashMap<String, Object> newState = new HashMap<>();
             newState.put(JSON_KEY_ON, true);
-            newState.put(JSON_KEY_BRIGHTNES, newBrightness);
+            newState.put(JSON_KEY_BRIGHTNESS, newBrightness);
             connector.sendDeviceCommands(newState);
         }
     }
@@ -140,7 +140,7 @@ public class TapoUniversalDevice extends TapoDevice {
         newState.put(JSON_KEY_ON, true);
         newState.put(JSON_KEY_HUE, command.getHue());
         newState.put(JSON_KEY_SATURATION, command.getSaturation());
-        newState.put(JSON_KEY_BRIGHTNES, command.getBrightness());
+        newState.put(JSON_KEY_BRIGHTNESS, command.getBrightness());
         connector.sendDeviceCommands(newState);
     }
 
index 0ed714819168083b3b7b2d3bfbf09f256a73874e..124fa1aa34d16f0ba147aa36b0e447ceeffab9a9 100644 (file)
@@ -102,7 +102,7 @@ public class TapoDeviceInfo {
     }
 
     private void setData() {
-        this.brightness = jsonObjectToInt(jsonObject, JSON_KEY_BRIGHTNES);
+        this.brightness = jsonObjectToInt(jsonObject, JSON_KEY_BRIGHTNESS);
         this.colorTemp = jsonObjectToInt(jsonObject, JSON_KEY_COLORTEMP, BULB_MIN_COLORTEMP);
         this.deviceId = jsonObjectToString(jsonObject, JSON_KEY_ID);
         this.deviceOn = jsonObjectToBool(jsonObject, JSON_KEY_ON);