mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-19 18:56:03 +00:00
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
This commit is contained in:
parent
0dfb996479
commit
28fc7c02f0
@ -54,6 +54,12 @@ readingsGroup_updateDevices($)
|
|||||||
while (@params) {
|
while (@params) {
|
||||||
my $param = shift(@params);
|
my $param = shift(@params);
|
||||||
|
|
||||||
|
while ($param && $param =~ m/^</ && $param !~ m/>$/ ) {
|
||||||
|
my $next = shift(@params);
|
||||||
|
last if( !defined($next) );
|
||||||
|
$param .= " ". $next;
|
||||||
|
}
|
||||||
|
|
||||||
# for backwards compatibility with weblink readings
|
# for backwards compatibility with weblink readings
|
||||||
if( $param eq '*noheading' ) {
|
if( $param eq '*noheading' ) {
|
||||||
$attr{$hash->{NAME}}{noheading} = 1;
|
$attr{$hash->{NAME}}{noheading} = 1;
|
||||||
@ -95,6 +101,8 @@ readingsGroup_updateDevices($)
|
|||||||
$list{$d} = 1;
|
$list{$d} = 1;
|
||||||
push @devices, [$d,$device[1]];
|
push @devices, [$d,$device[1]];
|
||||||
}
|
}
|
||||||
|
} elsif($device[0] =~ m/^<.*>$/) {
|
||||||
|
push @devices, [$device[0]];
|
||||||
} elsif( defined($defs{$device[0]}) ) {
|
} elsif( defined($defs{$device[0]}) ) {
|
||||||
$list{$device[0]} = 1;
|
$list{$device[0]} = 1;
|
||||||
push @devices, [@device];
|
push @devices, [@device];
|
||||||
@ -269,6 +277,10 @@ readingsGroup_2html($)
|
|||||||
foreach my $device (@{$devices}) {
|
foreach my $device (@{$devices}) {
|
||||||
my $h = $defs{$device->[0]};
|
my $h = $defs{$device->[0]};
|
||||||
my $regex = $device->[1];
|
my $regex = $device->[1];
|
||||||
|
if( !$h && $device->[0] =~ m/^<.*>$/ ) {
|
||||||
|
$h = $hash if( !$h );
|
||||||
|
$regex = $device->[0];
|
||||||
|
}
|
||||||
my $name = $h->{NAME};
|
my $name = $h->{NAME};
|
||||||
next if( !$h );
|
next if( !$h );
|
||||||
|
|
||||||
@ -286,8 +298,10 @@ readingsGroup_2html($)
|
|||||||
if( $regex && $regex =~ m/^<(.*)>$/ ) {
|
if( $regex && $regex =~ m/^<(.*)>$/ ) {
|
||||||
my $txt = $1;
|
my $txt = $1;
|
||||||
if( $txt =~ m/^{.*}$/ ) {
|
if( $txt =~ m/^{.*}$/ ) {
|
||||||
|
my $new_line = $first;
|
||||||
my $DEVICE = $name;
|
my $DEVICE = $name;
|
||||||
$txt = eval $txt;
|
($txt,$new_line) = eval $txt;
|
||||||
|
$first = $new_line if( defined($new_line) );
|
||||||
if( $@ ) {
|
if( $@ ) {
|
||||||
$txt = "<ERROR>";
|
$txt = "<ERROR>";
|
||||||
Log3 $d, 3, $d .": ". $regex .": ". $@;
|
Log3 $d, 3, $d .": ". $regex .": ". $@;
|
||||||
@ -581,9 +595,13 @@ readingsGroup_Get($@)
|
|||||||
Notes:
|
Notes:
|
||||||
<ul>
|
<ul>
|
||||||
<li><device> can be of the form INTERNAL=VALUE where INTERNAL is the name of an internal value and VALUE is a regex.</li>
|
<li><device> can be of the form INTERNAL=VALUE where INTERNAL is the name of an internal value and VALUE is a regex.</li>
|
||||||
|
<li><device> can be of the form <STRING> or <{perl}> where STRING or the string returned by perl is
|
||||||
|
inserted as a line in the readings list. </li>
|
||||||
<li>If regex is a comma separatet list the reading values will be shown on a single line.</li>
|
<li>If regex is a comma separatet list the reading values will be shown on a single line.</li>
|
||||||
<li>If regex starts with a + it will be matched against the internal values of the device instead of the readings.</li>
|
<li>If regex starts with a + it will be matched against the internal values of the device instead of the readings.</li>
|
||||||
<li>If regex starts with a ? it will be matched against the attributes of the device instead of the readings.</li>
|
<li>If regex starts with a ? it will be matched against the attributes of the device instead of the readings.</li>
|
||||||
|
<li>regex can be of the form <STRING> or <{perl}> where STRING or the string returned by perl is
|
||||||
|
inserted as the reading. </li>
|
||||||
<li>For internal values and attributes longpoll update is not possible. Refresh the page to update the values.</li>
|
<li>For internal values and attributes longpoll update is not possible. Refresh the page to update the values.</li>
|
||||||
</ul><br>
|
</ul><br>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user