diff --git a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/FreeboxOsBindingConstants.java b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/FreeboxOsBindingConstants.java index 26710fd7d7277..f9042be5c3bff 100644 --- a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/FreeboxOsBindingConstants.java +++ b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/FreeboxOsBindingConstants.java @@ -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"; diff --git a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ActivePlayerHandler.java b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ActivePlayerHandler.java index e47f0d6d47e95..d459ae86f1c68 100644 --- a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ActivePlayerHandler.java +++ b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ActivePlayerHandler.java @@ -17,6 +17,7 @@ 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 @@ private void poll() throws FreeboxException { 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 @@ private void poll() throws FreeboxException { 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"); diff --git a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ApiConsumerHandler.java b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ApiConsumerHandler.java index aa1b5dae03133..0e7d1ef52684d 100644 --- a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ApiConsumerHandler.java +++ b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ApiConsumerHandler.java @@ -17,6 +17,7 @@ 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 void updateProperties(@Nullable Map properties) { super.updateProperties(properties); } + @Override + public boolean anyChannelLinked(String groupId, Set channelSet) { + return channelSet.stream().map(id -> new ChannelUID(getThing().getUID(), groupId, id)) + .anyMatch(uid -> isLinked(uid)); + } + @Override public Configuration getConfig() { return super.getConfig(); diff --git a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ApiConsumerIntf.java b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ApiConsumerIntf.java index f291199679a71..5ed1ce9f6c323 100644 --- a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ApiConsumerIntf.java +++ b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ApiConsumerIntf.java @@ -14,6 +14,7 @@ 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 channelSet); + void stopJobs(); void addJob(String name, Runnable command, long initialDelay, long delay, TimeUnit unit); diff --git a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/HostHandler.java b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/HostHandler.java index 4a238d001e1e5..798192d693653 100644 --- a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/HostHandler.java +++ b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/HostHandler.java @@ -119,9 +119,9 @@ protected LanHost getLanHost() throws FreeboxException { 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); diff --git a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/RepeaterHandler.java b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/RepeaterHandler.java index eaa62f9929005..d9bcb20adf1a1 100644 --- a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/RepeaterHandler.java +++ b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/RepeaterHandler.java @@ -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 @@ private void poll() throws FreeboxException { 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 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); } diff --git a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/RevolutionHandler.java b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/RevolutionHandler.java index 8c8cbe5ab8213..b687fdedb57e5 100644 --- a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/RevolutionHandler.java +++ b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/RevolutionHandler.java @@ -15,6 +15,8 @@ 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 @@ protected boolean internalHandleCommand(String channelId, Command command) throw @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 { diff --git a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ServerHandler.java b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ServerHandler.java index d8fb8cd432caa..8b092d8fb0e2e 100644 --- a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ServerHandler.java +++ b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ServerHandler.java @@ -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 @@ protected void internalPoll() throws FreeboxException { 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 @@ private void fetchSystemConfig() throws FreeboxException { 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 @@ protected boolean internalHandleCommand(String channelId, Command command) throw 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; diff --git a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/VmHandler.java b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/VmHandler.java index ef33694b22b97..29a27eeced4dd 100644 --- a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/VmHandler.java +++ b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/VmHandler.java @@ -74,8 +74,8 @@ protected void internalForcePoll() throws FreeboxException { 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 { diff --git a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/WifiStationHandler.java b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/WifiStationHandler.java index a37e5f88a7499..b6baa25c0f8dd 100644 --- a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/WifiStationHandler.java +++ b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/WifiStationHandler.java @@ -77,7 +77,7 @@ private void poll() throws FreeboxException { Optional 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 @@ private void poll() throws FreeboxException { // Search if it is hosted by a repeater Optional 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()));