diff --git a/bundles/org.openhab.binding.miio/README.base.md b/bundles/org.openhab.binding.miio/README.base.md index ec6771736d597..1398a2a7f409e 100644 --- a/bundles/org.openhab.binding.miio/README.base.md +++ b/bundles/org.openhab.binding.miio/README.base.md @@ -80,9 +80,11 @@ However, for devices that are unsupported, you may override the value and try to | model | text | false | Device model string, used to determine the subtype | | refreshInterval | integer | false | Refresh interval for refreshing the data in seconds. (0=disabled) | | timeout | integer | false | Timeout time in milliseconds | -| communication | test | false | Communicate direct or via cloud (options values: 'direct', 'cloud') | +| communication | text | false | Communicate direct or via cloud (options values: 'direct', 'cloud') | +| cloudServer | text | false | Identifies the country server to use in case of cloud communication | -Note: Suggest to use the cloud communication only for devices that require it. It is unknown at this time if Xiaomi has a rate limit or other limitations on the cloud usage. e.g. if having many devices would trigger some throttling from the cloud side. +Note: Suggest to use the cloud communication only for devices that require it. +It is unknown at this time if Xiaomi has a rate limit or other limitations on the cloud usage. e.g. if having many devices would trigger some throttling from the cloud side. ### Example Thing file @@ -90,7 +92,7 @@ Note: Suggest to use the cloud communication only for devices that require it. I or in case of unknown models include the model information of a similar device that is supported: -`Thing miio:vacuum:s50 "vacuum" @ "livingroom" [ host="192.168.15.20", token="xxxxxxx", deviceId="326xxxx", model="roborock.vacuum.s4", communication="direct" ]` +`Thing miio:vacuum:s50 "vacuum" @ "livingroom" [ host="192.168.15.20", token="xxxxxxx", deviceId="326xxxx", model="roborock.vacuum.s4", communication="direct", cloudServer="de" ]` # Advanced: Unsupported devices diff --git a/bundles/org.openhab.binding.miio/README.md b/bundles/org.openhab.binding.miio/README.md index d39f57eb4b32e..cabb4b57acaec 100644 --- a/bundles/org.openhab.binding.miio/README.md +++ b/bundles/org.openhab.binding.miio/README.md @@ -80,9 +80,11 @@ However, for devices that are unsupported, you may override the value and try to | model | text | false | Device model string, used to determine the subtype | | refreshInterval | integer | false | Refresh interval for refreshing the data in seconds. (0=disabled) | | timeout | integer | false | Timeout time in milliseconds | -| communication | test | false | Communicate direct or via cloud (options values: 'direct', 'cloud') | +| communication | text | false | Communicate direct or via cloud (options values: 'direct', 'cloud') | +| cloudServer | text | false | Identifies the country server to use in case of cloud communication | -Note: Suggest to use the cloud communication only for devices that require it. It is unknown at this time if Xiaomi has a rate limit or other limitations on the cloud usage. e.g. if having many devices would trigger some throttling from the cloud side. +Note: Suggest to use the cloud communication only for devices that require it. +It is unknown at this time if Xiaomi has a rate limit or other limitations on the cloud usage. e.g. if having many devices would trigger some throttling from the cloud side. ### Example Thing file @@ -90,7 +92,7 @@ Note: Suggest to use the cloud communication only for devices that require it. I or in case of unknown models include the model information of a similar device that is supported: -`Thing miio:vacuum:s50 "vacuum" @ "livingroom" [ host="192.168.15.20", token="xxxxxxx", deviceId="326xxxx", model="roborock.vacuum.s4", communication="direct" ]` +`Thing miio:vacuum:s50 "vacuum" @ "livingroom" [ host="192.168.15.20", token="xxxxxxx", deviceId="326xxxx", model="roborock.vacuum.s4", communication="direct", cloudServer="de" ]` # Advanced: Unsupported devices diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/ActionConditions.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/ActionConditions.java index 0b4cb553eeb1f..8882a18b880f8 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/ActionConditions.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/ActionConditions.java @@ -76,7 +76,7 @@ public class ActionConditions { * @param value * @return RGB value + brightness as first byte */ - private static @Nullable JsonElement HsvToBRGB(@Nullable Command command, @Nullable JsonElement value) { + private static @Nullable JsonElement hsvToBRGB(@Nullable Command command, @Nullable JsonElement value) { if (command != null && command instanceof HSBType) { HSBType hsb = (HSBType) command; Color color = Color.getHSBColor(hsb.getHue().floatValue() / 360, hsb.getSaturation().floatValue() / 100, @@ -171,7 +171,7 @@ public class ActionConditions { case "BRIGHTNESSEXISTING": return brightnessExists(value); case "HSVTOBRGB": - return HsvToBRGB(command, value); + return hsvToBRGB(command, value); case "BRIGHTNESSONOFF": return brightness(value); case "HSBONLY": diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoAbstractHandler.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoAbstractHandler.java index 83832f3334bda..93acefd1b46e3 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoAbstractHandler.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoAbstractHandler.java @@ -374,7 +374,8 @@ protected void disconnected(@Nullable String message) { String deviceId = configuration.deviceId; if (deviceId.length() == 8 && deviceId.matches("^.*[a-zA-Z]+.*$")) { logger.warn( - "As per openHAB version 3.2 the deviceId is no longer a string with hexadecimals, instead it is a string with the numeric respresentation of the deviceId. If you continue seeing this message, update deviceId in your thing configuration"); + "As per openHAB version 3.2 the deviceId is no longer a string with hexadecimals, instead it is a string with the numeric respresentation of the deviceId. If you continue seeing this message, update deviceId in your thing configuration. Expected change for thing '{}': Update current deviceId: '{}' to '{}'", + getThing().getUID(), deviceId, Utils.fromHEX(deviceId)); deviceId = ""; } try { diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java index e3b36f664e489..75f4918e3c5c7 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java @@ -18,12 +18,12 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; -import java.text.SimpleDateFormat; import java.time.Instant; +import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; import java.util.Collections; -import java.util.Date; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -89,7 +89,7 @@ public class MiIoVacuumHandler extends MiIoAbstractHandler { private final Logger logger = LoggerFactory.getLogger(MiIoVacuumHandler.class); private static final float MAP_SCALE = 2.0f; - private static final SimpleDateFormat DATEFORMATTER = new SimpleDateFormat("yyyyMMdd-HHmmss"); + private static final DateTimeFormatter DATEFORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss"); private static final Gson GSON = new GsonBuilder().serializeNulls().create(); private final ChannelUID mapChannelUid; @@ -654,7 +654,7 @@ private State getMap(String map) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (logger.isDebugEnabled()) { final String mapPath = BINDING_USERDATA_PATH + File.separator + map - + DATEFORMATTER.format(new Date()) + ".rrmap"; + + LocalDateTime.now().format(DATEFORMATTER) + ".rrmap"; CloudUtil.writeBytesToFileNio(mapData, mapPath); logger.debug("Mapdata saved to {}", mapPath); } diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/yeelink.light.color1.json b/bundles/org.openhab.binding.miio/src/main/resources/database/yeelink.light.color1.json index 7e41b83c9746f..18305fa735de9 100644 --- a/bundles/org.openhab.binding.miio/src/main/resources/database/yeelink.light.color1.json +++ b/bundles/org.openhab.binding.miio/src/main/resources/database/yeelink.light.color1.json @@ -246,7 +246,7 @@ "actions": [ { "command": "start_cf", - "parameterType": "EMPTY", + "parameterType": "NONE", "parameters": [ 0, 0,