Closed AndreasPrang closed 4 years ago
I realised it with like this:
sprinkler
.getService(Service.Valve)
.getCharacteristic(Characteristic.RemainingDuration)
.on('get', function(callback) {
var err = null; // in case there were any problems
if (SPRINKLER.active) {
var duration = SPRINKLER.timerEnd - Math.floor(new Date() / 1000);
console.log(SPRINKLER.typeName + " RemainingDuration: " + duration)
callback(err, duration);
}
else {
callback(err, 0);
}
});
Fixed the issue with PR #88
I think for water valve the following Characteristic is missing to have duration variable working properly:
.getCharacteristic(Characteristic.RemainingDuration)