mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[freeboxos] Fix handling of REFRESH command for connectivity channels (#17178)
Fix #17168 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
8e3dedd181
commit
4376b9db73
@ -151,7 +151,7 @@ public abstract class ApiConsumerHandler extends BaseThingHandler implements Api
|
|||||||
try {
|
try {
|
||||||
if (checkBridgeHandler() != null) {
|
if (checkBridgeHandler() != null) {
|
||||||
if (command instanceof RefreshType) {
|
if (command instanceof RefreshType) {
|
||||||
internalPoll();
|
internalForcePoll();
|
||||||
} else if (!internalHandleCommand(channelUID.getIdWithoutGroup(), command)) {
|
} else if (!internalHandleCommand(channelUID.getIdWithoutGroup(), command)) {
|
||||||
logger.debug("Unexpected command {} on channel {}", command, channelUID.getId());
|
logger.debug("Unexpected command {} on channel {}", command, channelUID.getId());
|
||||||
}
|
}
|
||||||
@ -258,6 +258,10 @@ public abstract class ApiConsumerHandler extends BaseThingHandler implements Api
|
|||||||
|
|
||||||
protected abstract void internalPoll() throws FreeboxException;
|
protected abstract void internalPoll() throws FreeboxException;
|
||||||
|
|
||||||
|
protected void internalForcePoll() throws FreeboxException {
|
||||||
|
internalPoll();
|
||||||
|
}
|
||||||
|
|
||||||
private void updateIfActive(String group, String channelId, State state) {
|
private void updateIfActive(String group, String channelId, State state) {
|
||||||
ChannelUID id = new ChannelUID(getThing().getUID(), group, channelId);
|
ChannelUID id = new ChannelUID(getThing().getUID(), group, channelId);
|
||||||
if (isLinked(id)) {
|
if (isLinked(id)) {
|
||||||
|
@ -85,6 +85,12 @@ public class HostHandler extends ApiConsumerHandler {
|
|||||||
pushSubscribed = getManager(WebSocketManager.class).registerListener(host.getMac(), this);
|
pushSubscribed = getManager(WebSocketManager.class).registerListener(host.getMac(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void internalForcePoll() throws FreeboxException {
|
||||||
|
LanHost host = getLanHost();
|
||||||
|
updateConnectivityChannels(host);
|
||||||
|
}
|
||||||
|
|
||||||
protected LanHost getLanHost() throws FreeboxException {
|
protected LanHost getLanHost() throws FreeboxException {
|
||||||
return getManager(LanBrowserManager.class).getHost(getMac()).map(hostIntf -> hostIntf.host())
|
return getManager(LanBrowserManager.class).getHost(getMac()).map(hostIntf -> hostIntf.host())
|
||||||
.orElseThrow(() -> new FreeboxException("Host data not found"));
|
.orElseThrow(() -> new FreeboxException("Host data not found"));
|
||||||
|
@ -51,6 +51,15 @@ public class VmHandler extends HostHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void internalForcePoll() throws FreeboxException {
|
||||||
|
super.internalForcePoll();
|
||||||
|
|
||||||
|
logger.debug("Polling Virtual machine status");
|
||||||
|
VirtualMachine vm = getManager(VmManager.class).getDevice(getClientId());
|
||||||
|
updateVmChannels(vm);
|
||||||
|
}
|
||||||
|
|
||||||
public void updateVmChannels(VirtualMachine vm) {
|
public void updateVmChannels(VirtualMachine vm) {
|
||||||
boolean running = Status.RUNNING.equals(vm.status());
|
boolean running = Status.RUNNING.equals(vm.status());
|
||||||
updateChannelOnOff(VM_STATUS, STATUS, running);
|
updateChannelOnOff(VM_STATUS, STATUS, running);
|
||||||
|
Loading…
Reference in New Issue
Block a user