CEP vs OpenHAB Rules

Hello guys,

I’ve read that you could use Complex Event Processing (CEP) in OpenHAB to define more complex/powerful rules than the ones that can be defined directly in OpenHAB. Is that true?

Does anybody know an example for such a rule? In other words where are the limitation of the OpenHAB rules in comparison to CEP?

Thanks for your Help :slight_smile:

Not sure what you understand by ‘CEP’ and who’s writing that.
By default, only a single openHAB event can trigger a rule to be executed, but you can store and process any data and interact with external databases and external event processing systems via MQTT or HTTP so your actions can be based on as many inputs and historical data as you like.
If by ‘CEP’ you mean to use complex triggers such as ‘when A then B but only if C’ then yes an experimental rule engine to allow for that exists, but it’s not yet recommended for use, hence its name.

As i understood “Complex Event Processing”, is combining several events to a business event:
E1(Last one left the house) + NOT(E1.5(Nobody returned)) + E2(Window is opened) => Burglar Event
E3(Burglar Event) => call the police

In openHAB you would use a state and an event:
E1(Last one left the house) => S1(Nobody at home)
E2(Window is opened) + S1(Nobody at home) => S2(Burglary State => true)
E3(Burglary State changed to true) => call the police

So, the only difference is that you do not need to track the state, but on the other hand you need quite some horsepower to analyze all the events all the time. (The Event E1 could be a month ago.)

With CEP as i understand it, you build your business logic on top a pool of events, while in openHAB you build your business logic on one event and a pool of states.

You can build the same business logic with both approaches, according to my opinion the openHAB aproach is more economic, while the CEP approach is nicer in theory. With openHAB several business rules are coupled together by states while with CEP you just got a single bussiness rule.

But i may be wrong, because today is the first time i heard about CEP. :wink:

Me, too, so I looked that up in Wikipedia before answering. It’s not an all-too-well-defined thing. I had to guess the OP’s interest is in more complex triggers, hence my answer.
Also mind you that by definition, no two or more events can take place at the exactly same time, so essentially any event-driven logic will always be based on ONE event and a set of states - which is what OH can handle in its standard rules engine already.

So, I guess that’s why I feel like I’m always waiting for someone or something, :slight_smile:
( I realize you were not making a general statement to cover all things happening in the universe, but I could not resist…)

1 Like

Well at least it’s fundamental truth in the home automation universe, e.g. if you like the way you solve a problem, your wife won’t, and vice versa. SCNR either :wink: