[nikobus] Refresh impacted modules on simulated button press (#9716)

In case of simulated Nikobus push button event refresh impacted modules too so binding fetches the updated state from affected modules.

Signed-off-by: Boris Krivonog <boris.krivonog@inova.si>
This commit is contained in:
Boris Krivonog 2021-01-06 20:41:37 +01:00 committed by GitHub
parent a27c1648dd
commit 7c51fa9909
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -148,6 +148,7 @@ public class NikobusPushButtonHandler extends NikobusBaseThingHandler {
if (pcLink != null) {
pcLink.sendCommand(new NikobusCommand(getAddress() + END_OF_TRANSMISSION));
}
processImpactedModules();
}
}
@ -163,6 +164,10 @@ public class NikobusPushButtonHandler extends NikobusBaseThingHandler {
triggerProcessors.forEach(processor -> processor.process(currentTimeMillis));
}
processImpactedModules();
}
private void processImpactedModules() {
if (!impactedModules.isEmpty()) {
Utils.cancel(requestUpdateFuture);
requestUpdateFuture = scheduler.schedule(this::update, 400, TimeUnit.MILLISECONDS);