From bf1754e4c084b41663b537a3a07fae19c3bc70ba Mon Sep 17 00:00:00 2001 From: Christoph Weitkamp Date: Wed, 30 Dec 2020 15:59:35 +0100 Subject: [PATCH] [dwdunwetter] Fixed channel update (#9594) Signed-off-by: Christoph Weitkamp --- .../internal/handler/DwdUnwetterHandler.java | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/bundles/org.openhab.binding.dwdunwetter/src/main/java/org/openhab/binding/dwdunwetter/internal/handler/DwdUnwetterHandler.java b/bundles/org.openhab.binding.dwdunwetter/src/main/java/org/openhab/binding/dwdunwetter/internal/handler/DwdUnwetterHandler.java index b85448c8cf2c1..1f8dc3898e0ad 100644 --- a/bundles/org.openhab.binding.dwdunwetter/src/main/java/org/openhab/binding/dwdunwetter/internal/handler/DwdUnwetterHandler.java +++ b/bundles/org.openhab.binding.dwdunwetter/src/main/java/org/openhab/binding/dwdunwetter/internal/handler/DwdUnwetterHandler.java @@ -106,25 +106,26 @@ private void refresh() { for (int i = 0; i < warningCount; i++) { State warning = warningsData.getWarning(i); + int warningNumber = i + 1; if (warning == OnOffType.OFF) { - updateState(getChannelUuid(CHANNEL_WARNING, i), warning); + updateState(getChannelUuid(CHANNEL_WARNING, warningNumber), warning); } - updateState(getChannelUuid(CHANNEL_SEVERITY, i), warningsData.getSeverity(i)); - updateState(getChannelUuid(CHANNEL_DESCRIPTION, i), warningsData.getDescription(i)); - updateState(getChannelUuid(CHANNEL_EFFECTIVE, i), warningsData.getEffective(i)); - updateState(getChannelUuid(CHANNEL_EXPIRES, i), warningsData.getExpires(i)); - updateState(getChannelUuid(CHANNEL_ONSET, i), warningsData.getOnset(i)); - updateState(getChannelUuid(CHANNEL_EVENT, i), warningsData.getEvent(i)); - updateState(getChannelUuid(CHANNEL_HEADLINE, i), warningsData.getHeadline(i)); - updateState(getChannelUuid(CHANNEL_ALTITUDE, i), warningsData.getAltitude(i)); - updateState(getChannelUuid(CHANNEL_CEILING, i), warningsData.getCeiling(i)); - updateState(getChannelUuid(CHANNEL_INSTRUCTION, i), warningsData.getInstruction(i)); - updateState(getChannelUuid(CHANNEL_URGENCY, i), warningsData.getUrgency(i)); + updateState(getChannelUuid(CHANNEL_SEVERITY, warningNumber), warningsData.getSeverity(i)); + updateState(getChannelUuid(CHANNEL_DESCRIPTION, warningNumber), warningsData.getDescription(i)); + updateState(getChannelUuid(CHANNEL_EFFECTIVE, warningNumber), warningsData.getEffective(i)); + updateState(getChannelUuid(CHANNEL_EXPIRES, warningNumber), warningsData.getExpires(i)); + updateState(getChannelUuid(CHANNEL_ONSET, warningNumber), warningsData.getOnset(i)); + updateState(getChannelUuid(CHANNEL_EVENT, warningNumber), warningsData.getEvent(i)); + updateState(getChannelUuid(CHANNEL_HEADLINE, warningNumber), warningsData.getHeadline(i)); + updateState(getChannelUuid(CHANNEL_ALTITUDE, warningNumber), warningsData.getAltitude(i)); + updateState(getChannelUuid(CHANNEL_CEILING, warningNumber), warningsData.getCeiling(i)); + updateState(getChannelUuid(CHANNEL_INSTRUCTION, warningNumber), warningsData.getInstruction(i)); + updateState(getChannelUuid(CHANNEL_URGENCY, warningNumber), warningsData.getUrgency(i)); if (warning == OnOffType.ON) { - updateState(getChannelUuid(CHANNEL_WARNING, i), warning); + updateState(getChannelUuid(CHANNEL_WARNING, warningNumber), warning); } if (warningsData.isNew(i)) { - triggerChannel(getChannelUuid(CHANNEL_UPDATED, i), "NEW"); + triggerChannel(getChannelUuid(CHANNEL_UPDATED, warningNumber), "NEW"); } }