Skip to content

Instantly share code, notes, and snippets.

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 dannyrandall/7a71e532ca8513657dc5170e85d549b0 to your computer and use it in GitHub Desktop.
Save dannyrandall/7a71e532ca8513657dc5170e85d549b0 to your computer and use it in GitHub Desktop.
ruleset sensor_manager_profile {
meta {
name "Manage Sensor"
author "Daniel Randall"
use module twilio
with
accountSID = meta:rulesetConfig{"accountSID"}
authToken = meta:rulesetConfig{"authToken"}
shares notification_to
}
global {
notification_from = meta:rulesetConfig{"notification_from"}
notification_to = function() {
ent:notification_to.defaultsTo(meta:rulesetConfig{"default_notification_to"})
}
}
rule set_notification_to {
select when sensor_manager_profile updated
always {
ent:notification_to := event:attrs{"notification_to"}
}
}
rule send_sms {
select when sensor_manager_profile send_sms
twilio:sendSMS(notification_from,
notification_to(),
event:attrs{"msg"})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment