98_CustomReadings.pm: Improved parsing of the readingDefinitions that allows commas between curly braces
git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@7042 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -44,12 +44,21 @@ sub CustomReadings_read($)
|
||||
my $readingDefinitions = AttrVal( $name, "readingDefinitions", "");
|
||||
$readingDefinitions =~ s/\n//g;
|
||||
|
||||
my @definitionList = split(',', $readingDefinitions);
|
||||
my @used = ("state");
|
||||
|
||||
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]);
|
||||
|
||||
my $value = eval($definition[1]);
|
||||
|
||||
Reference in New Issue
Block a user