2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00
fhem-mirror/fhem/examples/04_log
pest 9a4281059b - Pest, Sun Apr 15 14:54:30 MEST 2007
- doc: fhem.pl and commandref.html (notifyon -> notify, correction of examples)


git-svn-id: https://svn.fhem.de/fhem/trunk@54 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2007-04-15 12:55:01 +00:00

54 lines
1.8 KiB
Plaintext

#
# fhem.pl configfile
# Logging FS20/KS300 data
# See the file fht.gnuplot for displaying the logged data (or webfrontend/pgm2)
#
attr global logfile /tmp/fhem-%Y-%m.log
attr global statefile /tmp/fhem.save # where to save the state of the devices
attr global verbose 3 # "normal" verbosity
attr global port 7072 # our TCP/IP port (localhost only)
attr global modpath /usr/local/lib # where our FHEM directory is
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
define wz FHT 3232 # type FHT, transmitter code 3232 (default value)
define ks1 KS300 1234 250 # type KS300, with 250ml rain / counter
#########################
# Log temperature and actuator changes into a file, its name changes weekly
define wzlog FileLog /var/tmp/wz-%Y-%U.log wz:.*(temp|actuator).*
# Make it accessible from fhemweb.pl (webpgm2)
attr wzlog logtype fht:Temp
# ks300 log
define kslog FileLog /var/log/wz-%Y-%U.log ks1:.*H:.*
define avglog FileLog /var/log/avg.log ks1:.*avg.*
attr kslog logtype ks300_1:Temp/Hum,ks300_2:Rain/Wind
##############################
# Alternative log method. It does the same, but it is somewhat slower as it
# starts the shellscript below. Don't forget the "", as some values contain
# paranthesis, and your shell will probably bark.
define tmplog notifyon wz:temp.* "/usr/local/bin/log.sh @ "@ %""
##############################
# If using the frontends pgm2 or pgm3, then you can put the devices
# into separate rooms, see the corresponding README:
attr wz room InDoor
attr wzlog room InDoor
attr ks1 room OutDoor
attr kslog room OutDoor
attr avglog room OutDoor
quit
#########################
And here is /usr/local/bin/log.sh, don't forget chmod +x
#!/bin/sh
fname=$1
shift
echo `date +"%Y-%m-%d_%H:%M:%S"` "$*" >> /var/log/$fname.log