lib.module

This library implements loading and starting of core modules of SmartHomeNG.

The methods of the class Modules implement the API for modules. They can be used the following way: To call eg. xxx(), use the following syntax:

from lib.module import Modules
modules = Modules.get_instance()

# to access a method (eg. enable_logic()):
moddules.xxx()
Warning:

This library is part of the core of SmartHomeNG. It should not be called directly from plugins!

class lib.module.Modules(smarthome, configfile)[Quellcode]

Bases: object

Module loader class. Parses config file and creates an instance for each module. To start the modules, the start() method has to be called.

Parameter:
  • smarthome – Instance of the smarthome master-object

  • configfile (str) – Basename of the module configuration file

static get_instance()[Quellcode]

Returns the instance of the Modules class, to be used to access the modules-api

Use it the following way to access the api:

from lib.module import Modules
modules = Modules.get_instance()

# to access a method (eg. xxx()):
modules.xxx()
Rückgabe:

modules instance

Rückgabetyp:

object of None

return_modules()[Quellcode]

Returns a list with the names of all loaded modules

Rückgabe:

list of module names

Rückgabetyp:

list

get_module(name)[Quellcode]

Returns the module object for the module named by the parameter or None, if the named module is not loaded

Parameter:

name (str) – Name of the module to return

Rückgabe:

list of module names

Rückgabetyp:

object

start()[Quellcode]

Start all modules

Call start routine of module in case the module wants to start any threads

stop()[Quellcode]

Stop all modules

Call stop routine of module to clean up in case the module has started any threads