Turn plug on for set time upon HSM intrusion alert

I can turn on a plug upon intrusion in HSM but I would like for it to turn off after a predetermined amount of time. Can someone point me in the right direction? Thanks.

Should be relatively simple. Create a rule machine rule. Make the trigger be when HSM alert becomes intrusion. For action you want to control switches. Turn on the switch you want, but also "turn on or off these switches after a delay" and set the switch to turn off after the amount of minutes you want.

I tried multiple things in RM. Does the alert override other control of the plug if it activated it?

I'm not sure, but to be safe I'd remove it from HSM and just let the rule machine control it.

I'll try that. Thanks.

In RM used HSM intrusion to turn plug on. Works fine.

Another triggered event using HSM intrusion to turn same plug off after 1 min delay. Does not work with other rule active.

Are they conflicting somehow?

Rules don't have an "Active."

Hubitat works completely via EVENTS

An Event is when something in the Conditions of a Rule CHANGES.

If you have a condition: Time Between 9:00AM and 9:10AM, you will receive two events. One at 9am that causes the Rule to evaluate and (in this example) perform the Action for True. at 9:11, another event occurs, the Rule is evaluated again and this time, Action for False runs. (Time and dates are Inclusive.)

If you have a 2nd rule that gets evaluated at 9:05, then it will do Action for True (or False) per the evaluation. That's it.. no overlap, no confusion. Event, do; event, do; event, do.

I think you're imagining Hubitat to work via STATES, but it doesn't... just Events.

This is a rule I have that turns a lamp on (if it was off) when the front door is opened between sunset and sunrise. If it was off, then the rule will turn it on and then off after 4 minutes. If it was already on, then the rule won't turn it off. This should do what you want if you use hsm intrusion as your trigger.

OK. Seems that I have my terms mixed up. I'm still learning the system.

Regardless, I am using the HSM alert to trigger both rules which happen to be for the same device. The first rule turns it on immediately upon HSM alert and the second turns it off after a delay using the same HSM alert as a trigger. Do the 2 rules conflict because the same trigger starts both of them and they happen to be attached to the same device?

Instead of turning on a physical device in HSM, turn on a virtual switch. That virtual switch will be your trigger for the rule action. The action will be to turn the physical light on, and then after a delay specified in your rule, the light will turn off again.

Thanks. I will try that. Why would the virtual switch work but not the actual one?

I assume you intend for me to activate the virtual switch out of HSM and not RM, is that correct?

1 Like

Correct. If you have HSM turning a light on, it will not turn it off until the alert state is cancelled. However if HSM turns on a virtual switch, and that virtual switch is nothing more than a trigger for a RM rule, then it won't matter if the virtual switch is still on because your HSM alert has not been cancelled. As soon as the time runs out in the RM rule, the light will turn off.

Thanks. I think that was the answer I was looking for. I'll give it a try tonight.

Finally got it to work. Used virtual button to turn on at HSM intrusion.

Created rule with conditions of HSM armed away and plug on. Delayed action of turning plug off. For some reason a triggered rule wouldn't work.

I'm figuring this thing out slowly. Reminds me of debugging in my old Fortran days. Anyone here old enough to remember that?

1 Like

Part of the problem was that the Iris plug wasn't reporting its status back to the hub. Replaced it with a different brand and it worked with the new rules.

1 Like