2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 01:46:08 +00:00

MAX: Add DbLog_splitFn (patch provided by juniormajor)

git-svn-id: https://svn.fhem.de/fhem/trunk@8382 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mgehre 2015-04-06 08:53:12 +00:00
parent d189343573
commit 6e1ea06ff2

View File

@ -16,6 +16,7 @@ sub MAX_Parse($$);
sub MAX_Set($@);
sub MAX_MD15Cmd($$$);
sub MAX_DateTime2Internal($);
sub MAX_DbLog_splitFn($);
my @ctrl_modes = ( "auto", "manual", "temporary", "boost" );
@ -75,6 +76,7 @@ MAX_Initialize($)
$hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 dummy:0,1 " .
"showtime:1,0 keepAuto:0,1 scanTemp:0,1 ".
$readingFnAttributes;
$hash->{DbLog_splitFn} = "MAX_DbLog_splitFn";
return undef;
}
@ -870,6 +872,23 @@ MAX_Parse($$)
return $shash->{NAME}
}
#############################
sub
MAX_DbLog_splitFn($)
{
my ($event) = @_;
my ($reading, $value, $unit) = "";
my @parts = split(/ /,$event);
$reading = shift @parts;
$reading =~ tr/://d;
$value = $parts[0];
$value = $parts[1] if (lc($value) =~ m/auto/);
$unit = "\xB0C" if(lc($reading) =~ m/temp/);
$unit = "%" if(lc($reading) =~ m/valve/);
return ($reading, $value, $unit);
}
1;
=pod