From 29528e37f93a8fc8c6eb52478e8ff130c5279ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20B=C3=B6hm?= Date: Thu, 26 Mar 2020 22:06:30 +0100 Subject: [PATCH] minor fixes --- .../comfoair/internal/ComfoAirHandler.java | 19 ++++++++++++------- .../resources/ESH-INF/thing/thing-types.xml | 6 +++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/bundles/org.openhab.binding.comfoair/src/main/java/org/openhab/binding/comfoair/internal/ComfoAirHandler.java b/bundles/org.openhab.binding.comfoair/src/main/java/org/openhab/binding/comfoair/internal/ComfoAirHandler.java index da1bce2efb65a..0dee22b9c7d10 100644 --- a/bundles/org.openhab.binding.comfoair/src/main/java/org/openhab/binding/comfoair/internal/ComfoAirHandler.java +++ b/bundles/org.openhab.binding.comfoair/src/main/java/org/openhab/binding/comfoair/internal/ComfoAirHandler.java @@ -146,15 +146,20 @@ public void initialize() { } if (comfoAirConnector != null) { comfoAirConnector.open(); - updateStatus(ThingStatus.ONLINE); + if (comfoAirConnector != null && comfoAirConnector.isConnected()) { + updateStatus(ThingStatus.ONLINE); - List channels = this.thing.getChannels(); + List channels = this.thing.getChannels(); - poller = scheduler.scheduleWithFixedDelay(() -> { - for (Channel channel : channels) { - updateChannelState(channel); - } - }, 0, (config.refreshInterval > 0) ? config.refreshInterval : DEFAULT_REFRESH_INTERVAL, TimeUnit.SECONDS); + poller = scheduler.scheduleWithFixedDelay(() -> { + for (Channel channel : channels) { + updateChannelState(channel); + } + }, 0, (config.refreshInterval > 0) ? config.refreshInterval : DEFAULT_REFRESH_INTERVAL, + TimeUnit.SECONDS); + } else { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); + } } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); } diff --git a/bundles/org.openhab.binding.comfoair/src/main/resources/ESH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.comfoair/src/main/resources/ESH-INF/thing/thing-types.xml index b99b012c477fe..f232a5660d3af 100644 --- a/bundles/org.openhab.binding.comfoair/src/main/resources/ESH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.comfoair/src/main/resources/ESH-INF/thing/thing-types.xml @@ -188,7 +188,7 @@ - + @@ -204,7 +204,7 @@ - + @@ -218,7 +218,7 @@ - +