Blockly Or logic command


I want to make a rule to check my Windows and Doors sensors as a part of a alarm system.

When the front door close by signal and show me close, all Windows and Doors with sensors shut be closed also. when one is open when closing and also when one is open later i want to know it.

Is there a sample or an idea to make a blockly code for my system?



Yes, this is very doable in Blockly. It might even be doable in simple UI rules.

But your requirements are not clear. So I can’t really tell you how to do it as I don’t fully understand what you want to do.

Just remember that OH rules always work as “when X event happens and Y is true do Z”. X could be something like “Item FrontDoor changed to CLOSED”, Y is optional but it can be something like “it’s between 08:00 and 13:00”, and Z is what to do, something like “send a notification”.

If “by signal” you mean send some sort of notification, then create a rule that triggers when the front door Item changes to CLOSED with an Action top send the notification.

Put all these Items into a Group. Make the Group type Contact and the aggregation function be One OPEN then OPEN else CLOSED. This will mean that the Group’s state will be OPEN if one or more members are OPEN and it’s state will be CLOSED only if all members of the Group are CLOSED. You can then just test the state of the Group Item to see if you have one or more doors or windows OPEN.

Going back to the way a rule works, you need an event to trigger the rule (a member of the doors ands windowns Group changes) and an action (send a notification that a window/door opened or closed).

Thanks very much for your quick reply. The solution point is" Make the Group type Contact and the aggregation function be One OPEN then OPEN else CLOSED
That make exact my missing OR logic function

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.