Skip to content

Commit

Permalink
Fix smart water alert level. (openhab#11734)
Browse files Browse the repository at this point in the history
Signed-off-by: Stewart Cossey <[email protected]>
Signed-off-by: Michael Schmidt <[email protected]>
  • Loading branch information
Cossey authored and mischmidt83 committed Jan 9, 2022
1 parent 8748a9f commit 2884d1c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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";
}
Expand Down

0 comments on commit 2884d1c

Please sign in to comment.