The future of the Rule Engine? Supporting contextual natural language

Hi all,

since a few years I have been thinking of home automation as a tool to express ones creativity. As you know, coming up with new ways of connecting your home devices can be very exciting, yet painful. Having discovered the UX improvements of openHAB 2.0 now, I believe the project has the chance to attract a lot more people into the world of smart homes.

Please let me therefore tell you a fictive story from the year 2019 that might or might not get reality:

Alex loves technology and since two years he is owning a set of smart lightbulbs and motion sensors that he controls from the vendors app. He likes playing around with different ways of defining how motions switch the lightbulbs, but the possibilities seem very limited to him. At least he was able to connect his Alexa to it. After news about attacks to some cloud services he is not willing to even more open up the control to his little smart home.

One day he reads an article about an app where ordinary people share how they automtate their home. They even can download other peoples projects and apply them to their own devices. One guy has created a set of rules involving the exact same motion sensors and applying a logic on them to switch off the lights when no one is at home. The article further states that your devices do not need to be connected to the Internet. It seems to Alex that finally you do no longer need developer skills to securely live your creativity in that space.

Alex is thrilled when he discovers the the app is for free. He would only need a Raspberry Pi for 20€ and a SD card that is preconfigured with openHAB 2.0 that he can order for 10€.

How realistic does this story sound to you? To my opinion the new Rule Engine has the potential to attract a lot more people to a cloudless smart home. I know it is not finished. There is ongoing development on the modules and the Paper UI. Furthermore, the Eclipse IoT Marketplace will provide the possibility to download third-party bundles and rule templates.

However, this might not fit to an ordinary beginner and I would like to provide another building block to it that could make it more attractive for the less skilled user. I am in the process of designing an Android app that will allow the user to define Triggers, Conditions, and Actions by entering natural language.

Trigger: “WHEN lightbulb1 is switched on”
Condition: “AND the time is 12:30”
Action: “DO switch off lightbulb2”

  • The user can create each of these modules separately and combine them to new rules.
  • The modules are stored in openHAB 2.0 (may be in one big invisible rule template).
  • Besides the textual form each module is displayed with an icon that symbolizes its meaning.
  • Via drag & drop the user can create a new rule in less than 3 seconds.
  • Complex wiring is not supported as it makes modules dependent on each other.
  • For each module type in openHAB 2.0 a grammar is defined that converts from textual form to the module format of the REST API. The grammar is flexible and allows the user to enter clauses intuitively.
  • I am tending to release the language processing and grammars to the community as open source.
  • To my knowledge rule templates are currently missing a context (e.g. only for lightning tag, only makes sense with a switch item). This is a barrier to building a platform for sharing them with others.
  • I would love seeing (or building) a platform where based on a users items she would get proposals which rule templates by other people might fit to her setup.

Let’s innovate! We should skate to where the puck is going to be, not where it has been already. Do you think that this concept could help beginners and non-developers to more easily craft their automation and even attract them to openHAB?

Best Regards,

1 Like

Reminds me of Octoblu… at least before Citrix bought them.

A natural language app that would build rules sounds interesting. I have a lot of time invested in understanding OpenHAB & trying to explain it to beginners. However, I’d love to see more people get started with & have success with OpenHAB by lowering the learning curve.

I’m just beginning to see things about Node Red. How would your proposal compare & contrast to Node Red.

According to this, it looks like Node Red might resemble what you’re talking about, but just for stuff with MQTT binding.

1 Like

Thanks @papabrenta for suggesting a comparison to a Node Red driven user experience. I have seen this post before and asked myself whether this would already realize the goal that is in my mind.

The Node Red UI definitely is very useful for greating complex scenarios and it is not bound to the Trigger / Condition / Action structure. But then I tought about the mental model a user would need to achieve his first automation: MQTT, Broker, JS. These are rather technical terms that adress a technically skilled person. Furthermore, you need to setup and configure an additional component to your system before you can start.

Seeing that openHAB 2.0 has a new extensible data model for rules, I am seeing the chance to build a completely new user experience for day 1 of the users journey.

  • The mental model a user has to learn consists of less technical terms: Thing, Item, Action, Trigger, Condition.
  • A UI that supports natural language processing could directly connect to openHAB 2.0 without the need to install yet another component.
  • The solution provides a nice learning curve. You can start easy with simple clauses like “DO switch on lightbulb1”. And if thinking to the extreme end up with “DO set counter1 to value of counter2 plus 5” (counter beeing an item).
  • The clauses can adapt to your current setup within openHAB 2.0. If you say “WHEN sunset occurred” this might match to the Astro binding or a module type that has been downloaded from the Eclipse IoT Marketplace. So whenever you extend openHAB 2.0 you automatically extend the possibilities of defining clauses.
  • You have access to all contextual data from openHAB 2.0: Tags, item types, channel types. These can be attached to a rule to give context and give advice to the user during entering clauses. Thus: “Contextual natural language processing”
  • The contextual clauses can even help the user to find rule templates by others that fit best to their own setup.
  • Restricting the rules to the Trigger / Condition / Action scheme further eases up consumption of rule templates by others. Because it is easier to understand them.

As a developer we tend to add a lot of features to a solution that reflect as components in the UI. It might be better to not overhelm a user in the beginning. Showing her only those features that are currently valid to her. What do you think?

Best regards,

1 Like

You make a lot of good points, Dominik. You make a good case for your proposal to be less technical than Node Red. As one who tries to help beginners, I often find it challenging to talk them through what they need to get a success. I wish you much success in your endeavors & look forward to hearing more about your progress.

1 Like

Sounds nice. My 50cent: Don’t create an Android app. Open it to all users and create a browser app (html5).

1 Like

Thanks @lopez1de for providing your concern that a html5 application would address more users. For sure you are right with this statement. After thinking about it a little further I have to admit that I would like to keep the app flexible in what home automation system it can connect to. This also means a UI served by the openHAB instance itself is not quite fitting my ambitions at the moment.

For me these leads to the following question where I would love to get your opinion on: Do you think it is an option to serve this user experience as a cloud offering connected to the openHAB Cloud Service? This would be a hybrid cloud approach for home automation. Create rules in the cloud application and let your local openHAB 2.0 instance take care of rule execution. However, this is far more sophisticated than I have planned for so far. But hey, it is an exciting idea.

Regards, Domink