mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
93_DbLog.pm: added support for MAX
git-svn-id: https://svn.fhem.de/fhem/trunk@3484 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1a9c20195f
commit
c11890990c
@ -113,6 +113,10 @@ DbLog_ParseEvent($$$)
|
|||||||
#default
|
#default
|
||||||
if(!defined($reading)) { $reading = ""; }
|
if(!defined($reading)) { $reading = ""; }
|
||||||
if(!defined($value)) { $value = ""; }
|
if(!defined($value)) { $value = ""; }
|
||||||
|
if( $value eq "" ) {
|
||||||
|
$reading= "state";
|
||||||
|
$value= $event;
|
||||||
|
}
|
||||||
|
|
||||||
# the interpretation of the argument depends on the device type
|
# the interpretation of the argument depends on the device type
|
||||||
# EMEM, M232Counter, M232Voltage return plain numbers
|
# EMEM, M232Counter, M232Voltage return plain numbers
|
||||||
@ -120,10 +124,28 @@ DbLog_ParseEvent($$$)
|
|||||||
($type eq "M232Counter") ||
|
($type eq "M232Counter") ||
|
||||||
($type eq "EMEM")) {
|
($type eq "EMEM")) {
|
||||||
}
|
}
|
||||||
|
#OneWire
|
||||||
|
elsif(($type eq "OWMULTI")) {
|
||||||
|
if(int(@parts)>1) {
|
||||||
|
$reading = "data";
|
||||||
|
$value = $event;
|
||||||
|
} else {
|
||||||
|
@parts = split(/\|/, AttrVal($device, $reading."VUnit", ""));
|
||||||
|
$unit = $parts[1] if($parts[1]);
|
||||||
|
if(lc($reading) =~ m/temp/) {
|
||||||
|
$value=~ s/ \(Celsius\)//;
|
||||||
|
$value=~ s/([-\.\d]+).*/$1/;
|
||||||
|
$unit= "°C";
|
||||||
|
}
|
||||||
|
elsif(lc($reading) =~ m/(humidity|vwc)/) {
|
||||||
|
$value=~ s/ \(\%\)//;
|
||||||
|
$unit= "%";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
# Onewire
|
# Onewire
|
||||||
elsif(($type eq "OWAD") ||
|
elsif(($type eq "OWAD") ||
|
||||||
($type eq "OWSWITCH") ||
|
($type eq "OWSWITCH")) {
|
||||||
($type eq "OWMULTI")) {
|
|
||||||
if(int(@parts)>1) {
|
if(int(@parts)>1) {
|
||||||
$reading = "data";
|
$reading = "data";
|
||||||
$value = $event;
|
$value = $event;
|
||||||
@ -132,6 +154,13 @@ DbLog_ParseEvent($$$)
|
|||||||
$unit = $parts[1] if($parts[1]);
|
$unit = $parts[1] if($parts[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# MAX
|
||||||
|
elsif(($type eq "MAX")) {
|
||||||
|
$unit= "°C" if(lc($reading) =~ m/temp/);
|
||||||
|
$unit= "%" if(lc($reading) eq "valveposition");
|
||||||
|
}
|
||||||
|
|
||||||
# FS20
|
# FS20
|
||||||
elsif(($type eq "FS20") ||
|
elsif(($type eq "FS20") ||
|
||||||
($type eq "X10")) {
|
($type eq "X10")) {
|
||||||
@ -145,6 +174,7 @@ DbLog_ParseEvent($$$)
|
|||||||
$reading= "data";
|
$reading= "data";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# FHT
|
# FHT
|
||||||
elsif($type eq "FHT") {
|
elsif($type eq "FHT") {
|
||||||
if($reading =~ m(-from[12]\ ) || $reading =~ m(-to[12]\ )) {
|
if($reading =~ m(-from[12]\ ) || $reading =~ m(-to[12]\ )) {
|
||||||
@ -231,6 +261,7 @@ DbLog_ParseEvent($$$)
|
|||||||
# remove trailing %
|
# remove trailing %
|
||||||
$value=~ s/ \%$//;
|
$value=~ s/ \%$//;
|
||||||
}
|
}
|
||||||
|
|
||||||
# BS
|
# BS
|
||||||
elsif($type eq "BS") {
|
elsif($type eq "BS") {
|
||||||
if($event =~ m(brightness:.*)) {
|
if($event =~ m(brightness:.*)) {
|
||||||
@ -240,6 +271,7 @@ DbLog_ParseEvent($$$)
|
|||||||
$unit= "lux";
|
$unit= "lux";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# RFXTRX Lighting
|
# RFXTRX Lighting
|
||||||
elsif($type eq "TRX_LIGHT") {
|
elsif($type eq "TRX_LIGHT") {
|
||||||
if($reading =~ m/^level (\d+)/) {
|
if($reading =~ m/^level (\d+)/) {
|
||||||
@ -247,6 +279,7 @@ DbLog_ParseEvent($$$)
|
|||||||
$reading= "level";
|
$reading= "level";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# RFXTRX Sensors
|
# RFXTRX Sensors
|
||||||
elsif($type eq "TRX_WEATHER") {
|
elsif($type eq "TRX_WEATHER") {
|
||||||
if($reading eq "energy_current") { $value=~ s/ W//; }
|
if($reading eq "energy_current") { $value=~ s/ W//; }
|
||||||
@ -260,6 +293,7 @@ DbLog_ParseEvent($$$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Weather
|
# Weather
|
||||||
elsif($type eq "WEATHER") {
|
elsif($type eq "WEATHER") {
|
||||||
if($event =~ m(^wind_condition)) {
|
if($event =~ m(^wind_condition)) {
|
||||||
@ -288,7 +322,7 @@ DbLog_ParseEvent($$$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# DUMMY
|
# Dummy
|
||||||
elsif($type eq "DUMMY") {
|
elsif($type eq "DUMMY") {
|
||||||
if( $value eq "" ) {
|
if( $value eq "" ) {
|
||||||
$reading= "data";
|
$reading= "data";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user