Routine or SHM Lists?


#1

I’ve got this piston I’m using for Kodi notifications but want add to it. I’ve got device lists set as variables for all my devices and wondering if I can do the same thing for all my routines. I’d like to have a statement that says “if X Routine runs then send notification…”. I’m sure I could do it within the statement but with all the separate conditions and or’s I’ll end up taking up a bunch of space.

Additionally I’d like to do the same thing with SHM status and wondering if I can put them all in a variable like the device list. At least with the SHM statuses it wouldn’t be as long.


#2

Well, I have seen pistons 300+ lines long, so you have plenty of elbow room in the piston above. One thing that I occasionally do to conserve space is put a common phrase into a variable first.

For example, if you want your notification to say, “Netflix was triggered at 3:45pm”, you could create a string variable:
{alert} = " was triggered at "$time
then in the appropriate section of your code, you could call that alert using less text like this:
show notification "Netflix"{alert}
which effectively turns 26 characters into 5 each time it is used.


I’ll let one of the experts chime in for list building


#3

Hey that’s a great idea! Getting more comfortable with variables now and never even thought of doing stuff like that. Thanks!