(#12) ESP
And not the whacko stuff JB Rhine wrote about - but Event Stream Processing. From now on, when I type ESP, I mean Event Stream Processing and not Extrasensory Perception.
I've been taking a long, leisurely path to this point - a good home automation system should make inferences. An inference is a conclusion based on data and reasoning. So let me be direct - a good home automation system should make inferences.
There.
Oh hell, one more time: a good home automation system should make inferences. That's Point #1.
An inference is a conclusion ("some one is home!") based on data ("the garage door opened, then the house door opened and closed -- all within a few minutes.").
Point #2, we've talked about how the rules that drive the conclusion could change over time. So they shouldn't be hard-coded as some sort of Finite State Machine in the application.
Point #3, tools exist that allow you to draw conclusions based on the appearance of data (in my case, specifically, MQTT event message).
And these tools allow you to express the event sequence easily.
At run time.
I know, right?
It's almost as cool as when Smuckers put peanut butter and jelly in the same jar!
Esper estas programaro por okazaĵo rivereto prilaborado.
(I slay myself...) Esper is an open source, Java based, Event Stream Processor. Event Stream Processing is a subset/superset/cousin/sibling of Complex Event Processing which we introduced earlier.
You can learn more about Esper from their website: http://www.espertech.com/esper/
Pulled right from their homepage:
For you Emergenetics Greenies, here's the recipe
Esper's a cool tool. And it comes with (as of this blogging) 733 pages of documentation. Esper's the brain child of a genius, and unfortunately, the documentation assumes you're a genius too.
There are few of the obligatory Hello World examples out there. Esper comes with plenty of examples, but they're source files. What mere mortals, like you and me, need are pretty simplistic step-by-step examples.
That's what I'll do next. I'll post my code.
Oh, I use NetBeans. So you JetBrains and Eclipse users will just have to suffer along.
I've been taking a long, leisurely path to this point - a good home automation system should make inferences. An inference is a conclusion based on data and reasoning. So let me be direct - a good home automation system should make inferences.
There.
Oh hell, one more time: a good home automation system should make inferences. That's Point #1.
An inference is a conclusion ("some one is home!") based on data ("the garage door opened, then the house door opened and closed -- all within a few minutes.").
Point #2, we've talked about how the rules that drive the conclusion could change over time. So they shouldn't be hard-coded as some sort of Finite State Machine in the application.
Point #3, tools exist that allow you to draw conclusions based on the appearance of data (in my case, specifically, MQTT event message).
And these tools allow you to express the event sequence easily.
At run time.
I know, right?
It's almost as cool as when Smuckers put peanut butter and jelly in the same jar!
Esper estas programaro por okazaĵo rivereto prilaborado.
(I slay myself...) Esper is an open source, Java based, Event Stream Processor. Event Stream Processing is a subset/superset/cousin/sibling of Complex Event Processing which we introduced earlier.
You can learn more about Esper from their website: http://www.espertech.com/esper/
Pulled right from their homepage:
Drawing Conclusions in 3, no 5, Easy StePs!
For you Emergenetics Greenies, here's the recipe
- Have your Home Automation Sensors publish events on the network. I'm using MQTT
- Download and install Esper (You can code Java, right?)
- Write Java code
- You'll need a main() that instantiates and runs the Esper Engine
- You'll need a POJO that represents your Events
- Write code to subscribe the the MQTT event stream
- Write a handler object, that you want triggered when Esper makes an inference
- Write the EPL that represents the event sequence you're after
- Tell Esper to associate the handler code and the EPL statement
- Run
- Debug, lather rinse repeat
See? Five steps.
Esper's a cool tool. And it comes with (as of this blogging) 733 pages of documentation. Esper's the brain child of a genius, and unfortunately, the documentation assumes you're a genius too.
There are few of the obligatory Hello World examples out there. Esper comes with plenty of examples, but they're source files. What mere mortals, like you and me, need are pretty simplistic step-by-step examples.
That's what I'll do next. I'll post my code.
Oh, I use NetBeans. So you JetBrains and Eclipse users will just have to suffer along.