Can this be done in Rule Machine?

I'm working on moving my last few rules over from WebCoRe in Smartthings to Rule Machine. Part of my departure piston is to do a double check that all doors are closed, garage doors are shut, locks locked, alarm armed, etc.. and notify which devices are open/unlocked. It's one thing to issue the command and trust the device followed it, but I want the second layer of confirmation to ensure the house is secured. To do this I use "save matching devices" to a variable, attempt to re-close/lock the device and then send a pushover notification.

I'm not finding any similar functionality in RM. I'm wondering if it exists somewhere and I'm just not seeing it, or if there's another way to accomplish this?

Not sure which part you are not able to make an equivalent of... If it is the variable, you could create a Global Variable in Rule Machine, then write/read that as needed. Maybe "First Check" as a boolean... Default value = true

So that would make it something like:
Main rule calls following rules:

  1. Lock everything up.
  2. Check that everything is locked/off.
    If everything is locked/off and First Check == true
    Else First Check = False
  3. If First Check == False
    A) Lock everything up.
    B) Check everything is locked/off.
    If everything is locked/off and First Check == False then First Check = True
    Else First Check = False and Notify that lockup failed

It's not just notifying that all locks are not locked. I want to know which lock didn't lock. Or which door/window is not closed, etc.. My webcore piston will check all 5 locks then say "The front and side doors did not lock" not just "There is a door unlocked"

EDIT: Plus I do not see the functionality to set devices as variables so I know the method in RM will not be identical, but I'm looking for the same functionality.

I'm sure you should be able to achieve this in some way with RM, but an alternative may be to look at some of @bptworld 's and @Cobra 's apps, they have some quite feature rich options such as reporting on dashboard tiles, etc devices that are over certain thresholds, etc.

1 Like

There is a Community app that would address the doors/windows piece. It is one of @Cobra's app called Check Open Contacts. You can find it along with others at https://cobra-apps.co.uk/

3 Likes

Ok, I get it a bit more now. So what you could do is have it build up a string. As it checks each door you add to the string:
Global Variable "Locks Notice" as String
At the start of the check, set Locks Notice to be blank.

Then in the test for the front door it sets the variable if the door fails:
Locks Notice = %Locks Notice% front door,

Next test for back door it sets the variable if that door fails:
Locks Notice = %Locks Notice% back door,

Then at the end it adds a bit of ending:
Locks Notice = %Locks Notice% did not lock.

So the end it would read "front door, back door, did not lock."

Obviously with more work you could format it to a more correct sentence. You do not need the boolean at this point because the failure test (and the test to see if the end of the sentence is needed) would just be if the string has anything in it.

Device Check Plus will do most of what your looking for.

Attempting to 'fix' the device is a great idea and something I could look into.

3 Likes

I think that would work for the notification but that would be a massive rule! LOL Fully built out I'm doing a check on an alarm, 5 locks, 4 garage doors, 18 doors/windows, 40some light switches... to build that one at a time would be a nightmare. But then I'd have to convert it from a string back to devices to re-issue the off commands to the offending devices. I suppose I could have it send the command to all the devices in that class again, but I try to limit network congestion by limiting unnecessary commands.

@bptworld this app looks very close to what I'm looking for except it doesn't attempt to re-issue the command to the offending devices. It's not entirely clear, does it notify which device is not in the right state or does it just send a notification to say that something isn't in the right state?

1 Like

Yes, that would be a pretty massive amount of work (I would recommend many smaller Rules to do the specific checks, combined in a greater Rule). You could group it a bit plus once you have one for a type done you could just Copy and edit each rule... but overall it would be a lot of work. However, maybe that app can help narrow it down and who knows, many developers here are responsive to requests so maybe you can get adjustments made that would build up a message and the retry.

Just a note on rules like this. I used to have loads in ST because they would always fail and I wanted to push fix commands. When I moved to HE I copied/ converted all these over, I have since completely removed them all now. They are just not needed in HE. When I send a command it always does what I ask.

Yes, it tells you exactly which devices are in the wrong state. I put it on my to do list to have it try to re issue the commands. Will most likely look at it later this week.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.