Last active
April 18, 2023 20:11
-
-
Save vajonam/2912602bcf0a107cbd3280cdab3b4188 to your computer and use it in GitHub Desktop.
car check stuff
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
if (msg.payload.after.label == "car") { | |
if (msg.payload.type == "new"){ | |
if (msg.payload.after.entered_zones.length > 0 && (msg.payload.after.entered_zones.includes("garage") && msg.payload.after.entered_zones.includes("driveway"))){ | |
return msg; | |
} | |
if (msg.payload.after.entered_zones.length > 0 && (msg.payload.after.entered_zones.includes("driveway") && msg.payload.after.entered_zones.includes("road"))) { | |
return msg; | |
} | |
} | |
if (msg.payload.type == "end") { | |
if (msg.payload.after.entered_zones.length > 0 && msg.payload.after.entered_zones.includes("road")) { | |
return msg; | |
} | |
} | |
return null; | |
} else { | |
node.warn("Not a car so continue flow") | |
return msg; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment