Please can someone help me with what should be a simple rule using RM 4.0???
Essentially I have a motion sensor in the living room that will turn on the lights. When i am watching TV i found the lights would turn off so i brought a contact sensor and wired up a pressure pad/mat and placed that under the chair. As i used to be on smartthings i wrote a webcore piston in which the lights would be turned on by the motion sensor but wouldnt turn of after a 2min delay unless the pressure pad/mat contact went to ope as well as the motion sensor being inactive. This worked fine. Now that i am trying out HE when using RM 4.0 it doesnt work. I find that if i get up and leave the room but return and sit back down within the 2min the lights would go off even thought the pressure pad contact was closed and the motion sensor was triggered. Then sometimes if i returned to the room and sat back down the lights would go on and off in the space of 30sec.
Thinking about it, i need some sort of task cancellation in the rule somewhere but when i try to put it in the lights never turn off. Please has anyone any thoughts about what is happening???
I have attached the old WC Piston and the new RM Rule as well as the log of what is happening below...........
Add a second trigger - pressure mat changed. Then I would rewrite your stuff after the first end-if
living room motion is active or pressure pad is "Pressurized" (ha!)
then cancel delayed actions
motion is inactive and pressure mat is "depressurized" then turn off lights delay= 2:00 cancel=yes
I do pretty much the same thing with a few of my lights. I use harmony in my living rooms. Here are some examples of what I do. Pay attention to the cancel delayed actions. Hope this helps?
This is the upstairs living room
This next one is for a lamp that dims when i'm watching tv or when the living room lights are on and brightens up when tv and living rooms lights are off. Makes it brighter in the upstairs so that we appear to be home.
I hope that these rules will help you with yoru future integrations. It's not webcore thinking, but it's just as robust.
I haven't read through all of the rule above, but I'm guessing it may also work for you (she has a lot of rules for pretty much any situation anyone asks for and is great about sharing!). However, if you're mostly happy with what you have now, there are two small changes that will make it work as you expect:
- On your "Delay 0:02:00" action, toggle the "Cancelable" option to on.
- In your actions for when the motion sensor is active (e.g., before your "On: ..." action), add a "Cancel Delayed Actions" action.
If you're familiar with webCoRE's Task Cancellation Policy (TCP), Rule Machine does not have anything exactly like that by default; you have to manually create the same effect yourself, which is exactly what this does for you (cancels the delay action--and everything after it--whenever "Cancel Delayed Actions" is run, which happens every time motion goes active again; otherwise, those "Off" commands won't get un-scheduled and so will run even if the sensor goes back to active).
You don't need to add the contact sensor as a trigger if you only want to verify that it's open before you turn off the lights. (If you think there's ever a chance that the motion sensor could go inactive before the contact sensor becomes open, then you might want to, but I'm guessing this is is unlikely since the sequence of actions is likely to be getting up off the couch, causing the contact sensor to open, then walking out of the room, causing the motion sensor to go active and eventually inactive, both of which will cause your rule actions to run and therefore your
IFs to be evaluated.)
Another alternative: I do something same with a pressure mat hooked up to a contact sensor under my couch (fantastic idea, by the way!), but I trick Hubitat into thinking it's a motion sensor using a virtual "motion with switch" driver. Every time the contact sensor closes, I send an
on() to that driver, which causes motion to become
active, and the opposite when it closes. Then I can use this virtual "motion" sensor device in any Hubitat automation that wants a motion sensor--opening up far more possibilities than a contact sensor generally does for lighting automations (e.g., you could use it as a "keep on" but not a "turn on" sensor in Motion Lighting). But you've pretty much got it in RM if that's what you want, so whatever works!
PS - I suppose there is more to your piston, setting specific settings based on mode. You can certainly do that in Rule Machine as well--"Set Dimmers Per Mode" will let you set
level, but you'll get a but more power if you create scenes (probably easier than specifying all these settings in the rule anyway) and use "Set Scenes Per Mode" (also available in Motion Lighting if you choose to use that instead).
I have the same sort of setup for lights on in my living room and watching TV. I went with a zwave power outlet that the TV is connected to. When the power is above 10 the TV is on and the lights dim and stay on. If it is below this then the room runs off of motion. I have this setup for two rooms.
Thanks for the help @april.brandt and @bertabcd1234. It all seems to be working as expected now!! . I'll probably test it all out at the weekend with a good box set and a few beers haha.
@pcgirl thats a great idea! The only problem with the pressure mat is it is only on one seat so if the person gets up then everyone else is left in the dark! Lol. What zwave power outlet do you use?
Thanks for the help guys, all is working as i expected it to now!
Looking into getting the energy monitoring plug to try out your suggestion @pcgirl