diff --git a/fhem/FHEM/33_readingsGroup.pm b/fhem/FHEM/33_readingsGroup.pm
index 691f3a92b..320299e37 100644
--- a/fhem/FHEM/33_readingsGroup.pm
+++ b/fhem/FHEM/33_readingsGroup.pm
@@ -30,7 +30,7 @@ use vars qw(%FW_hiddenroom);
use vars qw(%FW_visibleDeviceHash);
use vars qw(%FW_webArgs); # all arguments specified in the GET
-my @mapping_attrs = qw( commands mapping nameIcon cellStyle nameStyle valueColumn valueColumns valueFormat valueIcon valueStyle );
+my @mapping_attrs = qw( commands mapping nameIcon cellStyle nameStyle valueColumn valueColumns valueFormat valuePrefix valueSuffix valueIcon valueStyle );
sub readingsGroup_Initialize($)
{
@@ -728,6 +728,20 @@ readingsGroup_2html($)
}
($v,$devStateIcon) = readingsGroup_makeLink($v,$devStateIcon,$cmd) if( !$webCmdFn );
+ if( $hash->{helper}{valuePrefix} ) {
+ if( my $value_prefix = lookup2($hash->{helper}{valuePrefix},$name,$n,$v) ) {
+ $v = $value_prefix . $v;
+ $devStateIcon = $value_prefix . $devStateIcon if( $devStateIcon );
+ }
+ }
+
+ if( $hash->{helper}{valueSuffix} ) {
+ if( my $value_suffix = lookup2($hash->{helper}{valueSuffix},$name,$n,$v) ) {
+ $v .= $value_suffix;
+ $devStateIcon .= $value_suffix if( $devStateIcon );
+ }
+ }
+
if( $first || $multi == 1 ) {
$ret .= sprintf("
", ($row&1)?"odd":"even");
$row++;
@@ -956,6 +970,18 @@ readingsGroup_Notify($$)
if( $devStateIcon ) {
(undef,$devStateIcon) = readingsGroup_makeLink(undef,$devStateIcon,$cmd);
+ if( $hash->{helper}{valuePrefix} ) {
+ if( my $value_prefix = lookup2($hash->{helper}{valuePrefix},$n,$reading,$value) ) {
+ $devStateIcon = $value_prefix . $devStateIcon if( $devStateIcon );
+ }
+ }
+
+ if( $hash->{helper}{valueSuffix} ) {
+ if( my $value_suffix = lookup2($hash->{helper}{valueSuffix},$n,$reading,$value) ) {
+ $devStateIcon .= $value_suffix if( $devStateIcon );
+ }
+ }
+
DoTrigger( $name, "$n.$reading: $devStateIcon" );
next;
}
@@ -968,6 +994,20 @@ readingsGroup_Notify($$)
($value,undef) = readingsGroup_makeLink($value,undef,$cmd);
+ if( $hash->{helper}{valuePrefix} ) {
+ if( my $value_prefix = lookup2($hash->{helper}{valuePrefix},$n,$reading,$value) ) {
+ $value = $value_prefix . $value;
+ $devStateIcon = $value_prefix . $devStateIcon if( $devStateIcon );
+ }
+ }
+
+ if( $hash->{helper}{valueSuffix} ) {
+ if( my $value_suffix = lookup2($hash->{helper}{valueSuffix},$n,$reading,$value) ) {
+ $value .= $value_suffix;
+ $devStateIcon .= $value_suffix if( $devStateIcon );
+ }
+ }
+
$value = "$value
" if( $value_style );
DoTrigger( $name, "$n.$reading: $value" );
@@ -1036,7 +1076,11 @@ readingsGroup_Attr($$$;$)
my $attrVal = $attrVal;
if( $attrVal =~ m/^{.*}$/ ) {
my $av = eval $attrVal;
- $attrVal = $av if( ref($av) eq "HASH" );
+ if( $@ ) {
+ Log3 $hash->{NAME}, 3, $hash->{NAME} .": ". $@;
+ } else {
+ $attrVal = $av if( ref($av) eq "HASH" );
+ }
}
$hash->{helper}{$attrName} = $attrVal;
} else {
@@ -1215,8 +1259,14 @@ readingsGroup_Attr($$$;$)
this reading will be skipped. Can be given as a string, a perl expression returning a hash or a perl
expression returning a string, e.g.:
attr temperatures valueFormat %.1f °C
- attr temperatures valueFormat { temperature => "%.1f °C", humidity => "%.1f %" }
+ attr temperatures valueFormat { temperature => "%.1f °C", humidity => "%i %" }
attr temperatures valueFormat { ($READING eq 'temperature')?"%.1f °C":undef }
+ valuePrefix
+ text to be prepended to the reading value
+ valueSuffix
+ text to be appended after the reading value
+ attr temperatures valueFormat { temperature => "%.1f", humidity => "%i" }
+ attr temperatures valueSuffix { temperature => "°C", humidity => " %" }
nameIcon
Specify the 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.: