# RM - I need help with and application using multi doors to control the same relay

This is what Im trying to do?
Summary:
When any door or (doors) are open too long, then disable Air Condition unit.

I have the following (4) devices
Door1 (door sensor)
Door2 (door sensor)
Door3 (door sensor)
Relay1 (relay with dry contact, to disable AC)

Emxample:
If Door1 is open for greater than 15min, then energize Relay1,
While Relay1 is energized, Door2 or Door3 are allowed to open and/or close will NOT de-energize Relay1
If Door1 closes AND stays closed for 15s, then De-Energize Relay1,

If Door2 is open for greater than 15min, then energize Relay1,
While Relay1 is energized, Door1 or Door3 are allowed to open and/or closed will NOT de-energize Relay1
If Door2 closes AND stays closed for 15s, then De-Energize Relay1

If Door3 is open for greater than 15min, then energize Relay1,
While Relay1 is energized, Door1 or Door2 are alowed to open and/or closed will NOT de-energize Relay1
If Door3 closes AND stays closed for 15s, then De-Energize Relay1

Now for the challenge
While Relay1 is energize and second and/or third door is open AND its timer is greater than 10min, which ever door that energized Relay1 needs to be overridden by the last door opened keeping Relay1 energized.

Example, If Door1 is opened at 9:00, then Door2 is opened at 9:01, then Door3 is opened at 9:02, then Door1 is closed at 9:30, Door2 closed at 10:00, and Door3 closed at 11:00

Relay1 would Energize at 9:15 when door1 timer expires and Relay1 would De-Energize at 11:15 when Door3 closed at 11:00 and its 15s timer expires @ 11:15

The goal is not to allow any door to short cycle Relay1

I know how to do this in a PLC with Ladder logic, but im new to the RM, and clueless

Would a State Machine work for you in this case?

11:00 plus 15s is 11:00:15 so something like this should work

``````Trigger Events:
Door1, Door2, Door3, Door4 any contact open and stays that way for: 0:15:00

Event to Run
Close relay
Wait for event: Door1, Door2, Door3, Door4 all contact closed and stays that way for: 0:00:15
Open relay
``````
1 Like

The rule proposed by @pseudonym should do exactly what you are looking for. The only thing i might consider is using two rules instead of just one. I would end the first rule with the action to energize the relay. The second rule would use the
`Door1, Door2, Door3, Door4 all contact closed and stays that way for: 0:00:15`
for the trigger with the only action being to de-energize the relay. You could also add a required expression (or whatever it's called) so the second rule is only active when the relay is energized.

good catch, correct 11:00:15

I added to call you recommend, and then this is what happens i can open either door and it will energize the relay, but when close either door it de-energizes the relau, and thats not what i want. With either door open closing a door while another door is open needs to keep the relay energized

Post a screenshot of your rule

I suspect in the Wait you have "any" contact close when you want "all" contact closed.

Sorry about the screen shot, I had to take a picture with my cell phone, My hub is at my shop, without internet service

So I need to change it to "all" not any, correct?

1 Like

Update the Wait to ALL instead of any.

ok, I will try that tomorrow when I go back to my shop

1 Like