From aac28589e7ae8fd90505749006496c78259d4523 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sat, 24 Jul 2021 21:21:14 +0200 Subject: [PATCH 1/6] [miio] Minor improvement documentation & deviceId update message (#11046) * [miio] Minor improvement documentation & message * [miio] minor cleanup from sat * miio] fix another minor datetimeformat SAT issue Signed-off-by: Marcel Verpaalen --- bundles/org.openhab.binding.miio/README.base.md | 8 +++++--- bundles/org.openhab.binding.miio/README.md | 8 +++++--- .../binding/miio/internal/basic/ActionConditions.java | 4 ++-- .../miio/internal/handler/MiIoAbstractHandler.java | 3 ++- .../binding/miio/internal/handler/MiIoVacuumHandler.java | 8 ++++---- .../src/main/resources/database/yeelink.light.color1.json | 2 +- 6 files changed, 19 insertions(+), 14 deletions(-) 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, From ccbc5e7d464de414baab6e182e39122a8d330015 Mon Sep 17 00:00:00 2001 From: Petr27 Date: Sat, 24 Jul 2021 21:22:31 +0200 Subject: [PATCH 2/6] Update README.md (#11045) Add binding for Hama IR100, Hama DIR3100 and Auna Connect CD --- .../README.md | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/bundles/org.openhab.binding.fsinternetradio/README.md b/bundles/org.openhab.binding.fsinternetradio/README.md index ee8c1b12dcf5c..14dfecf606eb8 100644 --- a/bundles/org.openhab.binding.fsinternetradio/README.md +++ b/bundles/org.openhab.binding.fsinternetradio/README.md @@ -6,11 +6,12 @@ This binding integrates internet radios based on the [Frontier Silicon chipset]( Successfully tested are internet radios: - * [Hama IR100](https://de.hama.com/00054823/hama-internetradio-ir110) + * [Hama IR100, IR110](https://de.hama.com/00054823/hama-internetradio-ir110) + * [Hama DIR3100](https://www.conrad.com/p/hama-dir3100-internet-desk-radio-dab-fm-aux-internet-radio-usb-spotify-black-1233624) * [Medion MD87180, MD86988, MD86955, MD87528](http://internetradio.medion.com/) * [Silvercrest SMRS18A1, SMRS30A1, SMRS35A1, SIRD 14 C2, SIRD 14 D1](https://www.silvercrest-multiroom.de/en/products/stereo-internet-radio/) * [Roberts Stream 83i and 93i](https://www.robertsradio.com/uk/products/radio/smart-radio/) - * [Auna Connect 150, Auna KR200](https://www.auna.de/Radios/Internetradios/) + * [Auna Connect 150, Auna KR200, Auna Connect CD](https://www.auna.de/Radios/Internetradios/) * [TechniSat DIGITRADIO 350 IR and 850](https://www.technisat.com/en_XX/DAB+-Radios-with-Internetradio/352-10996/) * [TTMicro AS Pinell Supersound](https://www.ttmicro.no/radio) * [Revo SuperConnect](https://revo.co.uk/products/) @@ -67,16 +68,20 @@ All devices support some of the following channels: The radio mode depends on the internet radio model (and its firmware version!). This list is just an example how the mapping looks like for some of the devices, please try it out and adjust your sitemap for your particular radio. -| Radio Mode | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 -|--------------------------|----------------|-------------------------|-----------|--------------|-----------|----------|--------------|--------------|-----------|-----------|--------| -| Hama IR110 | Internet Radio | Spotify | Player | AUX in | - | - | - | - | - | - |- | -| Medion MD87180 | Internet Radio | Music Player (USB, LAN) | DAB Radio | FM Radio | AUX in | - | - | - | - | - |- | -| Medion MD 86988 | Internet Radio | Music Player | FM Radio | AUX in | - | - | - | - | - | - |- | -| Technisat DigitRadio 580 | Internet Radio | Spotify | - | Music Player | DAB Radio | FM Radio | AUX in | CD | Bluetooth | - |- | -| Dual IR 3a | Internet Radio | Spotify | - | Music Player | DAB Radio | FM Radio | Bluetooth | - | - | - |- | -| Silvercrest SIRD 14 C1 | - | Napster | Deezer | Qobuz | Spotify | TIDAL | Spotify | Music Player | DAB Radio | FM Radio | AUX in | -| Silvercrest SIRD 14 C2 | Internet Radio | TIDAL | Deezer | Qobuz | Spotify | - | Music Player | DAB Radio | FM Radio | AUX in |- | -| Auna KR200 Kitchen Radio | Internet Radio | Spotify | - | Music Player | DAB Radio | FM Radio | AUX in | - | - | - |- | +| Radio Mode | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 +|--------------------------|----------------|-------------------------|--------------|--------------|-----------|----------|--------------|--------------|-----------|-----------|--------| +| Hama IR100 | Internet Radio | Spotify | Music Player | AUX in | - | - | - | - | - | - |- | +| Hama IR110 | Internet Radio | Spotify | Music Player | AUX in | - | - | - | - | - | - |- | +| Hama DIR3100 | Internet Radio | Spotify | Music Player | DAB Radio | FM Radio | AUX in | - | - | - | - |- | +| Medion MD87180 | Internet Radio | Music Player (USB, LAN) | DAB Radio | FM Radio | AUX in | - | - | - | - | - |- | +| Medion MD 86988 | Internet Radio | Music Player | FM Radio | AUX in | - | - | - | - | - | - |- | +| Technisat DigitRadio 580 | Internet Radio | Spotify | - | Music Player | DAB Radio | FM Radio | AUX in | CD | Bluetooth | - |- | +| Dual IR 3a | Internet Radio | Spotify | - | Music Player | DAB Radio | FM Radio | Bluetooth | - | - | - |- | +| Silvercrest SIRD 14 C1 | - | Napster | Deezer | Qobuz | Spotify | TIDAL | Spotify | Music Player | DAB Radio | FM Radio | AUX in | +| Silvercrest SIRD 14 C2 | Internet Radio | TIDAL | Deezer | Qobuz | Spotify | - | Music Player | DAB Radio | FM Radio | AUX in |- | +| Auna KR200 Kitchen Radio | Internet Radio | Spotify | - | Music Player | DAB Radio | FM Radio | AUX in | - | - | - |- | +| Auna Connect CD | Internet Radio | Spotify | Music Player | Music Player | DAB Radio | FM Radio | CD | Bluetooth | AUX in | - | - |- | + ## Full Example From d5e0e4905a3adc32cbf745a93e2250d9207ea97c Mon Sep 17 00:00:00 2001 From: Christoph Weitkamp Date: Sat, 24 Jul 2021 21:23:51 +0200 Subject: [PATCH 3/6] Changed default color mode for color commands to XY (#11036) Signed-off-by: Christoph Weitkamp --- bundles/org.openhab.binding.deconz/README.md | 2 +- .../deconz/internal/dto/GroupAction.java | 8 +++-- .../internal/handler/GroupThingHandler.java | 31 +++++++++++++++++-- .../internal/handler/LightThingHandler.java | 14 ++++----- .../deconz/internal/handler/ThingConfig.java | 2 +- .../main/resources/OH-INF/config/config.xml | 29 ++++++++++++----- .../OH-INF/thing/group-thing-types.xml | 2 +- 7 files changed, 65 insertions(+), 23 deletions(-) diff --git a/bundles/org.openhab.binding.deconz/README.md b/bundles/org.openhab.binding.deconz/README.md index ef762dfa51ecd..22ef7af1e7fd4 100644 --- a/bundles/org.openhab.binding.deconz/README.md +++ b/bundles/org.openhab.binding.deconz/README.md @@ -89,7 +89,7 @@ The transition time is the time to move between two states and is configured in The resolution provided is 1/10s. If no value is provided, the default value of the device is used. -`extendedcolorlight` and `colorlight` have different modes for setting the color. +`extendedcolorlight`, `colorlight` and `lightgroup` have different modes for setting the color. Some devices accept only XY, others HSB, others both modes and the binding tries to autodetect the correct mode. If this fails, the advanced `colormode` parameter can be set to `xy` or `hs`. diff --git a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/dto/GroupAction.java b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/dto/GroupAction.java index 87fa4a10dcff5..3044ec7d8252b 100644 --- a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/dto/GroupAction.java +++ b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/dto/GroupAction.java @@ -33,14 +33,16 @@ public class GroupAction { public @Nullable Integer ct; public double @Nullable [] xy; public @Nullable String alert; + public @Nullable String colormode; public @Nullable String effect; public @Nullable Integer colorloopspeed; public @Nullable Integer transitiontime; @Override public String toString() { - return "GroupAction{" + "on=" + on + ", toggle=" + toggle + ", bri=" + bri + ", hue=" + hue + ", sat=" + sat - + ", ct=" + ct + ", xy=" + Arrays.toString(xy) + ", alert='" + alert + '\'' + ", effect='" + effect - + '\'' + ", colorloopspeed=" + colorloopspeed + ", transitiontime=" + transitiontime + '}'; + return "GroupAction{on=" + on + ", toggle=" + toggle + ", bri=" + bri + ", hue=" + hue + ", sat=" + sat + + ", ct=" + ct + ", xy=" + Arrays.toString(xy) + ", alert='" + alert + "', colormode='" + colormode + + "', effect='" + effect + "', colorloopspeed=" + colorloopspeed + ", transitiontime=" + transitiontime + + "}"; } } diff --git a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/GroupThingHandler.java b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/GroupThingHandler.java index 7a30eb98d04ab..d1642cfb967c1 100644 --- a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/GroupThingHandler.java +++ b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/GroupThingHandler.java @@ -59,6 +59,7 @@ public class GroupThingHandler extends DeconzBaseThingHandler { private Map scenes = Map.of(); private GroupState groupStateCache = new GroupState(); + private String colorMode = ""; public GroupThingHandler(Thing thing, Gson gson, DeconzDynamicCommandDescriptionProvider commandDescriptionProvider) { @@ -66,6 +67,14 @@ public GroupThingHandler(Thing thing, Gson gson, this.commandDescriptionProvider = commandDescriptionProvider; } + @Override + public void initialize() { + ThingConfig thingConfig = getConfigAs(ThingConfig.class); + colorMode = thingConfig.colormode; + + super.initialize(); + } + @Override public void handleCommand(ChannelUID channelUID, Command command) { String channelId = channelUID.getId(); @@ -89,11 +98,17 @@ public void handleCommand(ChannelUID channelUID, Command command) { case CHANNEL_COLOR: if (command instanceof HSBType) { HSBType hsbCommand = (HSBType) command; - Integer bri = Util.fromPercentType(hsbCommand.getBrightness()); - newGroupAction.bri = bri; - if (bri > 0) { + // XY color is the implicit default: Use XY color mode if i) no color mode is set or ii) if the bulb + // is in CT mode or iii) already in XY mode. Only if the bulb is in HS mode, use this one. + if ("hs".equals(colorMode)) { newGroupAction.hue = (int) (hsbCommand.getHue().doubleValue() * HUE_FACTOR); newGroupAction.sat = Util.fromPercentType(hsbCommand.getSaturation()); + } else { + PercentType[] xy = hsbCommand.toXY(); + if (xy.length < 2) { + logger.warn("Failed to convert {} to xy-values", command); + } + newGroupAction.xy = new double[] { xy[0].doubleValue() / 100.0, xy[1].doubleValue() / 100.0 }; } } else if (command instanceof PercentType) { newGroupAction.bri = Util.fromPercentType((PercentType) command); @@ -172,6 +187,16 @@ public void messageReceived(String sensorID, DeconzBaseMessage message) { thing.getChannels().stream().map(c -> c.getUID().getId()).forEach(c -> valueUpdated(c, groupState)); groupStateCache = groupState; } + GroupAction groupAction = groupMessage.action; + if (groupAction != null) { + if (colorMode.isEmpty()) { + String cmode = groupAction.colormode; + if (cmode != null && ("hs".equals(cmode) || "xy".equals(cmode))) { + // only set the color mode if it is hs or xy, not ct + colorMode = cmode; + } + } + } } } } diff --git a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java index 4a6a81328b481..3a5594629b57b 100644 --- a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java +++ b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java @@ -210,19 +210,19 @@ public void handleCommand(ChannelUID channelUID, Command command) { } } else if (command instanceof HSBType) { HSBType hsbCommand = (HSBType) command; - if ("xy".equals(colorMode)) { + // XY color is the implicit default: Use XY color mode if i) no color mode is set or ii) if the bulb + // is in CT mode or iii) already in XY mode. Only if the bulb is in HS mode, use this one. + if ("hs".equals(colorMode)) { + newLightState.hue = (int) (hsbCommand.getHue().doubleValue() * HUE_FACTOR); + newLightState.sat = Util.fromPercentType(hsbCommand.getSaturation()); + } else { PercentType[] xy = hsbCommand.toXY(); if (xy.length < 2) { logger.warn("Failed to convert {} to xy-values", command); } newLightState.xy = new double[] { xy[0].doubleValue() / 100.0, xy[1].doubleValue() / 100.0 }; - newLightState.bri = Util.fromPercentType(hsbCommand.getBrightness()); - } else { - // default is colormode "hs" (used when colormode "hs" is set or colormode is unknown) - newLightState.bri = Util.fromPercentType(hsbCommand.getBrightness()); - newLightState.hue = (int) (hsbCommand.getHue().doubleValue() * HUE_FACTOR); - newLightState.sat = Util.fromPercentType(hsbCommand.getSaturation()); } + newLightState.bri = Util.fromPercentType(hsbCommand.getBrightness()); } else if (command instanceof PercentType) { newLightState.bri = Util.fromPercentType((PercentType) command); } else if (command instanceof DecimalType) { diff --git a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/ThingConfig.java b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/ThingConfig.java index 9d26ba31dc55c..a3c69e82a700b 100644 --- a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/ThingConfig.java +++ b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/ThingConfig.java @@ -23,7 +23,7 @@ @NonNullByDefault public class ThingConfig { public String id = ""; - public int lastSeenPolling = 1440; public @Nullable Double transitiontime; public String colormode = ""; + public int lastSeenPolling = 1440; } diff --git a/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/config/config.xml b/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/config/config.xml index dc7cc06655109..bd0b4fab2fc77 100644 --- a/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/config/config.xml +++ b/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/config/config.xml @@ -10,23 +10,23 @@ network-address IP address or host name of deCONZ interface. - + Port of the deCONZ HTTP interface. 80 - + Port of the deCONZ Websocket. true - + password If no API Key is provided, a new one will be requested. You need to authorize the access on the deCONZ web interface. - + Timeout for asynchronous HTTP requests (in milliseconds). true @@ -52,7 +52,7 @@ The deCONZ bridge assigns an integer number ID to each device. - + Time to move between two states. If empty, the default of the device is used. Resolution is 1/10 second. @@ -63,11 +63,11 @@ The deCONZ bridge assigns an integer number ID to each device. - + Time to move between two states. If empty, the default of the device is used. Resolution is 1/10 second. - + Override the default color mode (auto-detect) @@ -78,4 +78,19 @@ + + + + The deCONZ bridge assigns an integer number ID to each group. + + + + Override the default color mode (auto-detect) + + + + + true + + diff --git a/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/thing/group-thing-types.xml b/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/thing/group-thing-types.xml index dda79246633f2..7a0fb8266e982 100644 --- a/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/thing/group-thing-types.xml +++ b/bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/thing/group-thing-types.xml @@ -21,7 +21,7 @@ uid - + From 3d3cdf388920731f837d0d1785bc5a54ad59a9d3 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 24 Jul 2021 15:25:44 -0400 Subject: [PATCH 4/6] [haywardomnilogic] Remove erroneous chlorinator code from filterhandler (#11028) * Removed erroneous chlorinator code from filterhandler Signed-off-by: Matt Myers --- .../internal/handler/HaywardFilterHandler.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bundles/org.openhab.binding.haywardomnilogic/src/main/java/org/openhab/binding/haywardomnilogic/internal/handler/HaywardFilterHandler.java b/bundles/org.openhab.binding.haywardomnilogic/src/main/java/org/openhab/binding/haywardomnilogic/internal/handler/HaywardFilterHandler.java index edf7a96d33b05..4c0dc646381e5 100644 --- a/bundles/org.openhab.binding.haywardomnilogic/src/main/java/org/openhab/binding/haywardomnilogic/internal/handler/HaywardFilterHandler.java +++ b/bundles/org.openhab.binding.haywardomnilogic/src/main/java/org/openhab/binding/haywardomnilogic/internal/handler/HaywardFilterHandler.java @@ -61,10 +61,6 @@ public void getTelemetry(String xmlResponse) throws HaywardException { String thingSystemID = getThing().getUID().getId(); for (int i = 0; i < systemIDs.size(); i++) { if (systemIDs.get(i).equals(thingSystemID)) { - // Operating Mode - data = bridgehandler.evaluateXPath("//Chlorinator/@operatingMode", xmlResponse); - updateData(HaywardBindingConstants.CHANNEL_CHLORINATOR_OPERATINGMODE, data.get(i)); - // Valve Position data = bridgehandler.evaluateXPath("//Filter/@valvePosition", xmlResponse); updateData(HaywardBindingConstants.CHANNEL_FILTER_VALVEPOSITION, data.get(i)); From e23a0de94a84598fb7f8fe472bdd8856a81d5741 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Sat, 24 Jul 2021 21:27:01 +0200 Subject: [PATCH 5/6] [homeassistant/homie] Standardize config URI (#11021) * [homeassistant/homie] Standardize config URI Signed-off-by: Laurent Garnier --- .../homeassistant/generic/internal/MqttBindingConstants.java | 2 +- .../resources/OH-INF/config/homeassistant-channel-config.xml | 2 +- .../mqtt/homie/generic/internal/MqttBindingConstants.java | 2 +- .../src/main/resources/OH-INF/config/homie-channel-config.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/generic/internal/MqttBindingConstants.java b/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/generic/internal/MqttBindingConstants.java index ddcd6dca1573d..39d11f1c67112 100644 --- a/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/generic/internal/MqttBindingConstants.java +++ b/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/generic/internal/MqttBindingConstants.java @@ -29,5 +29,5 @@ public class MqttBindingConstants { // List of all Thing Type UIDs public static final ThingTypeUID HOMEASSISTANT_MQTT_THING = new ThingTypeUID(BINDING_ID, "homeassistant"); - public static final String CONFIG_HA_CHANNEL = "mqtt:ha_channel"; + public static final String CONFIG_HA_CHANNEL = "channel-type:mqtt:ha-channel"; } diff --git a/bundles/org.openhab.binding.mqtt.homeassistant/src/main/resources/OH-INF/config/homeassistant-channel-config.xml b/bundles/org.openhab.binding.mqtt.homeassistant/src/main/resources/OH-INF/config/homeassistant-channel-config.xml index d1c27cced9c93..64cbf21ea2977 100644 --- a/bundles/org.openhab.binding.mqtt.homeassistant/src/main/resources/OH-INF/config/homeassistant-channel-config.xml +++ b/bundles/org.openhab.binding.mqtt.homeassistant/src/main/resources/OH-INF/config/homeassistant-channel-config.xml @@ -4,7 +4,7 @@ xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0" xsi:schemaLocation="https://openhab.org/schemas/config-description/v1.0.0 https://openhab.org/schemas/config-description-1.0.0.xsd"> - + HomeAssistant component type (e.g. binary_sensor, switch, light) diff --git a/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/generic/internal/MqttBindingConstants.java b/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/generic/internal/MqttBindingConstants.java index 0f423f363eb2c..8ed20a9b59763 100644 --- a/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/generic/internal/MqttBindingConstants.java +++ b/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/generic/internal/MqttBindingConstants.java @@ -29,7 +29,7 @@ public class MqttBindingConstants { // List of all Thing Type UIDs public static final ThingTypeUID HOMIE300_MQTT_THING = new ThingTypeUID(BINDING_ID, "homie300"); - public static final String CONFIG_HOMIE_CHANNEL = "mqtt:homie_channel"; + public static final String CONFIG_HOMIE_CHANNEL = "channel-type:mqtt:homie-channel"; public static final String HOMIE_PROPERTY_VERSION = "homieversion"; public static final String HOMIE_PROPERTY_HEARTBEAT_INTERVAL = "heartbeat_interval"; diff --git a/bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/config/homie-channel-config.xml b/bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/config/homie-channel-config.xml index 741a1369644e3..83e50a30bb535 100644 --- a/bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/config/homie-channel-config.xml +++ b/bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/config/homie-channel-config.xml @@ -4,7 +4,7 @@ xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0" xsi:schemaLocation="https://openhab.org/schemas/config-description/v1.0.0 https://openhab.org/schemas/config-description-1.0.0.xsd"> - + The channels unit From cf6729adefaaedec2440567393d06abfbff4e501 Mon Sep 17 00:00:00 2001 From: nimric <55734294+nimric@users.noreply.github.com> Date: Sat, 24 Jul 2021 21:29:15 +0200 Subject: [PATCH 6/6] [jdbc] Select the proper schema when retrieving the item tables (#11023) Signed-off-by: Riccardo Nimser-Joseph --- .../openhab/persistence/jdbc/db/JdbcPostgresqlDAO.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcPostgresqlDAO.java b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcPostgresqlDAO.java index 45e50b84ace8d..883c85d44f791 100644 --- a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcPostgresqlDAO.java +++ b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcPostgresqlDAO.java @@ -52,7 +52,8 @@ private void initSqlQueries() { sqlIfTableExists = "SELECT * FROM PG_TABLES WHERE TABLENAME='#searchTable#'"; sqlCreateItemsTableIfNot = "CREATE TABLE IF NOT EXISTS #itemsManageTable# (itemid SERIAL NOT NULL, #colname# #coltype# NOT NULL, CONSTRAINT #itemsManageTable#_pkey PRIMARY KEY (itemid))"; sqlCreateNewEntryInItemsTable = "INSERT INTO items (itemname) SELECT itemname FROM #itemsManageTable# UNION VALUES ('#itemname#') EXCEPT SELECT itemname FROM items"; - sqlGetItemTables = "SELECT table_name FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_schema='public' AND NOT table_name='#itemsManageTable#'"; + sqlGetItemTables = "SELECT table_name FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_schema=(SELECT table_schema " + + "FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_name='#itemsManageTable#') AND NOT table_name='#itemsManageTable#'"; // http://stackoverflow.com/questions/17267417/how-do-i-do-an-upsert-merge-insert-on-duplicate-update-in-postgresql // for later use, PostgreSql > 9.5 to prevent PRIMARY key violation use: // SQL_INSERT_ITEM_VALUE = "INSERT INTO #tableName# (TIME, VALUE) VALUES( NOW(), CAST( ? as #dbType#) ) ON @@ -121,9 +122,10 @@ public Long doCreateNewEntryInItemsTable(ItemsVO vo) { @Override public List doGetItemTables(ItemsVO vo) { - String sql = StringUtilsExt.replaceArrayMerge(sqlGetItemTables, new String[] { "#itemsManageTable#" }, - new String[] { vo.getItemsManageTable() }); - logger.debug("JDBC::doGetItemTables sql={}", sql); + String sql = StringUtilsExt.replaceArrayMerge(this.sqlGetItemTables, + new String[] { "#itemsManageTable#", "#itemsManageTable#" }, + new String[] { vo.getItemsManageTable(), vo.getItemsManageTable() }); + this.logger.debug("JDBC::doGetItemTables sql={}", sql); return Yank.queryBeanList(sql, ItemsVO.class, null); }