This is the ThingsDB documentation for version v0, click here for the latest version!
Create (and configure) a new module for ThingsDB.
After a module is created, a future() is required to use the new module.
ThingsDB has special support for Python modules which will be activated if you module file ends with .py
. In this case the Python interpreter will be used to start the module.
By default a module can be used in all scopes. It is possible however, to restrict the usage by using set_module_scope(..).
This function generates an event.
new_module(name, file, [configuration])
Argument | Type | Description |
---|---|---|
name |
str (required) | Name of the new module. |
file |
str (required) | Filename of the module. The same file might be configured multiple times. The file must be path relative to the modules path). If the file ends with .py , the Python interpreter will be used to start the module. |
configuration |
any (optional) | Configuration for the module. The configuration will be packed using a fixed deep value of two (2 ). If omitted (or nil ), no configuration will be used for the module. |
Returns nil
. You might want to use module_info(..) to check if the module is successfully running.
Create a new module
DEMO1
:
new_module('DEMO1', 'demo');
Return value in JSON format
null