[tapocontrol] Color values must be int, not decimal (#14656)

* 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>
This commit is contained in:
Arne Seime 2023-04-01 16:46:02 +02:00 committed by GitHub
parent 766a451a7c
commit a546a50555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 16 deletions

View File

@ -70,9 +70,9 @@ All devices support some of the following channels:
| | output1 | Switch | Power socket 1 on or off | P300 | | | output1 | Switch | Power socket 1 on or off | P300 |
| | output2 | Switch | Power socket 2 on or off | P300 | | | output2 | Switch | Power socket 2 on or off | P300 |
| | output3 | Switch | Power socket 3 on or off | P300 | | | output3 | Switch | Power socket 3 on or off | P300 |
| | brightness | Dimmer | Brightness 0-100% | L510, L530, L610, 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 | | | colorTemperature | Number | White-Color-Temp 2500-6500K | L510, L530, L610, L630, L900, L920 |
| | color | Color | Color | L530, L630, L900 | | | color | Color | Color | L530, L630, L900, L920 |
| effects | fxName | String | Active lightning effect (readonly) | L530 | | 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 | | 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 | | | onTime | Number:Time | seconds output is on | P100, P105, P110, P115, L510, L530, L900, L920, L930 |

View File

@ -111,7 +111,7 @@ public class TapoThingConstants {
public static final String CLOUD_JSON_KEY_TYPE = "deviceType"; public static final String CLOUD_JSON_KEY_TYPE = "deviceType";
/*** DEVICE JSON STRINGS (DEVICE) ***/ /*** 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_COLORTEMP = "color_temp";
public static final String JSON_KEY_FW = "fw_ver"; public static final String JSON_KEY_FW = "fw_ver";
public static final String JSON_KEY_HUE = "hue"; public static final String JSON_KEY_HUE = "hue";

View File

@ -121,7 +121,7 @@ public class TapoLightStrip extends TapoDevice {
} else { } else {
HashMap<String, Object> newState = new HashMap<>(); HashMap<String, Object> newState = new HashMap<>();
newState.put(JSON_KEY_ON, true); newState.put(JSON_KEY_ON, true);
newState.put(JSON_KEY_BRIGHTNES, newBrightness); newState.put(JSON_KEY_BRIGHTNESS, newBrightness);
connector.sendDeviceCommands(newState); connector.sendDeviceCommands(newState);
} }
} }
@ -134,9 +134,9 @@ public class TapoLightStrip extends TapoDevice {
protected void setColor(HSBType command) { protected void setColor(HSBType command) {
HashMap<String, Object> newState = new HashMap<>(); HashMap<String, Object> newState = new HashMap<>();
newState.put(JSON_KEY_ON, true); newState.put(JSON_KEY_ON, true);
newState.put(JSON_KEY_HUE, command.getHue()); newState.put(JSON_KEY_HUE, command.getHue().intValue());
newState.put(JSON_KEY_SATURATION, command.getSaturation()); newState.put(JSON_KEY_SATURATION, command.getSaturation().intValue());
newState.put(JSON_KEY_BRIGHTNES, command.getBrightness()); newState.put(JSON_KEY_BRIGHTNESS, command.getBrightness().intValue());
connector.sendDeviceCommands(newState); connector.sendDeviceCommands(newState);
} }

View File

@ -118,7 +118,7 @@ public class TapoSmartBulb extends TapoDevice {
} else { } else {
HashMap<String, Object> newState = new HashMap<>(); HashMap<String, Object> newState = new HashMap<>();
newState.put(JSON_KEY_ON, true); newState.put(JSON_KEY_ON, true);
newState.put(JSON_KEY_BRIGHTNES, newBrightness); newState.put(JSON_KEY_BRIGHTNESS, newBrightness);
connector.sendDeviceCommands(newState); connector.sendDeviceCommands(newState);
} }
} }
@ -133,7 +133,7 @@ public class TapoSmartBulb extends TapoDevice {
newState.put(JSON_KEY_ON, true); newState.put(JSON_KEY_ON, true);
newState.put(JSON_KEY_HUE, command.getHue().intValue()); newState.put(JSON_KEY_HUE, command.getHue().intValue());
newState.put(JSON_KEY_SATURATION, command.getSaturation().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); newState.put(JSON_KEY_LIGHTNING_DYNAMIC_ENABLE, false);
connector.sendDeviceCommands(newState); connector.sendDeviceCommands(newState);
} }

View File

@ -125,7 +125,7 @@ public class TapoUniversalDevice extends TapoDevice {
} else { } else {
HashMap<String, Object> newState = new HashMap<>(); HashMap<String, Object> newState = new HashMap<>();
newState.put(JSON_KEY_ON, true); newState.put(JSON_KEY_ON, true);
newState.put(JSON_KEY_BRIGHTNES, newBrightness); newState.put(JSON_KEY_BRIGHTNESS, newBrightness);
connector.sendDeviceCommands(newState); connector.sendDeviceCommands(newState);
} }
} }
@ -140,7 +140,7 @@ public class TapoUniversalDevice extends TapoDevice {
newState.put(JSON_KEY_ON, true); newState.put(JSON_KEY_ON, true);
newState.put(JSON_KEY_HUE, command.getHue()); newState.put(JSON_KEY_HUE, command.getHue());
newState.put(JSON_KEY_SATURATION, command.getSaturation()); newState.put(JSON_KEY_SATURATION, command.getSaturation());
newState.put(JSON_KEY_BRIGHTNES, command.getBrightness()); newState.put(JSON_KEY_BRIGHTNESS, command.getBrightness());
connector.sendDeviceCommands(newState); connector.sendDeviceCommands(newState);
} }

View File

@ -84,7 +84,7 @@ public class TapoDeviceInfo {
} }
private void setData() { 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.colorTemp = jsonObjectToInt(jsonObject, JSON_KEY_COLORTEMP, BULB_MIN_COLORTEMP);
this.deviceId = jsonObjectToString(jsonObject, JSON_KEY_ID); this.deviceId = jsonObjectToString(jsonObject, JSON_KEY_ID);
this.deviceOn = jsonObjectToBool(jsonObject, JSON_KEY_ON); this.deviceOn = jsonObjectToBool(jsonObject, JSON_KEY_ON);

View File

@ -125,7 +125,7 @@ public class TapoUniversalDevice extends TapoDevice {
} else { } else {
HashMap<String, Object> newState = new HashMap<>(); HashMap<String, Object> newState = new HashMap<>();
newState.put(JSON_KEY_ON, true); newState.put(JSON_KEY_ON, true);
newState.put(JSON_KEY_BRIGHTNES, newBrightness); newState.put(JSON_KEY_BRIGHTNESS, newBrightness);
connector.sendDeviceCommands(newState); connector.sendDeviceCommands(newState);
} }
} }
@ -140,7 +140,7 @@ public class TapoUniversalDevice extends TapoDevice {
newState.put(JSON_KEY_ON, true); newState.put(JSON_KEY_ON, true);
newState.put(JSON_KEY_HUE, command.getHue()); newState.put(JSON_KEY_HUE, command.getHue());
newState.put(JSON_KEY_SATURATION, command.getSaturation()); newState.put(JSON_KEY_SATURATION, command.getSaturation());
newState.put(JSON_KEY_BRIGHTNES, command.getBrightness()); newState.put(JSON_KEY_BRIGHTNESS, command.getBrightness());
connector.sendDeviceCommands(newState); connector.sendDeviceCommands(newState);
} }

View File

@ -102,7 +102,7 @@ public class TapoDeviceInfo {
} }
private void setData() { 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.colorTemp = jsonObjectToInt(jsonObject, JSON_KEY_COLORTEMP, BULB_MIN_COLORTEMP);
this.deviceId = jsonObjectToString(jsonObject, JSON_KEY_ID); this.deviceId = jsonObjectToString(jsonObject, JSON_KEY_ID);
this.deviceOn = jsonObjectToBool(jsonObject, JSON_KEY_ON); this.deviceOn = jsonObjectToBool(jsonObject, JSON_KEY_ON);