Gateway plugins

From OpenMotics
Revision as of 17:45, 2 March 2014 by Fryckbos (talk | contribs)
Jump to navigation Jump to search

The plugin system on the OpenMotics Gateway allows users to run python code on the gateway. This code can interact with the OpenMotics Master through the webservice, expose new methods on the webservice, receive events for input and output changes and run background tasks.

Writing a plugin

The @om_expose decorator

Decorator to expose a method of the plugin class through the webinterface. The url will be /plugins/<plugin-name>/<method>.

Normally an authentication token is required to access the method. The token will be checked and removed automatically when using the following construction:

@om_expose
def method_to_expose(self, ...):
...

It is possible to expose a method without authentication: no token will be required to access the method, this is done as follows:

@om_expose(auth=False)
def method_to_expose(self, ...):
...

Packaging a plugin

Installing a plugin

Plugin configuration