From 541308d0fec0aa86edb80cfc032b35c3a99ec475 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Fri, 27 Aug 2021 23:37:43 +0200 Subject: [PATCH] Added constants for TCP port and poll interval in seconds. Fixes #11167 Signed-off-by: Jacob Laursen --- .../danfossairunit/internal/DanfossAirUnitHandler.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitHandler.java b/bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitHandler.java index f1bc9ddb1cb23..6721c8c959205 100644 --- a/bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitHandler.java +++ b/bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitHandler.java @@ -44,6 +44,8 @@ @NonNullByDefault public class DanfossAirUnitHandler extends BaseThingHandler { + private static final int TCP_PORT = 30046; + private static final int POLLING_INTERVAL_SECONDS = 5; private final Logger logger = LoggerFactory.getLogger(DanfossAirUnitHandler.class); private @NonNullByDefault({}) DanfossAirUnitConfiguration config; private @Nullable ValueCache valueCache; @@ -86,7 +88,7 @@ public void initialize() { config = getConfigAs(DanfossAirUnitConfiguration.class); valueCache = new ValueCache(config.updateUnchangedValuesEveryMillis); try { - DanfossAirUnit danfossAirUnit = new DanfossAirUnit(InetAddress.getByName(config.host), 30046); + DanfossAirUnit danfossAirUnit = new DanfossAirUnit(InetAddress.getByName(config.host), TCP_PORT); hrv = danfossAirUnit; scheduler.execute(() -> { try { @@ -151,8 +153,8 @@ public void dispose() { } private synchronized void startPolling() { - pollingJob = scheduler.scheduleWithFixedDelay(this::updateAllChannels, 5, config.refreshInterval, - TimeUnit.SECONDS); + pollingJob = scheduler.scheduleWithFixedDelay(this::updateAllChannels, POLLING_INTERVAL_SECONDS, + config.refreshInterval, TimeUnit.SECONDS); } private synchronized void stopPolling() {