Sounds like a relatively straight forward extension to Expire. The way Expire works now is you define a state the Item should become (update or command) after a certain amount of time after the Item no longer receives an event. For example, update a sensor Item to UNDEF when it doesn’t receive an update for 15 minutes, or command a Switch to OFF five minutes after it last received a command ON.
Using Expire Updater [4.0.0.0;5.9.9.9] you can dynamically change the Expire time at runtime.
A simple rule can handle the restarting of the Expire timers (I should publish this as a rule template Rule template can now be found at: Restart Expire [4.0.0.0;5.9.9.9]).
configuration: {}
triggers:
- id: "1"
configuration:
startlevel: 50
type: core.SystemStartlevelTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
type: application/javascript
script: >
var {helpers} = require('openhab_rules_tools');
console.loggerName = 'org.openhab.automation.rules_tools.Restart Expire.'+ruleUID;
//osgi.getService('org.apache.karaf.log.core.LogService').setLevel(console.loggerName, 'DEBUG');
helpers.validateLibraries('4.1.0', '2.0.1');
console.info('Restarting Expire timers');
var expireItems = items.getItems().filter(i => i.getMetadata('expire') !== null).forEach( i => {
if(i.getMetadata('expire').configuration['ignoreStateUpdates'] == 'true') {
console.debug('Commanding Item ' + i.name + ' Expire by command');
i.sendCommand(i.state);
}
else {
console.debug('Resetting Item ' + i.name + ' Expire by update');
i.postUpdate(i.state);
}
});
type: script.ScriptAction
You can get pretty close to your requirements today.