This object is in archive! 

Door opens? Turn on light. Door closes? Turn of light.

Paul T shared this question 8 years ago
Need Answer

Hi all,


I am new with the Zipatile (just installed my first few sensors and activators :)), so please explain what I'm doing wrong.


What I want:

- When sunset ("voordeur lamp" is configured to be on at sunset), and front door opens, turn on the light.

- Wait (keep checking) whether the front door closes and turn off the light after 120 seconds.


I build the rule as following, my train of thoughts:

- When voordeur lamp (front door light) and voordeur (front door) are on/open, turn on the light in the hallway instantly;


- then keep checking for 10 minutes (repeat 600 times, with 1 second wait for the action) whether the front door is closed. If so, keep the hallway light on for another 120 seconds (wait 120 seconds) and then turn it off.

-- The repeat should stop running e.g. after the 2nd attempt, if the frontdoor already closed by then (e.g. within 2 seconds after opening).


Underneath rule does turn on the "hal lamp" (hallway light), but it doesn't turn it off, while the front door did close.


41b9be356d1e6b02656d666758d6360f


Thanks in advance for your guidance!

Replies (4)

photo
1

Paul,


You don't need to use repeat to update sensor state, you can achieve this using the puzzle JOIN. See below and let me know if this works as you expect.

PPB_ZIPATOQUAD_DOOR = VOORDEUR

PPB_QUBINOF2RLY1 = VOORDEUR LAMP

PPB_QUBINOF2RLY2 = HAL LAMP


Regards

photo
1

Agree with Alberto, it's easier to use JOIN. But your rule can work as well it you use 'Refresh All' before testing if the door is opened. Once a rule is trigered, the rule always uses the state of devices when the rule is trigerred, not the current one. This is why 'Refresh All' exists. See my example: https://community.zipato.com/topic/stopping-execution-of-a-repeat-block#comment-25971

photo
1

Hey Olivier en Alberto,


Thanks a lot for your quick replies!

Alberto, your code works perfectly, thanks for the extra printscreen, really helped me out :-)


Olivier, thanks, I was doubting why it didn't work but that explains a lot. Alberto wrote in the topic you mention: "doing it very often may decrease battery life on your devices on the long run", so let's not go for that option.


Thanks both!

photo
1

Hi, I disagree with Alberto, Refresh All doesn't drain the batteries, as Refresh All doesn't trigger the Zipabox to retreive the new state of the device, but rather let the rule see the new value that was sent nevertheless by the device when its state was changed.

photo
1

It might be the case, but then, the purpose of JOIN and REFRESH ALL is almost the same, if not the same. But as usual documentation from Zipato is ambiguous. I think the description on knowledge base for JOIN puzzle is totally opposite than the behavior of the block...

https://community.zipato.com/knowledge-base/article/the-puzzle-blocks

photo
Leave a Comment
 
Attach a file