Skip to content

Commit c1abdb6

Browse files
authored
set status description if software update pending (#20658)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
1 parent ee6ebad commit c1abdb6

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/handler/HomematicThingHandler.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import org.openhab.core.thing.Thing;
5656
import org.openhab.core.thing.ThingStatus;
5757
import org.openhab.core.thing.ThingStatusDetail;
58+
import org.openhab.core.thing.ThingStatusInfo;
5859
import org.openhab.core.thing.binding.BaseThingHandler;
5960
import org.openhab.core.thing.binding.ThingHandler;
6061
import org.openhab.core.thing.binding.builder.ChannelBuilder;
@@ -520,6 +521,8 @@ private void updateStatus(HmDevice device) throws GatewayNotAvailableException,
520521
if (oldStatus == ThingStatus.UNINITIALIZED) {
521522
return;
522523
}
524+
ThingStatusInfo oldStatusInfo = thing.getStatusInfo();
525+
String newDescription = null;
523526
ThingStatus newStatus = ThingStatus.ONLINE;
524527
ThingStatusDetail newDetail = ThingStatusDetail.NONE;
525528

@@ -532,12 +535,16 @@ private void updateStatus(HmDevice device) throws GatewayNotAvailableException,
532535
} else if (device.isUnreach()) {
533536
newStatus = ThingStatus.OFFLINE;
534537
newDetail = ThingStatusDetail.COMMUNICATION_ERROR;
535-
} else if (device.isConfigPending() || device.isUpdatePending()) {
538+
} else if (device.isConfigPending()) {
536539
newDetail = ThingStatusDetail.CONFIGURATION_PENDING;
540+
} else if (device.isUpdatePending()) {
541+
// don't set newStatus or newDetail; just add status description indicating update pending
542+
newDescription = "@text/status.update-pending";
537543
}
538544

539-
if (thing.getStatus() != newStatus || thing.getStatusInfo().getStatusDetail() != newDetail) {
540-
updateStatus(newStatus, newDetail);
545+
if (oldStatus != newStatus || oldStatusInfo.getStatusDetail() != newDetail
546+
|| !Objects.equals(oldStatusInfo.getDescription(), newDescription)) {
547+
updateStatus(newStatus, newDetail, newDescription);
541548
}
542549
if (oldStatus == ThingStatus.OFFLINE && newStatus == ThingStatus.ONLINE) {
543550
initialize();

bundles/org.openhab.binding.homematic/src/main/resources/OH-INF/i18n/homematic.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,12 @@ thing-type.config.homematic.bridge.xmlCallbackPort.description = Callback port o
6060

6161
channel-type.homematic.DUTY_CYCLE_RATIO.label = Duty Cycle
6262
channel-type.homematic.DUTY_CYCLE_RATIO.description = Current duty cycle usage
63+
64+
channel-type.config.homematic.config.delay.label = Delay
65+
channel-type.config.homematic.config.delay.description = Delays transmission of a command to the Homematic gateway, duplicate commands are filtered out (in seconds)
66+
channel-type.config.homematic.config.receiveDelay.label = Receive Delay
67+
channel-type.config.homematic.config.receiveDelay.description = Delays a received event from the Homematic gateway, duplicate events are filtered out (in seconds)
68+
69+
# thing status descriptions
70+
71+
status.update-pending = Software update pending

0 commit comments

Comments
 (0)