From 61fa4ace9e44a8ae01c873f433eadc0c86b7ae1b Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Sat, 7 Sep 2013 08:04:20 +0000 Subject: [PATCH] fixed mapping git-svn-id: https://svn.fhem.de/fhem/trunk@3867 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/33_readingsGroup.pm | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fhem/FHEM/33_readingsGroup.pm b/fhem/FHEM/33_readingsGroup.pm index 07eefecd1..4bd5094b5 100644 --- a/fhem/FHEM/33_readingsGroup.pm +++ b/fhem/FHEM/33_readingsGroup.pm @@ -131,8 +131,8 @@ sub lookup($$$$$) $default =~ s/\%READING/$reading/g; $default =~ s/\$ALIAS/$alias/g; - $default =~ s/\$READING/$name/g; - $default =~ s/\$DEVICE/$reading/g; + $default =~ s/\$DEVICE/$name/g; + $default =~ s/\$READING/$reading/g; } return $default; @@ -242,8 +242,10 @@ readingsGroup_2html($) my $m = "$a$separator$n"; my $txt = lookup($mapping,$name,$a,$n,$m); - if( my $icon = lookup($nameIcons,$name,$a,$n,$m) ) { - $txt = FW_makeImage( $icon, $txt, "icon" ); + if( $nameIcons ) { + if( my $icon = lookup($nameIcons,$name,$a,$n,"") ) { + $txt = FW_makeImage( $icon, $txt, "icon" ); + } } $ret .= sprintf("", ($row&1)?"odd":"even"); @@ -305,8 +307,10 @@ readingsGroup_2html($) my $m = "$a$separator$n"; my $txt = lookup($mapping,$name,$a,$n,$m); - if( my $icon = lookup($nameIcons,$name,$a,$n,$m) ) { - $txt = FW_makeImage( $icon, $txt, "icon" ); + if( $nameIcons ) { + if( my $icon = lookup($nameIcons,$name,$a,$n,"") ) { + $txt = FW_makeImage( $icon, $txt, "icon" ); + } } $ret .= sprintf("", ($row&1)?"odd":"even"); @@ -558,6 +562,10 @@ readingsGroup_Get($@) attr temperatures valueFormat %.1f °C
attr temperatures valueFormat { temperature => "%.1f °C", humidity => "%.1f %" }
attr temperatures valueFormat { ($READING eq 'temperature')?"%.1f °C":undef } +
  • nameIcon
    + Specify an icon to be used instead of the reading name. Can be a simple string or a perl expression enclosed + in {} that returns a hash that maps reading names to the icon name. e.g.:
    + attr devices nameIcon $DEVICE

  • The nameStyle and valueStyle attributes can also contain a perl expression enclosed in {} that returns the style string to use. The perl code can use $DEVICE,$READING and $VALUE, e.g.: