Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » Multiple AND or OR operators in rules when using rule REST API(How to use multiple AND or OR operators in rule conditions when using Rule REST API)
Multiple AND or OR operators in rules when using rule REST API [message #1778018] Fri, 08 December 2017 08:17 Go to next message
Dushan Aluth Patabendige is currently offline Dushan Aluth PatabendigeFriend
Messages: 4
Registered: December 2017
Location: Kuala Lumpur, Malaysia
Junior Member

I'm consuming Eclipse smart home REST API to create rules. I already know how to create a rule with only one condition.

 "conditions": [
        {
            "id": "7",
            "label": "Test rule",
            "description": "This triggers the rule if an item state has changed.",
            "configuration": {
            "itemName": "sensor_luminance_TUID_zwave_device_octopuszstick1_node12",
            "state": "48",
            "operator": "="
            },
            "type": "core.ItemStateCondition"
        }
    ]


But I have a requirement to create rules with multiple OR or AND operators. Ex:

If( X AND Y AND Z ) {
       DO THIS
}

If ((X AND Y) OR Z) {
       DO THIS
}


How to do it?
Re: Multiple AND or OR operators in rules when using rule REST API [message #1778152 is a reply to message #1778018] Mon, 11 December 2017 10:22 Go to previous messageGo to next message
Henning Treu is currently offline Henning TreuFriend
Messages: 44
Registered: April 2017
Member
Hi Dushan,

a rule can have a list of triggers and can be started by any of the triggers in this list. As for the conditions, a rule will execute its action(s) only if all given conditions match. For more information start on the JavaDoc for the Rule class.

Hope that helps. Cheers,
Henning
Re: Multiple AND or OR operators in rules when using rule REST API [message #1778225 is a reply to message #1778152] Tue, 12 December 2017 07:02 Go to previous message
Dushan Aluth Patabendige is currently offline Dushan Aluth PatabendigeFriend
Messages: 4
Registered: December 2017
Location: Kuala Lumpur, Malaysia
Junior Member

Hi Henning,

Thank you for the help!

Regards,
Dushan
Previous Topic:Eclipse SmartHome
Next Topic:Eclipse Kura
Goto Forum:
  


Current Time: Sat Nov 09 00:48:05 GMT 2024

Powered by FUDForum. Page generated in 0.03840 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top