+
+ The following sample codes can be imported via "Raw definition".
+
+
+ -
+
+ Global, flexible opened windows/doors message
+
+ (similar to those described in the forum)
+
+
+
+defmod Fenster_monitoring monitoring .*:(open|tilted) .*:closed
+attr Fenster_monitoring errorReturn {return unless(@errors);;\
+ $_ = AttrVal($_, "alias", $_) foreach(@errors);;\
+ return("Das Fenster \"$errors[0]\" ist schon länger geöffnet.") if(int(@errors) == 1);;\
+ @errors = sort {lc($a) cmp lc($b)} @errors;;\
+ return(join("\n - ", "Die folgenden ".@errors." Fenster sind schon länger geöffnet:", @errors))\
+}
+attr Fenster_monitoring errorWait {AttrVal($name, "winOpenTimer", 60*10)}
+attr Fenster_monitoring warningReturn {return unless(@warnings);;\
+ $_ = AttrVal($_, "alias", $_) foreach(@warnings);;\
+ return("Das Fenster \"$warnings[0]\" ist seit kurzem geöffnet.") if(int(@warnings) == 1);;\
+ @warnings = sort {lc($a) cmp lc($b)} @warnings;;\
+ return(join("\n - ", "Die folgenden ".@warnings." Fenster sind seit kurzem geöffnet:", @warnings))\
+}
+ As soon as a device triggers an "open" or "tilded" event, the device is
+ set to the warning list and a timer is started after which the device
+ is moved from the warning to the error list. The waiting time can be
+ set for each device via userattr "winOpenTimer". The default value is
+ 10 minutes.
+ As soon as a device triggers a "closed" event, the device is deleted
+ from both lists and still running timers are stopped.
+
+
+ -
+ Battery monitoring
+defmod Batterie_monitoring monitoring .*:battery:.low .*:battery:.ok
+attr Batterie_monitoring errorReturn {return unless(@errors);;\
+ $_ = AttrVal($_, "alias", $_) foreach(@errors);;\
+ return("Bei dem Gerät \"$errors[0]\" muss die Batterie gewechselt werden.") if(int(@errors) == 1);;\
+ @errors = sort {lc($a) cmp lc($b)} @errors;;\
+ return(join("\n - ", "Die folgenden ".@errors." Geräten muss die Batterie gewechselt werden:", @errors))\
+}
+attr Batterie_monitoring errorWait 60*60*24*14
+attr Batterie_monitoring warningReturn {return unless(@warnings);;\
+ $_ = AttrVal($_, "alias", $_) foreach(@warnings);;\
+ return("Bei dem Gerät \"$warnings[0]\" muss die Batterie demnächst gewechselt werden.") if(int(@warnings) == 1);;\
+ @warnings = sort {lc($a) cmp lc($b)} @warnings;;\
+ return(join("\n - ", "Die folgenden ".@warnings." Geräten muss die Batterie demnächst gewechselt werden:", @warnings))\
+}
+ As soon as a device triggers a "battery: low" event, the device is set
+ to the warning list and a timer is started after which the device is
+ moved from the warning to the error list. The waiting time is set to 14
+ days.
+ As soon as a device triggers a "battery: ok" event, the device is
+ deleted from both lists and still running timers are stopped.
+
+
+ -
+ Activity Monitor
+defmod Activity_monitoring monitoring .*:.*
+attr Activity_monitoring errorReturn {return unless(@errors);;\
+ $_ = AttrVal($_, "alias", $_) foreach(@errors);;\
+ return("Das Gerät \"$errors[0]\" hat sich seit mehr als 24 Stunden nicht mehr gemeldet.") if(int(@errors) == 1);;\
+ @errors = sort {lc($a) cmp lc($b)} @errors;;\
+ return(join("\n - ", "Die folgenden ".@errors." Geräten haben sich seit mehr als 24 Stunden nicht mehr gemeldet:", @errors))\
+}
+attr Activity_monitoring errorWait 60*60*24
+attr Activity_monitoring warningReturn {return unless(@warnings);;\
+ $_ = AttrVal($_, "alias", $_) foreach(@warnings);;\
+ return("Das Gerät \"$warnings[0]\" hat sich seit mehr als 12 Stunden nicht mehr gemeldet.") if(int(@warnings) == 1);;\
+ @warnings = sort {lc($a) cmp lc($b)} @warnings;;\
+ return(join("\n - ", "Die folgenden ".@warnings." Geräten haben sich seit mehr als 12 Stunden nicht mehr gemeldet:", @warnings))\
+}
+attr Activity_monitoring warningWait 60*60*12
+ Devices are not monitored until they have triggered at least one event.
+ If the device does not trigger another event in 12 hours, it will be
+ set to the warning list. If the device does not trigger another event
+ within 24 hours, it will be moved from the warning list to the error
+ list.
+
+
+ -
+ Regular maintenance (for example changing the table water filter)
+
+defmod Wasserfilter_monitoring monitoring Wasserfilter_DashButton:.*:.short
+attr Wasserfilter_monitoring errorReturn {return unless(@errors);;\
+ return "Der Wasserfilter muss gewechselt werden.";;\
+}
+attr Wasserfilter_monitoring errorWait 60*60*24*30
+attr Wasserfilter_monitoring warningReturn {return unless(@warnings);;\
+ return "Der Wasserfilter muss demnächst gewechselt werden.";;\
+}
+attr Wasserfilter_monitoring warningWait 60*60*24*25
+ A DashButton is used to tell FHEM that
+ the water filter has been changed.
+ After 30 days, the DashButton is set to the error list.
+
+
+ -
+ Regular maintenance (for example cleaning rooms)
+
+defmod putzen_DashButton dash_dhcp
+attr putzen_DashButton allowed AC:63:BE:2E:19:AF,AC:63:BE:49:23:48,AC:63:BE:49:5E:FD,50:F5:DA:93:2B:EE,AC:63:BE:B2:07:78
+attr putzen_DashButton devAlias ac-63-be-2e-19-af:Badezimmer\
+ac-63-be-49-23-48:Küche\
+ac-63-be-49-5e-fd:Schlafzimmer\
+50-f5-da-93-2b-ee:Arbeitszimmer\
+ac-63-be-b2-07-78:Wohnzimmer
+attr putzen_DashButton event-min-interval .*:5
+attr putzen_DashButton port 6767
+attr putzen_DashButton userReadings state {return (split(":", @{$hash->{CHANGED}}[0]))[0];;}
+attr putzen_DashButton widgetOverride allowed:textField-long devAlias:textField-long
+
+defmod putzen_monitoring monitoring putzen_DashButton:.*:.short
+attr putzen_monitoring errorFuncAdd {$event =~ m/^(.+):/;;\
+ $name = $1;;\
+ return 1;;\
+}
+attr putzen_monitoring errorReturn {return unless(@errors);;\
+ return("Der Raum \"$errors[0]\" muss wieder geputzt werden.") if(int(@errors) == 1);;\
+ return(join("\n - ", "Die folgenden Räume müssen wieder geputzt werden:", @errors))\
+}
+attr putzen_monitoring errorWait 60*60*24*7
+ Several DashButton are used to inform
+ FHEM that the rooms have been cleaned.
+ After 7 days, the room is set to the error list.
+ However, the room name is not the device name but the readings name and
+ is changed in the errorFuncAdd
attribute.
+
+
+ -
+
+ Operating hours dependent maintenance
+ (for example, clean the Beamer filter)
+
+
+defmod BeamerFilter_monitoring monitoring Beamer_HourCounter:pulseTimeOverall BeamerFilter_DashButton:.*:.short
+attr BeamerFilter_monitoring userattr errorInterval
+attr BeamerFilter_monitoring errorFuncAdd {return 1\
+ if(ReadingsVal($name, "pulseTimeOverall", 0) >= \
+ ReadingsVal($name, "pulseTimeService", 0)\
+ + (AttrVal($SELF, "errorInterval", 0))\
+ && $addMatch\
+ );;\
+ return;;\
+}
+attr BeamerFilter_monitoring errorFuncRemove {return unless($removeMatch);;\
+ fhem(\
+ "setreading $name pulseTimeService "\
+ .ReadingsVal($name, "pulseTimeOverall", 0)\
+ );;\
+ return 1;;\
+}
+attr BeamerFilter_monitoring errorInterval 60*60*200
+attr BeamerFilter_monitoring errorReturn {return unless(@errors);;\
+ return "Der Filter vom Beamer muss gereinigt werden.";;\
+}
+attr BeamerFilter_monitoring warningFuncAdd {return}
+attr BeamerFilter_monitoring warningFuncRemove {return}
+ An HourCounter is used to record the
+ operating hours of a beamer and a
+ DashButton to tell FHEM that the filter
+ has been cleaned.
+ If the filter has not been cleaned for more than 200 hours, the device
+ is set to the error list.
+ If cleaning is acknowledged with the DashButton, the device is removed
+ from the error list and the current operating hours are stored in the
+ HourCounter device.
+
+
+