From 28fc7c02f0fa2c59cbdf9c4a9e442b593386013e Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Tue, 12 Nov 2013 09:30:31 +0000 Subject: [PATCH] added a way to instert strings into the readings list git-svn-id: https://svn.fhem.de/fhem/trunk@4206 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/33_readingsGroup.pm | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/33_readingsGroup.pm b/fhem/FHEM/33_readingsGroup.pm index d2ba6ffe3..4c7ab597b 100644 --- a/fhem/FHEM/33_readingsGroup.pm +++ b/fhem/FHEM/33_readingsGroup.pm @@ -54,6 +54,12 @@ readingsGroup_updateDevices($) while (@params) { my $param = shift(@params); + while ($param && $param =~ m/^$/ ) { + my $next = shift(@params); + last if( !defined($next) ); + $param .= " ". $next; + } + # for backwards compatibility with weblink readings if( $param eq '*noheading' ) { $attr{$hash->{NAME}}{noheading} = 1; @@ -95,6 +101,8 @@ readingsGroup_updateDevices($) $list{$d} = 1; push @devices, [$d,$device[1]]; } + } elsif($device[0] =~ m/^<.*>$/) { + push @devices, [$device[0]]; } elsif( defined($defs{$device[0]}) ) { $list{$device[0]} = 1; push @devices, [@device]; @@ -269,6 +277,10 @@ readingsGroup_2html($) foreach my $device (@{$devices}) { my $h = $defs{$device->[0]}; my $regex = $device->[1]; + if( !$h && $device->[0] =~ m/^<.*>$/ ) { + $h = $hash if( !$h ); + $regex = $device->[0]; + } my $name = $h->{NAME}; next if( !$h ); @@ -286,8 +298,10 @@ readingsGroup_2html($) if( $regex && $regex =~ m/^<(.*)>$/ ) { my $txt = $1; if( $txt =~ m/^{.*}$/ ) { + my $new_line = $first; my $DEVICE = $name; - $txt = eval $txt; + ($txt,$new_line) = eval $txt; + $first = $new_line if( defined($new_line) ); if( $@ ) { $txt = ""; Log3 $d, 3, $d .": ". $regex .": ". $@; @@ -581,9 +595,13 @@ readingsGroup_Get($@) Notes:
@@ -605,7 +623,7 @@ readingsGroup_Get($@) define systemStatus readingsGroup sysstat
attr systemStatus notime 1
attr systemStatus nostate 1
- attr systemStatus mapping { 'load' => 'Systemauslastung', 'temperature' => 'Systemtemperatur in &deg;C'}
+ attr systemStatus mapping {'load' => 'Systemauslastung', 'temperature' => 'Systemtemperatur in &deg;C'}

define Verbrauch readingsGroup TYPE=PCA301:state,power,consumption
attr Verbrauch mapping %ALIAS