Pub/sub detailed informations

plugin.configuration

Publisher: * all Domogik plugins

Subscriber: any member who wants to be aware of the plugins configuration updates * manager * UIs

When a plugin configuration is updated (add, delete, update actions), the dbmgr published over the MQ a message.

An example to catch these messages is available as src/domogik/examples/mq-python/sub_plugin_configuration.py.

You will get messages like this:

{"host": "darkstar", "type": "plugin", "id": "diskfree", "event": "updated"}

The only event value is updated.

In the manager, a Plugin object is created for each plugin detected (on the file system). In each of these objects, a subscription is made to the plugin.configuration category and when a message is catched, if type == ‘plugin’ and id == <plugin id> and host = <hostname> then the plugin configuration in database is reloaded (in order the clients.detail message to be updated)

plugin.status

Publisher: * all Domogik plugins

Subscriber: any member who wants to be aware of the plugins status * manager * UIs

Each domogik plugin sends over the MQ its status. The manager subscribe to the category plugin to get the plugin status in real time.

For example, on plugin startup (see XplPlugin.__init__()), a plugin sends the STATUS_STARTING (starting value):

self._pub.send_event('plugin.status',
                     {"type" : "plugin",
                      "id" : self._name,
                      "host" : self.get_sanitized_hostname(),
                      "event" : STATUS_STARTING})

An example to catch these messages is available as src/domogik/examples/mq-python/sub_plugin_status.py.

You will get messages like this:

{"host": "darkstar", "type": "plugin", "id": "diskfree", "event": "alive"}

Find here :doc:the full list of available status.</technical/plugins/index>

In the manager, a Plugin object is created for each plugin detected (on the file system). In each of these objects, a subscription is made to the plugin.status category and when a message is catched, if type == ‘plugin’ and id == <plugin id> then the plugin status is set to the catched value.

clients.list

Publisher: * manager

Subscriber: any member who wants to be aware of the clients (plugins, ...) list * UIs

The manager publishes over the MQ the clients list when there is something new.

An example to catch these messages is available as src/domogik/examples/mq-python/sub_clients_list.py.

You will get messages like this:

{"domogik-diskfree.darkstar": {"status": "alive", "configured": true, "pid": 0, "host": "darkstar", "type": "plugin", "id": "diskfree"}}

clients.detail

Publisher: * manager

Subscriber: any member who wants to be aware of the clients (plugins, ...) detail * UIs

The manager publishes over the MQ the clients detail when there is something new.

Notice that the cliens detail include the clients list.

An example to catch these messages is available as src/domogik/examples/mq-python/sub_clients_detail.py.

You will get messages like this:

{u'domogik-diskfree.darkstar': {u'status': u'unknown', u'name': u'diskfree', u'data': {u'configuration': [{u'description': u'Automatically start plugin at Domogik startup', u'default': False, u'required': False, u'options': [], u'key': u'startup-plugin', u'type': u'boolean', u'id': u'0'}, {u'description': u'Interval between each poll (minute)', u'default': 5, u'required': False, u'value': u'7', u'options': [], u'key': u'interval', u'type': u'integer', u'id': u'1'}]}, u'configured': True, u'pid': 0, u'package_id': u'plugin-diskfree', u'host': u'darkstar', u'type': u'plugin'}}

packages.detail

Publisher: * manager

Subscriber: any member who wants to be aware of the packages details * UIs

The manager publishes over the MQ the packages detail when there is something new.

An example to catch these messages is available as src/domogik/examples/mq-python/sub_packages_detail.py.

You will get messages like this:

{u'plugin-diskfree': {u'device_types': {u'diskfree.disk_usage': {u'commands': [], u'description': u'Disk usage', u'xpl_params': [{u'type': u'string', u'description': u'The path to look at', u'key': u'device'}], u'sensors': [u'get_total_space', u'get_percent_used', u'get_free_space', u'get_used_space'], u'id': u'diskfree.disk_usage', u'name': u'Disk usage'}}, u'udev_rules': []}}