Hey all
I would like an automation that when a door is opened 10 times I want a notification. Can it be done in the rule machine?
Yes. You could increment a global variable as a counter.
Sure, but how do you want to do this, exactly? Do you want it to notify you every ten times the door is opened, regardless of how much time has passed in between? Or do you want to "reset" it if a certain amount of time has passed since the first (or last?) opening? The possibilities are endless, and Rule Machine will let you create whatever logic you want to handle this. The latest versions have local variables, so you don't really need a global variable for this (but you could if you wanted to display it on a Dashboard or something).
For the basic "notify me every 10 times the door opens" thing, something like this would work. First, define a local variable as a type of Number with an initial value of 0. I'm calling mine doorCount
, but you can call it whatever you want:
Then create a rule that increments this value every time the door is opened and notifies you if it's 10 (or more; really just 10 should be fine but if something ever goes wonky I'd want this to get reset just in case, so I'm using >=
rather than just =
):
If you want a "reset" after some period of time has elapsed, you have a few options; the easiest would be to add a "Set doorCont to 0" action at the very end, set a delay on that action for however long (say, a few hours), and enable the "cancelable" option. Then, also add a "Cancel Delayed Actions" action as the first thing in your rule:
You can probably figure out other ways to adjust this according to how you really want these notifications to work. Good luck!
Thanks it works perfectly, you are the man.
Now I do not understand how I do so I get a note my mobile after 10 times? excuse my ignorance.
Glad it helped! So you'll need two things to actually get the notification. For one, instead of my "Log..." action, you'll choose the "Send or Speak a Message" action, type whatever you want in "Message to send," and choose your Hubitat mobile app device under "Use Notification Devices."
Second (but really first, I guess), if you don't have the Hubitat mobile app set up on your phone yet, you'll need to do that. It's available in the App Store and Google Play, and will ask you to sign into the account you have probably already registered with in the Hubitat Portal (this is different from your hub login if you've password-protected your admin interface, which you have to go through some work to set up so probably haven't if you're not sure). Doing so will create a new device for your phone under "Devices" on your hub as part of the app setup. I'm honestly not sure what this looks like if you only have one hub and don't already have a mobile device set up on that hub (I have a few and it asks me to choose my hub and whether I want to re-use an existing device, something you could certainly do if you ever replace your phone). I'm guessing it either does it for you or asks you minimal questions to get it done. In any case, after that, you'll see it under the device selection I talked about above.
The Hubitat mobile app isn't the only option for notifications, in case you don't like it for some reason. Pushover is natively supported but requires a (one-time, I think) purchase. Twilio is also natively supported for SMS instead of push notifications (but requires a subscription). There are also a few other community solutions. I think the Hubitat app works well and I've used it since it was introduced (previously routed them through SmartThings with a community app and driver)--just wanted to point out that it isn't all that's out there.
Of course that's how you do it, thanks again I will return when my project is complete and you will see the result of it.
A smartthings door / window sensor a magnet, then you have a note when the trap is full. My contribution to automation.
I use the same concept to know when I need to change our cat’s litter box
Nice