From 77db35d3d51c31ff5645eff8f34805106c6dfe43 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Thu, 7 Jul 2011 07:02:50 +0000 Subject: [PATCH] Small fixes, preparing for the 5.1 release git-svn-id: https://svn.fhem.de/fhem/trunk@930 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/99_updatefhem.pm | 8 +-- fhem/Makefile | 7 ++- fhem/TODO | 5 ++ fhem/contrib/FB7390/fhemcmd.sh | 14 +++++ fhem/contrib/FB7390/install | 65 +++++++++++++++++++++++ fhem/contrib/FB7390/makeimage | 55 ++++++++++++++++++++ fhem/contrib/FB7390/startfhem | 19 +++++++ fhem/docs/HOWTO.html | 80 +++++++++++++++++------------ fhem/docs/commandref.html | 2 +- fhem/examples/sample_pgm2 | 9 ++-- fhem/webfrontend/pgm2/01_FHEMWEB.pm | 12 +++-- 11 files changed, 230 insertions(+), 46 deletions(-) create mode 100644 fhem/contrib/FB7390/fhemcmd.sh create mode 100755 fhem/contrib/FB7390/install create mode 100755 fhem/contrib/FB7390/makeimage create mode 100755 fhem/contrib/FB7390/startfhem diff --git a/fhem/FHEM/99_updatefhem.pm b/fhem/FHEM/99_updatefhem.pm index 55bbb3e92..2cc37d98f 100644 --- a/fhem/FHEM/99_updatefhem.pm +++ b/fhem/FHEM/99_updatefhem.pm @@ -33,8 +33,8 @@ CommandUpdatefhem($$) my ($cl, $param) = @_; my $lt = ""; my $ret = ""; - #my $moddir = "$attr{global}{modpath}/FHEM"; - my $moddir = "XXX"; + my $moddir = "$attr{global}{modpath}/FHEM"; + #my $moddir = "XXX"; # Read in the OLD filetimes.txt my %oldtime; @@ -111,8 +111,8 @@ sub CommandCULflash($$) { my ($cl, $param) = @_; - #my $moddir = "$attr{global}{modpath}/FHEM"; - my $moddir = "XXX"; + my $moddir = "$attr{global}{modpath}/FHEM"; + #my $moddir = "XXX"; my %ctypes = ( CUL_V2 => "at90usb162", diff --git a/fhem/Makefile b/fhem/Makefile index 2a9fb240b..c669beaec 100644 --- a/fhem/Makefile +++ b/fhem/Makefile @@ -13,8 +13,8 @@ RDOCDIR=$(ROOT)$(DOCDIR) RMANDIR=$(ROOT)$(MANDIR) RETCDIR=$(ROOT)$(ETCDIR) -VERS=5.0 -DATE=2010-08-15 +VERS=5.1 +DATE=2011-07-09 DESTDIR=fhem-$(VERS) all: @@ -86,3 +86,6 @@ deb: mv .f $(DESTDIR) dpkg-deb --build $(DESTDIR) rm -rf $(DESTDIR) + +fb7390: + cd contrib/FB7390 && ./makeimage $(DESTDIR) diff --git a/fhem/TODO b/fhem/TODO index 534639906..19e5d9312 100644 --- a/fhem/TODO +++ b/fhem/TODO @@ -14,3 +14,8 @@ Webpgm2 - integrate weblink details in the SVG - autocreate: multiple plots - fancy webkit tranformations + +============= +5.1 +- .deb +- examples diff --git a/fhem/contrib/FB7390/fhemcmd.sh b/fhem/contrib/FB7390/fhemcmd.sh new file mode 100644 index 000000000..cd45db2d3 --- /dev/null +++ b/fhem/contrib/FB7390/fhemcmd.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +## FritzBox 7390 +## Beispiel fuer das Senden von FHEM Kommandos ueber den Telefoncode +## #95*x* wobei x hier 1 bzw 2 entspricht. + +case $1 in +1) echo "set Steckdose on" | /sbin/socat - TCP:127.0.0.1:7072 + ;; +2) echo "set Steckdose off" | /sbin/socat - TCP:127.0.0.1:7072 + ;; +esac + + diff --git a/fhem/contrib/FB7390/install b/fhem/contrib/FB7390/install new file mode 100755 index 000000000..5e1712a4e --- /dev/null +++ b/fhem/contrib/FB7390/install @@ -0,0 +1,65 @@ +#! /bin/sh + +root=/var/InternerSpeicher +home=$root/fhem + +echo "########################### FHEM INSTALL BEGIN #######################" +killall perl > /dev/null 2>&1 +sleep 1 + +echo "########################### Extracting fhem.tar.gz ###################" +cd $root +if test -d fhem; then + mv fhem fhem.OLD +fi + +gzip -cd /var/fhem.tar.gz | tar xf - + +cd $root + +# Save files from the AVM Style installation +if test -f fhem.OLD/opt/etc/fhem.cfg; then + echo "########################### Converting chroot style config ###########" + export LD_LIBRARY_PATH=$home/lib + export PERL5LIB=$home/lib/perl5/site_perl/5.12.2/mips-linux:$home/lib/perl5/site_perl/5.12.2:$home/lib/perl5/5.12.2/mips-linux:$home/lib/perl5/5.12.2 + cp fhem.OLD/opt/etc/fhem.cfg fhem + fhem/perl -pi -e 's,/opt,$root,g; + s,fhem/share,fhem,; + s,^#define autocreate,define autocreate,; + s,^#attr autocreate,attr autocreate,; + s,ttyACM(.)(@\d+)?,ttyACM$1\@38400,;' fhem/fhem.cfg + mv fhem.OLD/opt/fhem/log/* fhem/log +fi + +# Save files from our old version +if test -f fhem.OLD/fhem.cfg; then + echo "########################### Copying non-chroot style config ##########" + mv fhem.OLD/FHEM/*.sh fhem/FHEM + mv fhem.OLD/FHEM/99.*Util.pm fhem/FHEM + mv fhem.OLD/FHEM/*.sh fhem/FHEM + mv fhem.OLD/log/* fhem/log + mv fhem.OLD/fhem.cfg fhem +fi +chown -R boxusr80:root $home + +if test -d fhem.OLD; then + echo "########################### Deleting the old directory ###############" + rm -rf fhem.OLD +fi + +cat /var/flash/debug.cfg > /var/nvi.tmp +grep -q fhem /var/nvi.tmp +r=$? +if test $r != 0; then + echo "########################### Modifying the startup script #############" + echo $home/startfhem >> /var/nvi.tmp + cat /var/nvi.tmp > /var/flash/debug.cfg +fi +rm -f /var/nvi.tmp + +echo "########################### Starting fhem ############################" +sync +$home/startfhem + +echo "########################### FHEM INSTALL END #########################" +exit 1 # INSTALL_SUCCESS_REBOOT diff --git a/fhem/contrib/FB7390/makeimage b/fhem/contrib/FB7390/makeimage new file mode 100755 index 000000000..1c0ddf04d --- /dev/null +++ b/fhem/contrib/FB7390/makeimage @@ -0,0 +1,55 @@ +#!/bin/sh + +fw=$1 +if test ! -f ../../$fw.tar.gz; then + echo "usage: makeimage " + echo "../../.tar.gz mus exist" + exit 1 +fi + +rm -rf var +echo Extracting the fritzbox template +tar xf ../../priv/fritzbox7390_template.tar +cd var +tar zxf fhem.tar.gz +rm -rf fhem/FHEM +mkdir fhem/FHEM +cd .. + +cp install var +cp startfhem var/fhem +cp fhemcmd.sh var/fhem/FHEM + + +echo Extracting $fw +rm -rf $fw +tar zxf ../../$fw.tar.gz +cd $fw +cp fhem.pl\ + FHEM/*\ + webfrontend/pgm2/*\ + docs/*.html\ + docs/fhem.png\ + docs/*.jpg\ + ../var/fhem/FHEM + +cd examples +for i in *; do + cp -r $i ../../var/fhem/FHEM/example.$i +done +cd ../.. +rm -rf $fw + + +echo Packing again +cd var/fhem +cp FHEM/example.sample_pgm2 fhem.cfg +perl -pi -e 's,/tmp,./log,g' fhem.cfg + +cd .. +tar zcf fhem.tar.gz fhem +rm -rf fhem + +cd .. +tar cf $fw-fb7390.image var +rm -rf var diff --git a/fhem/contrib/FB7390/startfhem b/fhem/contrib/FB7390/startfhem new file mode 100755 index 000000000..61f9fe2bb --- /dev/null +++ b/fhem/contrib/FB7390/startfhem @@ -0,0 +1,19 @@ +#!/bin/sh + +home=/var/InternerSpeicher/fhem + +cd $home + +trap "" SIGHUP +modprobe cdc_acm +sleep 2 + +ln -sf $home/FHEM/fhemcmd.sh /var/fhemcmd + +PATH=$home:$PATH +export PATH + +export LD_LIBRARY_PATH=$home/lib +export PERL5LIB=$home/lib/perl5/site_perl/5.12.2/mips-linux:$home/lib/perl5/site_perl/5.12.2:$home/lib/perl5/5.12.2/mips-linux:$home/lib/perl5/5.12.2 + +perl fhem.pl fhem.cfg diff --git a/fhem/docs/HOWTO.html b/fhem/docs/HOWTO.html index a719054f7..49fb869fd 100644 --- a/fhem/docs/HOWTO.html +++ b/fhem/docs/HOWTO.html @@ -45,13 +45,19 @@

Starting fhem

@@ -67,10 +74,12 @@

Attaching the USB device for the PC (CUL / FHZ1x00PC / EM1010PC)

+ Notes: + +

Configuring transmitter devices

@@ -117,7 +133,7 @@ If you want to do the same manually:
Wait a while, until the transmitter sent some data. In the logfile - (Browser window: "All together" -> Logs:Logfile:text) a line + (Browser window: "Unsorted -> Logs / Fhemlog / text) a line will appear:
       FS20 Unknown device <HOUSECODE>, Button <BTN> Code <CDE>, please define it
@@ -131,12 +147,12 @@ Here is a complete list of FS20 models.
For other device types similar messages should appear.

- Note: Creating a fhem FHT device automatically or manually does - not imply that the CUL or the FHZ is paired with it. For this purpose you - have to set the FHT to accept new devices (Prog:Cent:N/A), and send a command to - it (e.g. set fht.kitchen desired-temp 20). - If there is no signal for a while, then check - this FAQ entry. + Note: Creating a fhem FHT or HomeMatic device automatically or + manually does not imply that the CUL or the FHZ is paired with it. For + this purpose you have to set the FHT to accept new devices + (Prog:Cent:N/A), and send a command to it (e.g. set fht.kitchen + desired-temp 20). If there is no signal for a while, then check this FAQ entry. @@ -162,7 +178,7 @@

Timed commands / Notification

diff --git a/fhem/examples/sample_pgm2 b/fhem/examples/sample_pgm2 index f5132b219..27142838c 100644 --- a/fhem/examples/sample_pgm2 +++ b/fhem/examples/sample_pgm2 @@ -8,12 +8,15 @@ attr global statefile /tmp/fhem.save # where to save the state of the devices attr global verbose 3 # "normal" verbosity (min 1, max 5) #define CUL CUL /dev/ttyACM0 1234 -#define FHEM FHEM /dev/USB0 +#define FHZ FHZ /dev/USB0 define WEB FHEMWEB 8083 global -define WEBS FHEMWEB 8084 global -attr WEBS smallscreen +define WEBphone FHEMWEB 8084 global +attr WEBphone smallscreen + +define WEBtablet FHEMWEB 8085 global +attr WEBtablet touchpad # Fake logfile, to access the global log define Logfile FileLog /tmp/fhem-%Y-%m.log fakelog diff --git a/fhem/webfrontend/pgm2/01_FHEMWEB.pm b/fhem/webfrontend/pgm2/01_FHEMWEB.pm index fe40882b4..fd8d05cd2 100755 --- a/fhem/webfrontend/pgm2/01_FHEMWEB.pm +++ b/fhem/webfrontend/pgm2/01_FHEMWEB.pm @@ -310,13 +310,16 @@ FW_AnswerCall($) $FW_tp = AttrVal($FW_wname, "touchpad", $FW_ss); # Lets go: - if($arg =~ m,^${FW_ME}/(.*html)$, || $arg =~ m,^${FW_ME}/(example.*)$,) { +Log 1, "ARG: $arg"; + if($arg =~ m,^${FW_ME}/(example.*|.*html)$,) { my $f = $1; +Log 1, "GOT: $f"; $f =~ s,/,,g; # little bit of security open(FH, "$FW_dir/$f") || return; pO join("", ); close(FH); $FW_RETTYPE = "text/plain; charset=ISO-8859-1" if($f !~ m/\.*html$/); +Log 1, "RT: $FW_RETTYPE"; return 1; } elsif($arg =~ m,^$FW_ME/(.*).css,) { @@ -434,7 +437,7 @@ FW_AnswerCall($) FW_roomOverview($cmd); FW_style($cmd,undef) if($cmd =~ m/^style /); - FW_doDetail($FW_detail) if($FW_detail); + FW_doDetail($FW_detail) if($FW_detail); FW_showRoom() if($FW_room && !$FW_detail); FW_logWrapper($cmd) if($cmd =~ /^logwrapper/); FW_showArchive($cmd) if($cmd =~ m/^showarchive/); @@ -1442,8 +1445,9 @@ FW_style($$) my @fl; push(@fl, "fhem.cfg"); push(@fl, ""); + push(@fl, FW_fileList("$FW_dir/.*.sh")); + push(@fl, FW_fileList("$FW_dir/.*Util.*")); push(@fl, FW_fileList("$FW_dir/.*.css")); - push(@fl, ""); push(@fl, FW_fileList("$FW_dir/.*.js")); push(@fl, ""); push(@fl, FW_fileList("$FW_dir/.*.gplot")); @@ -1479,7 +1483,7 @@ FW_style($$) my $row = 0; foreach my $file (@fl) { pO ""; - pH $file, $file, 1; + pO "$file"; pO ""; $row = ($row+1)%2; }