From 7bc76f6f46256f38249f3f4472af735d4a4605cb Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Wed, 2 Dec 2009 20:38:00 +0000 Subject: [PATCH] RFR fixes example path fixes Prompt changed git-svn-id: https://svn.fhem.de/fhem/trunk@493 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/00_CUL.pm | 9 ++++++--- fhem/FHEM/16_CUL_RFR.pm | 12 ++++++++++-- fhem/Makefile | 4 ++-- fhem/contrib/JsonList/README.JsonList | 8 ++++---- fhem/contrib/JsonList/commandref.html.patch | 8 ++++---- fhem/contrib/getstate/README.getstate | 8 ++++---- fhem/docs/commandref.html | 6 +++--- fhem/docs/faq.html | 10 +++++----- fhem/examples/01_fs20 | 4 ++-- fhem/examples/02_fs20 | 4 ++-- fhem/examples/03_fht | 4 ++-- fhem/examples/04_log | 4 ++-- fhem/examples/05_rm100 | 4 ++-- fhem/examples/07_sunset_windowed | 4 ++-- fhem/examples/sample_fhem | 4 ++-- fhem/examples/sample_pgm2 | 6 +++--- 17 files changed, 57 insertions(+), 44 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 05ee2c798..be6d38e3e 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -548,3 +548,5 @@ - ==DATE== (4.9) - bugfix: changed the fhem prompt from FHZ> to fhem> + - bugfix: CUL_RFR fixes (chaining RFR's should work) + - bugfix: Path in the examples fixed (got corrupted) diff --git a/fhem/FHEM/00_CUL.pm b/fhem/FHEM/00_CUL.pm index c76fdea46..472966fd3 100755 --- a/fhem/FHEM/00_CUL.pm +++ b/fhem/FHEM/00_CUL.pm @@ -488,7 +488,10 @@ CUL_ReadAnswer($$$) my ($hash, $arg, $anydata) = @_; my $type = $hash->{TYPE}; - $hash = $hash->{IODev} if($type eq "CUL_RFR"); + while($hash->{TYPE} eq "CUL_RFR") { # Look for the first "real" CUL + $hash = $hash->{IODev}; + } + return ("No FD", undef) if(!$hash || ($^O !~ /Win/ && !defined($hash->{FD}))); @@ -816,8 +819,8 @@ CUL_SimpleWrite(@) return if(!$hash); if($hash->{TYPE} eq "CUL_RFR") { - $msg = CUL_RFR_AddPrefix($hash, $msg); - $hash = $hash->{IODev}; + # Prefix $msg with RRBBU and return the corresponding CUL hash. + ($hash, $msg) = CUL_RFR_AddPrefix($hash, $msg); } $msg .= "\n" unless($nonl); diff --git a/fhem/FHEM/16_CUL_RFR.pm b/fhem/FHEM/16_CUL_RFR.pm index 8826fea66..d5b66a35a 100755 --- a/fhem/FHEM/16_CUL_RFR.pm +++ b/fhem/FHEM/16_CUL_RFR.pm @@ -102,7 +102,10 @@ CUL_RFR_Parse($$) sub CUL_RFR_DelPrefix($) { - my ($prefix, $msg) = split("U", shift, 2); + my ($msg) = @_; + while($msg =~ m/^\d{4}U/) { + (undef, $msg) = split("U", $msg, 2); + } return $msg; } @@ -110,7 +113,12 @@ sub CUL_RFR_AddPrefix($$) { my ($hash, $msg) = @_; - return "u" . $hash->{ID} . $hash->{ROUTERID} . $msg; + while($hash->{TYPE} eq "CUL_RFR") { + # Prefix $msg with RRBBU and return the corresponding CUL hash + $msg = "u" . $hash->{ID} . $hash->{ROUTERID} . $msg; + $hash = $hash->{IODev}; + } + return ($hash, $msg); } 1; diff --git a/fhem/Makefile b/fhem/Makefile index e0c827e99..5819c48d7 100644 --- a/fhem/Makefile +++ b/fhem/Makefile @@ -2,8 +2,8 @@ BINDIR=/usr/local/bin MODDIR=/usr/local/lib VARDIR=/var/log/fhem -VERS=4.7 -DATE=2009-10-23 +VERS=4.8 +DATE=2009-11-28 all: @echo Nothing to do for all. diff --git a/fhem/contrib/JsonList/README.JsonList b/fhem/contrib/JsonList/README.JsonList index 4d461befc..58b3e6975 100644 --- a/fhem/contrib/JsonList/README.JsonList +++ b/fhem/contrib/JsonList/README.JsonList @@ -31,7 +31,7 @@ Usage: displayed, e.g.: Example: - FHZ> jsonlist + fhem> jsonlist { "ResultSet": { "Results": [ @@ -49,7 +49,7 @@ Usage: } Example for : - FHZ> jsonlist lamp1 + fhem> jsonlist lamp1 { "ResultSet": { "Results": { @@ -75,7 +75,7 @@ Usage: } Example for : - FHZ> jsonlist HMS + fhem> jsonlist HMS { "ResultSet": { "Results": [ @@ -89,7 +89,7 @@ Usage: } Example for ROOMS: - FHZ> jsonlist ROOMS + fhem> jsonlist ROOMS { "ResultSet": { "Results": [ diff --git a/fhem/contrib/JsonList/commandref.html.patch b/fhem/contrib/JsonList/commandref.html.patch index f316acca6..9f1e10fbc 100644 --- a/fhem/contrib/JsonList/commandref.html.patch +++ b/fhem/contrib/JsonList/commandref.html.patch @@ -21,7 +21,7 @@ + entries if no parameter is given. +

+ Example: -+
  FHZ> jsonlist
++  
  fhem> jsonlist
 +  {
 +    "ResultSet": {
 +      "Results": [
@@ -40,7 +40,7 @@
 +  
+ If specifying <devspec>, then a detailed status for + <devspec> will be displayed, e.g.: -+
  FHZ> jsonlist lamp1
++  
  fhem> jsonlist lamp1
 +  {
 +    "ResultSet": {
 +      "Results": {
@@ -67,7 +67,7 @@
 +  
+ If specifying <typespec>, then a list with the status for + the defined <typespec> devices will be displayed, e.g.: -+
  FHZ> jsonlist HMS
++  
  fhem> jsonlist HMS
 +  {
 +    "ResultSet": {
 +      "Results": [
@@ -82,7 +82,7 @@
 +  
+ If specifying ROOMS, then a list with the defined rooms + will be displayed, e.g.: -+
  FHZ> jsonlist ROOMS
++  
  fhem> jsonlist ROOMS
 +  {
 +    "ResultSet": {
 +      "Results": [
diff --git a/fhem/contrib/getstate/README.getstate b/fhem/contrib/getstate/README.getstate
index ccd24c218..d277c05db 100644
--- a/fhem/contrib/getstate/README.getstate
+++ b/fhem/contrib/getstate/README.getstate
@@ -19,19 +19,19 @@ EXAMPLES
     Output a short string of the "READINGS" for .
 
       Example for a FS20-Device:
-      FHZ> getstate EG.sz.SD.Tv
+      fhem> getstate EG.sz.SD.Tv
       state:0
 
       Example for a FHT-Device:
-      FHZ> getstate EG.wz.HZ
+      fhem> getstate EG.wz.HZ
       actuator:0 day-temp:21.5 desired-temp:21.5 lowtemp-offset:4.0 [...]
 
       Example for a KS300/555-Device:
-      FHZ> getstate GH.ga.WE.01
+      fhem> getstate GH.ga.WE.01
       humidity:93 israining:0 rain:207.8 rain_raw:815 temperature:5.1 [...]
 
       Example for a HMS-Device:
-      FHZ> getstate NN.xx.RM.01
+      fhem> getstate NN.xx.RM.01
       smoke_detect:0
 
 CONTRIB
diff --git a/fhem/docs/commandref.html b/fhem/docs/commandref.html
index affce1b35..9fcd29cc5 100644
--- a/fhem/docs/commandref.html
+++ b/fhem/docs/commandref.html
@@ -491,7 +491,7 @@ A line ending with \ will be concatenated with the next one, so long lines
   reading (actuator, measured-temp) for all devices from the devspec. 
   

Example: -
  FHZ> list
+  
  fhem> list
 
   Type list  for detailed info.
 
@@ -524,7 +524,7 @@ A line ending with \ will be concatenated with the next one, so long lines
   
If specifying name, then a detailed status for name will be displayed, e.g.: -
  FHZ> list fl
+  
  fhem> list fl
 
   Internals:
     CODE       5102
@@ -728,7 +728,7 @@ A line ending with \ will be concatenated with the next one, so long lines
   entries. It is not intended for human consumption.
   

Example: -
  FHZ> xmllist
+  
  fhem> xmllist
   <FHZINFO>
           <internal_LIST>
                   <internal name="global" state="internal" sets="" attrs="room configfile logfile modpath pidfilename port statefile userattr verbose version">
diff --git a/fhem/docs/faq.html b/fhem/docs/faq.html
index 2e7e0a321..9431b3a49 100644
--- a/fhem/docs/faq.html
+++ b/fhem/docs/faq.html
@@ -272,21 +272,21 @@ by fhem.pl?
 
   
   # Check simply the value. It is the same as seen in "list"
-  FHZ> {$value{myfht}}
+  fhem> {$value{myfht}}
   measured-temp: 23.8 (Celsius)
 
   # Get the second word, so we can compare it.
-  FHZ> { my @a = split(" ", $value{myfht});; $a[1] }
+  fhem> { my @a = split(" ", $value{myfht});; $a[1] }
   23.8
 
   # Set the ventilator on now, if its too hot.
-  FHZ> { my @a = split(" ", $value{myfht});; fhem("set ventilator on") if($a[1] > 25.0) }
+  fhem> { my @a = split(" ", $value{myfht});; fhem("set ventilator on") if($a[1] > 25.0) }
 
   # Now do this regularly
-  FHZ> define chilldown at +*00:30:00 { my @a = split(" ", $value{myfht});; fhem("set ventilator on") if($a[1] > 25.0) }
+  fhem> define chilldown at +*00:30:00 { my @a = split(" ", $value{myfht});; fhem("set ventilator on") if($a[1] > 25.0) }
 
   # An alternative:
-  FHZ> define chilldown at +*00:30:00 { fhem("set ventilator on") if($value{myfht} gt "measured-temp: 25.0") }
+  fhem> define chilldown at +*00:30:00 { fhem("set ventilator on") if($value{myfht} gt "measured-temp: 25.0") }
   
diff --git a/fhem/examples/01_fs20 b/fhem/examples/01_fs20 index 36cfbdf24..5e833bd24 100644 --- a/fhem/examples/01_fs20 +++ b/fhem/examples/01_fs20 @@ -7,8 +7,8 @@ # # Common part -attr global logfile .-%Y-%m.log -attr global statefile ..save # where to save the state of the devices +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 diff --git a/fhem/examples/02_fs20 b/fhem/examples/02_fs20 index ef09200f3..7962d1f76 100644 --- a/fhem/examples/02_fs20 +++ b/fhem/examples/02_fs20 @@ -10,8 +10,8 @@ # Common part -attr global logfile .-%Y-%m.log -attr global statefile ..save # where to save the state of the devices +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 . # where our FHEM directory is diff --git a/fhem/examples/03_fht b/fhem/examples/03_fht index 91da42528..ccb1c5137 100644 --- a/fhem/examples/03_fht +++ b/fhem/examples/03_fht @@ -8,8 +8,8 @@ # After about 5-10 minutes, check if "list wz" returns something meaningful # -attr global logfile .-%Y-%m.log -attr global statefile ..save # where to save the state of the devices +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 . # where our FHEM directory is diff --git a/fhem/examples/04_log b/fhem/examples/04_log index c644e300d..77c76ae24 100644 --- a/fhem/examples/04_log +++ b/fhem/examples/04_log @@ -4,8 +4,8 @@ # contrib/91_DbLog.pm # -attr global logfile .-%Y-%m.log -attr global statefile ..save # where to save the state of the devices +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 . # where our FHEM directory is diff --git a/fhem/examples/05_rm100 b/fhem/examples/05_rm100 index 3edfe3681..2d2ccc7d9 100644 --- a/fhem/examples/05_rm100 +++ b/fhem/examples/05_rm100 @@ -8,8 +8,8 @@ # if there is no definition for it. Check the commandref.html define, Type HMS # section for details -attr global logfile .-%Y-%m.log -attr global statefile ..save # where to save the state of the devices +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 diff --git a/fhem/examples/07_sunset_windowed b/fhem/examples/07_sunset_windowed index 1801d44ec..5a3c4cc6d 100755 --- a/fhem/examples/07_sunset_windowed +++ b/fhem/examples/07_sunset_windowed @@ -65,8 +65,8 @@ # Globale Einstellungen # global settings -attr global logfile /var/log/fhem/fhem.log -attr global statefile /var/cache/fhem/fhem.save +attr global logfile /tmp/fhem.log +attr global statefile /tmp/fhem.save attr global pidfilename /var/run/fhem.pid attr global verbose 3 attr global port 7072 diff --git a/fhem/examples/sample_fhem b/fhem/examples/sample_fhem index ee86bc419..1db3333ab 100644 --- a/fhem/examples/sample_fhem +++ b/fhem/examples/sample_fhem @@ -1,8 +1,8 @@ # # Minimalistic fhem.pl configfile. Take a look at the other examples for more. # -attr global logfile .-%Y-%m.log -attr global statefile ..save # where to save the state of the devices +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 diff --git a/fhem/examples/sample_pgm2 b/fhem/examples/sample_pgm2 index c94758207..8a7762578 100644 --- a/fhem/examples/sample_pgm2 +++ b/fhem/examples/sample_pgm2 @@ -2,8 +2,8 @@ # Minimalistic fhem.pl & pgm2 configfile. Take a look at the other examples for # more. # -attr global logfile .-%Y-%m.log -attr global statefile ..save # where to save the state of the devices +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,4 +12,4 @@ define WEB FHEMWEB 8083 global attr WEB plotmode SVG # Fake logfile, to access the global log -define Logfile FileLog .-%Y-%m.log fakelog +define Logfile FileLog /tmp/fhem-%Y-%m.log fakelog