mknx/smarthome — pull request #17 by robert-budde (2013-06-20 15:22:17+00:00)
Title: Add watch_item_eval to allow flexible selection of watch items for logics

***PROPOSAL***

Hi!

__This should just serve as a PROPOSAL how to allow flexibel selection of watch_items for logics!__

example from my own logic.conf:

[nachtbeleuchtung]
filename = 'nachtbeleuchtung.py'
; watch_item = *.Automatikschalter
watch_item_eval = [item for item in sh.match_items('*.Automatikschalter') if 'nacht_helligkeitswert' in item.conf]

Works like a charm - of course it is somewhat hard for novices...

see
http://www.diveintopython.net/power_of_introspection/filtering_lists.html