From 2884d1ca67c781a8875f47d114707458905c2e4a Mon Sep 17 00:00:00 2001 From: Stewart Cossey Date: Fri, 10 Dec 2021 00:35:29 +1300 Subject: [PATCH] Fix smart water alert level. (#11734) Signed-off-by: Stewart Cossey Signed-off-by: Michael Schmidt --- .../binding/nzwateralerts/internal/api/SmartWater.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.nzwateralerts/src/main/java/org/openhab/binding/nzwateralerts/internal/api/SmartWater.java b/bundles/org.openhab.binding.nzwateralerts/src/main/java/org/openhab/binding/nzwateralerts/internal/api/SmartWater.java index 9d4b9c590d39c..4f09393fe6446 100644 --- a/bundles/org.openhab.binding.nzwateralerts/src/main/java/org/openhab/binding/nzwateralerts/internal/api/SmartWater.java +++ b/bundles/org.openhab.binding.nzwateralerts/src/main/java/org/openhab/binding/nzwateralerts/internal/api/SmartWater.java @@ -36,7 +36,7 @@ public class SmartWater implements WaterWebService { private static final String REGION_WAIKATO = "/alert-levels/waikato-district-council"; private static final String REGION_WAIPA = "/alert-levels/waipa-district-council"; - private static final String PATTERN = "/assets/Alert-Level-Images/water-alert-([1-4]|no)-large.svg.*?"; + private static final String PATTERN = "/assets/Alert-Level-Images/(?:water-alert-([1-4]|no)-large|(save)-wai-logo).svg.*?"; private static final Pattern REGEX = Pattern.compile(PATTERN, Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL); @@ -66,8 +66,10 @@ public int findWaterLevel(final String data, final String area) { while (matches.find()) { String level = matches.group(1); + final String altMsgs = matches.group(2); + logger.debug("Data Level {}", level); - if (level.equalsIgnoreCase("no")) { + if ("no".equalsIgnoreCase(level) || "save".equalsIgnoreCase(altMsgs)) { logger.debug("Convert Data Level to 0"); level = "0"; }