]> git.basschouten.com Git - openhab-addons.git/commitdiff
[freeboxos] Avoid useless API requests (server/player) (#17237)
authorlolodomo <lg.hc@free.fr>
Tue, 13 Aug 2024 14:38:26 +0000 (16:38 +0200)
committerGitHub <noreply@github.com>
Tue, 13 Aug 2024 14:38:26 +0000 (16:38 +0200)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/FreeboxOsBindingConstants.java
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ActivePlayerHandler.java
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ApiConsumerHandler.java
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ApiConsumerIntf.java
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/HostHandler.java
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/RepeaterHandler.java
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/RevolutionHandler.java
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ServerHandler.java
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/VmHandler.java
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/WifiStationHandler.java

index 26710fd7d7277c5f468e3b8d6ff596545bcc2c78..f9042be5c3bff8653bd5e1db97212405160104dc 100644 (file)
@@ -89,15 +89,16 @@ public class FreeboxOsBindingConstants {
     // List of all Group Channel ids
     public static final String GROUP_SENSORS = "sensors";
     public static final String GROUP_FANS = "fans";
-    public static final String CONNECTION_STATUS = "connection-status";
-    public static final String SYS_INFO = "sysinfo";
-    public static final String ACTIONS = "actions";
-    public static final String FILE_SHARING = "file-sharing";
-    public static final String CONNECTIVITY = "connectivity";
-    public static final String DISPLAY = "display";
-    public static final String VM_STATUS = "vmstatus";
+    public static final String GROUP_CONNECTION_STATUS = "connection-status";
+    public static final String GROUP_SYS_INFO = "sysinfo";
+    public static final String GROUP_ACTIONS = "actions";
+    public static final String GROUP_PLAYER_STATUS = "player-status";
+    public static final String GROUP_FILE_SHARING = "file-sharing";
+    public static final String GROUP_CONNECTIVITY = "connectivity";
+    public static final String GROUP_DISPLAY = "display";
+    public static final String GROUP_VM_STATUS = "vmstatus";
     public static final String GROUP_WIFI = "wifi";
-    public static final String REPEATER_MISC = "repeater-misc";
+    public static final String GROUP_REPEATER_MISC = "repeater-misc";
 
     // List of all Channel ids
     public static final String RSSI = "rssi";
@@ -122,6 +123,7 @@ public class FreeboxOsBindingConstants {
     public static final String BYTES_DOWN = "bytes-down";
     public static final String BW = "bandwidth";
     public static final String PCT_BW = "bandwidth-usage";
+    public static final String CONNECTION_STATUS = "connection-status";
     public static final String ONHOOK = "onhook";
     public static final String RINGING = "ringing";
     public static final String HARDWARE_STATUS = "hardware-status";
index e47f0d6d47e956734d4034b61ac2772d46521e68..d459ae86f1c68b68c62823471a6b8cc69aab02e2 100644 (file)
@@ -17,6 +17,7 @@ import static org.openhab.binding.freeboxos.internal.FreeboxOsBindingConstants.*
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.openhab.binding.freeboxos.internal.action.ActivePlayerActions;
@@ -52,7 +53,7 @@ public class ActivePlayerHandler extends PlayerHandler implements FreeDeviceIntf
     public ActivePlayerHandler(Thing thing) {
         super(thing);
         statusDrivenByLanConnectivity = false;
-        eventChannelUID = new ChannelUID(getThing().getUID(), SYS_INFO, BOX_EVENT);
+        eventChannelUID = new ChannelUID(getThing().getUID(), GROUP_SYS_INFO, BOX_EVENT);
     }
 
     @Override
@@ -90,12 +91,14 @@ public class ActivePlayerHandler extends PlayerHandler implements FreeDeviceIntf
                 updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "@text/info-player-not-reachable");
             }
             if (player.reachable()) {
-                Status status = getManager(PlayerManager.class).getPlayerStatus(getClientId());
-                if (status != null) {
-                    updateChannelString(PLAYER_STATUS, PLAYER_STATUS, status.powerState().name());
-                    ForegroundApp foreground = status.foregroundApp();
-                    if (foreground != null) {
-                        updateChannelString(PLAYER_STATUS, PACKAGE, foreground._package());
+                if (anyChannelLinked(GROUP_PLAYER_STATUS, Set.of(PLAYER_STATUS, PACKAGE))) {
+                    Status status = getManager(PlayerManager.class).getPlayerStatus(getClientId());
+                    if (status != null) {
+                        updateChannelString(GROUP_PLAYER_STATUS, PLAYER_STATUS, status.powerState().name());
+                        ForegroundApp foreground = status.foregroundApp();
+                        if (foreground != null) {
+                            updateChannelString(GROUP_PLAYER_STATUS, PACKAGE, foreground._package());
+                        }
                     }
                 }
                 Configuration config = getManager(PlayerManager.class).getConfig(getClientId());
@@ -105,7 +108,7 @@ public class ActivePlayerHandler extends PlayerHandler implements FreeDeviceIntf
                     uptime = 0;
                 }
             }
-            updateChannelQuantity(SYS_INFO, UPTIME, uptime, Units.SECOND);
+            updateChannelQuantity(GROUP_SYS_INFO, UPTIME, uptime, Units.SECOND);
         } else {
             logger.debug("{}: poll with reachable={}", thing.getUID(), reachable);
             updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "@text/info-player-not-reachable");
index aa1b5dae03133b8a8380b04f7cd822440b566980..0e7d1ef52684d807362dfd3e0bd6aee08adaad0d 100644 (file)
@@ -17,6 +17,7 @@ import java.time.ZonedDateTime;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
 
@@ -355,6 +356,12 @@ public abstract class ApiConsumerHandler extends BaseThingHandler implements Api
         super.updateProperties(properties);
     }
 
+    @Override
+    public boolean anyChannelLinked(String groupId, Set<String> channelSet) {
+        return channelSet.stream().map(id -> new ChannelUID(getThing().getUID(), groupId, id))
+                .anyMatch(uid -> isLinked(uid));
+    }
+
     @Override
     public Configuration getConfig() {
         return super.getConfig();
index f291199679a71da4e566752c9f361af9c583e654..5ed1ce9f6c323f623d34bd946ccb212a400a9f51 100644 (file)
@@ -14,6 +14,7 @@ package org.openhab.binding.freeboxos.internal.handler;
 
 import java.math.BigDecimal;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
@@ -45,6 +46,8 @@ public interface ApiConsumerIntf extends ThingHandler {
 
     void updateStatus(ThingStatus status, ThingStatusDetail statusDetail, @Nullable String description);
 
+    boolean anyChannelLinked(String groupId, Set<String> channelSet);
+
     void stopJobs();
 
     void addJob(String name, Runnable command, long initialDelay, long delay, TimeUnit unit);
index 4a238d001e1e5dbe8731d534c1799153d490b46e..798192d6936530e9cb2242ab0e2765756e4167c9 100644 (file)
@@ -119,9 +119,9 @@ public class HostHandler extends ApiConsumerHandler {
 
     public void updateConnectivityChannels(LanHost host) {
         logger.debug("{}: updateConnectivityChannels with host.reachable() = {}", thing.getUID(), host.reachable());
-        updateChannelOnOff(CONNECTIVITY, REACHABLE, host.reachable());
-        updateChannelDateTimeState(CONNECTIVITY, LAST_SEEN, host.getLastSeen());
-        updateChannelString(CONNECTIVITY, IP_ADDRESS, host.getIpv4());
+        updateChannelOnOff(GROUP_CONNECTIVITY, REACHABLE, host.reachable());
+        updateChannelDateTimeState(GROUP_CONNECTIVITY, LAST_SEEN, host.getLastSeen());
+        updateChannelString(GROUP_CONNECTIVITY, IP_ADDRESS, host.getIpv4());
         if (statusDrivenByLanConnectivity) {
             if (host.reachable()) {
                 updateStatus(ThingStatus.ONLINE);
index eaa62f9929005498b692c83144ad495e165729a2..d9bcb20adf1a101e84e205436d5378488e007064 100644 (file)
@@ -48,7 +48,7 @@ public class RepeaterHandler extends HostHandler implements FreeDeviceIntf {
 
     public RepeaterHandler(Thing thing) {
         super(thing);
-        eventChannelUID = new ChannelUID(getThing().getUID(), REPEATER_MISC, BOX_EVENT);
+        eventChannelUID = new ChannelUID(getThing().getUID(), GROUP_REPEATER_MISC, BOX_EVENT);
     }
 
     @Override
@@ -84,21 +84,21 @@ public class RepeaterHandler extends HostHandler implements FreeDeviceIntf {
         RepeaterManager repeaterManager = getManager(RepeaterManager.class);
 
         Repeater repeater = repeaterManager.getDevice(getClientId());
-        updateChannelOnOff(REPEATER_MISC, LED, repeater.ledActivated());
-        updateChannelString(REPEATER_MISC, CONNECTION_STATUS, repeater.connection());
+        updateChannelOnOff(GROUP_REPEATER_MISC, LED, repeater.ledActivated());
+        updateChannelString(GROUP_REPEATER_MISC, CONNECTION_STATUS, repeater.connection());
 
         List<LanHost> hosts = repeaterManager.getRepeaterHosts(getClientId());
-        updateChannelDecimal(REPEATER_MISC, HOST_COUNT, hosts.size());
+        updateChannelDecimal(GROUP_REPEATER_MISC, HOST_COUNT, hosts.size());
 
         uptime = checkUptimeAndFirmware(repeater.getUptimeVal(), uptime, repeater.firmwareVersion());
-        updateChannelQuantity(REPEATER_MISC, UPTIME, uptime, Units.SECOND);
+        updateChannelQuantity(GROUP_REPEATER_MISC, UPTIME, uptime, Units.SECOND);
     }
 
     @Override
     protected boolean internalHandleCommand(String channelId, Command command) throws FreeboxException {
         if (ON_OFF_CLASSES.contains(command.getClass()) && LED.equals(channelId)) {
             getManager(RepeaterManager.class).led(getClientId(), TRUE_COMMANDS.contains(command))
-                    .ifPresent(repeater -> updateChannelOnOff(REPEATER_MISC, LED, repeater.ledActivated()));
+                    .ifPresent(repeater -> updateChannelOnOff(GROUP_REPEATER_MISC, LED, repeater.ledActivated()));
         }
         return super.internalHandleCommand(channelId, command);
     }
index 8c8cbe5ab8213cf83900955ca4328fddb5ebb2b4..b687fdedb57e5aa311fb6bc2add67662be4fb36b 100644 (file)
@@ -15,6 +15,8 @@ package org.openhab.binding.freeboxos.internal.handler;
 import static org.openhab.binding.freeboxos.internal.FreeboxOsBindingConstants.*;
 import static org.openhab.core.library.unit.Units.PERCENT;
 
+import java.util.Set;
+
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.openhab.binding.freeboxos.internal.api.FreeboxException;
 import org.openhab.binding.freeboxos.internal.api.rest.LcdManager;
@@ -66,10 +68,12 @@ public class RevolutionHandler extends ServerHandler {
     @Override
     protected void internalPoll() throws FreeboxException {
         super.internalPoll();
-        Config config = getManager(LcdManager.class).getConfig();
-        updateChannelQuantity(DISPLAY, LCD_BRIGHTNESS, config.brightness(), PERCENT);
-        updateChannelDecimal(DISPLAY, LCD_ORIENTATION, config.orientation());
-        updateChannelOnOff(DISPLAY, LCD_FORCED, config.orientationForced());
+        if (anyChannelLinked(GROUP_DISPLAY, Set.of(LCD_BRIGHTNESS, LCD_ORIENTATION, LCD_FORCED))) {
+            Config config = getManager(LcdManager.class).getConfig();
+            updateChannelQuantity(GROUP_DISPLAY, LCD_BRIGHTNESS, config.brightness(), PERCENT);
+            updateChannelDecimal(GROUP_DISPLAY, LCD_ORIENTATION, config.orientation());
+            updateChannelOnOff(GROUP_DISPLAY, LCD_FORCED, config.orientationForced());
+        }
     }
 
     private void setOrientation(LcdManager manager, Config config, Command command) throws FreeboxException {
index d8fb8cd432caa51bd68e57eec1145731025527c0..8b092d8fb0e2e04a22ff4aadeb871b3f9ec95111 100644 (file)
@@ -68,7 +68,7 @@ public class ServerHandler extends ApiConsumerHandler implements FreeDeviceIntf
 
     public ServerHandler(Thing thing) {
         super(thing);
-        eventChannelUID = new ChannelUID(getThing().getUID(), SYS_INFO, BOX_EVENT);
+        eventChannelUID = new ChannelUID(getThing().getUID(), GROUP_SYS_INFO, BOX_EVENT);
     }
 
     @Override
@@ -115,15 +115,27 @@ public class ServerHandler extends ApiConsumerHandler implements FreeDeviceIntf
         fetchConnectionStatus();
         fetchSystemConfig();
 
-        updateChannelOnOff(ACTIONS, WIFI_STATUS, getManager(WifiManager.class).getStatus());
-        updateChannelOnOff(ACTIONS, AIRMEDIA_STATUS, getManager(AirMediaManager.class).getStatus());
-        updateChannelOnOff(ACTIONS, UPNPAV_STATUS, getManager(UPnPAVManager.class).getStatus());
+        if (anyChannelLinked(GROUP_ACTIONS, Set.of(WIFI_STATUS))) {
+            updateChannelOnOff(GROUP_ACTIONS, WIFI_STATUS, getManager(WifiManager.class).getStatus());
+        }
+        if (anyChannelLinked(GROUP_ACTIONS, Set.of(AIRMEDIA_STATUS))) {
+            updateChannelOnOff(GROUP_ACTIONS, AIRMEDIA_STATUS, getManager(AirMediaManager.class).getStatus());
+        }
+        if (anyChannelLinked(GROUP_ACTIONS, Set.of(UPNPAV_STATUS))) {
+            updateChannelOnOff(GROUP_ACTIONS, UPNPAV_STATUS, getManager(UPnPAVManager.class).getStatus());
+        }
 
-        Samba response = getManager(SambaManager.class).getConfig();
-        updateChannelOnOff(FILE_SHARING, SAMBA_FILE_STATUS, response.fileShareEnabled());
-        updateChannelOnOff(FILE_SHARING, SAMBA_PRINTER_STATUS, response.printShareEnabled());
-        updateChannelOnOff(FILE_SHARING, FTP_STATUS, getManager(FtpManager.class).getStatus());
-        updateChannelOnOff(FILE_SHARING, AFP_FILE_STATUS, getManager(AfpManager.class).getStatus());
+        if (anyChannelLinked(GROUP_FILE_SHARING, Set.of(SAMBA_FILE_STATUS, SAMBA_PRINTER_STATUS))) {
+            Samba response = getManager(SambaManager.class).getConfig();
+            updateChannelOnOff(GROUP_FILE_SHARING, SAMBA_FILE_STATUS, response.fileShareEnabled());
+            updateChannelOnOff(GROUP_FILE_SHARING, SAMBA_PRINTER_STATUS, response.printShareEnabled());
+        }
+        if (anyChannelLinked(GROUP_FILE_SHARING, Set.of(FTP_STATUS))) {
+            updateChannelOnOff(GROUP_FILE_SHARING, FTP_STATUS, getManager(FtpManager.class).getStatus());
+        }
+        if (anyChannelLinked(GROUP_FILE_SHARING, Set.of(AFP_FILE_STATUS))) {
+            updateChannelOnOff(GROUP_FILE_SHARING, AFP_FILE_STATUS, getManager(AfpManager.class).getStatus());
+        }
     }
 
     private void fetchSystemConfig() throws FreeboxException {
@@ -133,33 +145,41 @@ public class ServerHandler extends ApiConsumerHandler implements FreeDeviceIntf
         config.fans().forEach(f -> updateChannelQuantity(GROUP_FANS, f.id(), f.value(), Units.RPM));
 
         uptime = checkUptimeAndFirmware(config.uptimeVal(), uptime, config.firmwareVersion());
-        updateChannelQuantity(SYS_INFO, UPTIME, uptime, Units.SECOND);
+        updateChannelQuantity(GROUP_SYS_INFO, UPTIME, uptime, Units.SECOND);
 
-        LanConfig lanConfig = getManager(LanManager.class).getConfig();
-        updateChannelString(SYS_INFO, IP_ADDRESS, lanConfig.ip());
+        if (anyChannelLinked(GROUP_SYS_INFO, Set.of(IP_ADDRESS))) {
+            LanConfig lanConfig = getManager(LanManager.class).getConfig();
+            updateChannelString(GROUP_SYS_INFO, IP_ADDRESS, lanConfig.ip());
+        }
     }
 
     private void fetchConnectionStatus() throws FreeboxException {
-        Status status = getManager(ConnectionManager.class).getConfig();
-        updateChannelString(CONNECTION_STATUS, LINE_STATUS, status.state());
-        updateChannelString(CONNECTION_STATUS, LINE_TYPE, status.type());
-        updateChannelString(CONNECTION_STATUS, LINE_MEDIA, status.media());
-        updateChannelString(CONNECTION_STATUS, IP_ADDRESS, status.ipv4());
-        updateChannelString(CONNECTION_STATUS, IPV6_ADDRESS, status.ipv6());
-
-        updateRateBandwidth(status.rateUp(), status.bandwidthUp(), "up");
-        updateRateBandwidth(status.rateDown(), status.bandwidthDown(), "down");
-
-        updateChannelQuantity(CONNECTION_STATUS, BYTES_UP, new QuantityType<>(status.bytesUp(), OCTET), GIBIOCTET);
-        updateChannelQuantity(CONNECTION_STATUS, BYTES_DOWN, new QuantityType<>(status.bytesDown(), OCTET), GIBIOCTET);
+        if (anyChannelLinked(GROUP_CONNECTION_STATUS,
+                Set.of(LINE_STATUS, LINE_TYPE, LINE_MEDIA, IP_ADDRESS, IPV6_ADDRESS, BYTES_UP, BYTES_DOWN, RATE + "-up",
+                        BW + "-up", PCT_BW + "-up", RATE + "-down", BW + "-down", PCT_BW + "-down"))) {
+            Status status = getManager(ConnectionManager.class).getConfig();
+            updateChannelString(GROUP_CONNECTION_STATUS, LINE_STATUS, status.state());
+            updateChannelString(GROUP_CONNECTION_STATUS, LINE_TYPE, status.type());
+            updateChannelString(GROUP_CONNECTION_STATUS, LINE_MEDIA, status.media());
+            updateChannelString(GROUP_CONNECTION_STATUS, IP_ADDRESS, status.ipv4());
+            updateChannelString(GROUP_CONNECTION_STATUS, IPV6_ADDRESS, status.ipv6());
+
+            updateRateBandwidth(status.rateUp(), status.bandwidthUp(), "up");
+            updateRateBandwidth(status.rateDown(), status.bandwidthDown(), "down");
+
+            updateChannelQuantity(GROUP_CONNECTION_STATUS, BYTES_UP, new QuantityType<>(status.bytesUp(), OCTET),
+                    GIBIOCTET);
+            updateChannelQuantity(GROUP_CONNECTION_STATUS, BYTES_DOWN, new QuantityType<>(status.bytesDown(), OCTET),
+                    GIBIOCTET);
+        }
     }
 
     private void updateRateBandwidth(long rate, long bandwidth, String orientation) {
         QuantityType<?> rateUp = new QuantityType<>(rate * 8, Units.BIT_PER_SECOND);
         QuantityType<?> bandwidthUp = new QuantityType<>(bandwidth, BIT_PER_SECOND);
-        updateChannelQuantity(CONNECTION_STATUS, RATE + "-" + orientation, rateUp, KILOBIT_PER_SECOND);
-        updateChannelQuantity(CONNECTION_STATUS, BW + "-" + orientation, bandwidthUp, KILOBIT_PER_SECOND);
-        updateChannelQuantity(CONNECTION_STATUS, PCT_BW + "-" + orientation,
+        updateChannelQuantity(GROUP_CONNECTION_STATUS, RATE + "-" + orientation, rateUp, KILOBIT_PER_SECOND);
+        updateChannelQuantity(GROUP_CONNECTION_STATUS, BW + "-" + orientation, bandwidthUp, KILOBIT_PER_SECOND);
+        updateChannelQuantity(GROUP_CONNECTION_STATUS, PCT_BW + "-" + orientation,
                 !bandwidthUp.equals(QuantityType.ZERO) ? rateUp.multiply(HUNDRED).divide(bandwidthUp)
                         : QuantityType.ZERO,
                 Units.PERCENT);
@@ -171,27 +191,29 @@ public class ServerHandler extends ApiConsumerHandler implements FreeDeviceIntf
             boolean enable = TRUE_COMMANDS.contains(command);
             switch (channelId) {
                 case WIFI_STATUS:
-                    updateChannelOnOff(ACTIONS, WIFI_STATUS, getManager(WifiManager.class).setStatus(enable));
+                    updateChannelOnOff(GROUP_ACTIONS, WIFI_STATUS, getManager(WifiManager.class).setStatus(enable));
                     return true;
                 case FTP_STATUS:
-                    updateChannelOnOff(FILE_SHARING, FTP_STATUS, getManager(FtpManager.class).setStatus(enable));
+                    updateChannelOnOff(GROUP_FILE_SHARING, FTP_STATUS, getManager(FtpManager.class).setStatus(enable));
                     return true;
                 case SAMBA_FILE_STATUS:
-                    updateChannelOnOff(FILE_SHARING, SAMBA_FILE_STATUS,
+                    updateChannelOnOff(GROUP_FILE_SHARING, SAMBA_FILE_STATUS,
                             getManager(SambaManager.class).setFileShare(enable));
                     return true;
                 case SAMBA_PRINTER_STATUS:
-                    updateChannelOnOff(FILE_SHARING, SAMBA_PRINTER_STATUS,
+                    updateChannelOnOff(GROUP_FILE_SHARING, SAMBA_PRINTER_STATUS,
                             getManager(SambaManager.class).setPrintShare(enable));
                     return true;
                 case UPNPAV_STATUS:
-                    updateChannelOnOff(ACTIONS, UPNPAV_STATUS, getManager(UPnPAVManager.class).setStatus(enable));
+                    updateChannelOnOff(GROUP_ACTIONS, UPNPAV_STATUS, getManager(UPnPAVManager.class).setStatus(enable));
                     return true;
                 case AFP_FILE_STATUS:
-                    updateChannelOnOff(FILE_SHARING, AFP_FILE_STATUS, getManager(AfpManager.class).setStatus(enable));
+                    updateChannelOnOff(GROUP_FILE_SHARING, AFP_FILE_STATUS,
+                            getManager(AfpManager.class).setStatus(enable));
                     return true;
                 case AIRMEDIA_STATUS:
-                    updateChannelOnOff(ACTIONS, AIRMEDIA_STATUS, getManager(AirMediaManager.class).setStatus(enable));
+                    updateChannelOnOff(GROUP_ACTIONS, AIRMEDIA_STATUS,
+                            getManager(AirMediaManager.class).setStatus(enable));
                     return true;
                 default:
                     break;
index ef33694b22b97dd42552d8e6395724384b61aaad..29a27eeced4ddad6fe9ba3164a14ae0ee3ecf996 100644 (file)
@@ -74,8 +74,8 @@ public class VmHandler extends HostHandler {
 
     public void updateVmChannels(VirtualMachine vm) {
         boolean running = Status.RUNNING.equals(vm.status());
-        updateChannelOnOff(VM_STATUS, STATUS, running);
-        updateChannelOnOff(CONNECTIVITY, REACHABLE, running);
+        updateChannelOnOff(GROUP_VM_STATUS, STATUS, running);
+        updateChannelOnOff(GROUP_CONNECTIVITY, REACHABLE, running);
         if (running) {
             updateStatus(ThingStatus.ONLINE);
         } else {
index a37e5f88a7499fc557c3e46a48548a9687e5e1d5..b6baa25c0f8ddf85ae90b04f69fb99f81170f7a8 100644 (file)
@@ -77,7 +77,7 @@ public class WifiStationHandler extends HostHandler {
         Optional<Station> station = getManager(APManager.class).getStation(mac);
         if (station.isPresent()) {
             Station data = station.get();
-            updateChannelDateTimeState(CONNECTIVITY, LAST_SEEN, data.getLastSeen());
+            updateChannelDateTimeState(GROUP_CONNECTIVITY, LAST_SEEN, data.getLastSeen());
             updateChannelString(GROUP_WIFI, WIFI_HOST, SERVER_HOST);
             updateWifiStationChannels(data.signal(), data.getSsid(), data.rxRate(), data.txRate());
             return;
@@ -86,7 +86,7 @@ public class WifiStationHandler extends HostHandler {
         // Search if it is hosted by a repeater
         Optional<LanHost> wifiHost = getManager(RepeaterManager.class).getHost(mac);
         if (wifiHost.isPresent()) {
-            updateChannelDateTimeState(CONNECTIVITY, LAST_SEEN, wifiHost.get().getLastSeen());
+            updateChannelDateTimeState(GROUP_CONNECTIVITY, LAST_SEEN, wifiHost.get().getLastSeen());
             LanAccessPoint lanAp = wifiHost.get().accessPoint();
             if (lanAp != null) {
                 updateChannelString(GROUP_WIFI, WIFI_HOST, "%s-%s".formatted(lanAp.type(), lanAp.uid()));