mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[hue] show friends of hue battery sensors as online (#17878)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
e78b51ef32
commit
030012b106
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user