Not sure this idea makes any sense, but here goes ....
Now that I have 30-40 rules, I've begun to notice that nearly every time I write a rule, there is some notification logic that I am writing. And so I retype the same stuff into RM4 over and over again with each rule....sending messages to various mobile devices and/or speaking those messages. What I wonder is why I have to reconstruct this logic into every rule. Couldn't I instead use global variables to set the parameters for a notification and then "call" on some other rule to execute the notification?
If doable, I picture the parameters for a generic Notifier would be something like this:
- Recipients: who receives the messages
- Message Channel: Text-based (SMS, HE App, Pushover) or Speech (Sonos, Echo)
- Priority (esp.for Pushover)
- (If Spoken) Time of Day restrictions to prevent making noise when people are sleeping
So, I'd picture each rule would set these 5 parameters appropriate to the use-case and pass them along to some kind of shared notification engine to execute the messaging. Except the code for that messaging is defined once and only once. Easier to maintain, easier to change.
I was thinking about using Global Variables, but what happens when multiple rules are setting different values for the same 5 GVs, not sure how HE would thread the activity. Is this possible? How would I approach it? Appreciate any feedback. Be gentle, I'm still a newbie.