mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 08:11:44 +00:00
98_CustomReadings.pm: Improved parsing of the readingDefinitions that allows commas between curly braces
git-svn-id: https://svn.fhem.de/fhem/trunk@7042 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
39a9f164a5
commit
b26d327611
@ -44,12 +44,21 @@ sub CustomReadings_read($)
|
|||||||
my $readingDefinitions = AttrVal( $name, "readingDefinitions", "");
|
my $readingDefinitions = AttrVal( $name, "readingDefinitions", "");
|
||||||
$readingDefinitions =~ s/\n//g;
|
$readingDefinitions =~ s/\n//g;
|
||||||
|
|
||||||
my @definitionList = split(',', $readingDefinitions);
|
|
||||||
my @used = ("state");
|
my @used = ("state");
|
||||||
|
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
foreach (@definitionList) {
|
|
||||||
my @definition = split(':', $_, 2);
|
my @definitionList = split(",", $readingDefinitions);
|
||||||
|
while (@definitionList) {
|
||||||
|
my $param = shift(@definitionList);
|
||||||
|
|
||||||
|
while ($param && $param =~ /{/ && $param !~ /}/ ) {
|
||||||
|
my $next = shift(@definitionList);
|
||||||
|
last if( !defined($next) );
|
||||||
|
$param .= ",". $next;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @definition = split(':', $param, 2);
|
||||||
push(@used, $definition[0]);
|
push(@used, $definition[0]);
|
||||||
|
|
||||||
my $value = eval($definition[1]);
|
my $value = eval($definition[1]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user