From 12b1c786ac661f22b05a240ee6a994b6c7fcaa4c Mon Sep 17 00:00:00 2001 From: borisneubert <> Date: Tue, 24 Jul 2012 19:48:19 +0000 Subject: [PATCH] get ... icon .. added for FHEMWEB git-svn-id: https://svn.fhem.de/fhem/trunk@1759 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/docs/commandref.html | 13 ++++++++++- fhem/webfrontend/pgm2/01_FHEMWEB.pm | 36 +++++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/fhem/docs/commandref.html b/fhem/docs/commandref.html index 0d0fcee2a..e962d19e0 100644 --- a/fhem/docs/commandref.html +++ b/fhem/docs/commandref.html @@ -8710,7 +8710,18 @@ KlikAanKlikUit, NEXA, CHACON, HomeEasy UK.
You need to define an RFXtrx433 Set
- Get
+ Get + + Attributes diff --git a/fhem/webfrontend/pgm2/01_FHEMWEB.pm b/fhem/webfrontend/pgm2/01_FHEMWEB.pm index 98ea91405..7e08dba42 100755 --- a/fhem/webfrontend/pgm2/01_FHEMWEB.pm +++ b/fhem/webfrontend/pgm2/01_FHEMWEB.pm @@ -98,6 +98,7 @@ FHEMWEB_Initialize($) my ($hash) = @_; $hash->{ReadFn} = "FW_Read"; + $hash->{GetFn} = "FW_Get"; $hash->{AttrFn} = "FW_Attr"; $hash->{DefFn} = "FW_Define"; $hash->{UndefFn} = "FW_Undef"; @@ -2061,10 +2062,6 @@ FW_ReadIcons() #} } -# returns the physical path relative to $FW_icondir for the logical path -# examples: -# FS20.on -> dark/FS20.on.png -# weather/sunny -> default/weather/sunny.gif sub FW_getIcon($) { my ($name)= @_; @@ -2072,6 +2069,21 @@ FW_getIcon($) { return $FW_icons{$icon} ? $icon : undef; } +# returns the physical absolute path relative for the logical path +# examples: +# FS20.on -> $FW_icondir/dark/FS20.on.png +# weather/sunny -> $FW_icondir/default/weather/sunny.gif +sub +FW_IconPath($) { + + my ($name)= @_; + $name =~ s/\.(png)$//; # FIXME + $name= "${name}.png"; # FIXME + FW_ReadIcons() unless($FW_iconsread); + my $path= $FW_icons{$name}; + return $path ? $FW_icondir. $path : undef; +} + # returns the URL for the logical path # examples: # FS20.on -> /icons/FS20.on @@ -2315,7 +2327,23 @@ FW_devState($$) } ##################################### +sub FW_Get($@) { + my ($hash, @a) = @_; + + return "syntax error" if(int(@a) != 3); + + return "Unknown argument $a[1], choose one of " . "icon" + unless($a[1] eq "icon"); + + my $icon= FW_IconPath($a[2]); + return defined($icon) ? $icon : "no such icon"; + +} + + + +##################################### 1;