mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-26 15:21:41 +01:00
[tivo] refresh connection every 12 hours (#10824)
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
parent
72e3729ca7
commit
bce5363856
@ -29,6 +29,7 @@ public class TiVoBindingConstants {
|
|||||||
public static final String BINDING_ID = "tivo";
|
public static final String BINDING_ID = "tivo";
|
||||||
public static final int CONFIG_SOCKET_TIMEOUT_MS = 1000;
|
public static final int CONFIG_SOCKET_TIMEOUT_MS = 1000;
|
||||||
public static final int INIT_POLLING_DELAY_S = 5;
|
public static final int INIT_POLLING_DELAY_S = 5;
|
||||||
|
public static final int POLLING_DELAY_12HR_S = 43200;
|
||||||
|
|
||||||
// List of all Thing Type UIDs
|
// List of all Thing Type UIDs
|
||||||
public static final ThingTypeUID THING_TYPE_TIVO = new ThingTypeUID(BINDING_ID, "sckt");
|
public static final ThingTypeUID THING_TYPE_TIVO = new ThingTypeUID(BINDING_ID, "sckt");
|
||||||
|
@ -212,8 +212,9 @@ public class TiVoHandler extends BaseThingHandler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (tivoConfigData.isKeepConnActive()) {
|
if (tivoConfigData.isKeepConnActive()) {
|
||||||
// Run once
|
// Run once every 12 hours to keep the connection from going stale
|
||||||
refreshJob = scheduler.schedule(runnable, INIT_POLLING_DELAY_S, TimeUnit.SECONDS);
|
refreshJob = scheduler.scheduleWithFixedDelay(runnable, INIT_POLLING_DELAY_S, POLLING_DELAY_12HR_S,
|
||||||
|
TimeUnit.SECONDS);
|
||||||
logger.debug("Status collection '{}' will start in '{}' seconds.", getThing().getUID(),
|
logger.debug("Status collection '{}' will start in '{}' seconds.", getThing().getUID(),
|
||||||
INIT_POLLING_DELAY_S);
|
INIT_POLLING_DELAY_S);
|
||||||
} else if (tivoConfigData.doPollChanges()) {
|
} else if (tivoConfigData.doPollChanges()) {
|
||||||
|
@ -84,6 +84,13 @@ public class TivoStatusProvider {
|
|||||||
logger.debug(" statusRefresh '{}' - EXISTING status data - '{}'", tivoConfigData.getCfgIdentifier(),
|
logger.debug(" statusRefresh '{}' - EXISTING status data - '{}'", tivoConfigData.getCfgIdentifier(),
|
||||||
tivoStatusData.toString());
|
tivoStatusData.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this will close the connection and re-open every 12 hours
|
||||||
|
if (tivoConfigData.isKeepConnActive()) {
|
||||||
|
connTivoDisconnect();
|
||||||
|
doNappTime();
|
||||||
|
}
|
||||||
|
|
||||||
connTivoConnect();
|
connTivoConnect();
|
||||||
doNappTime();
|
doNappTime();
|
||||||
if (!tivoConfigData.isKeepConnActive()) {
|
if (!tivoConfigData.isKeepConnActive()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user