Creating a dynamic list in rule machine

Hey all,

I want to add a contact device name to a list variable if it’s open for longer than 2 minutes. Then remove the contact server from the list once it’s closed. I know how to write an app to do it, but why rewrite something if it’s already been done?

Have you tried using Notifier? You can have it monitor contact sensors and send a notification when it's been open/closed for X minutes

If you wanted to do it in RM, you could create a local variable and write to that. It will be messy though

Rule Machine doesn't have list/array/collection-type variables, so this will be pretty difficult. Your best (only?) option would probably be a String variable, but then you run into the problem that String operations are more limited than you'd probably need to be able to select/remove devices:

So, if it were me, I'd second the recommendation above to consider Notifications if it meets your needs. Otherwise, I'd explore that custom app idea more. A DeviceWrapperList or a List of DeviceWrappers (I have no idea how the former is implemented but it seems to do anything I've also asked of List) is mind-blowingly easy to manipulate or search through with the methods and closures Groovy provides (once you find the right one).

I found an app named "Device Groups" which allows you to do just as its name reads. So I grouped my contact sensors by room and used the sensor group name for my notifications. Now I can delay the notification per room. so I will only get notified once per room if any of the contact sensor remain open for an extended period of time.