FHEM Forum

FHEM => Codeschnipsel => Thema gestartet von: rapster am 27 November 2014, 23:23:57

Titel: checkContacts() - Funktion zum Überwachen mehrere Kontakte, z.B. Fensterkontakte
Beitrag von: rapster am 27 November 2014, 23:23:57
Hallo Zusammen,

hier mal eine Funktion zum Überwachen mehrerer Kontakte, ähnlich structure.

Es können beim jeweiligen Status User-Commands ausgeführt werden, bzw. der Rückgabewert für andere Funktionen genutzt werden.


# To use checkContacts define a Dummy for displaying and configuration, and call this function with checkContacts('dummyName')
# define DisplayAndConfigurationDummy dummy
# attr DisplayAndConfigurationDummy userattr searchRegExp checkType goodState:closed,open goodCommand badCommand unknownCommand contactsDelimiter
#
# searchRegExp - the RegExp attr to find the contacts
# checkType - optional type check of device, e.g. CUL_HM
# goodState - optional which state is good, closed or open
# goodCommand,badCommand,unknownCommand - optional if defined commands will be executed on corresponding state, you can use wildcard %contacts% which will be replaced with the corresponding devAlias or if not exists the devName.
# contactsDelimiter - optional delimiter between found devices
#
# returns count of unknown+bad devices, if all is good return is 0
#


Gruß Claudiu
Titel: Antw:checkContacts() - Funktion zum Überwachen mehrere Kontakte, z.B. Fensterkontakte
Beitrag von: rapster am 20 Januar 2015, 07:07:32
Aus aktuellem Anlass, mal ne aktuelle Version, glaub paar Kleinigkeiten hatten sich geändert...