Help with baby crib logic


So my 14 month old somehow managed to get the rail of her crib down (luckily she didn’t fall out). Now my wife is paranoid because our darling daughter has no fear and would swan dive from the top of her crib without hesitation. I placed a contact sensor on her crib and one on her door and fired up a rule that if both sensors are closed, and then the crib rails comes down (open) then the wife and I will get an alert. The problem is that the crib rail needs to be pulled up before it will go down. So the contact sensor opens for a split second, goes closed for a split second then goes open. So at the moment it sends me two notifications. (I’m thinking I can use a delay somewhere to get rid of the second notification).

Logic problem: I need to account for the crib rail starting in either position. (Up or down).

1st scenario is the crib rail is up....  go into room, close door behind you, pull the crib rail down to get the baby in, pull the rail back up, open the door, close the door behind.  

2nd scenario is the same but without the need to put the rail down first.

Any ideas on the best way to set this up? Is the best way to create a rule that when both the crib and door are closed send the alert if the rail goes down. But only if the crib rail goes down after 2 min or something? Should I get a smart button and put it outside her room and use it to arm and disarm the rule?


Get a bigger/longer/second magnet so that the entire unlatch motion has a magnet near?


You may want to add a motion sensor instead of just the door sensor with the crib sensor. Have the motion tracking limited to the room excluding the crib. Easily done with using electrical tap. I would also use two separate rules.

Scenario 1: first rule

  • Motion inactive. Contact sensors closed.
    -add a delay for 10 seconds with an on truth change so if the crib is opened then a false positive doesn’t go off

Scenario 2: if motion and door sensor closed then notify


You can easily treat this like many do with a motion detector... e.g. If there is no motion for x minutes, then turn off the light.

This is done in Rule Machine with a Rule. Use the Delay with Cancel option before sending the notification. This will help to prevent the double/false messages.


Thanks for the suggestions. I have another motion sensor on the way to try it out and I will also double up on the magnet to see if that helps with the false open.