mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-13 17:26:34 +00:00
Examples revisited
git-svn-id: https://svn.fhem.de/fhem/trunk@215 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
7b5564a91d
commit
9ec069e883
@ -11,7 +11,7 @@ attr global logfile /tmp/fhem-%Y-%m.log
|
|||||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
||||||
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
||||||
attr global port 7072 # our TCP/IP port (localhost only)
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
attr global modpath /usr/local/lib # where our FHEM directory is
|
attr global modpath . # where our FHEM directory is
|
||||||
|
|
||||||
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#
|
#
|
||||||
# fhem.pl configfile
|
# fhem.pl configfile
|
||||||
#
|
#
|
||||||
# We have 2 rollades (which are connected via the FS20MS). Button 3 on the
|
# The challange: We have 2 rollades (which are connected via the FS20MS).
|
||||||
# FS20S20 should activate both rollades. There are three solutions:
|
# Button 3 on the FS20S20 should activate both rollades. There are three
|
||||||
|
# solutions:
|
||||||
# 1. Builtin commands
|
# 1. Builtin commands
|
||||||
# 2. Perl expression
|
# 2. Perl expression
|
||||||
# 3. Shell script (realized via external script at the end of this file)
|
# 3. Shell script (realized via external script at the end of this file)
|
||||||
@ -13,7 +14,7 @@ attr global logfile /tmp/fhem-%Y-%m.log
|
|||||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
||||||
attr global verbose 3 # "normal" verbosity
|
attr global verbose 3 # "normal" verbosity
|
||||||
attr global port 7072 # our TCP/IP port (localhost only)
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
attr global modpath /usr/local/lib # where our FHEM directory is
|
attr global modpath . # where our FHEM directory is
|
||||||
|
|
||||||
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ define n_1a notify btn3 set roll1 %;; set roll2 %
|
|||||||
# Method 1b: shorter:
|
# Method 1b: shorter:
|
||||||
define n_1b notify btn3 set roll1,roll2 %
|
define n_1b notify btn3 set roll1,roll2 %
|
||||||
|
|
||||||
# Method 2a: perl.
|
# Method 2a: the same in perl. Everything between {} is evaluated as perl code
|
||||||
define n_2a notify btn3 { fhem "set roll1,roll2 %" }
|
define n_2a notify btn3 { fhem "set roll1,roll2 %" }
|
||||||
|
|
||||||
# Method 2b: perl. open the rollades only to a certain amount if they are
|
# Method 2b: perl. open the rollades only to a certain amount if they are
|
||||||
@ -44,7 +45,8 @@ define n_2b notify btn3 {\
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
# Method 3: shell. The script follows after "quit". Dont forget to chmod u+x it.
|
# Method 3: shell. Everything between "" is evaluated as a shell command. The
|
||||||
|
# script follows after "quit". Dont forget to chmod u+x it.
|
||||||
define n_3 notify btn3 "/usr/local/bin/roll.sh %"
|
define n_3 notify btn3 "/usr/local/bin/roll.sh %"
|
||||||
|
|
||||||
quit # Ignore the rest of this file
|
quit # Ignore the rest of this file
|
||||||
@ -64,8 +66,8 @@ quit # Ignore the rest of this file
|
|||||||
fhem=/usr/local/bin/fhem.pl
|
fhem=/usr/local/bin/fhem.pl
|
||||||
|
|
||||||
if test $1 = "on"; then
|
if test $1 = "on"; then
|
||||||
$fhem 7072 "set roll1 on-for-timer 10
|
$fhem 7072 "set roll1 on-for-timer 10"
|
||||||
$fhem 7072 "set roll2 on-for-timer 16
|
$fhem 7072 "set roll2 on-for-timer 16"
|
||||||
else
|
else
|
||||||
$fhem 7072 "set roll1,roll2 off"
|
$fhem 7072 "set roll1,roll2 off"
|
||||||
fi
|
fi
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
# After about 5-10 minutes, check if "list wz" returns something meaningful
|
# After about 5-10 minutes, check if "list wz" returns something meaningful
|
||||||
#
|
#
|
||||||
|
|
||||||
attr global logfile /tmp/fhem-%Y-%m.log
|
attr global logfile /var/log/fhem/fhem-%Y-%m.log
|
||||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
attr global statefile /var/log/fhem/fhem.save # where to save the state of the devices
|
||||||
attr global verbose 3 # "normal" verbosity
|
attr global verbose 3 # "normal" verbosity
|
||||||
attr global port 7072 # our TCP/IP port (localhost only)
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
attr global modpath /usr/local/lib # where our FHEM directory is
|
attr global modpath /usr/local/libusr/local/lib # where our FHEM directory is
|
||||||
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
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 wz FHT 3232 # type FHT, transmitter code 3232 (default value)
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
# contrib/91_DbLog.pm
|
# contrib/91_DbLog.pm
|
||||||
#
|
#
|
||||||
|
|
||||||
attr global logfile /tmp/fhem-%Y-%m.log
|
attr global logfile /var/log/fhem/fhem-%Y-%m.log
|
||||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
attr global statefile /var/log/fhem/fhem.save # where to save the state of the devices
|
||||||
attr global verbose 3 # "normal" verbosity
|
attr global verbose 3 # "normal" verbosity
|
||||||
attr global port 7072 # our TCP/IP port (localhost only)
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
attr global modpath /usr/local/lib # where our FHEM directory is
|
attr global modpath /usr/local/libusr/local/lib # where our FHEM directory is
|
||||||
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
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 wz FHT 3232 # type FHT, transmitter code 3232 (default value)
|
||||||
@ -17,7 +17,7 @@ define ks1 KS300 1234 250 # type KS300, with 250ml rain / counter
|
|||||||
|
|
||||||
#########################
|
#########################
|
||||||
# Log temperature and actuator changes into a file, its name changes weekly
|
# Log temperature and actuator changes into a file, its name changes weekly
|
||||||
define wzlog FileLog /var/tmp/wz-%Y-%U.log wz:.*(temp|actuator).*
|
define wzlog FileLog /var/var/log/fhem/wz-%Y-%U.log wz:.*(temp|actuator).*
|
||||||
|
|
||||||
# Make it accessible from 01_FHEMWEB.pm (webpgm2)
|
# Make it accessible from 01_FHEMWEB.pm (webpgm2)
|
||||||
# Note: for FHEMWEB large logfiles (one per year) are recommended to be able to
|
# Note: for FHEMWEB large logfiles (one per year) are recommended to be able to
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
# if there is no definition for it. Check the commandref.html define, Type HMS
|
# if there is no definition for it. Check the commandref.html define, Type HMS
|
||||||
# section for details
|
# section for details
|
||||||
|
|
||||||
attr global logfile /tmp/fhem-%Y-%m.log
|
attr global logfile /var/log/fhem/fhem-%Y-%m.log
|
||||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
attr global statefile /var/log/fhem/fhem.save # where to save the state of the devices
|
||||||
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
||||||
attr global port 7072 # our TCP/IP port (localhost only)
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
attr global modpath /usr/local/lib # where our FHEM directory is
|
attr global modpath /usr/local/libusr/local/lib # where our FHEM directory is
|
||||||
|
|
||||||
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# These are only examples for the at and notify command
|
# These are only examples for the at and notify command
|
||||||
|
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
# absolute ones:
|
# absolute ones:
|
||||||
define a1 at 17:00:00 set lamp on # fhem command
|
define a1 at 17:00:00 set lamp on # fhem command
|
||||||
@ -14,11 +13,14 @@ define a5 at +00:00:10 set lamp on # switch the lamp on in 10 seconds
|
|||||||
define a6 at +00:00:02 set lamp on-for-timer 1 # Blink once in 2 seconds
|
define a6 at +00:00:02 set lamp on-for-timer 1 # Blink once in 2 seconds
|
||||||
define a7 at +*{3}00:00:02 set lamp on-for-timer 1 # Blink 3 times
|
define a7 at +*{3}00:00:02 set lamp on-for-timer 1 # Blink 3 times
|
||||||
|
|
||||||
|
# For correct sunrise/sunset values, put the following line (with your
|
||||||
|
# coordinates in it) in your fhem.cfg
|
||||||
|
{ sunrise_coord("8.686", "50.112", "") }
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
# Switch the lamp on from sunset to 11 PM each day
|
# Switch the lamp on from sunset to 11 PM each day
|
||||||
# You have to install 99_SUNRISE_EL.pm in the FHEM directory to have sunset()
|
|
||||||
# We have to use the relative versions, as the next event is computed now
|
# We have to use the relative versions, as the next event is computed now
|
||||||
{ sunrise_coord("8.686", "50.112", "") }
|
# and absolute values would cause problems in the spring
|
||||||
define a8 at +*{sunset_rel()} set lamp on
|
define a8 at +*{sunset_rel()} set lamp on
|
||||||
define a9 at *23:00:00 set lamp off
|
define a9 at *23:00:00 set lamp off
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ define a9 at *23:00:00 set lamp off
|
|||||||
define a10 at +*{sunset_rel()} set lamp on-till 23:00
|
define a10 at +*{sunset_rel()} set lamp on-till 23:00
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
# Only do this on weekend. For the preset perl variables see commandref.html
|
# Only do this at weekend. For the preset perl variables see commandref.html
|
||||||
define a11 at +*{sunset_rel()} { fhem("set lamp on-till 23:00") if($we) }
|
define a11 at +*{sunset_rel()} { fhem("set lamp on-till 23:00") if($we) }
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
@ -36,7 +38,6 @@ define a12 at *07:00 set lamp1,lamp2 on-till {sunrise_abs(+600)}
|
|||||||
|
|
||||||
##################################
|
##################################
|
||||||
# Switch lamp1 on at sunrise, but not before 07:00
|
# Switch lamp1 on at sunrise, but not before 07:00
|
||||||
# Note: you have to put 99_Utils.pm in the FHEM modules directory
|
|
||||||
define a13 at +*{max(abstime2rel("07:00"),sunrise_rel())} set lamp1 on
|
define a13 at +*{max(abstime2rel("07:00"),sunrise_rel())} set lamp1 on
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
|
@ -70,7 +70,7 @@ attr global statefile /var/cache/fhem/fhem.save
|
|||||||
attr global pidfilename /var/run/fhem.pid
|
attr global pidfilename /var/run/fhem.pid
|
||||||
attr global verbose 3
|
attr global verbose 3
|
||||||
attr global port 7072
|
attr global port 7072
|
||||||
attr global modpath /usr/local/lib
|
attr global modpath /usr/local/libusr/local/lib
|
||||||
|
|
||||||
# Die Definition des Attributs "freigabe"
|
# Die Definition des Attributs "freigabe"
|
||||||
# definition of attribute "freigabe"
|
# definition of attribute "freigabe"
|
||||||
@ -90,23 +90,28 @@ define roll_eg_wz1 FS20 fb02 0c fg f2 lm 8f
|
|||||||
# timed jobs
|
# timed jobs
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
define roll_wz1_off1 at *20:00:00 { if( $value{roll_eg_wz1} ne "off" ) { \
|
define roll_wz1_off1 at *20:00:00 { \
|
||||||
if( $attr{roll_eg_wz1}{freigabe} ) { \
|
if( $value{roll_eg_wz1} ne "off" ) { \
|
||||||
fhem("set roll_eg_wz1 off");; \
|
if( $attr{roll_eg_wz1}{freigabe} ) { \
|
||||||
fhem("deleteattr roll_eg_wz1 freigabe") \
|
fhem("set roll_eg_wz1 off");; \
|
||||||
} else { \
|
fhem("deleteattr roll_eg_wz1 freigabe") \
|
||||||
fhem("attr roll_eg_wz1 freigabe") \
|
} else { \
|
||||||
} \
|
fhem("attr roll_eg_wz1 freigabe") \
|
||||||
} }
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
define roll_wz1_off2 at +*{sunset_rel(+3600)} { if( $value{roll_eg_wz1} ne "off" ) { \
|
define roll_wz1_off2 at +*{sunset_rel(+3600)} {\
|
||||||
if( $attr{roll_eg_wz1}{freigabe} ) { \
|
if( $value{roll_eg_wz1} ne "off" ) { \
|
||||||
fhem("set roll_eg_wz1 off");; \
|
if( $attr{roll_eg_wz1}{freigabe} ) { \
|
||||||
fhem("deleteattr roll_eg_wz1 freigabe") \
|
fhem("set roll_eg_wz1 off");; \
|
||||||
} else { \
|
fhem("deleteattr roll_eg_wz1 freigabe") \
|
||||||
fhem("attr roll_eg_wz1 freigabe") \
|
} else { \
|
||||||
} \
|
fhem("attr roll_eg_wz1 freigabe") \
|
||||||
} }
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
define roll_wz1_off3 at *22:00:00 { fhem("set roll_eg_wz1 off") if($value{roll_eg_wz1} ne "off");; \
|
define roll_wz1_off3 at *22:00:00 {\
|
||||||
fhem("deleteattr roll_eg_wz1 freigabe") }
|
fhem("set roll_eg_wz1 off") if($value{roll_eg_wz1} ne "off");; \
|
||||||
|
fhem("deleteattr roll_eg_wz1 freigabe") }
|
||||||
|
8
fhem/examples/sample_fhem
Normal file
8
fhem/examples/sample_fhem
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#
|
||||||
|
# Minimalistic fhem.pl configfile. Take a look at the other examples for more.
|
||||||
|
#
|
||||||
|
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 (min 1, max 5)
|
||||||
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
|
attr global modpath . # where our FHEM directory is
|
12
fhem/examples/sample_pgm2
Normal file
12
fhem/examples/sample_pgm2
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#
|
||||||
|
# Minimalistic fhem.pl & pgm2 configfile. Take a look at the other examples for
|
||||||
|
# more.
|
||||||
|
#
|
||||||
|
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 (min 1, max 5)
|
||||||
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
|
attr global modpath . # where our FHEM directory is
|
||||||
|
|
||||||
|
define WEB FHEMWEB 8083
|
||||||
|
attr WEB plotmode SVG
|
Loading…
x
Reference in New Issue
Block a user