mknx/smarthome — pull request #142 by ohinckel (2014-12-28 14:03:24+00:00)
Title: Attach logic trigger methods for plugins

Plugin developers have two possibilities to attach the logic to the SmartHome.py configuration / system:
* using `parse_item()` method
* using `parse_logic()` method

The `parse_item()` method is called for each configured item and the plugin can decide if it is interested in item changes or not by simply returning an update method depending on the condition. When returning an update method a trigger method will be added to the item and invoked each time the item's value is changed.

The `parse_logic()` method is called for each configured logic and the plugin can decide if it is interested in the logic or not. This can be used to setup some configuration for the plugin, but can't be used to register a trigger method which is invoked each time the logic is triggered. This patch add this functionality to register a trigger method for logics by simply returning a trigger method.

Example:
```
def parse_item(self, item):
...
return self.update_item

def parse_logic(self, logic):
...
return self.trigger_logic

def update_item(self, item, caller=None, source=None, dest=None):
// do something on item value change
...

def trigger_logic(self, logic, by=None, source=None, dest=None):
// do something on logic trigger
...
```

This way a plugin can register a logic hook, which is called each time a logic was triggered.