Class Plugins
This class implements the following methods and properties:
- class lib.plugin.Plugins(smarthome, configfile)[Quellcode]
Bases:
object
Plugin loader Class. Parses config file and creates a worker thread for each plugin
- Parameter:
smarthome – Instance of the smarthome master-object
configfile (str) – Basename of the plugin configuration file
- get(plugin_name, instance=None)[Quellcode]
Get plugin object by plugin name and instance (optional)
- Parameter:
plugin_name – name of the plugin (not the plugin configuration)
instance – name of the instance of the plugin (optional)
- Rückgabe:
plugin object
- get_logic_parameters()[Quellcode]
Returns the list of all logic parameter definitions of all configured/loaded plugins
- Rückgabe:
- get_loaded_plugins()[Quellcode]
Returns a list with the names of all loaded plugins
if multiple instances of a plugin are loaded, the plugin name is returned only once
- Rückgabe:
list of plugin names
- Rückgabetyp:
list
- get_loaded_plugin_instances()[Quellcode]
Returns a list of tuples of all loaded plugins with the plugin name and the instance name
- Rückgabe:
list of (plugin name, instance name)
- Rückgabetyp:
list of tuples
- static get_instance()[Quellcode]
Returns the instance of the Plugins class, to be used to access the plugin-api
Use it the following way to access the api:
from lib.plugin import Plugins plugins = Plugins.get_instance() # to access a method (eg. xxx()): plugins.xxx()
- Rückgabe:
logics instance
- Rückgabetyp:
object of None
- return_plugin(configname)[Quellcode]
Returns (the object of) one loaded smartplugin with given configname
- Parameter:
name (str) – name of the plugin to get
- Rückgabe:
object of the plugin
- Rückgabetyp:
object
- return_plugins()[Quellcode]
Returns a list with the instances of all loaded plugins
- Rückgabe:
list of plugin names
- Rückgabetyp:
list
- class PyObject[Quellcode]
Bases:
Structure
- refcnt
Structure/Union member
- unload_plugin(configname)[Quellcode]
Unloads (the object of) one loaded plugin with given configname
- Parameter:
name (str) – name of the plugin to unload
- Rückgabe:
success or failure
- Rückgabetyp:
bool
- start()[Quellcode]
- stop()[Quellcode]
- get_pluginthread(configname)[Quellcode]
Returns one plugin with given name
- Rückgabe:
Thread object for the given plugin name
- Rückgabetyp:
object