[hue] show friends of hue battery sensors as online (#17878)

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
Andrew Fiddian-Green 2024-12-10 19:52:44 +00:00 committed by GitHub
parent 93e0723bbb
commit 91d6b62dd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -12,6 +12,8 @@
*/
package org.openhab.binding.hue.internal.api.dto.clip2.enums;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
@ -27,6 +29,8 @@ public enum ZigbeeStatus {
CONNECTIVITY_ISSUE,
UNIDIRECTIONAL_INCOMING;
private static final Set<ZigbeeStatus> CONNECTIVITY_ISSUES = Set.of(DISCONNECTED, CONNECTIVITY_ISSUE);
public static ZigbeeStatus of(@Nullable String value) {
if (value != null) {
try {
@ -43,4 +47,11 @@ public enum ZigbeeStatus {
String s = this.name().replace("_", " ");
return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
}
/**
* Return true if the status is a connectivity issue
*/
public boolean isConnectivityIssue() {
return CONNECTIVITY_ISSUES.contains(this);
}
}

View File

@ -1045,7 +1045,7 @@ public class Clip2ThingHandler extends BaseThingHandler {
if (Objects.nonNull(zigbeeStatus)) {
logger.debug("{} -> updateConnectivityState() thingStatus:{}, zigbeeStatus:{}", resourceId,
thing.getStatus(), zigbeeStatus);
hasConnectivityIssue = zigbeeStatus != ZigbeeStatus.CONNECTED;
hasConnectivityIssue = zigbeeStatus.isConnectivityIssue();
if (hasConnectivityIssue) {
if (thing.getStatusInfo().getStatusDetail() != ThingStatusDetail.COMMUNICATION_ERROR) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE,