Created
March 11, 2021 06:04
-
-
Save dannyrandall/7a71e532ca8513657dc5170e85d549b0 to your computer and use it in GitHub Desktop.
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
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