2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

93_DbLog: Added support for longpoll SVG.

git-svn-id: https://svn.fhem.de/fhem/trunk@9688 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rapster 2015-10-26 11:57:48 +00:00
parent a13bc14769
commit e36f27a75f
2 changed files with 39 additions and 9 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: 93_DbLog: Added support for longpoll SVG.
- feature: contrib/98_openweathermap.pm - add support for stationByZip.
e.g. 76133,de will find weather data for Karlsruhe,Germany
- bugfix: 38_CO20: fixed error messages on timeout

View File

@ -33,14 +33,15 @@ sub DbLog_Initialize($)
{
my ($hash) = @_;
$hash->{DefFn} = "DbLog_Define";
$hash->{UndefFn} = "DbLog_Undef";
$hash->{NotifyFn} = "DbLog_Log";
$hash->{SetFn} = "DbLog_Set";
$hash->{GetFn} = "DbLog_Get";
$hash->{AttrFn} = "DbLog_Attr";
$hash->{ShutdownFn} = "DbLog_Shutdown";
$hash->{AttrList} = "disable:0,1 ".
$hash->{DefFn} = "DbLog_Define";
$hash->{UndefFn} = "DbLog_Undef";
$hash->{NotifyFn} = "DbLog_Log";
$hash->{SetFn} = "DbLog_Set";
$hash->{GetFn} = "DbLog_Get";
$hash->{AttrFn} = "DbLog_Attr";
$hash->{SVG_regexpFn} = "DbLog_regexpFn";
$hash->{ShutdownFn} = "DbLog_Shutdown";
$hash->{AttrList} = "disable:0,1 ".
"DbLogType:Current,History,Current/History ".
"shutdownWait ".
"suppressUndef:0,1 ".
@ -142,6 +143,32 @@ sub DbLog_Attr(@)
return undef;
}
################################################################
#
# Exrahieren des Filters aus der ColumnsSpec (gplot-Datei)
#
# Die grundlegend idee ist das jeder svg plot einen filter hat der angibt
# welches device und reading dargestellt wird so das der plot sich neu
# lädt wenn es ein entsprechendes event gibt.
#
# Parameter: Quell-Instanz-Name, und alle FileLog-Parameter, die diese Instanz betreffen.
# Quelle: http://forum.fhem.de/index.php/topic,40176.msg325200.html#msg325200
################################################################
sub DbLog_regexpFn($$) {
my ($name, $filter) = @_;
my $ret;
my @a = split( ' ', $filter );
for(my $i = 0; $i < int(@a); $i++) {
my @fld = split(":", $a[$i]);
$ret .= '|' if( $ret );
$ret .= $fld[0] .'.'. $fld[1];
}
return $ret;
}
################################################################
#
# Parsefunktion, abhaengig vom Devicetyp
@ -501,6 +528,8 @@ sub DbLog_Log($$) {
# Log is my entry, Dev is the entry of the changed device
my ($hash, $dev) = @_;
Log3 $hash,5, "Notify from Device: ".$dev->{NAME}." recieved";
return undef if($hash->{STATE} eq "disabled");
# name and type required for parsing
@ -1884,7 +1913,7 @@ DbLog_sampleDataFn($$$$$)
# Table Current present, use it for sample data
my $dbhf = $defs{$dlName}{DBHF};
my $query = "select device,reading,value from current where device <> '' group by device,reading order by device,reading";
my $query = "select device,reading,value from current where device <> '' order by device,reading";
my $sth = $dbhf->prepare( $query );
$sth->execute();
while (my @line = $sth->fetchrow_array()) {