This commit is contained in:
2019-11-29 08:23:17 -06:00
parent 9c5b19bbc1
commit 75127f46e2
11 changed files with 211 additions and 5 deletions

View File

@@ -0,0 +1,13 @@
// gets each sensor passed in by their uid and
// then returns true if any of them are tripped
anyTripped = false;
for (var key in uidTags) {
var uidThing = mcApi.uidTag().getByUid(uidTags[key]);
if (uidThing && uidThing.getResource().value === "1") {
anyTripped = true;
break;
}
}
anyTripped;

View File

@@ -1,4 +0,0 @@
northDoorOpen = mcApi.uidTag().getByUid("north-garage-door-tripped").getResource();
southDoorOpen = mcApi.uidTag().getByUid("south-garage-door-tripped").getResource();
!northDoorOpen || !southDoorOpen

View File

@@ -0,0 +1,13 @@
// gets each sensor passed in by their uid and
// then returns true if none of them are tripped
noneTripped = true;
for (var key in uidTags) {
var uidThing = mcApi.uidTag().getByUid(uidTags[key]);
if (uidThing && uidThing.getResource().value === "1") {
noneTripped = false;
break;
}
}
noneTripped;

View File

@@ -0,0 +1,8 @@
// disables a timer with the 'timeName' binding passed in
filter = new java.util.HashMap();
filter.put('name', timerName);
timer = mcApi.timer().get(filter);
if (timer) {
mcApi.timer().disable([timer.id]);
}

View File

@@ -0,0 +1,8 @@
// enables a timer with the 'timeName' binding passed in
filter = new java.util.HashMap();
filter.put('name', timerName);
timer = mcApi.timer().get(filter);
if (timer) {
mcApi.timer().enable([timer.id]);
}