mirror of
https://github.com/fhem/fhem-mirror.git
synced 2024-11-22 02:59:49 +00:00
Reorg - Part 5
git-svn-id: https://svn.fhem.de/fhem/trunk@1866 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
4f2c6efca1
commit
3eac189f69
@ -42,24 +42,31 @@ sub FW_pH(@);
|
||||
sub FW_pHPlain(@);
|
||||
sub FW_pO(@);
|
||||
|
||||
use vars qw($FW_dir); # base directory for web server: the first available from $modpath/www, $modpath/FHEM
|
||||
use vars qw($FW_icondir); # icon base directory for web server: the first available from $FW_dir/icons, $FW_dir
|
||||
use vars qw($FW_docdir); # doc directory for web server: the first available from $FW_dir/docs, $modpath/docs, $FW_dir
|
||||
use vars qw($FW_cssdir); # css directory for web server: the first available from $FW_dir/css, $FW_dir
|
||||
use vars qw($FW_gplotdir); # gplot directory for web server: the first available from $FW_dir/gplot,$FW_dir
|
||||
use vars qw($FW_jsdir); # js directory for web server: the first available from $FW_dir/javascript, $FW_dir
|
||||
use vars qw($MW_dir); # moddir (./FHEM), needed by edit Files in new structure
|
||||
use vars qw($FW_ME); # webname (default is fhem), needed by 97_GROUP
|
||||
use vars qw($FW_ss); # is smallscreen, needed by 97_GROUP/95_VIEW
|
||||
use vars qw($FW_tp); # is touchpad (iPad / etc)
|
||||
use vars qw($FW_dir); # base directory for web server: the first available
|
||||
# from $modpath/www, $modpath/FHEM
|
||||
use vars qw($FW_icondir); # icon base directory for web server: the first
|
||||
# available from $FW_dir/icons, $FW_dir
|
||||
use vars qw($FW_docdir); # doc directory for web server: the first available
|
||||
# from $FW_dir/docs, $modpath/docs, $FW_dir
|
||||
use vars qw($FW_cssdir); # css directory for web server: the first available
|
||||
# from $FW_dir/css, $FW_dir
|
||||
use vars qw($FW_gplotdir);# gplot directory for web server: the first
|
||||
# available from $FW_dir/gplot,$FW_dir
|
||||
use vars qw($FW_jsdir); # js directory for web server: the first available
|
||||
# from $FW_dir/javascript, $FW_dir
|
||||
use vars qw($MW_dir); # moddir (./FHEM), needed by edit Files in new
|
||||
# structure
|
||||
use vars qw($FW_ME); # webname (default is fhem), needed by 97_GROUP
|
||||
use vars qw($FW_ss); # is smallscreen, needed by 97_GROUP/95_VIEW
|
||||
use vars qw($FW_tp); # is touchpad (iPad / etc)
|
||||
|
||||
# global variables, also used by 97_GROUP/95_VIEW/95_FLOORPLAN
|
||||
use vars qw(%FW_types); # device types,
|
||||
use vars qw($FW_RET); # Returned data (html)
|
||||
use vars qw($FW_wname); # Web instance
|
||||
use vars qw($FW_subdir); # Sub-path in URL for extensions, e.g. 95_FLOORPLAN
|
||||
use vars qw(%FW_pos); # scroll position
|
||||
use vars qw($FW_cname); # Current connection name
|
||||
use vars qw(%FW_types); # device types,
|
||||
use vars qw($FW_RET); # Returned data (html)
|
||||
use vars qw($FW_wname); # Web instance
|
||||
use vars qw($FW_subdir); # Sub-path in URL for extensions, e.g. 95_FLOORPLAN
|
||||
use vars qw(%FW_pos); # scroll position
|
||||
use vars qw($FW_cname); # Current connection name
|
||||
|
||||
my $zlib_loaded;
|
||||
my $try_zlib = 1;
|
||||
@ -94,11 +101,9 @@ my $FW_chash; # client fhem hash
|
||||
my $FW_encoding="UTF-8";
|
||||
|
||||
|
||||
my $ICONEXTENSION = "gif|ico|png|jpg"; # don't forget to amend FW_ServeSpecial if you change this!
|
||||
# don't forget to amend FW_ServeSpecial if you change this!
|
||||
my $ICONEXTENSION = "gif|ico|png|jpg";
|
||||
|
||||
# FIXME
|
||||
# use constant FOO => BAR
|
||||
# is better but then I cannot use FOO in a regexp. Any ideas how to fix it?
|
||||
|
||||
#####################################
|
||||
sub
|
||||
@ -159,8 +164,8 @@ FW_Define($$)
|
||||
|
||||
|
||||
FW_SetDirs;
|
||||
FW_ReadIcons($hash); # we do it only once at startup to save ressources at runtime
|
||||
|
||||
# we do it only once at startup to save ressources at runtime
|
||||
FW_ReadIcons($hash);
|
||||
|
||||
my $ret = TcpServer_Open($hash, $port, $global);
|
||||
|
||||
@ -337,8 +342,6 @@ FW_SetDirs() {
|
||||
# doc dir
|
||||
if(-d "$FW_dir/docs") {
|
||||
$FW_docdir = "$FW_dir/docs";
|
||||
} elsif(-f "$FW_dir/pgm2/commandref.html") {
|
||||
$FW_docdir = "$FW_dir/pgm2";
|
||||
} elsif(-d "$attr{global}{modpath}/docs") {
|
||||
$FW_docdir = "$attr{global}{modpath}/docs";
|
||||
} else {
|
||||
@ -411,12 +414,11 @@ FW_AnswerCall($)
|
||||
|
||||
elsif($arg =~ m,^$FW_ME/icons/(.*)$,) {
|
||||
my ($icon,$cachable) = ($1, 1);
|
||||
|
||||
#Debug "You want $icon which is " . $FW_icons{$icon};
|
||||
# if we do not have the icon, we convert the device state to the icon name
|
||||
if(!$FW_icons{$icon}) {
|
||||
$icon = FW_dev2image($icon);
|
||||
#Debug "We do not have it and thus use $icon which is " . $FW_icons{$icon};
|
||||
#Debug "We do not have it and thus use $icon which is ".$FW_icons{$icon};
|
||||
$cachable = 0;
|
||||
return 0 if(!$icon);
|
||||
}
|
||||
@ -2006,10 +2008,25 @@ FW_Attr(@)
|
||||
{
|
||||
my @a = @_;
|
||||
my $hash = $defs{$a[1]};
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
if($a[0] eq "set" && $a[2] eq "HTTPS") {
|
||||
TcpServer_SetSSL($hash);
|
||||
}
|
||||
|
||||
if($a[2] eq "stylesheetPrefix" ||
|
||||
$a[2] eq "smallscreen") {
|
||||
|
||||
# AttrFn is called too early, we have to set/del the attr here
|
||||
if($a[0] eq "set") {
|
||||
$attr{$name}{$a[2]} = (defined($a[3]) ? $a[3] : 1);
|
||||
} else {
|
||||
delete $attr{$name}{$a[2]};
|
||||
}
|
||||
FW_ReadIcons($hash);
|
||||
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
@ -2021,6 +2038,7 @@ FW_ReadIconsFrom($$) {
|
||||
# filenames are relative to $FW_icondir
|
||||
|
||||
my ($prepend,$dir)= @_;
|
||||
return if($dir =~ m,/\.svn,);
|
||||
|
||||
#Debug "read icons from \"${FW_icondir}/${dir}\", prepend \"$prepend\"";
|
||||
|
||||
@ -2033,11 +2051,12 @@ FW_ReadIconsFrom($$) {
|
||||
foreach my $entry (@entries) {
|
||||
my $filename= "$dir/$entry";
|
||||
#Debug " entry: \"$entry\", filename= \"$filename\"";
|
||||
if( -d "${FW_icondir}/${filename}" ) {
|
||||
# entry is a directory
|
||||
FW_ReadIconsFrom("${prepend}${entry}/", $filename) unless($entry eq "." || $entry eq "..");
|
||||
} elsif( -f "${FW_icondir}/${filename}") {
|
||||
# entry is a regular file
|
||||
|
||||
if( -d "${FW_icondir}/${filename}" ) { # entry is a directory
|
||||
FW_ReadIconsFrom("${prepend}${entry}/", $filename)
|
||||
unless($entry eq "." || $entry eq "..");
|
||||
|
||||
} elsif( -f "${FW_icondir}/${filename}") { # entry is a regular file
|
||||
if($entry =~ m/^(.*)\.($ICONEXTENSION)$/i) {
|
||||
my $logicalname= $1;
|
||||
my $iconname= "${prepend}${logicalname}";
|
||||
@ -2055,22 +2074,32 @@ FW_ReadIcons($)
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
%FW_icons = ();
|
||||
|
||||
# read icons from default directory
|
||||
FW_ReadIconsFrom("", "default");
|
||||
# read icons from stylesheet specific directory, icons found here supersede default icons with same name
|
||||
my $prefix= AttrVal($name, "stylesheetPrefix", "");
|
||||
|
||||
# read icons from stylesheet specific directory, icons found here supersede
|
||||
# default icons with same name. Smallscreen a special "stylesheet"
|
||||
my $prefix = AttrVal($name, "smallscreen", "") ? "smallscreen" : "";
|
||||
$prefix = AttrVal($name, "stylesheetPrefix", $prefix);
|
||||
FW_ReadIconsFrom("", "$prefix") unless($prefix eq "");
|
||||
# read icons from explicit directory, icons found here supersede all other icons with same name
|
||||
|
||||
# read icons from explicit directory, icons found here supersede all other
|
||||
# icons with same name
|
||||
my $iconpath= AttrVal($name, "iconpath", "");
|
||||
FW_ReadIconsFrom("", "$iconpath") unless($iconpath eq "");
|
||||
|
||||
# if now icons were found so far, read icons from icondir itself
|
||||
FW_ReadIconsFrom("", "") unless(%FW_icons);
|
||||
|
||||
$hash->{fhem}{icons}= join(":", %FW_icons);
|
||||
$hash->{fhemIcons} = \%FW_icons;
|
||||
|
||||
Log 4, "$name: Icon dictionary for $FW_icondir follows...";
|
||||
foreach my $k (keys %FW_icons) {
|
||||
Log 4, " $k => " . $FW_icons{$k};
|
||||
my $dumpLevel = 4;
|
||||
if($attr{global}{verbose} >= $dumpLevel) {
|
||||
Log $dumpLevel, "$name: Icon dictionary for $FW_icondir follows...";
|
||||
foreach my $k (sort keys %FW_icons) {
|
||||
Log $dumpLevel, " $k => " . $FW_icons{$k};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -2080,7 +2109,7 @@ sub
|
||||
FW_GetIcons() {
|
||||
#Debug "Getting icons for $FW_wname.";
|
||||
my $hash= $defs{$FW_wname};
|
||||
%FW_icons= split(":", $hash->{fhem}{icons});
|
||||
%FW_icons= %{$hash->{fhemIcons}};
|
||||
}
|
||||
|
||||
sub
|
||||
@ -2357,8 +2386,9 @@ FW_devState($$)
|
||||
|
||||
#####################################
|
||||
|
||||
sub FW_Get($@) {
|
||||
|
||||
sub
|
||||
FW_Get($@)
|
||||
{
|
||||
my ($hash, @a) = @_;
|
||||
|
||||
return "syntax error" if(int(@a) != 3);
|
||||
@ -2369,14 +2399,14 @@ sub FW_Get($@) {
|
||||
$FW_wname= $hash->{NAME};
|
||||
my $icon= FW_IconPath($a[2]);
|
||||
return defined($icon) ? $icon : "no such icon";
|
||||
|
||||
}
|
||||
|
||||
|
||||
#####################################
|
||||
|
||||
sub FW_Set($@) {
|
||||
|
||||
sub
|
||||
FW_Set($@)
|
||||
{
|
||||
my ($hash, @a) = @_;
|
||||
|
||||
return "syntax error" if(int(@a) != 2);
|
||||
@ -2386,7 +2416,6 @@ sub FW_Set($@) {
|
||||
|
||||
FW_ReadIcons($hash);
|
||||
return undef;
|
||||
|
||||
}
|
||||
|
||||
#####################################
|
||||
|
196
fhem/Makefile
196
fhem/Makefile
@ -1,94 +1,71 @@
|
||||
BINDIR=/usr/bin
|
||||
MODDIR=/usr/share/fhem
|
||||
VARDIR=/var/log/fhem
|
||||
DOCDIR=/usr/share/doc/fhem
|
||||
MANDIR=/usr/share/man/man1
|
||||
ETCDIR=/etc
|
||||
|
||||
BINDIR=/tmp/fhem/usr/bin
|
||||
MODDIR=/tmp/fhem/usr/share/fhem
|
||||
VARDIR=/tmp/fhem/var/log/fhem
|
||||
MANDIR=/tmp/fhem/usr/share/man/man1
|
||||
ETCDIR=/tmp/fhem/etc
|
||||
|
||||
|
||||
# Used for .deb package creation
|
||||
RBINDIR=$(ROOT)$(BINDIR)
|
||||
RMODDIR=$(ROOT)$(MODDIR)
|
||||
RVARDIR=$(ROOT)$(VARDIR)
|
||||
RDOCDIR=$(ROOT)$(DOCDIR)
|
||||
RMANDIR=$(ROOT)$(MANDIR)
|
||||
RETCDIR=$(ROOT)$(ETCDIR)
|
||||
|
||||
# Destination Directories
|
||||
DEST=$(RETCDIR) $(RBINDIR) $(RDOCDIR) $(RMODDIR) $(RMANDIR) $(RVARDIR)
|
||||
DEST=$(RETCDIR) $(RBINDIR) $(RMODDIR) $(RMANDIR) $(RVARDIR)
|
||||
|
||||
VERS=5.2
|
||||
DATE=2011-12-31
|
||||
DESTDIR=fhem-$(VERS)
|
||||
|
||||
all:
|
||||
@echo "fhem $(VERS) - $(DATE)"
|
||||
@echo
|
||||
@echo "Use 'make <target>', where <target> is"
|
||||
@echo " install - to install base files for fhem"
|
||||
@echo " install-pgm2 - to install base files and webgui pgm2 for fhem"
|
||||
@echo " dist - to create a compressed archivfile of fhem"
|
||||
@echo " deb - to create a .deb file of fhem"
|
||||
@echo " fb7390 - to create an imagefile for AVM Fritz!Box 7390"
|
||||
@echo " fb7270 - to create an imagefile for AVM Fritz!Box 7270"
|
||||
@echo " install - to install fhem"
|
||||
@echo " dist - to create a .tar.gz file"
|
||||
@echo " deb - to create a .deb file"
|
||||
@echo " fb7390 - to create an AVM Fritz!Box 7390 imagefile"
|
||||
@echo " fb7270 - to create a zip file for the AVM Fritz!Box 7270"
|
||||
@echo " backup - to backup current installation of fhem"
|
||||
@echo " uninstall - to uninstall an existing fhem installation (with backup)"
|
||||
@echo
|
||||
@echo "Examples:"
|
||||
@echo " make install-pgm2"
|
||||
@echo " make deb"
|
||||
@echo
|
||||
@echo " uninstall - to uninstall fhem (with backup)"
|
||||
@echo "Check Makefile for default installation paths!"
|
||||
@echo
|
||||
|
||||
prepare:
|
||||
@echo "Preparing installation for fhem..."
|
||||
@echo "- create directories"
|
||||
install:
|
||||
@echo "- creating directories"
|
||||
@-$(foreach DIR,$(DEST), if [ ! -e $(DIR) ]; then mkdir -p $(DIR); fi; )
|
||||
@echo "- fix permissions"
|
||||
@find ./FHEM -type f -print | xargs chmod 644
|
||||
@find ./docs -type f -print | xargs chmod 644
|
||||
@find ./examples -type f -print | xargs chmod 644
|
||||
@echo "- modify examples"
|
||||
@rm -rf examples_changed
|
||||
@cp -r examples examples_changed
|
||||
@perl -pi -e 's,modpath \.,modpath $(MODDIR),' examples_changed/[a-z]*
|
||||
@perl -pi -e 's,([^h]) /tmp,$$1 $(VARDIR),' examples_changed/[a-z]*
|
||||
@echo "- fixing permissions / path 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 [ -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;
|
||||
@echo
|
||||
|
||||
install:prepare install-base install-note
|
||||
|
||||
install-pgm2:prepare install-base pgm2 install-note
|
||||
|
||||
install-base:
|
||||
@echo "Install base files of fhem..."
|
||||
cp examples_changed/sample_fhem $(RETCDIR)/fhem.cfg
|
||||
cp fhem.pl $(RBINDIR)
|
||||
cp -r FHEM $(RMODDIR)
|
||||
cp -rp contrib $(RMODDIR)
|
||||
cp -rp docs/* $(RDOCDIR)
|
||||
cp docs/fhem.man $(RMANDIR)/fhem.pl.1
|
||||
gzip -f -9 $(RMANDIR)/fhem.pl.1
|
||||
|
||||
install-note:
|
||||
@echo
|
||||
@echo "Housekeeping..."
|
||||
@rm -rf examples_changed
|
||||
@echo "- remove .svn stuff"
|
||||
find $(RMODDIR) -name .svn -print | xargs rm -rf
|
||||
find $(RDOCDIR) -name .svn -print | xargs rm -rf
|
||||
@echo "- copying files"
|
||||
@cp fhem.cfg.install $(RETCDIR)/fhem.cfg
|
||||
@rm fhem.cfg.install
|
||||
@cp fhem.pl $(RBINDIR)
|
||||
@cp -rp FHEM docs www contrib $(RMODDIR)
|
||||
@cp docs/fhem.man $(RMANDIR)/fhem.pl.1
|
||||
@gzip -f -9 $(RMANDIR)/fhem.pl.1
|
||||
@echo "- cleanup: removing .svn leftovers"
|
||||
@find $(RMODDIR) -name .svn -print | xargs rm -rf
|
||||
@echo
|
||||
@echo "Installation of fhem completed!"
|
||||
@echo
|
||||
@echo "To start fhem use"
|
||||
@echo "<perl $(BINDIR)/fhem.pl $(ETCDIR)/fhem.cfg>"
|
||||
@echo "Start fhem with"
|
||||
@echo " perl $(BINDIR)/fhem.pl $(ETCDIR)/fhem.cfg"
|
||||
@echo
|
||||
|
||||
backup:
|
||||
@echo
|
||||
@echo "Backup current installation of fhem to .backup directory.."
|
||||
@echo "Saving fhem to the .backup directory in the current directory"
|
||||
@-if [ ! -e .backup ]; then mkdir .backup; fi;
|
||||
@tar czf .backup/fhem-backup_`date +%y%m%d%H%M`.tar.gz \
|
||||
$(RETCDIR)/fhem* $(RBINDIR)/fhem* $(RDOCDIR) $(RMODDIR) $(RMANDIR)/fhem* $(RVARDIR)
|
||||
@ -98,100 +75,49 @@ uninstall:backup
|
||||
@echo "Remove fhem installation..."
|
||||
rm -rf $(RETCDIR)/fhem.cfg
|
||||
rm -rf $(RBINDIR)/fhem.pl
|
||||
rm -rf $(RDOCDIR)
|
||||
rm -rf $(RMODDIR)
|
||||
rm -rf $(RMANDIR)/fhem.pl.*
|
||||
rm -rf $(RVARDIR)
|
||||
@echo done
|
||||
@echo
|
||||
|
||||
pgm2:
|
||||
@echo
|
||||
@echo "Install files of fhem webfrontend pgm2..."
|
||||
@-if [ ! -e $(RMODDIR)/www/pgm2 ]; then mkdir -p $(RMODDIR)/www/pgm2; fi;
|
||||
@echo "- fix permissions"
|
||||
@find ./webfrontend/pgm2/* -type f -print | xargs chmod 644
|
||||
cp -r webfrontend/pgm2/*.pm $(RMODDIR)/FHEM
|
||||
cp -r webfrontend/pgm2/*?[!pm] $(RMODDIR)/www/pgm2
|
||||
cp docs/commandref.html docs/faq.html docs/HOWTO.html $(RMODDIR)/www/pgm2
|
||||
cp docs/*.png docs/*.jpg $(RMODDIR)/www/pgm2
|
||||
cp examples_changed/sample_pgm2 $(RETCDIR)/fhem.cfg
|
||||
|
||||
dist:
|
||||
@echo "fhem $(VERS) - $(DATE)"
|
||||
@echo
|
||||
@echo "Make distribution..."
|
||||
@echo "- copy files"
|
||||
@mkdir .f
|
||||
@cp -r CHANGED FHEM HISTORY Makefile README.SVN\
|
||||
TODO contrib docs examples fhem.pl webfrontend .f
|
||||
@echo
|
||||
@echo "Housekeeping..."
|
||||
@echo "- remove misc developing stuff"
|
||||
@find .f -name .svn -print | xargs rm -rf
|
||||
@find .f -name \*.orig -print | xargs rm -f
|
||||
@find .f -name .#\* -print | xargs rm -f
|
||||
@find .f -type f -print | grep -v Makefile |\
|
||||
mkdir .f
|
||||
cp -r CHANGED FHEM HISTORY Makefile README.SVN\
|
||||
contrib docs examples fhem.pl webfrontend .f
|
||||
find .f -name .svn -print | xargs rm -rf
|
||||
find .f -name \*.orig -print | xargs rm -f
|
||||
find .f -name .#\* -print | xargs rm -f
|
||||
find .f -type f -print | grep -v Makefile |\
|
||||
xargs perl -pi -e 's/=VERS=/$(VERS)/g;s/=DATE=/$(DATE)/g'
|
||||
@mv .f $(DESTDIR)
|
||||
@echo
|
||||
@echo "Distribution..."
|
||||
@echo "- create archiv"
|
||||
@tar cf - $(DESTDIR) | gzip > $(DESTDIR).tar.gz
|
||||
@echo "- copy main documentation files"
|
||||
@mv $(DESTDIR)/docs/*.html .
|
||||
@echo "- Housekeeping"
|
||||
@rm -rf $(DESTDIR)
|
||||
@echo
|
||||
@echo "Done. Provided files: $(DESTDIR).tar.gz *.html"
|
||||
@echo
|
||||
mv .f $(DESTDIR)
|
||||
tar cf - $(DESTDIR) | gzip > $(DESTDIR).tar.gz
|
||||
mv $(DESTDIR)/docs/*.html .
|
||||
rm -rf $(DESTDIR)
|
||||
|
||||
dist-clean:
|
||||
@echo
|
||||
@echo "Housekeeping..."
|
||||
@echo "- remove distribution files"
|
||||
@rm -rf *.html $(DESTDIR).tar.gz
|
||||
@echo done
|
||||
@echo
|
||||
rm -rf *.html $(DESTDIR).tar.gz
|
||||
|
||||
deb:
|
||||
@echo
|
||||
@echo "Make debian package..."
|
||||
@echo $(PWD)
|
||||
@rm -rf .f
|
||||
@echo
|
||||
rm -rf .f
|
||||
make ROOT=`pwd`/.f install
|
||||
@echo
|
||||
@echo "- copy files"
|
||||
@cp -r contrib/DEBIAN .f
|
||||
@echo "- housekeeping"
|
||||
@rm -rf .f/$(MODDIR)/contrib/FB7*/var
|
||||
@rm -rf .f/$(MODDIR)/contrib/FB7*/*.image
|
||||
@rm -rf .f/$(MODDIR)/contrib/FB7*/*.zip
|
||||
@find .f -name .svn -print | xargs rm -rf
|
||||
@find .f -name \*.orig -print | xargs rm -f
|
||||
@find .f -name .#\* -print | xargs rm -f
|
||||
@echo "- modify fhem version and date"
|
||||
@find .f -type f -print | grep -v Makefile |\
|
||||
cp -r contrib/DEBIAN .f
|
||||
rm -rf .f/$(MODDIR)/contrib/FB7*/var
|
||||
rm -rf .f/$(MODDIR)/contrib/FB7*/*.image
|
||||
rm -rf .f/$(MODDIR)/contrib/FB7*/*.zip
|
||||
find .f -name .svn -print | xargs rm -rf
|
||||
find .f -name \*.orig -print | xargs rm -f
|
||||
find .f -name .#\* -print | xargs rm -f
|
||||
find .f -type f -print | grep -v Makefile |\
|
||||
xargs perl -pi -e 's/=VERS=/$(VERS)/g;s/=DATE=/$(DATE)/g'
|
||||
@echo "- fix permissions"
|
||||
@find .f -type f | xargs chmod 644
|
||||
@find .f -type d | xargs chmod 755
|
||||
@chmod 755 `cat contrib/executables`
|
||||
@gzip -9 .f/$(DOCDIR)/changelog
|
||||
@echo "- fix ownership"
|
||||
@chown -R root:root .f
|
||||
@echo "- housekeeping"
|
||||
@mv .f $(DESTDIR)
|
||||
@echo
|
||||
@echo "Build package..."
|
||||
@dpkg-deb --build $(DESTDIR)
|
||||
@echo
|
||||
@echo "Housekeeping..."
|
||||
@rm -rf $(DESTDIR)
|
||||
@echo
|
||||
@echo "Done. Provided file: $(DESTDIR).deb"
|
||||
@echo
|
||||
find .f -type f | xargs chmod 644
|
||||
find .f -type d | xargs chmod 755
|
||||
chmod 755 `cat contrib/executables`
|
||||
chown -R root:root .f
|
||||
mv .f $(DESTDIR)
|
||||
dpkg-deb --build $(DESTDIR)
|
||||
rm -rf $(DESTDIR)
|
||||
|
||||
fb7390:
|
||||
cd contrib/FB7390 && ./makeimage $(DESTDIR)
|
||||
|
@ -1,18 +0,0 @@
|
||||
#
|
||||
# fhem.pl configfile
|
||||
#
|
||||
# Define a lamp (which is plugged in via an FS20ST).
|
||||
# To program the FS20ST, start the server, plug the FS20ST while pressing its
|
||||
# button (it starts blinking), and then execute fhem.pl 7072 "set lamp on"
|
||||
#
|
||||
|
||||
# Common part
|
||||
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 FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
||||
|
||||
define lamp FS20 8765 01 # type FS20, transmitter code 8765, button 2
|
@ -1,73 +0,0 @@
|
||||
#
|
||||
# fhem.pl configfile
|
||||
#
|
||||
# The challenge: We have 2 rollades (which are connected via the FS20MS).
|
||||
# Button 3 on the FS20S20 should activate both rollades. There are three
|
||||
# solutions:
|
||||
# 1. Builtin commands
|
||||
# 2. Perl expression
|
||||
# 3. Shell script (realized via external script at the end of this file)
|
||||
|
||||
|
||||
# Common part
|
||||
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
|
||||
|
||||
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
||||
|
||||
define roll1 FS20 7777 02 # type FS20, transmitter code 7777, button 3
|
||||
define roll2 FS20 7777 03 # type FS20, transmitter code 7777, button 4
|
||||
define btn3 FS20 8765 03 # define a button from the FS20S20
|
||||
setstate roll1 off # initial state is closed
|
||||
|
||||
# Note: Only one of the methods should be used
|
||||
|
||||
# Method 1a: builtin commands. Note the double ;
|
||||
define n_1a notify btn3 set roll1 %;; set roll2 %
|
||||
|
||||
# Method 1b: shorter:
|
||||
define n_1b notify btn3 set roll1,roll2 %
|
||||
|
||||
# Method 2a: the same in perl. Everything between {} is evaluated as perl code
|
||||
define n_2a notify btn3 { fhem "set roll1,roll2 %" }
|
||||
|
||||
# Method 2b: perl. open the rollades only to a certain amount if they are
|
||||
# closed. Else do the required command.
|
||||
define n_2b notify btn3 {\
|
||||
if("%" eq "on" && $value{roll1} eq "off") {\
|
||||
fhem "set roll1 on-for-timer 10";;\
|
||||
fhem "set roll2 on-for-timer 16";;\
|
||||
} else { \
|
||||
fhem "set roll1,roll2 %"\
|
||||
} \
|
||||
}
|
||||
|
||||
# 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 %"
|
||||
|
||||
quit # Ignore the rest of this file
|
||||
|
||||
#!/bin/sh
|
||||
#
|
||||
# roll1 needs 10 sec to open to a certain level, roll2 16 sec. The following
|
||||
# shell script opens both of them when called woth "on", and closes both of
|
||||
# them else. We rely on the fact, that the FS20MS switches off after ca 60s.
|
||||
#
|
||||
# Note that for greater time values the FS20 timer gets inaccurate, you
|
||||
# can use something like
|
||||
# $fhem 7072 "set roll1 on; at +00:00:21 set roll1 on"
|
||||
# instead.
|
||||
#
|
||||
|
||||
fhem=/usr/bin/fhem.pl
|
||||
|
||||
if test $1 = "on"; then
|
||||
$fhem 7072 "set roll1 on-for-timer 10"
|
||||
$fhem 7072 "set roll2 on-for-timer 16"
|
||||
else
|
||||
$fhem 7072 "set roll1,roll2 off"
|
||||
fi
|
@ -1,61 +0,0 @@
|
||||
#
|
||||
# fhem.pl configfile
|
||||
#
|
||||
# Define an FHT80b device. You have to know its transmitter code,
|
||||
# or set verbose to 4 and wait for a while watching the log.
|
||||
#
|
||||
# wz stands for "wohnzimmer".
|
||||
# After about 5-10 minutes, check if "list wz" returns something meaningful
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
||||
|
||||
# Since it is said that FHZ1x00 sometimes forgets its own random-initialized
|
||||
# FHTcode (Contronics speak: "Zentralencode"; sometimes called "fhtid"),
|
||||
# it's probably a good idea to manually hard-code it.
|
||||
# Changing the value (range is 1 to 99) needs re-registration of FHT80b
|
||||
# via their "cent" menu item (instructions see FAQ).
|
||||
# set FHZ FHTcode XX
|
||||
|
||||
|
||||
define wz FHT 3232 # type FHT, transmitter code 3232 (default value)
|
||||
|
||||
#########################
|
||||
# Some documentation suggests that the FHZ time should be set every minute.
|
||||
# I only set it once a day.
|
||||
define fhz_timer at *03:30:00 set FHZ time
|
||||
|
||||
#########################
|
||||
# If you wish to have up-to date information on certain parameters which can be
|
||||
# modified on the FHT80b itself, then enable the line below. My device sends a
|
||||
# message when a value changes, and sends measured-temp, actuator and state
|
||||
# messages regularly, so I do not use this command.
|
||||
# Be patient: the reply comes after 5-10 minutes.
|
||||
#define wz_refresh at *04:00:00 set wz report1 255 report2 255
|
||||
|
||||
# alias for the above
|
||||
#define wz_refresh at *04:00:00 set wz refreshvalues
|
||||
|
||||
|
||||
###################
|
||||
# If at the weekly lime-protection time (usually saturday at 11:00 AM) the
|
||||
# desired temperature is lower than the measured temperature, then you'll get
|
||||
# instead of "actuator:0%" the "actuator:lime-protection" messsages every 2.5
|
||||
# minutes. I think this is an FHT80b firmware bug, a workaround is to set the
|
||||
# desired temperature for a short time higher than the measured temperature.
|
||||
# You can automate it (for all FHT's) with the following notify:
|
||||
|
||||
define lime_reset notify .*lime-protection {\
|
||||
my $d = $defs{@}{READINGS}{"desired-temp"}{VAL};;\
|
||||
my $m = $defs{@}{READINGS}{"measured-temp"}{VAL};;\
|
||||
if($m > $d) {\
|
||||
fhem("set @ desired-temp 29");;\
|
||||
fhem("set @ desired-temp $d");;\
|
||||
}\
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
#
|
||||
# fhem.pl configfile
|
||||
# Logging FS20/KS300 data into files. For database logging see the
|
||||
# contrib/91_DbLog.pm
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
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/log/fhem/wz-%Y-%U.log wz:.*(temp|actuator).*
|
||||
|
||||
# Make it accessible from 01_FHEMWEB.pm (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 temp4rain10:Temp/Rain,hum6wind8:Hum/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 @ "@ %""
|
||||
|
||||
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
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# fhem.pl configfile
|
||||
#
|
||||
# Define RM100-2 devices:
|
||||
#
|
||||
# As the RM100-2 changes its code after the battery is changed (or the switch
|
||||
# on the device itself is changed), we map _all_ RM100-2 to the device id 1001
|
||||
# if there is no definition for it. Check the commandref.html define, Type HMS
|
||||
# section for details
|
||||
|
||||
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 FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
||||
|
||||
|
||||
define rm100 HMS 1001 # type HMS
|
||||
define rm100log FileLog /var/log/wz-%Y-%U.log rm100:.*
|
||||
define smokealarm notify rm100:smoke.*on "wall "FIRE: @ %""
|
||||
|
||||
# Test the log/notify
|
||||
# fhem.pl 7072 'trigger rm100 smoke on'
|
@ -1,41 +0,0 @@
|
||||
# These are only examples for the at and notify command
|
||||
|
||||
##################################
|
||||
# absolute ones:
|
||||
define a1 at 17:00:00 set lamp on # fhem command
|
||||
define a2 at 17:00:00 { Log 1, "Teetime" } # Perl command
|
||||
define a3 at 17:00:00 "/bin/echo "Teetime" > /dev/console" # shell command
|
||||
define a4 at *17:00:00 set lamp on # repeat every day
|
||||
|
||||
##################################
|
||||
# relative ones
|
||||
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 a7 at +*{3}00:00:02 set lamp on-for-timer 1 # Blink 3 times
|
||||
|
||||
##################################
|
||||
# Switch the lamp on from sunset to 11 PM each day
|
||||
# We have to use the relative versions, as the next event is computed now
|
||||
# and absolute values would cause problems in the spring
|
||||
define a8 at +*{sunset_rel()} set lamp on
|
||||
define a9 at *23:00:00 set lamp off
|
||||
|
||||
##################################
|
||||
# A more elegant solution, which even works if sunset is after 23:00
|
||||
define a10 at +*{sunset_rel()} set lamp on-till 23:00
|
||||
|
||||
##################################
|
||||
# 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) }
|
||||
|
||||
##################################
|
||||
# Switch lamp1 and lamp2 on from 7:00 till 10 minutes after sunrise
|
||||
define a12 at *07:00 set lamp1,lamp2 on-till {sunrise(+600)}
|
||||
|
||||
##################################
|
||||
# Switch lamp1 on at sunrise, but not before 07:00 and not after 09:00
|
||||
define a13 at +*{sunrise(0,"07:00","09:00"))} set lamp1 on
|
||||
|
||||
##################################
|
||||
# Blink 3 times if the piri sends a command
|
||||
define n1 notify piri:on.* define a13 at +*{3}00:00:02 set lamp on-for-timer 1
|
@ -1,115 +0,0 @@
|
||||
###########################################################################
|
||||
# Beispiel: Steuerung nach Sonnenzyklus mit Zeitfenster
|
||||
#
|
||||
# Aufgabenstellung: Ein Rolladen soll eine Stunde nach Sonnenuntergang
|
||||
# schliessen, aber fruehestens um 20:00 und spaetestens um 22:00
|
||||
#
|
||||
# Loesungsansatz: Es werden zwei at-Jobs zu festen Zeiten eingeplant, um
|
||||
# 20:00 und um 22:00, zusaetzlich existiert ein at-Job, der mit der
|
||||
# variablen Zeit "sunset_rel(3600)" eingeplant ist. Die einzelnen Jobs
|
||||
# verwenden ein benutzerdefiniertes Attribut "freigabe", um untereinander
|
||||
# Informationen auszutauschen.
|
||||
#
|
||||
# Funktionsweise: Der erste ablaufende Job prueft den Zustand des Attributs
|
||||
# "freigabe". Wenn es existiert, wird der Rolladen geschlossen und das
|
||||
# Attribut geloescht. Wenn nicht, wird das Attribut gesetzt, der Rolladen
|
||||
# aber nicht geschlossen. Der naechste Job findet dann ein gesetztes Attribut
|
||||
# vor, schliesst den Rolladen und loescht das Atribut. Der 22:00-Job, der
|
||||
# das Ende des Zeitfensters darstellt, loescht das Attribut und schliesst
|
||||
# den Rolladen, falls noch nicht geschehen.
|
||||
#
|
||||
# Sonnenuntergang um 18:30:
|
||||
# um 19:30 laeuft der variable Job und setzt das Attribut
|
||||
# um 20:00 laeuft der fixe Job 1 und schliesst den Rolladen
|
||||
# um 22:00 laeuft der fixe Job 2 (und veraendert nichts)
|
||||
# Sonnenuntergang um 20:30:
|
||||
# um 20:00 laeuft der fixe Job 1 und setzt das Attribut
|
||||
# um 21:30 laeuft der variable Job und schliesst den Rolladen
|
||||
# um 22:00 laeuft der fixe Job 2 (und veraendert nichts)
|
||||
# Sonnenuntergang um 22:30:
|
||||
# um 20:00 laeuft der fixe Job 1 und setzt das Attribut
|
||||
# um 22:00 laeuft der fixe Job 2 und schliesst den Rolladen
|
||||
# um 23:30 laeuft der variable Job (und veraendert nichts)
|
||||
###########################################################################
|
||||
# example: sunset-dependent action within fixed-time boundaries
|
||||
#
|
||||
# task: A shutter is to be closed one hour past sunset, but not before
|
||||
# 20:00 and at 22:00 at the latest.
|
||||
#
|
||||
# solution: Two fixed-time jobs at 20:00 and 22:00, respectively, mark the
|
||||
# desired "window of opportunity". A time-variable job is scheduled for one
|
||||
# hour past sunset ("sunset_rel(3600)"). The jobs use a user defined attribute
|
||||
# named "freigabe" ("permission" in german) to exchange information.
|
||||
|
||||
# How it works: The first job checks the status of the attribute. If it's set,
|
||||
# the shutter is closed and the attribute is deleted. If the attribute doesn't
|
||||
# exist, it is set but the shutter will not be closed. The next job running
|
||||
# then finds the attribute set and therefore closes the shutter and deletes
|
||||
# the attribute. The job running at 22:00 unconditionally deletes the attribute
|
||||
# and closes the shutter, if it's still open.
|
||||
#
|
||||
# sunset at 18:30:
|
||||
# at 19:30 the time-variable job runs and sets the attribute
|
||||
# at 20:00 fixed job 1 runs and closes the shutter
|
||||
# at 22:00 fixed job 2 runs (and changes nothing)
|
||||
# sunset at 20:30:
|
||||
# at 20:00 fixed job 1 runs and sets the attribute
|
||||
# at 21:30 the time-variable job runs and closes the shutter
|
||||
# at 22:00 fixed job 2 runs (and changes nothing)
|
||||
# sunset at 22:30:
|
||||
# at 20:00 fixed job 1 runs and sets the attribute
|
||||
# at 22:00 fixed job 2 runs and closes the shutter
|
||||
# at 23:30 the time-variable job runs (and changes nothing)
|
||||
###########################################################################
|
||||
|
||||
# Globale Einstellungen
|
||||
# global settings
|
||||
|
||||
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
|
||||
attr global modpath /usr/share/fhem
|
||||
|
||||
# Die Definition des Attributs "freigabe"
|
||||
# definition of attribute "freigabe"
|
||||
|
||||
attr global userattr freigabe
|
||||
|
||||
define FHZ FHZ /dev/ttyUSB0
|
||||
|
||||
# devices
|
||||
|
||||
define roll_eg_wz1 FS20 fb02 0c fg f2 lm 8f
|
||||
|
||||
##########################################################################
|
||||
# Timing-Funktionen
|
||||
# timed jobs
|
||||
##########################################################################
|
||||
|
||||
define roll_wz1_off1 at *20:00:00 { \
|
||||
if( $value{roll_eg_wz1} ne "off" ) { \
|
||||
if( $attr{roll_eg_wz1}{freigabe} ) { \
|
||||
fhem("set roll_eg_wz1 off");; \
|
||||
fhem("deleteattr 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" ) { \
|
||||
if( $attr{roll_eg_wz1}{freigabe} ) { \
|
||||
fhem("set roll_eg_wz1 off");; \
|
||||
fhem("deleteattr 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");; \
|
||||
fhem("deleteattr roll_eg_wz1 freigabe") }
|
@ -1,10 +0,0 @@
|
||||
#
|
||||
# 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 modpath . # where our FHEM directory is
|
||||
|
||||
define telnetPort telnet 7072 # our TCP/IP port (localhost only)
|
||||
#attr telnetPort password secret
|
@ -1,9 +1,6 @@
|
||||
#
|
||||
# pgm2 / autocreate configfile. Take a look at the other examples for more.
|
||||
#
|
||||
attr global logfile /tmp/fhem-%Y-%m.log
|
||||
attr global logfile ./log/fhem-%Y-%m.log
|
||||
attr global modpath . # where our FHEM directory is
|
||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
||||
attr global statefile ./log/fhem.save # where to save the state of the devices
|
||||
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
||||
|
||||
define telnetPort telnet 7072 global # our TCP/IP port
|
||||
@ -17,12 +14,12 @@ define WEBtablet FHEMWEB 8085 global
|
||||
attr WEBtablet touchpad
|
||||
|
||||
# Fake FileLog entry, to access the fhem log from FHEMWEB
|
||||
define Logfile FileLog /tmp/fhem-%Y-%m.log fakelog
|
||||
define Logfile FileLog ./log/fhem-%Y-%m.log fakelog
|
||||
|
||||
define autocreate autocreate
|
||||
attr autocreate autosave
|
||||
attr autocreate device_room %TYPE
|
||||
attr autocreate filelog /tmp/%NAME-%Y.log
|
||||
attr autocreate filelog ./log/%NAME-%Y.log
|
||||
attr autocreate weblink
|
||||
attr autocreate weblink_room Plots
|
||||
|
0
fhem/log/.gitkeep
Normal file
0
fhem/log/.gitkeep
Normal file
Loading…
Reference in New Issue
Block a user