diff --git a/Makefile b/Makefile index 829d19856..6e02d5b08 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,19 @@ -BINDIR=/usr/bin -MODDIR=/usr/share/fhem -VARDIR=/var/log/fhem -MANDIR=/usr/share/man/man1 -ETCDIR=/etc +VERS=5.3 +DATE=2012-10-28 + +RELATIVE_PATH=YES +BINDIR=/opt/fhem +MODDIR=$(BINDIR) +VARDIR=$(BINDIR)/log +MANDIR=$(BINDIR)/docs +ETCDIR=$(BINDIR) + +# Old variant +#BINDIR=/usr/bin +#MODDIR=/usr/share/fhem +#VARDIR=/var/log/fhem +#MANDIR=/usr/share/man/man1 +#ETCDIR=/etc # Used for .deb package creation RBINDIR=$(ROOT)$(BINDIR) @@ -14,8 +25,6 @@ RETCDIR=$(ROOT)$(ETCDIR) # Destination Directories DEST=$(RETCDIR) $(RBINDIR) $(RMODDIR) $(RMANDIR) $(RVARDIR) -VERS=5.2 -DATE=2011-12-31 DESTDIR=fhem-$(VERS) all: @@ -32,11 +41,13 @@ all: install: @echo "- creating directories" @-$(foreach DIR,$(DEST), if [ ! -e $(DIR) ]; then mkdir -p $(DIR); fi; ) - @echo "- fixing permissions / path in fhem.cfg" + @echo "- fixing permissions in fhem.cfg" @find FHEM docs www contrib -type f -print | xargs chmod 644 @cp fhem.cfg fhem.cfg.install - @perl -pi -e 's,modpath \.,modpath $(MODDIR),' fhem.cfg.install - @perl -pi -e 's,([^h]) \./log,$$1 $(VARDIR),' fhem.cfg.install + @-if [ "$(RELATIVE_PATH)" != YES ]; then\ + perl -pi -e 's,modpath \.,modpath $(MODDIR),' fhem.cfg.install; \ + perl -pi -e 's,([^h]) \./log,$$1 $(VARDIR),' fhem.cfg.install; \ + fi; @-if [ -e $(RETCDIR)/fhem.cfg ]; then \ echo "- move existing configuration to fhem.cfg.`date "+%Y-%m-%d_%H:%M:%S"`"; \ mv $(RETCDIR)/fhem.cfg $(RETCDIR)/fhem.cfg.`date "+%Y-%m-%d_%H:%M:%S"`; fi; diff --git a/contrib/DEBIAN/conffiles b/contrib/DEBIAN/conffiles index 220308349..fd1e366c7 100644 --- a/contrib/DEBIAN/conffiles +++ b/contrib/DEBIAN/conffiles @@ -1 +1 @@ -/etc/fhem.cfg +/opt/fhem/fhem.cfg diff --git a/contrib/DEBIAN/postinst b/contrib/DEBIAN/postinst index bac9be2d1..3a972c453 100644 --- a/contrib/DEBIAN/postinst +++ b/contrib/DEBIAN/postinst @@ -6,18 +6,18 @@ if ! getent passwd fhem >/dev/null; then useradd --system --home /var/log/fhem --gid dialout --shell /bin/false fhem fi -chown -R fhem /var/log/fhem /etc/fhem.cfg /usr/share/fhem /usr/bin/fhem.pl +chown -R fhem /opt/fhem #set up of autostart if test -x /sbin/initctl; then # upstart mkdir -p /etc/init - cp /usr/share/fhem/contrib/init-scripts/fhem.upstart /etc/init/fhem.conf + cp /opt/fhem/contrib/init-scripts/fhem.upstart /etc/init/fhem.conf initctl start fhem else # Sysvinit mkdir -p /etc/init.d - cp /usr/share/fhem/contrib/init-scripts/fhem.3 /etc/init.d/fhem + cp /opt/fhem/contrib/init-scripts/fhem.3 /etc/init.d/fhem chmod ugo+x /etc/init.d/fhem update-rc.d fhem defaults invoke-rc.d fhem start diff --git a/contrib/FB7270/makeimage b/contrib/FB7270/makeimage index 8830a12c3..621d100d9 100755 --- a/contrib/FB7270/makeimage +++ b/contrib/FB7270/makeimage @@ -24,6 +24,13 @@ rm -rf $fw rm -rf fhem/docs/*.{odg,pdf,man,txt} cp fhemcmd.sh fhem/FHEM cp startfhem fhem +cat >> fhem/fhem.cfg << 'EOF' +attr WEB basicAuth {use FritzBoxUtils;;FB_checkPw("localhost","$password") } +attr WEBphone basicAuth {use FritzBoxUtils;;FB_checkPw("localhost","$password") } +attr WEBtablet basicAuth {use FritzBoxUtils;;FB_checkPw("localhost","$password") } +attr telnetPort password {use FritzBoxUtils;;FB_checkPw("localhost","$password") } +EOF + echo Packing again zip -qr $fw-fb7270.zip fhem diff --git a/contrib/FB7390/install b/contrib/FB7390/install index c8a63476d..944412432 100755 --- a/contrib/FB7390/install +++ b/contrib/FB7390/install @@ -9,40 +9,42 @@ sleep 1 echo "########################### Extracting fhem.tar.gz ###################" cd $root - if test -d fhem; then - odir=fhem.old.`date +%Y-%m-%d_%H:%M:%S` - mv fhem $odir + rm -rf fhem.OLD + 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 $odir/etc/fhem.cfg; then +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 $odir/etc/fhem.cfg fhem - fhem/perl -pi -e 's,/usr/share/fhem,'$home',g; - s,/var/log/fhem,'$home'/log,; + 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 $odir/var/log/fhem/* fhem/log + mv fhem.OLD/opt/fhem/log/* fhem/log fi # Save files from our old version -if test -f $odir/fhem.cfg; then - mv $odir/FHEM/*.sh fhem/FHEM - mv $odir/FHEM/99.*Util.pm fhem/FHEM - mv $odir/FHEM/*.sh fhem/FHEM - mv $odir/log/* fhem/log - mv $odir/*.cfg fhem +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/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=$? @@ -53,7 +55,9 @@ if test $r != 0; then fi rm -f /var/nvi.tmp -# We have to restart with exit code 1, else the frontend tells us: -# update failed: no error +echo "########################### Starting fhem ############################" +sync +$home/startfhem + echo "########################### FHEM INSTALL END #########################" -exit 1 +exit 1 # INSTALL_SUCCESS_REBOOT diff --git a/contrib/FB7390/makeimage b/contrib/FB7390/makeimage index 87c6e978c..8ac7c6ef7 100755 --- a/contrib/FB7390/makeimage +++ b/contrib/FB7390/makeimage @@ -8,30 +8,45 @@ if test ! -f ../../$fw.tar.gz; then 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,www,docs} +rm -rf fhem/FHEM www docs +mkdir fhem/FHEM fhem/docs cd .. -rm -rf $fw -tar zxf ../../$fw.tar.gz - -cd $fw -cp -rp fhem.pl fhem.cfg FHEM docs www ../var/fhem -cd .. - -rm -rf $fw -rm -rf var/fhem/docs/*.{odg,pdf,man,txt} cp install var cp startfhem var/fhem cp fhemcmd.sh var/fhem/FHEM -cd var + +echo Extracting $fw +rm -rf $fw +tar zxf ../../$fw.tar.gz +cd $fw +cp fhem.cfg fhem.pl ../var/fhem +cp -rp FHEM/* ../var/fhem/FHEM +cp docs/fhem.png docs/*.html docs/*.jpg ../var/fhem/docs +cp -rp www ../var/fhem + +cd .. +rm -rf $fw + + +echo Packing again +cd var/fhem +cat >> fhem.cfg << 'EOF' +attr WEB basicAuth {use FritzBoxUtils;;FB_checkPw("localhost","$password") } +attr WEBphone basicAuth {use FritzBoxUtils;;FB_checkPw("localhost","$password") } +attr WEBtablet basicAuth {use FritzBoxUtils;;FB_checkPw("localhost","$password") } +attr telnetPort password {use FritzBoxUtils;;FB_checkPw("localhost","$password") } +EOF + +cd .. tar zcf fhem.tar.gz fhem rm -rf fhem -cd .. +cd .. tar cf $fw-fb7390.image var rm -rf var diff --git a/contrib/FB7390/startfhem b/contrib/FB7390/startfhem index 561f7c21e..84e6ec4ba 100755 --- a/contrib/FB7390/startfhem +++ b/contrib/FB7390/startfhem @@ -17,20 +17,15 @@ 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 -########### START fhem-user -# let FHEM run as user boxusr80 by adding user fhem with uid of boxusr80 -# Using this feature the following will not work: ping,WOL,lcd4linux -#id fhem > /dev/null 2>&1 -#if [ "$?" -ne "0" ]; then -# echo "user fhem does not exist. Adding it." -# echo "fhem:any:1080:0:fhem:/home-not-used:/bin/sh" >>/var/tmp/passwd -#fi -#chown root ${home}/dfu-programmer -#chmod 4755 ${home}/dfu-programmer -########### END fhem-user - -# set file ownership, so that the webinterface can read it. -chown -R boxusr80 ${home}/log -chown -R boxusr80 ${home}/FHEM +# let FHEM run as user boxusr80 +# add user fhem with uid of boxusr80 +id fhem > /dev/null 2>&1 +if [ "$?" -ne "0" ]; then + echo "user fhem does not exist. Adding it." + echo "fhem:any:1080:0:fhem:/home-not-used:/bin/sh" >>/var/tmp/passwd + # set files ownership + chown -R boxusr80 ${home}/log + chown -R boxusr80 ${home}/FHEM +fi perl fhem.pl fhem.cfg diff --git a/contrib/executables b/contrib/executables index b5867828a..b3c212b99 100644 --- a/contrib/executables +++ b/contrib/executables @@ -1,28 +1,28 @@ -.f/usr/bin/fhem.pl -.f/usr/share/fhem/contrib/checkmsg.pl -.f/usr/share/fhem/contrib/crc.pl -.f/usr/share/fhem/contrib/dblog/fhemdb_get.pl -.f/usr/share/fhem/contrib/em1010.pl -.f/usr/share/fhem/contrib/fhem2speech/fhem-speech -.f/usr/share/fhem/contrib/fhem2speech/fhem-speech.agi -.f/usr/share/fhem/contrib/fs20_holidays.sh -.f/usr/share/fhem/contrib/garden.pl -.f/usr/share/fhem/contrib/getstate/fhem-getstate -.f/usr/share/fhem/contrib/init-scripts/fhem.1 -.f/usr/share/fhem/contrib/init-scripts/fhem.2 -.f/usr/share/fhem/contrib/init-scripts/fhem.3 -.f/usr/share/fhem/contrib/km271.pl -.f/usr/share/fhem/contrib/ks300avg.pl -.f/usr/share/fhem/contrib/rolwzo_not_off.sh -.f/usr/share/fhem/contrib/rotateShiftWork/rotateShiftWork.sh -.f/usr/share/fhem/contrib/serial.pl -.f/usr/share/fhem/contrib/voip2fhem/voip2fhem -.f/usr/share/fhem/contrib/voip2fhem/voip2fhem_create_telefonlist -.f/usr/share/fhem/contrib/voip2fhem/voip2fhem_create_txt2gsm -.f/usr/share/fhem/contrib/ws2000_reader.pl -.f/usr/share/fhem/contrib/DEBIAN/postrm -.f/usr/share/fhem/contrib/DEBIAN/postinst -.f/usr/share/fhem/contrib/DEBIAN/prerm +.f/opt/fhem/fhem.pl +.f/opt/fhem/contrib/checkmsg.pl +.f/opt/fhem/contrib/crc.pl +.f/opt/fhem/contrib/dblog/fhemdb_get.pl +.f/opt/fhem/contrib/em1010.pl +.f/opt/fhem/contrib/fhem2speech/fhem-speech +.f/opt/fhem/contrib/fhem2speech/fhem-speech.agi +.f/opt/fhem/contrib/fs20_holidays.sh +.f/opt/fhem/contrib/garden.pl +.f/opt/fhem/contrib/getstate/fhem-getstate +.f/opt/fhem/contrib/init-scripts/fhem.1 +.f/opt/fhem/contrib/init-scripts/fhem.2 +.f/opt/fhem/contrib/init-scripts/fhem.3 +.f/opt/fhem/contrib/km271.pl +.f/opt/fhem/contrib/ks300avg.pl +.f/opt/fhem/contrib/rolwzo_not_off.sh +.f/opt/fhem/contrib/rotateShiftWork/rotateShiftWork.sh +.f/opt/fhem/contrib/serial.pl +.f/opt/fhem/contrib/voip2fhem/voip2fhem +.f/opt/fhem/contrib/voip2fhem/voip2fhem_create_telefonlist +.f/opt/fhem/contrib/voip2fhem/voip2fhem_create_txt2gsm +.f/opt/fhem/contrib/ws2000_reader.pl +.f/opt/fhem/contrib/DEBIAN/postrm +.f/opt/fhem/contrib/DEBIAN/postinst +.f/opt/fhem/contrib/DEBIAN/prerm .f/DEBIAN/postrm .f/DEBIAN/postinst .f/DEBIAN/prerm diff --git a/contrib/fhemupdate.control.fhem b/contrib/fhemupdate.control.fhem index 1ab457198..0e2b6ca16 100644 --- a/contrib/fhemupdate.control.fhem +++ b/contrib/fhemupdate.control.fhem @@ -10,4 +10,4 @@ MOV www/pgm2/*.gplot www/gplot MOV www/pgm2/*.jpg www/images/default MOV www/pgm2/*.png www/images/default MOV www/pgm2/*.html docs -DEL FHEM/99_updatefhem.pm +MOV FHEM/99_updatefhem.pm UNUSED diff --git a/contrib/init-scripts/fhem.2 b/contrib/init-scripts/fhem.2 index 2de44f8e3..109737034 100755 --- a/contrib/init-scripts/fhem.2 +++ b/contrib/init-scripts/fhem.2 @@ -1,10 +1,12 @@ #!/bin/sh # by Matthias Bauer +cd /opt/fhem + case "$1" in start) echo "Starting $0" - fhem.pl /etc/fhem/fhem.conf + perl fhem.pl fhem.cfg ;; stop) echo "Stopping $0" diff --git a/contrib/init-scripts/fhem.3 b/contrib/init-scripts/fhem.3 index 97afe71a7..2e0d75b03 100644 --- a/contrib/init-scripts/fhem.3 +++ b/contrib/init-scripts/fhem.3 @@ -12,20 +12,18 @@ ### END INIT INFO set -e - -fhz=/usr/bin/fhem.pl -conf=/etc/fhem.cfg +cd /opt/fhem port=7072 case "$1" in 'start') echo "Starting fhem..." - $fhz $conf + perl fhem.pl fhem.cfg RETVAL=$? ;; 'stop') echo "Stopping fhem..." - $fhz $port "shutdown" + perl fhem.pl $port "shutdown" RETVAL=$? ;; 'status') diff --git a/contrib/init-scripts/fhem.upstart b/contrib/init-scripts/fhem.upstart index 9fb02e979..f6dca4f74 100644 --- a/contrib/init-scripts/fhem.upstart +++ b/contrib/init-scripts/fhem.upstart @@ -11,4 +11,5 @@ stop on runlevel [016] expect fork respawn -exec /usr/bin/fhem.pl /etc/fhem.cfg +chdir /opt/fhem +exec perl fhem.pl fhem.cfg diff --git a/docs/HOWTO.html b/docs/HOWTO.html index 645cdf6b2..15a1c5279 100644 --- a/docs/HOWTO.html +++ b/docs/HOWTO.html @@ -42,30 +42,45 @@ 7170/7270 zip file.

- As most fhem installations access the "outer world" via a USB device - connected to the fhem computer (CUL, FHZ1x00, etc), we most probably need - the perl serial module. See the commandref section of your USB device, if - this module is needed.

+ Many fhem installations access the "outer world" via a USB device + connected to the fhem computer (CUL, FHZ1x00, TUL, EUL, etc), these + installations most probably need the perl serial module. See the + commandref section of your USB device, if this module is needed. You can + avoid this module by using a device which connects via Ethernet, e.g. a + HMLAN or a CUNO.

- If yes, you can install it e.g. with "sudo cpan + If you need this module, you can install it e.g. with "sudo cpan Device::SerialPort". There are also precompiled debian packages (libdevice-serialport-perl), and this module is already installed on OSX 10.6. If you cannot install it, you then take a look at the @directio option in the commandref.html as a last resort.

- The default configuration will install fhem into /usr/bin, - /usr/share/fhem and /var/log/fhem and /etc/fhem.cfg, according to the - debian/ubuntu requirments. Edit the Makefile to change this. + The default configuration will install fhem into /opt/fhem, edit the + Makefile to change this. You can also start fhem directly from where you + unpacked it, installation is optional. To install & start fhem type:
-      make install-pgm2
-      perl /usr/bin/fhem.pl /etc/fhem.cfg
+ make + cd /opt/fhem + perl fhem.pl fhem.cfg + + After starting, the fhem logfile in the log directory should look like:
+      2012.10.27 17:14:28 1: Including fhem.cfg
+      2012.10.27 17:14:28 3: WEB: port 8083 opened
+      2012.10.27 17:14:28 3: WEBphone: port 8084 opened
+      2012.10.27 17:14:28 3: WEBtablet: port 8085 opened
+      2012.10.27 17:14:28 1: Including /tmp/fhem.save
+      2012.10.27 17:14:28 3: telnetPort: port 7072 opened
+      2012.10.27 17:14:28 1: usb create starting
+      2012.10.27 17:14:28 1: usb create end
+      2012.10.27 17:14:28 2: SecurityCheck:  ...
+      2012.10.27 17:14:28 0: Server started (version Fhem 5.3 ...
+ + The SecurityCheck warning tells you, that some of the fhem interfaces are + opened without a passwort. You should either set a password for each + device (see below), or set a global attribute to disable this message if + you are sure passwords are not needed. - After starting, the logfile should look like:
-      2008.06.15 16:17:03 2: FHEMWEB port 8083 opened
-      2008.06.15 16:17:03 2: FHEMWEB port 8084 opened
-      2008.06.15 16:17:03 2: FHEMWEB port 8085 opened
-      2008.06.15 16:17:03 0: Server started (version ...)
@@ -79,26 +94,30 @@ http://fhem-host:8085/fhem if you are using a tablet like the iPad.

- In the default configuration, fhem will look for USB attached FHZ, CUL - and TCM devices on startup (unix/OSX only) and will create - appropriate fhem devices.

+ Note: On the FritzBox the default configuration enables password + checking on all interfaces: The username is ignored, and the passwort is + checked against the FritzBox password.

- On linux (esp. FB7390) it will even try to - flash the unflashed CUL, if it is attached at startup. See the usb and
+ + On linux (esp. FB7390) fhem will try to flash an unflashed CUL, if it is + attached at startup. See the
usb and CULflash commands for details, and - check the "unsorted" room in FHEMWEB for the newly created - devices. Note that switching a CUL to HomeMatic mode is still has to be - done manually. Only one device is flashed per fhem-startup.

+ check the "unsorted" room in FHEMWEB for the newly created devices. Note + that switching a CUL to HomeMatic mode is still has to be done manually. +

- For doing it manually (or if fhem failed to discover your device): - Attach the USB device (CUL, FHZ1000PC/FHZ1300, TUL, EUL, etc) to your - computer, and look for the corresponding device in the /dev + For defining USB Input devices manually (or if fhem failed to discover + your device): Attach the USB device (CUL, FHZ1000PC/FHZ1300, TUL, EUL, + etc) to your computer, and look for the corresponding device in the /dev directory. For CUL a file named - /dev/ttyACM* will be created under - Linux and /dev/cu.usbmodem* under OS X. Note the exact name of the device. - Define it for fhem (by typing it in the "Fhem cmd" input field in the - browser):
+      /dev/ttyACM* will be created under Linux and /dev/cu.usbmodem* under OS
+      X. Note the exact name of the device.  Define it for fhem (by typing it
+      in the "Fhem cmd" input field in the browser):
+
       define CUL1 CUL /dev/ttyACM0@9600 1234
You can find details about CUL define parameters FHZ with slightly different parameters:
       define FHZ1 FHZ /dev/ttyUSB0
- For the FHZ on OSX you need to install the ftdi driver first from - http://www.ftdichip.com/Drivers/VCP.htm, the device name will be - /dev/cu.usbserial-xxxxxxxx. - -

Notes:

- - Note: if you rename the device itself, the attached FileLog - and weblink will be renamed automatically. The other way round (renaming - the FileLog or weblink) will not rename the associated devices + Note: if you rename the device itself, the attached FileLog and + weblink will be renamed automatically. The other way round (renaming the + FileLog or weblink) will not rename the associated devices automatically.

If you want to do the same manually:
@@ -172,7 +186,7 @@ HomeMatic sensors do not need to be paired with fhem, on the other side fhem will only autocreate such a device, when it receives a pairing request. You still need to "set CUL hmPairForSec 600" to respond - to this request. + to this request. The same is valid vor ZWave devices. @@ -191,9 +205,9 @@ to get only the commands available for this device.

- Other systems (EnOcean/HomeMatic) require a more elaborate procedure, and - the corresponding USB device is to be set into a pairing mode first. See - the commandref entry for your device. + Other systems (EnOcean/HomeMatic/ZWave) require a more elaborate + procedure, and the corresponding USB device is to be set into a pairing + mode first. See the commandref entry for your device.

Creating a fhem FHT / HomeMatic / EnOcean device automatically or @@ -353,37 +367,39 @@

Security


diff --git a/docs/fhem.html b/docs/fhem.html index 72faccf1c..86a21a715 100644 --- a/docs/fhem.html +++ b/docs/fhem.html @@ -14,6 +14,7 @@ @@ -125,7 +127,7 @@

Android frontends: - AndFHEM (native app) + andFHEM (native app) @@ -280,9 +282,6 @@
contrib/README describes some loosely coupled useful modules / scripts which can be used with fhem.
- -
Protocol descriptions and other useful stuff: http://fhz4linux.info/
@@ -296,25 +295,6 @@ http://fhem.svn.sourceforge.net

- Frontends:
- -
- Device/OS Specific installation guides:

Debian/Ubuntu

Unix / OSX

@@ -390,12 +373,7 @@
  • Download the .tar.gz package, unpack it, and change to the unpacked directory. - +
  • start fhem directly from this directory (perl fhem.pl fhem.cfg).

    Windows

    @@ -421,7 +399,9 @@ -

    Fritz!Box 7170 in fhemwiki

    - -

    Fritz!Box 7170 (from Achim, as of 2009-10-19)

    - - -

    Fritz!Box 7270 (from Volker, as of 2009-10-19)

    - -