-
-
Save tknaller/ad4752df9d300d2a55ab4501119edcd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lastUpdateItem = items.getItem("SKODAENYAQiVSKODAENYAQiV_general_LastUpdate"); | |
var lastUpdate = time.toZDT(lastUpdateItem.rawState); | |
var thing = things.getThing("connectedcar:skoda-e:e8ec4960d7"); | |
var fiveMinAgo = time.ZonedDateTime.now().minusMinutes(5); | |
if (lastUpdate.isBefore(fiveMinAgo)) { | |
console.log("skoda account last update is more than 5 minutes ago, disabling"); | |
thing.setEnabled(false); | |
console.log("disabled skoda account thing, waiting 15 seconds"); | |
setTimeout(() => { | |
thing.setEnabled(true); | |
console.log("reenabled skoda account thing"); | |
}, 15000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment