mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-27 07:41:39 +01:00
[deconz] retry full state request if initial request failed (#8704)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
parent
aa98737e9f
commit
5c7fe8183a
@ -71,7 +71,7 @@ public class ThingDiscoveryService extends AbstractDiscoveryService implements D
|
|||||||
protected void startScan() {
|
protected void startScan() {
|
||||||
final DeconzBridgeHandler handler = this.handler;
|
final DeconzBridgeHandler handler = this.handler;
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
handler.requestFullState();
|
handler.requestFullState(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public class DeconzBridgeHandler extends BaseBridgeHandler implements WebSocketC
|
|||||||
configuration.put(CONFIG_APIKEY, config.apikey);
|
configuration.put(CONFIG_APIKEY, config.apikey);
|
||||||
updateConfiguration(configuration);
|
updateConfiguration(configuration);
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_PENDING, "Waiting for configuration");
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_PENDING, "Waiting for configuration");
|
||||||
requestFullState();
|
requestFullState(true);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Unknown status code for authorisation request");
|
throw new IllegalStateException("Unknown status code for authorisation request");
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ public class DeconzBridgeHandler extends BaseBridgeHandler implements WebSocketC
|
|||||||
* Perform a request to the REST API for retrieving the full bridge state with all sensors and switches
|
* Perform a request to the REST API for retrieving the full bridge state with all sensors and switches
|
||||||
* and configuration.
|
* and configuration.
|
||||||
*/
|
*/
|
||||||
public void requestFullState() {
|
public void requestFullState(boolean isInitialRequest) {
|
||||||
if (config.apikey == null) {
|
if (config.apikey == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -182,6 +182,10 @@ public class DeconzBridgeHandler extends BaseBridgeHandler implements WebSocketC
|
|||||||
}
|
}
|
||||||
}).thenAccept(fullState -> {
|
}).thenAccept(fullState -> {
|
||||||
if (fullState == null) {
|
if (fullState == null) {
|
||||||
|
if (isInitialRequest) {
|
||||||
|
scheduledFuture = scheduler.schedule(() -> requestFullState(true), POLL_FREQUENCY_SEC,
|
||||||
|
TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fullState.config.name.isEmpty()) {
|
if (fullState.config.name.isEmpty()) {
|
||||||
@ -260,7 +264,7 @@ public class DeconzBridgeHandler extends BaseBridgeHandler implements WebSocketC
|
|||||||
if (config.apikey == null) {
|
if (config.apikey == null) {
|
||||||
requestApiKey();
|
requestApiKey();
|
||||||
} else {
|
} else {
|
||||||
requestFullState();
|
requestFullState(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user