Reusable Python3 rules with Zone API

Hi all,

I’ve been with OpenHab for a while and transitioned my rules from XTend, to Jython and now Python 3 (via HABapp). During this time, I’ve created my own framework to provide an abstraction layer on top of OpenHab items. I’ve finally found sometimes to create a PyPi package distribution that allows the framework to be installed via pip.

This is an area that is definitely not for non-technical OpenHab users. That said, the usage of Python 3 does allow for a reusable set of rules, that can be further extended by the user. I hope that it could be useful for some people. The default bundled actions do address common use cases such as managing light, or sending alerts when certain events are triggered.

The Zone API groups items into devices and zones (rooms). A set of actions are automatically registered with each zones based on various criteria (such as the zone types and the devices it contains). The appropriate actions are triggered when a device event is triggered. All the user needs to do is to name the OpenHab items according to a set of conventions, the rest is taken care of by the framework. There is detailed instructions on how to set up an instance on the GitHub page.

The framework relies on HABapp. For a comparison between HABApp and Jython, see this post.

Cheers,

1 Like