Skip to content

Instantly share code, notes, and snippets.

@tknaller
Last active January 12, 2023 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tknaller/ad4752df9d300d2a55ab4501119edcd3 to your computer and use it in GitHub Desktop.
Save tknaller/ad4752df9d300d2a55ab4501119edcd3 to your computer and use it in GitHub Desktop.
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