Difference between revisions of "Gateway plugins"
Jump to navigation
Jump to search
Line 17: | Line 17: | ||
It is possible to expose a method without authentication: no token will be required to access the method, this is done as follows: | It is possible to expose a method without authentication: no token will be required to access the method, this is done as follows: | ||
− | "" | + | <syntaxhighlight lang="python"> |
@om_expose(auth=False) | @om_expose(auth=False) | ||
def method_to_expose(self, ...): | def method_to_expose(self, ...): | ||
... | ... | ||
− | + | </syntaxhighlight> | |
== Packaging a plugin == | == Packaging a plugin == |
Revision as of 17:45, 2 March 2014
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.
Contents
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, ...):
...