Skip to content

Commit 3b5c1c6

Browse files
lolodomojoni1993
authored andcommitted
[freeboxos] Fix handling of REFRESH command for connectivity channels (openhab#17178)
Fix openhab#17168 Signed-off-by: Laurent Garnier <[email protected]>
1 parent f82d431 commit 3b5c1c6

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ApiConsumerHandler.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public void handleCommand(ChannelUID channelUID, Command command) {
151151
try {
152152
if (checkBridgeHandler() != null) {
153153
if (command instanceof RefreshType) {
154-
internalPoll();
154+
internalForcePoll();
155155
} else if (!internalHandleCommand(channelUID.getIdWithoutGroup(), command)) {
156156
logger.debug("Unexpected command {} on channel {}", command, channelUID.getId());
157157
}
@@ -258,6 +258,10 @@ protected boolean internalHandleCommand(String channelId, Command command) throw
258258

259259
protected abstract void internalPoll() throws FreeboxException;
260260

261+
protected void internalForcePoll() throws FreeboxException {
262+
internalPoll();
263+
}
264+
261265
private void updateIfActive(String group, String channelId, State state) {
262266
ChannelUID id = new ChannelUID(getThing().getUID(), group, channelId);
263267
if (isLinked(id)) {

bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/HostHandler.java

+6
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ protected void internalPoll() throws FreeboxException {
8585
pushSubscribed = getManager(WebSocketManager.class).registerListener(host.getMac(), this);
8686
}
8787

88+
@Override
89+
protected void internalForcePoll() throws FreeboxException {
90+
LanHost host = getLanHost();
91+
updateConnectivityChannels(host);
92+
}
93+
8894
protected LanHost getLanHost() throws FreeboxException {
8995
return getManager(LanBrowserManager.class).getHost(getMac()).map(hostIntf -> hostIntf.host())
9096
.orElseThrow(() -> new FreeboxException("Host data not found"));

bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/VmHandler.java

+9
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ protected void internalPoll() throws FreeboxException {
5151
}
5252
}
5353

54+
@Override
55+
protected void internalForcePoll() throws FreeboxException {
56+
super.internalForcePoll();
57+
58+
logger.debug("Polling Virtual machine status");
59+
VirtualMachine vm = getManager(VmManager.class).getDevice(getClientId());
60+
updateVmChannels(vm);
61+
}
62+
5463
public void updateVmChannels(VirtualMachine vm) {
5564
boolean running = Status.RUNNING.equals(vm.status());
5665
updateChannelOnOff(VM_STATUS, STATUS, running);

0 commit comments

Comments
 (0)