diff --git a/fhem/CHANGED b/fhem/CHANGED index 99a8b1f95..a5a5348ae 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # 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. + - change: 93_DbRep: DbRep version as INTERNAL, check if DBI module is + installed - bugfix: 76_MSGMail: Clean up net::smtp version number before comparison - bugix: 14_Hideki: fixed wrong return in ParseFn (msg533900) 14_SD_WS: fixed wrong return in ParseFn (msg533900) diff --git a/fhem/FHEM/93_DbRep.pm b/fhem/FHEM/93_DbRep.pm index 4d6851777..49ba5d786 100644 --- a/fhem/FHEM/93_DbRep.pm +++ b/fhem/FHEM/93_DbRep.pm @@ -40,6 +40,7 @@ ########################################################################################################### # Versions History: # +# 4.7.6 07.12.2016 DbRep version as internal, check if perl module DBI is installed # 4.7.5 05.12.2016 collaggstr day aggregation changed # 4.7.4 28.11.2016 sub calcount changed due to Forum #msg529312 # 4.7.3 20.11.2016 new diffValue function made suitable to SQLite @@ -147,12 +148,14 @@ use warnings; use POSIX qw(strftime); use Time::HiRes qw(gettimeofday tv_interval); use Scalar::Util qw(looks_like_number); -use DBI; +eval "use DBI;1" or my $DbRepMMDBI = "DBI"; use DBI::Const::GetInfoType; use Blocking; use Time::Local; # no if $] >= 5.017011, warnings => 'experimental'; +my $DbRepVersion = "4.7.6"; + my %dbrep_col = ("DEVICE" => 64, "TYPE" => 64, "EVENT" => 512, @@ -210,20 +213,24 @@ sub DbRep_Define($@) { my ($hash, $def) = @_; my $name = $hash->{NAME}; + return "Error: Perl module ".$DbRepMMDBI." is missing. + Install it on Debian with: sudo apt-get install libdbi-perl" if($DbRepMMDBI); + my @a = split("[ \t][ \t]*", $def); if(int(@a) < 2) { return "You need to specify more parameters.\n". "Format: define DbRep "; } - $hash->{LASTCMD} = " "; - $hash->{ROLE} = AttrVal($name, "role", "Client"); + $hash->{LASTCMD} = " "; + $hash->{ROLE} = AttrVal($name, "role", "Client"); $hash->{HELPER}{DBLOGDEVICE} = $a[2]; + $hash->{VERSION} = $DbRepVersion; - $hash->{NOTIFYDEV} = "global,".$name; # nur Events dieser Devices an DbRep_Notify weiterleiten + $hash->{NOTIFYDEV} = "global,".$name; # nur Events dieser Devices an DbRep_Notify weiterleiten - my $dbconn = $defs{$a[2]}{dbconn}; - $hash->{DATABASE} = (split(/;|=/, $dbconn))[1]; + my $dbconn = $defs{$a[2]}{dbconn}; + $hash->{DATABASE} = (split(/;|=/, $dbconn))[1]; RemoveInternalTimer($hash); InternalTimer(time+5, 'DbRep_firstconnect', $hash, 0);