Skip to content

Instantly share code, notes, and snippets.

@CarltonHenderson
Created October 17, 2022 21:57
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 CarltonHenderson/e47419484030d4182a8a4b1d552f4867 to your computer and use it in GitHub Desktop.
Save CarltonHenderson/e47419484030d4182a8a4b1d552f4867 to your computer and use it in GitHub Desktop.
(
/* User Config */
$TrapLocations := {
"2037335832365003002c0047": "Garage",
"203733583236500375754859": "Basement"
};
$from := "+18505551212"; /* My Twilio account phone number */
$to := "+14015551212"; /* My cellphone number */
/* End Config*/
$shouldRoute := $contains(file, "#motion.qo") ? true : $doNotRoute();
$sparrowNodeId := $substringBefore(file, "#");
$location := $lookup($TrapLocations,$sparrowNodeId);
$timestamp:= $fromMillis(when*1000, '[H01]:[m01]:[s01] [z]', '-0400');
$body := "There's movement in the " & $location & " mousetrap! " & $timestamp;
"&Body=" & $body & "&From=" & $from & "&To=" & $to & "&"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment