2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

all modules/files maintained by me: loglevel removed, Log3 uses the verbose

attribute, which is available from now on for all devices.


git-svn-id: https://svn.fhem.de/fhem/trunk@3738 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-08-18 14:13:59 +00:00
parent 33c3118cb8
commit 856ce5a4fa
49 changed files with 435 additions and 486 deletions

View File

@ -101,10 +101,9 @@ CUL_Initialize($)
$hash->{SetFn} = "CUL_Set";
$hash->{AttrFn} = "CUL_Attr";
$hash->{AttrList}= "do_not_notify:1,0 dummy:1,0 " .
"showtime:1,0 model:CUL,CUN,CUR loglevel:0,1,2,3,4,5,6 " .
"sendpool addvaltrigger " .
"rfmode:SlowRF,HomeMatic,MAX hmId ".
"hmProtocolEvents:0_off,1_dump,2_dumpFull,3_dumpTrigger";
"showtime:1,0 model:CUL,CUN,CUR " .
"sendpool addvaltrigger rfmode:SlowRF,HomeMatic,MAX hmId ".
"hmProtocolEvents:0_off,1_dump,2_dumpFull,3_dumpTrigger";
$hash->{ShutdownFn} = "CUL_Shutdown";
@ -131,7 +130,7 @@ CUL_Define($$)
if(@a < 4 || @a > 5) {
my $msg = "wrong syntax: define <name> CUL {none | devicename[\@baudrate] ".
"| devicename\@directio | hostname:port} <FHTID>";
Log 2, $msg;
Log3 undef, 2, $msg;
return $msg;
}
@ -1238,7 +1237,6 @@ CUL_Attr(@)
<li><a href="#do_not_notify">do_not_notify</a></li>
<li><a href="#attrdummy">dummy</a></li>
<li><a href="#showtime">showtime</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#model">model</a> (CUL,CUN,CUR)</li>
<li><a name="sendpool">sendpool</a><br>
If using more than one CUL/CUN for covering a large area, sending

View File

@ -33,7 +33,7 @@ FBAHA_Initialize($)
$hash->{DefFn} = "FBAHA_Define";
$hash->{GetFn} = "FBAHA_Get";
$hash->{SetFn} = "FBAHA_Set";
$hash->{AttrList}= "dummy:1,0 loglevel:0,1,2,3,4,5,6 ";
$hash->{AttrList}= "dummy:1,0";
}
@ -83,7 +83,7 @@ FBAHA_Set($@)
my ($i,$p) = ($1,$2,$3);
my $msg = "UNDEFINED FBDECT_$i FBDECT $i $p";
DoTrigger("global", $msg, 1);
Log 3, "$msg, please define it";
Log3 $name, 3, "$msg, please define it";
}
}
}
@ -94,7 +94,7 @@ FBAHA_Set($@)
FBAHA_Write($hash, "00", "00010001"); # REGISTER
my ($err, $data) = FBAHA_ReadAnswer($hash, "REGISTER", "^01");
if($err) {
Log 1, $err;
Log3 $name, 1, $err;
$hash->{STATE} = "???";
return $err;
}
@ -102,11 +102,12 @@ FBAHA_Set($@)
if($data =~ m/^01030010(........)/) {
$hash->{STATE} = "Initialized";
$hash->{HANDLE} = $1;
Log 1, "FBAHA $hash->{NAME} registered with handle: $hash->{HANDLE}";
Log3 $name, 1,
"FBAHA $hash->{NAME} registered with handle: $hash->{HANDLE}";
} else {
my $msg = "Got bogus answer for REGISTER request: $data";
Log 1, $msg;
Log3 $name, 1, $msg;
$hash->{STATE} = "???";
return $msg;
@ -246,7 +247,6 @@ FBAHA_Read($@)
return "" if(!defined($buf));
my $name = $hash->{NAME};
my $ll5 = GetLogLevel($name,5);
$buf = unpack('H*', $buf);
my $data = ($hash->{PARTIAL} ? $hash->{PARTIAL} : "");
@ -257,14 +257,14 @@ FBAHA_Read($@)
delete($hash->{READ_TS});
}
Log $ll5, "FBAHA/RAW: $data/$buf";
Log3 $name, 5, "FBAHA/RAW: $data/$buf";
$data .= $buf;
my $msg;
while(length($data) >= 16) {
my $len = hex(substr($data, 4,4))*2;
if($len < 16 || $len > 10240) { # Out of Sync
Log 1, "FBAHA: resetting buffer as we are out of sync ($len)";
Log3 $name, 1, "FBAHA: resetting buffer as we are out of sync ($len)";
$hash->{PARTIAL} = "";
return "";
}
@ -393,7 +393,6 @@ FBAHA_Ready($)
<b>Attributes</b>
<ul>
<li><a href="#dummy">dummy</a></li>
<li><a href="#loglevel">loglevel</a></li>
</ul>
<br>
@ -477,7 +476,6 @@ FBAHA_Ready($)
<b>Attributes</b>
<ul>
<li><a href="#dummy">dummy</a></li>
<li><a href="#loglevel">loglevel</a></li>
</ul>
<br>

View File

@ -105,7 +105,7 @@ FHZ_Initialize($)
$hash->{GetFn} = "FHZ_Get";
$hash->{SetFn} = "FHZ_Set";
$hash->{AttrList}= "do_not_notify:1,0 dummy:1,0 " .
"showtime:1,0 model:fhz1000,fhz1300 loglevel:0,1,2,3,4,5,6 ".
"showtime:1,0 model:fhz1000,fhz1300 ".
"fhtsoftbuffer:1,0 addvaltrigger";
}
@ -140,7 +140,7 @@ FHZ_Ready($)
}
return undef if(!$po);
Log 1, "USB device $dev reappeared";
Log3 $name, 1, "USB device $dev reappeared";
$hash->{PortObj} = $po;
if($^O !~ m/Win/) {
$hash->{FD} = $po->FILENO;
@ -178,7 +178,7 @@ FHZ_Set($@)
my $v = join(" ", @a);
my $name = $hash->{NAME};
Log GetLogLevel($name,2), "FHZ set $v";
Log3 $name, 2, "FHZ set $v";
if($a[1] eq "initfull") {
@ -244,13 +244,13 @@ FHZ_Get($@)
my $v = join(" ", @a);
my $name = $hash->{NAME};
Log GetLogLevel($name,2), "FHZ get $v";
Log3 $name, 2, "FHZ get $v";
FHZ_ReadAnswer($hash, "Flush", 0);
FHZ_Write($hash, $fn, $arg) if(!IsDummy($hash->{NAME}));
my $msg = FHZ_ReadAnswer($hash, $a[1], 1.0);
Log 5, "GET Got: $msg" if(defined($msg));
Log3 $name, 5, "GET Got: $msg" if(defined($msg));
return $msg if(!$msg || $msg !~ /^81..c9..0102/);
if($a[1] eq "serial") {
@ -348,14 +348,14 @@ FHZ_Define($$)
$attr{$name}{fhtsoftbuffer} = 0;
if($dev eq "none") {
Log 1, "FHZ device is none, commands will be echoed only";
Log3 $name, 1, "FHZ device is none, commands will be echoed only";
$attr{$name}{dummy} = 1;
return undef;
}
$hash->{DeviceName} = $dev;
$hash->{PARTIAL} = "";
Log 3, "FHZ opening FHZ device $dev";
Log3 $name, 3, "FHZ opening FHZ device $dev";
if($^O =~ m/Win/) {
require Win32::SerialPort;
$po = new Win32::SerialPort ($dev);
@ -365,12 +365,12 @@ FHZ_Define($$)
}
if(!$po) {
my $msg = "Can't open $dev: $!";
Log(3, $msg) if($hash->{MOBILE});
Log3($name, 3, $msg) if($hash->{MOBILE});
return $msg if(!$hash->{MOBILE});
$readyfnlist{"$name.$dev"} = $hash;
return "";
}
Log 3, "FHZ opened FHZ device $dev";
Log3 $name, 3, "FHZ opened FHZ device $dev";
$hash->{PortObj} = $po;
if($^O !~ m/Win/) {
@ -397,7 +397,7 @@ FHZ_Undef($$)
$defs{$d}{IODev} == $hash)
{
my $lev = ($reread_active ? 4 : 2);
Log GetLogLevel($name,$lev), "deleting port for $d";
Log3 $name, $lev, "deleting port for $d";
delete $defs{$d}{IODev};
}
}
@ -426,7 +426,7 @@ FHZ_Parse($$)
}
if(!$type) {
Log 4, "FHZ $name unknown: $omsg";
Log3 $name, 4, "FHZ $name unknown: $omsg";
$hash->{CHANGED}[0] = "$msg";
return $hash->{NAME};
}
@ -436,7 +436,7 @@ FHZ_Parse($$)
$msg = substr($msg, 4, 2);
}
Log 4, "FHZ $name $type: $msg";
Log3 $name, 4, "FHZ $name $type: $msg";
$hash->{CHANGED}[0] = "$type: $msg";
return $hash->{NAME};
}
@ -503,13 +503,13 @@ FHZ_ReadAnswer($$$)
}
Log 4, "FHZ/RAW: " . unpack('H*',$buf);
Log3 $hash, 4, "FHZ/RAW: " . unpack('H*',$buf);
$mfhzdata .= $buf;
next if(length($mfhzdata) < 2);
my $len = ord(substr($mfhzdata,1,1)) + 2;
if($len>20) {
Log 4, "Oversized message (" . unpack('H*',$mfhzdata) .
Log3 $hash, 4, "Oversized message (" . unpack('H*',$mfhzdata) .
"), dropping it ...";
return undef;
}
@ -555,7 +555,7 @@ FHZ_XmitLimitCheck($$)
if(@b > 163) { # Maximum nr of transmissions per hour (unconfirmed).
my $me = $hash->{NAME};
Log GetLogLevel($me,2), "FHZ TRANSMIT LIMIT EXCEEDED";
Log3 $me, 2, "FHZ TRANSMIT LIMIT EXCEEDED";
DoTrigger($me, "TRANSMIT LIMIT EXCEEDED");
} else {
@ -574,7 +574,7 @@ FHZ_Write($$$)
my ($hash,$fn,$msg) = @_;
if(!$hash || !defined($hash->{PortObj})) {
Log 5, "FHZ device $hash->{NAME} is not active, cannot send";
Log3 $hash, 5, "FHZ device $hash->{NAME} is not active, cannot send";
return;
}
@ -589,7 +589,7 @@ FHZ_Write($$$)
my $bstring = FHZ_CompleteMsg($fn, $msg);
Log 5, "Sending " . unpack('H*', $bstring);
Log3 $hash, 5, "Sending " . unpack('H*', $bstring);
if(!$hash->{QUEUE}) {
@ -637,7 +637,7 @@ FHZ_Reopen($)
my $dev = $hash->{DeviceName};
$hash->{PortObj}->close();
Log 1, "USB device $dev closed";
Log3 $hash, 1, "USB device $dev closed";
for(;;) {
sleep(5);
if($^O =~ m/Win/) {
@ -646,7 +646,7 @@ FHZ_Reopen($)
$hash->{PortObj} = new Device::SerialPort($dev);
}
if($hash->{PortObj}) {
Log 1, "USB device $dev reopened";
Log3 $hash, 1, "USB device $dev reopened";
$hash->{FD} = $hash->{PortObj}->FILENO if($^O !~ m/Win/);
FHZ_DoInit($hash->{NAME}, $hash->{ttytype}, $hash->{PortObj});
return;
@ -665,7 +665,7 @@ FHZ_Close($)
my $name = $hash->{NAME};
$hash->{PortObj}->close();
Log 1, "USB device $dev closed";
Log3 $name, 1, "USB device $dev closed";
delete($hash->{PortObj});
delete($hash->{FD});
delete($selectlist{"$name.$dev"});
@ -722,7 +722,7 @@ FHZ_Read($)
if(!defined($buf) || length($buf) == 0) {
my $dev = $hash->{DeviceName};
Log 1, "USB device $dev disconnected, waiting to reappear";
Log3 $name, 1, "USB device $dev disconnected, waiting to reappear";
delete($hash->{FD});
$hash->{PortObj}->close();
delete($hash->{PortObj});
@ -740,7 +740,7 @@ FHZ_Read($)
my $fhzdata = $hash->{PARTIAL};
Log 4, "FHZ/RAW: " . unpack('H*',$buf) .
Log3 $name, 4, "FHZ/RAW: " . unpack('H*',$buf) .
" (Unparsed: " . unpack('H*', $fhzdata) . ")";
$fhzdata .= $buf;
@ -751,18 +751,18 @@ FHZ_Read($)
my $si = index($fhzdata, $msgstart);
if($si) {
if($si == -1) {
Log(5, "Bogus message received, no start character found");
Log3 $name, 5, "Bogus message received, no start character found";
$fhzdata = "";
last;
} else {
Log(5, "Bogus message received, skipping to start character");
Log3 $name, 5, "Bogus message received, skipping to start character";
$fhzdata = substr($fhzdata, $si);
}
}
my $len = ord(substr($fhzdata,1,1)) + 2;
if($len>20) {
Log 4,
Log3 $name, 4,
"Oversized message (" . unpack('H*',$fhzdata) . "), dropping it ...";
$fhzdata = "";
next;
@ -788,7 +788,7 @@ FHZ_Read($)
} else {
Log 4, "Bad CRC message, skipping it (Bogus message follows)";
Log3 $name, 4, "Bad CRC message, skipping it (Bogus message follows)";
$fhzdata = substr($fhzdata, 2);
}
@ -865,7 +865,7 @@ FHZ_Read($)
<li>In order to set the time of your FHT's, schedule this command every
minute:<br>
<code>define fhz_timer at +*00:01:00 set FHZ time</code><br>
See the <a href="#loglevel">loglevel</a> to prevent logging of
See the <a href="#verbose">verbose</a> to prevent logging of
this command.
</li>
<li>FHTcode is a two digit hex number (from 00 to 63?) and sets the
@ -953,6 +953,9 @@ FHZ_Read($)
<a name="loglevel"></a>
<li>loglevel<br>
<b>Note:</b>Deprecated! The module maintainer is encouraged to replace it
with verbose.<br><br>
Set the device loglevel to e.g. 6 if you do not wish messages from a
given device to appear in the global logfile (FHZ/FS20/FHT). E.g. to
set the FHT time, you should schedule "set FHZ time" every minute, but

View File

@ -14,7 +14,6 @@ sub
LIRC_Initialize($)
{
my ($hash) = @_;
Log 1, "LIRC_Initialize";
# Provider
$hash->{ReadFn} = "LIRC_Read";
@ -24,7 +23,7 @@ LIRC_Initialize($)
# Consumer
$hash->{DefFn} = "LIRC_Define";
$hash->{UndefFn} = "LIRC_Undef";
$hash->{AttrList}= "loglevel:0,1,2,3,4,5,6";
$hash->{AttrList}= "";
}
#####################################
@ -43,7 +42,7 @@ LIRC_Define($$)
my $name = $a[0];
my $config = $a[2];
Log 3, "LIRC opening $name device $config";
Log3 $name, 3, "LIRC opening $name device $config";
my $lirc = Lirc::Client->new({
prog => 'fhem',
rcfile => "$config",
@ -51,7 +50,7 @@ LIRC_Define($$)
fake => 0,
});
return "Can't open $config: $!\n" if(!$lirc);
Log 3, "LIRC opened $name device $config";
Log3 $name, 3, "LIRC opened $name device $config";
my $select = IO::Select->new();
$select->add( $lirc->sock );
@ -95,7 +94,7 @@ LIRC_Read($)
my @codes = $lirc->next_codes; # should not block
my $name = $hash->{NAME};
for my $code (@codes){
Log GetLogLevel($name,3), "LIRC $name $code";
Log3 $name, 3, "LIRC $name $code";
DoTrigger($name, $code);
}
}
@ -160,7 +159,6 @@ LIRC_Ready($)
<a name="LIRCattr"></a>
<b>Attributes</b>
<ul>
<li><a href="#loglevel">loglevel</a></li>
</ul><br>
</ul>

View File

@ -155,8 +155,7 @@ ZWDongle_Initialize($)
$hash->{DefFn} = "ZWDongle_Define";
$hash->{SetFn} = "ZWDongle_Set";
$hash->{GetFn} = "ZWDongle_Get";
$hash->{AttrList}= "do_not_notify:1,0 dummy:1,0 " .
"model:ZWDongle loglevel:0,1,2,3,4,5,6 ";
$hash->{AttrList}= "do_not_notify:1,0 dummy:1,0 model:ZWDongle";
}
#####################################
@ -185,7 +184,8 @@ ZWDongle_Define($$)
if($dev =~ m/none:(.*)/) {
$hash->{homeId} = $1;
Log 1, "$name device is none (homeId:$1), commands will be echoed only";
Log3 $name, 1,
"$name device is none (homeId:$1), commands will be echoed only";
$attr{$name}{dummy} = 1;
return undef;
@ -404,7 +404,6 @@ ZWDongle_Read($@)
return "" if(!defined($buf));
my $name = $hash->{NAME};
my $ll5 = GetLogLevel($name,5);
$buf = unpack('H*', $buf);
# The dongle looses data over USB for some commands(?), and dropping the old
@ -415,7 +414,7 @@ ZWDongle_Read($@)
$hash->{READ_TS} = $ts; # Flush old data.
Log 5, "ZWDongle/RAW: $data/$buf";
Log3 $name, 5, "ZWDongle/RAW: $data/$buf";
$data .= $buf;
my $msg;
@ -427,12 +426,12 @@ ZWDongle_Read($@)
next;
}
if($fb eq "15") { # NACK
Log 1, "$name: NACK received";
Log3 $name, 1, "$name: NACK received";
$data = substr($data, 2);
next;
}
if($fb ne "01") { # SOF
Log 1, "$name: SOF missing (got $fb instead of 01)";
Log3 $name, 1, "$name: SOF missing (got $fb instead of 01)";
last;
}
@ -446,11 +445,11 @@ ZWDongle_Read($@)
my $ccs = ZWDongle_CheckSum("$len$msg"); # Computed Checksum
if($rcs ne $ccs) {
Log 1, "$name: wrong checksum: received $rcs, computed $ccs";
Log3 $name, 1, "$name: wrong checksum: received $rcs, computed $ccs";
next;
}
DevIo_SimpleWrite($hash, "06", 1); # Send ACK
Log $ll5, "ZWDongle_Read $name: $msg";
Log3 $name, 5, "ZWDongle_Read $name: $msg";
last if(defined($local) && (!defined($regexp) || ($msg =~ m/$regexp/)));
ZWDongle_Parse($hash, $name, $msg);
$msg = undef;
@ -621,7 +620,6 @@ ZWDongle_Ready($)
<ul>
<li><a href="#dummy">dummy</a></li>
<li><a href="#do_not_notify">do_not_notify</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#model">model</a></li>
</ul>
<br>

View File

@ -111,7 +111,7 @@ FHEMWEB_Initialize($)
$hash->{NotifyFn}= "FW_SecurityCheck";
$hash->{ActivateInformFn} = "FW_ActivateInform";
$hash->{AttrList}=
"loglevel:0,1,2,3,4,5,6 webname fwcompress:0,1 ".
"webname fwcompress:0,1 ".
"plotmode:gnuplot,gnuplot-scroll,SVG plotsize endPlotToday:1,0 plotfork ".
"stylesheetPrefix touchpad:deprecated smallscreen:deprecated ".
"basicAuth basicAuthMsg hiddenroom hiddengroup HTTPS allowfrom CORS:0,1 ".
@ -175,7 +175,7 @@ FW_Define($$)
# Make sure that fhem only runs once
if($ret && !$init_done) {
Log 1, "$ret. Exiting.";
Log3 $hash, 1, "$ret. Exiting.";
exit(1);
}
@ -351,7 +351,6 @@ FW_serveSpecial($$$$)
$file = "$FW_sp$file" if($ext eq "css" && -f "$dir/$FW_sp$file.$ext");
$FW_RETTYPE = ext2MIMEType($ext);
#Log 1, "Serving $dir/$file.$ext as $FW_RETTYPE, cacheable:$cacheable";
return FW_returnFileAsStream("$dir/$file.$ext", "",
$FW_RETTYPE, 0, $cacheable);
}
@ -645,7 +644,7 @@ FW_digestCgi($)
$cmd.=" $arg{$c}" if(defined($arg{$c}) &&
($arg{$c} ne "state" || $cmd !~ m/^set/));
$cmd.=" $val{$c}" if(defined($val{$c}));
#Log 1, "GOT:$arg -> CMD:$cmd";
#Log3 $FW_wname, 1, "GOT:$arg -> CMD:$cmd";
return ($cmd, $c);
}
@ -2278,13 +2277,13 @@ FW_ActivateInform()
<b>Get</b>
<ul>
<li>icon &lt;logical icon&gt;<br>
returns the absolute path to the logical icon. Example:
<ul>
<code>get myFHEMWEB icon FS20.on<br>
/data/Homeautomation/fhem/FHEM/FS20.on.png
</code>
</ul>
</li>
<li>pathlist<br>
return FHEMWEB specific directories, where files for given types are
located
@ -2430,8 +2429,6 @@ FW_ActivateInform()
<li><a href="#allowfrom">allowfrom</a></li>
</li><br>
<li><a href="#loglevel">loglevel</a></li>
</li><br>
<a name="stylesheetPrefix"></a>
<li>stylesheetPrefix<br>

View File

@ -41,7 +41,7 @@ FBDECT_Initialize($)
$hash->{ParseFn} = "FBDECT_Parse";
$hash->{AttrList} =
"IODev do_not_notify:1,0 ignore:1,0 dummy:1,0 showtime:1,0 ".
"loglevel:0,1,2,3,4,5,6 $readingFnAttributes " .
"$readingFnAttributes " .
"model:".join(",", sort @fbdect_models);
}
@ -144,7 +144,7 @@ FBDECT_Parse($$@)
my $mt = substr($msg, 0, 2);
if($mt ne "07" && $mt ne "04") {
Log 1, "FBDECT: unknown message type $mt";
Log3 $ioName, 1, "FBDECT: unknown message type $mt";
return ""; # Nobody else is able to handle this
}
@ -152,7 +152,7 @@ FBDECT_Parse($$@)
my $hash = $modules{FBDECT}{defptr}{$id};
if(!$hash) {
my $ret = "UNDEFINED FBDECT_$id FBDECT $id switch";
Log 3, "$ret, please define it";
Log3 $ioName, 3, "$ret, please define it";
DoTrigger("global", $ret);
return "";
}
@ -276,7 +276,6 @@ FBDECT_Undef($$)
<li><a href="#ignore">ignore</a></li>
<li><a href="#dummy">dummy</a></li>
<li><a href="#showtime">showtime</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#model">model</a></li>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
</ul>
@ -357,7 +356,6 @@ FBDECT_Undef($$)
<li><a href="#ignore">ignore</a></li>
<li><a href="#dummy">dummy</a></li>
<li><a href="#showtime">showtime</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#model">model</a></li>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
</ul>

View File

@ -129,7 +129,7 @@ FS20_Initialize($)
$hash->{ParseFn} = "FS20_Parse";
$hash->{AttrList} = "IODev follow-on-for-timer:1,0 follow-on-timer ".
"do_not_notify:1,0 ignore:1,0 dummy:1,0 showtime:1,0 ".
"loglevel:0,1,2,3,4,5,6 $readingFnAttributes " .
"$readingFnAttributes " .
"model:".join(",", sort keys %models);
}
@ -425,7 +425,7 @@ FS20_Parse($$)
my $dev_four = hex2four($dev);
my $btn_four = hex2four($btn);
Log 3, "FS20 Unknown device $dev ($dev_four), " .
Log3 $hash, 3, "FS20 Unknown device $dev ($dev_four), " .
"Button $btn ($btn_four) Code $cde ($v), please define it";
return "UNDEFINED FS20_$dev$btn FS20 $dev $btn";
}
@ -673,7 +673,6 @@ four2hex($$)
</li><br>
<li><a href="#do_not_notify">do_not_notify</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#showtime">showtime</a></li>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>

View File

@ -183,7 +183,7 @@ ZWave_Initialize($)
$hash->{ParseFn} = "ZWave_Parse";
$hash->{AttrList} = "IODev do_not_notify:1,0 ".
"ignore:1,0 dummy:1,0 showtime:1,0 classes ".
"loglevel:0,1,2,3,4,5,6 $readingFnAttributes " .
"$readingFnAttributes " .
"model:".join(",", sort @zwave_models);
map { $zwave_id2class{$zwave_class{$_}{id}} = $_ } keys %zwave_class;
}
@ -225,11 +225,11 @@ ZWave_Define($$)
my $ctrlId = $1 if($homeReading && $homeReading =~ m/CtrlNodeId:(..)/);
if($ctrlId) {
Log 1, "Adding the controller $ctrlId to association group 1";
Log3 $name, 1, "Adding the controller $ctrlId to association group 1";
IOWrite($hash, "00", "130a04850101${ctrlId}05");
} else {
Log 1, "Cannot associate $name, missing controller id";
Log3 $name, 1, "Cannot associate $name, missing controller id";
}
}
}
@ -276,7 +276,7 @@ ZWave_Cmd($$@)
}
Log GetLogLevel($name,2), "ZWave $type $name $cmd";
Log3 $name, 2, "ZWave $type $name $cmd";
################################
# ZW_SEND_DATA,nodeId,CMD,ACK|AUTO_ROUTE
@ -438,11 +438,11 @@ ZWave_Parse($$@)
my $homeId = $iodev->{homeId};
my $ioName = $iodev->{NAME};
if(!$homeId) {
Log 1, "ERROR: $ioName homeId is not set!" if(!$iodev->{errReported});
Log3 $ioName, 1, "ERROR: $ioName homeId is not set!"
if(!$iodev->{errReported});
$iodev->{errReported} = 1;
return;
}
my $ll4 = AttrVal($ioName, "loglevel", 4);
return "" if($msg !~ m/00(..)(..)(..)(..*)/); # Ignore unknown commands
my ($cmd, $callbackid, $id, $arg) = ($1, $2, $3, $4);
@ -473,11 +473,11 @@ ZWave_Parse($$@)
if($evt) {
return "$cmd $evt" if($local);
DoTrigger($ioName, "$cmd $evt");
Log $ll4, "$ioName $cmd $evt";
Log3 $ioName, 4, "$ioName $cmd $evt";
return "";
} else {
Log $ll4, "$ioName $cmd $id ($arg)";
Log3 $ioName, 4, "$ioName $cmd $id ($arg)";
}
@ -496,7 +496,7 @@ ZWave_Parse($$@)
my $hash = $modules{ZWave}{defptr}{"$homeId $id"};
if(!$hash) {
$id = hex($id);
Log 3, "Unknown ZWave device $homeId $id, please define it";
Log3 $ioName, 3, "Unknown ZWave device $homeId $id, please define it";
return "";
}
@ -504,7 +504,7 @@ ZWave_Parse($$@)
my $className = $zwave_id2class{$class} ? $zwave_id2class{$class} : "UNKNOWN";
my $ptr = $zwave_class{$className}{parse} if($zwave_class{$className}{parse});
if(!$ptr) {
Log $ll4, "$hash->{NAME}: Unknown message ($className $arg)";
Log3 $ioName, 4, "$hash->{NAME}: Unknown message ($className $arg)";
return "";
}
@ -729,7 +729,6 @@ ZWave_Undef($$)
<li><a href="#ignore">ignore</a></li>
<li><a href="#dummy">dummy</a></li>
<li><a href="#showtime">showtime</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#model">model</a></li>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
<li><a href="#classes">classes</a>

View File

@ -186,7 +186,7 @@ FHT_Initialize($)
$hash->{UndefFn} = "FHT_Undef";
$hash->{ParseFn} = "FHT_Parse";
$hash->{AttrList} = "IODev do_not_notify:1,0 model:fht80b dummy:1,0 " .
"showtime:1,0 loglevel:0,1,2,3,4,5,6 retrycount " .
"showtime:1,0 retrycount " .
"minfhtbuffer lazy tmpcorr ignore:1,0 ".
$readingFnAttributes;
}
@ -300,7 +300,7 @@ FHT_Set($@)
$cmd ne "report1" && $cmd ne "report2" && $cmd ne "refreshvalues" &&
defined($readings->{$cmd}) && $readings->{$cmd}{VAL} eq $val) {
$ret .= "Lazy mode ignores $cmd";
Log GetLogLevel($name,2), "Lazy mode ignores $cmd $val";
Log3 $name, 2, "Lazy mode ignores $cmd $val";
} else {
$ncmd++;
@ -331,7 +331,7 @@ FHT_Set($@)
} else {
IOWrite($hash, "04", $arg);
Log GetLogLevel($name,2), "FHT set $name $allcmd";
Log3 $name, 2, "FHT set $name $allcmd";
}
@ -364,7 +364,7 @@ FHT_Define($$)
if($l2 == $i2 && $l1 >= $i1 && $l1 <= $i1+7) {
my $err = "$a[0]: CODE collides with the FHTID of the corresponding CUL";
Log 1, $err;
Log3 $a[0], 1, $err;
return $err;
}
}
@ -372,7 +372,7 @@ FHT_Define($$)
$modules{FHT}{defptr}{$a[2]} = $hash;
$attr{$a[0]}{retrycount} = 3;
#Log GetLogLevel($a[0],2),"Asking the FHT device $a[0]/$a[2] to send its data";
#Log3 $a[0], 2, "Asking the FHT device $a[0]/$a[2] to send its data";
#FHT_Set($hash, ($a[0], "report1", "255", "report2", "255"));
return undef;
@ -407,7 +407,7 @@ FHT_Parse($$)
return "" if($dp->{addr} eq $dev);
}
Log 3, "FHT Unknown device $dev, please define it";
Log3 $hash, 3, "FHT Unknown device $dev, please define it";
return "UNDEFINED FHT_$dev FHT $dev";
}
@ -416,11 +416,10 @@ FHT_Parse($$)
return "" if(IsIgnored($name));
my $io = $def->{IODev};
my $ll4 = GetLogLevel($name,4);
# Short message
if(length($msg) < 26) {
Log $ll4,"FHT Short message. Device $name, Message: $msg";
Log3 $name, 4, "FHT Short message. Device $name, Message: $msg";
return "";
}
@ -430,7 +429,7 @@ FHT_Parse($$)
} elsif(!$val || $cde eq "65" || $cde eq "66") {
# This is a confirmation message. We reformat it so that
# it looks like a real message, and let the rest parse it
Log $ll4, "FHT $name confirmation: $cde";
Log3 $name, 4, "FHT $name confirmation: $cde";
$val = substr($msg, 22, 2);
$confirm = 1;
}
@ -439,7 +438,7 @@ FHT_Parse($$)
my $cmd = $codes{$cde};
if(!$cmd) {
Log $ll4, "FHT $name (Unknown: $cde => $val)";
Log3 $name, 4, "FHT $name (Unknown: $cde => $val)";
readingsSingleUpdate($def, "unknown_$cde", $val, 1);
return $name;
}
@ -554,16 +553,16 @@ FHT_Parse($$)
# set additional warnings and trigger notify
readingsBulkUpdate($def, "battery", $valBattery);
Log $ll4, "FHT $name battery: $valBattery";
Log3 $name, 4, "FHT $name battery: $valBattery";
readingsBulkUpdate($def, "lowtemp", $valLowTemp);
Log $ll4, "FHT $name lowtemp: $valLowTemp";
Log3 $name, 4, "FHT $name lowtemp: $valLowTemp";
readingsBulkUpdate($def, "window", $valWindow);
Log $ll4, "FHT $name window: $valWindow";
Log3 $name, 4, "FHT $name window: $valWindow";
readingsBulkUpdate($def, "windowsensor", $valSensor);
Log $ll4, "FHT $name windowsensor: $valSensor";
Log3 $name, 4, "FHT $name windowsensor: $valSensor";
}
$cmd = "FHZ:$cmd" if(substr($msg,24,1) eq "7");
@ -574,7 +573,7 @@ FHT_Parse($$)
readingsBulkUpdate($def, "temperature", $val); # For dewpoint
}
Log $ll4, "FHT $name $cmd: $val";
Log3 $name, 4, "FHT $name $cmd: $val";
#
# now we are done with updating readings
@ -589,10 +588,10 @@ FHT_Parse($$)
my $h = $io->{SOFTBUFFER}{$key};
my $hcmd = $h->{CMD};
my $hname = $h->{HASH}->{NAME};
Log $ll4, "FHT softbuffer check: $hname / $hcmd";
Log3 $name, 4, "FHT softbuffer check: $hname / $hcmd";
if($hname eq $name && $hcmd =~ m/^$cmd $val/) {
$found = $key;
Log $ll4, "FHT softbuffer found";
Log3 $name, 4, "FHT softbuffer found";
last;
}
}
@ -622,7 +621,7 @@ doSoftBuffer($)
next if($now-$h->{SENDTIME} < $retryafter);
my $retry = $attr{$name}{retrycount};
if($h->{NSENT} > $retry) {
Log GetLogLevel($name,2), "$name set $h->{CMD}: ".
Log3 $name, 2, "$name set $h->{CMD}: ".
"no confirmation after $h->{NSENT} tries, giving up";
delete($io->{SOFTBUFFER}{$key});
next;
@ -638,7 +637,7 @@ doSoftBuffer($)
$arg =~ s/,(....),/$1:/;
$arg = uc($arg);
if($cul =~ m/$arg/) {
Log GetLogLevel($name,3), "fhtsoftbuffer: $name set $h->{CMD} ".
Log3 $name, 3, "fhtsoftbuffer: $name set $h->{CMD} ".
"is still in the culfw buffer, wont send it again";
$h->{SENDTIME} = $now;
$h->{NSENT}++;
@ -651,7 +650,7 @@ doSoftBuffer($)
next if($fhzbuflen < $arglen || $fhzbuflen < getFhtMin($io));
IOWrite($h->{HASH}, "04", $h->{ARG});
Log GetLogLevel($name,2), "FHT set $name $h->{CMD}";
Log3 $name, 2, "FHT set $name $h->{CMD}";
$fhzbuflen -= $arglen;
$h->{SENDTIME} = $now;
@ -698,7 +697,7 @@ getFhtBuffer($)
for(;;) {
return 0 if(!defined($io->{FD})); # Avoid crash if the CUL/FHZ is absent
my $msg = CallFn($io->{NAME}, "GetFn", $io, (" ", "fhtbuf"));
Log 5, "getFhtBuffer: $count $msg";
Log3 $io, 5, "getFhtBuffer: $count $msg";
return hex($1) if($msg && $msg =~ m/=> ([0-9A-F]+)$/i);
return 0 if($count++ >= 5);
}
@ -988,7 +987,6 @@ getFhtBuffer($)
<li><a href="#ignore">ignore</a></li>
<li><a href="#do_not_notify">do_not_notify</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#model">model</a> (fht80b)</li>
<li><a href="#showtime">showtime</a></li>
<li><a href="#IODev">IODev</a></li>

View File

@ -13,7 +13,7 @@ FHT8V_Initialize($)
$hash->{DefFn} = "FHT8V_Define";
$hash->{SetFn} = "FHT8V_Set";
$hash->{GetFn} = "FHT8V_Get";
$hash->{AttrList} = "IODev dummy:1,0 ignore:1,0 loglevel:0,1,2,3,4,5,6 ".
$hash->{AttrList} = "IODev dummy:1,0 ignore:1,0 ".
$readingFnAttributes;
}
@ -76,16 +76,16 @@ FHT8V_Set($@)
if($arg eq "valve" ) {
return "Set valve needs a numeric parameter between 0 and 100"
if(@a != 3 || $a[2] !~ m/^\d+$/ || $a[2] < 0 || $a[2] > 100);
Log GetLogLevel($n,3), "FHT8V set $n $arg $a[2]";
Log3 $n, 3, "FHT8V set $n $arg $a[2]";
$hash->{STATE} = sprintf("%d %%", $a[2]);
IOWrite($hash, "", sprintf("T%s0026%02X", $hash->{addr}, $a[2]*2.55));
} elsif ($arg eq "pair" ) {
Log GetLogLevel($n,3), "FHT8V set $n $arg";
Log3 $n, 3, "FHT8V set $n $arg";
IOWrite($hash, "", sprintf("T%s002f00", $hash->{addr}));
} elsif ($arg eq "decalc" ) {
Log GetLogLevel($n,3), "FHT8V set $n $arg";
Log3 $n, 3, "FHT8V set $n $arg";
$hash->{STATE} = "lime-protection";
IOWrite($hash, "", sprintf("T%s000A00", $hash->{addr}));
@ -195,7 +195,6 @@ FHT8V_Get($@)
<li><a href="#IODev">IODev</a></li>
<li><a href="#dummy">dummy</a></li>
<li><a href="#ignore">ignore</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#eventMap">eventMap</a></li><br>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
</ul>

View File

@ -38,7 +38,7 @@ HMS_Initialize($)
$hash->{DefFn} = "HMS_Define";
$hash->{UndefFn} = "HMS_Undef";
$hash->{ParseFn} = "HMS_Parse";
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:hms100-t,hms100-tf,hms100-wd,hms100-mg,hms100-tfk,rm100-2,hms100-co,hms100-fit loglevel:0,1,2,3,4,5,6 ignore:0,1 $readingFnAttributes";
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:hms100-t,hms100-tf,hms100-wd,hms100-mg,hms100-tfk,rm100-2,hms100-co,hms100-fit ignore:0,1 $readingFnAttributes";
}
#####################################
@ -83,7 +83,7 @@ HMS_Parse($$)
# 810e047f0214a001a81f000001000000 HMS100TFK
my $val = substr($msg, 24, 8) if(length($msg) == 32);
if(!defined($val)) {
Log 3, "Strange HMS message $msg";
Log3 $hash, 3, "Strange HMS message $msg";
return "";
}
@ -99,12 +99,13 @@ HMS_Parse($$)
# a wildcard too for each type: 100<device-code>,
my $odev = $dev;
if(!defined($modules{HMS}{defptr}{$dev})) {
Log 4, "HMS device $dev not defined, using the wildcard device 100$cde";
Log3 $hash, 4,
"HMS device $dev not defined, using the wildcard device 100$cde";
$dev = "100$cde";
}
if(!defined($modules{HMS}{defptr}{$dev})) {
Log 3, "Unknown HMS device $dev/$odev, please define it";
Log3 $hash, 3, "Unknown HMS device $dev/$odev, please define it";
$type = "HMS" if(!$type);
$type =~ s/-//; # RM100-2, - is special in fhem names
return "UNDEFINED ${type}_$odev HMS $odev";
@ -210,12 +211,12 @@ HMS_Parse($$)
} else {
Log 3, "HMS Device $dev (Unknown type: $type)";
Log3 $name, 3, "HMS Device $dev (Unknown type: $type)";
return "";
}
Log GetLogLevel($name,4), "HMS Device $dev ($type: $val)";
Log3 $name, 4, "HMS Device $dev ($type: $val)";
readingsBeginUpdate($def);
my $max = int(@txt);
@ -298,7 +299,6 @@ HMS_Parse($$)
<ul>
<li><a href="#ignore">ignore</a></li>
<li><a href="#do_not_notify">do_not_notify</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#showtime">showtime</a></li>
<li><a href="#IODev">IODev</a></li>
<li><a href="#eventMap">eventMap</a></li>

View File

@ -20,7 +20,8 @@ KS300_Initialize($)
$hash->{DefFn} = "KS300_Define";
$hash->{UndefFn} = "KS300_Undef";
$hash->{ParseFn} = "KS300_Parse";
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:ks300 loglevel:0,1 rainadjustment:0,1 ignore:0,1";
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:ks300 ".
"rainadjustment:0,1 ignore:0,1";
}
#####################################
@ -77,7 +78,7 @@ KS300_Parse($$)
# CRC, they seem to contain partial data (e.g. temp/wind/hum but not rain)
# They are suppressed as of now.
if(hex($a[3]) != 13) {
Log 4, "Strange KS300 message received, won't decode ($msg)";
Log3 $hash, 4, "Strange KS300 message received, won't decode ($msg)";
return "";
}
@ -223,13 +224,13 @@ KS300_Parse($$)
# Negative temp
$v[4] = -$v[4] if($v[8] & 8);
Log GetLogLevel($def->{NAME},4), "KS300 $dev: $msg";
Log3 $def, 4, "KS300 $dev: $msg";
my $max = int(@v);
# For logging/summary
my $val = "T: $v[4] H: $v[3] W: $v[2] R: $v[1] IR: $v[5]";
Log GetLogLevel($def->{NAME},4), "KS300 $dev: $val";
Log3 $def, 4, "KS300 $dev: $val";
$def->{STATE} = $val;
$def->{CHANGED}[0] = $val;
@ -324,7 +325,7 @@ KS300_Parse($$)
} else {
Log 4, "KS300 detected: $msg";
Log3 $hash, 4, "KS300 detected: $msg";
return "UNDEFINED KS300 KS300 1234";
}
@ -389,7 +390,6 @@ KS300_Parse($$)
<li><a href="#eventMap">eventMap</a></li><br>
<li><a href="#do_not_notify">do_not_notify</a></li>
<li><a href="#showtime">showtime</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#model">model</a> (ks300)</li>
<li>rainadjustment<br>
If this attribute is set, fhem automatically accounts for rain counter

View File

@ -17,8 +17,7 @@ CUL_TX_Initialize($)
$hash->{DefFn} = "CUL_TX_Define";
$hash->{UndefFn} = "CUL_TX_Undef";
$hash->{ParseFn} = "CUL_TX_Parse";
$hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 " .
"showtime:1,0 loglevel:0,1,2,3,4,5,6 " .
$hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 showtime:1,0 " .
$readingFnAttributes;
}
@ -40,7 +39,6 @@ CUL_TX_Define($$)
$modules{CUL_TX}{defptr}{$a[2]} = $hash;
$hash->{STATE} = "Defined";
Log 4, "CUL_TX defined $a[0] $a[2]";
return undef;
}
@ -68,21 +66,20 @@ CUL_TX_Parse($$)
my $id3 = (hex($a[3])<<3) + (hex($a[4])>>1);
if($a[5] ne $a[8] || $a[6] ne $a[9]) {
Log 4, "CUL_TX $id3 ($msg) data error";
Log3 $hash, 4, "CUL_TX $id3 ($msg) data error";
return "";
}
my $def = $modules{CUL_TX}{defptr}{$id3};
if(!$def) {
Log 2, "CUL_TX Unknown device $id3, please define it";
Log3 $hash, 2, "CUL_TX Unknown device $id3, please define it";
return "UNDEFINED CUL_TX_$id3 CUL_TX $id3" if(!$def);
}
my $now = time();
my $name = $def->{NAME};
my $ll4 = GetLogLevel($name,4);
Log $ll4, "CUL_TX $name $id3 ($msg)";
Log3 $name, 4, "CUL_TX $name $id3 ($msg)";
my ($msgtype, $val);
my $valraw = ($a[5].$a[6].".".$a[7]);
@ -94,7 +91,7 @@ CUL_TX_Parse($$)
$def->{lastT} = $now;
$msgtype = "temperature";
$val = sprintf("%2.1f", ($valraw - 50 + $def->{corr}) );
Log $ll4, "CUL_TX $msgtype $name $id3 T: $val F: $id2";
Log3 $name, 4, "CUL_TX $msgtype $name $id3 T: $val F: $id2";
} elsif ($type eq "E") {
if($now - $def->{lastH} < $def->{minsecs} ) {
@ -103,11 +100,10 @@ CUL_TX_Parse($$)
$def->{lastH} = $now;
$msgtype = "humidity";
$val = $valraw;
Log $ll4, "CUL_TX $msgtype $name $id3 H: $val F: $id2";
Log3 $name, 4, "CUL_TX $msgtype $name $id3 H: $val F: $id2";
} else {
my $ll2 = GetLogLevel($name,4);
Log $ll2, "CUL_TX $type $name $id3 ($msg) unknown type";
Log3 $name, 2, "CUL_TX $type $name $id3 ($msg) unknown type";
return "";
}
@ -180,7 +176,6 @@ CUL_TX_Parse($$)
<li><a href="#ignore">ignore</a></li><br>
<li><a href="#do_not_notify">do_not_notify</a></li><br>
<li><a href="#showtime">showtime</a></li><br>
<li><a href="#loglevel">loglevel</a></li><br>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
</ul>
<br>

View File

@ -26,7 +26,7 @@ CUL_WS_Initialize($)
$hash->{AttrFn} = "CUL_WS_Attr";
$hash->{ParseFn} = "CUL_WS_Parse";
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 ".
"model:S300TH,KS300 loglevel ignore:0,1 ".
"model:S300TH,KS300 ignore:0,1 ".
$readingFnAttributes;
}
@ -115,7 +115,7 @@ CUL_WS_Parse($$)
my $def = $modules{CUL_WS}{defptr}{$hash->{NAME} . "." . $cde};
$def = $modules{CUL_WS}{defptr}{$cde} if(!$def);
if(!$def) {
Log 1, "CUL_WS UNDEFINED $type sensor detected, code $cde";
Log3 $hash, 1, "CUL_WS UNDEFINED $type sensor detected, code $cde";
return "UNDEFINED CUL_WS_$cde CUL_WS $cde";
}
@ -232,7 +232,8 @@ CUL_WS_Parse($$)
if(@a == 9 && int(@a) > 8) { # S300TH
# Sanity check
if (!($msg =~ /^K[0-9A-F]\d\d\d\d\d\d\d$/ )) {
Log GetLogLevel($name,1), "Error: S300TH CUL_WS Cannot decode $msg (sanitycheck). Malformed";
Log3 $name, 1,
"Error: S300TH CUL_WS Cannot decode $msg (sanitycheck). Malformed";
return "";
}
@ -280,10 +281,10 @@ CUL_WS_Parse($$)
}
if(!$val) {
Log GetLogLevel($name,1), "CUL_WS Cannot decode $msg";
Log3 $name, 1, "CUL_WS Cannot decode $msg";
return "";
}
Log GetLogLevel($name,4), "CUL_WS $devtype $name: $val";
Log3 $name, 4, "CUL_WS $devtype $name: $val";
# Sanity checks
if($NotifyTemperature &&
@ -294,7 +295,8 @@ CUL_WS_Parse($$)
$hash->{READINGS}{temperature}{VAL};
my $diff = ($NotifyTemperature - $tval)+0;
if($diff < -15.0 || $diff > 15.0) {
Log 2, "$name: Temp difference ($diff) too large: $val, skipping it";
Log3 $name, 2,
"$name: Temp difference ($diff) too large: $val, skipping it";
$hash->{READINGS}{strangetemp}{VAL} = $NotifyTemperature;
$hash->{READINGS}{strangetemp}{TIME} = TimeNow();
return "";
@ -303,7 +305,7 @@ CUL_WS_Parse($$)
delete $hash->{READINGS}{strangetemp} if($hash->{READINGS});
if(defined($hum) && ($hum < 0 || $hum > 100)) {
Log 1, "BOGUS: $name reading: $val, skipping it";
Log3 $name, 1, "BOGUS: $name reading: $val, skipping it";
return "";
}
@ -392,7 +394,6 @@ CUL_WS_Attr(@)
<li><a href="#do_not_notify">do_not_notify</a></li>
<li><a href="#eventMap">eventMap</a></li>
<li><a href="#ignore">ignore</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#model">model</a> (S300,KS300,WS7000)</li>
<li><a href="#showtime">showtime</a></li>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>

View File

@ -22,7 +22,7 @@ CUL_EM_Initialize($)
$hash->{UndefFn} = "CUL_EM_Undef";
$hash->{ParseFn} = "CUL_EM_Parse";
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 " .
"model:EMEM,EMWZ,EMGZ loglevel ignore:0,1 ".
"model:EMEM,EMWZ,EMGZ ignore:0,1 ".
$readingFnAttributes;
}
@ -117,7 +117,7 @@ CUL_EM_Parse($$)
my $c= 0; # count changes
my %readings;
Log GetLogLevel($n,5), "CUL_EM $n: $val";
Log3 $n, 5, "CUL_EM $n: $val";
$readings{RAW} = $val;
#
@ -175,7 +175,7 @@ CUL_EM_Parse($$)
###################################
# Start CUMULATE day and month
Log GetLogLevel($n,4), "CUL_EM $n: $val";
Log3 $n, 4, "CUL_EM $n: $val";
my $tsecs_prev;
#----- get previous tsecs
@ -207,7 +207,7 @@ CUL_EM_Parse($$)
$val = sprintf("CUM_DAY: %0.3f CUM: %0.3f COST: %0.2f",
$total-$cmv[3], $total, ($total-$cmv[3])*$cost);
$readings{cum_day} = $val;
Log GetLogLevel($n,3), "CUL_EM $n: $val";
Log3 $n, 3, "CUL_EM $n: $val";
if( (localtime($tsecs_prev))[4] != (localtime($tsecs))[4] ) {
@ -224,7 +224,7 @@ CUL_EM_Parse($$)
$val = sprintf("CUM_MONTH: %0.3f CUM: %0.3f COST: %0.2f",
$total-$cmv[3], $total,($total-$cmv[3])*$cost+$basicfee);
$readings{cum_month} = $val;
Log GetLogLevel($n,3), "CUL_EM $n: $val";
Log3 $n, 3, "CUL_EM $n: $val";
}
}
@ -242,7 +242,7 @@ CUL_EM_Parse($$)
} else {
Log 1, "CUL_EM detected, Code $cde $val";
Log3 $hash, 1, "CUL_EM detected, Code $cde $val";
return "UNDEFINED CUL_EM_$cde CUL_EM $cde";
}
@ -316,7 +316,6 @@ CUL_EM_Parse($$)
<li><a href="#ignore">ignore</a></li><br>
<li><a href="#do_not_notify">do_not_notify</a></li><br>
<li><a href="#showtime">showtime</a></li><br>
<li><a href="#loglevel">loglevel</a></li><br>
<li><a href="#model">model</a> (EMEM,EMWZ,EMGZ)</li><br>
<li><a href="#IODev">IODev</a></li><br>
<li><a href="#eventMap">eventMap</a></li><br>

View File

@ -20,7 +20,7 @@ CUL_RFR_Initialize($)
$hash->{UndefFn} = "CUL_RFR_Undef";
$hash->{ParseFn} = "CUL_RFR_Parse";
$hash->{AttrList} = "IODev do_not_notify:0,1 model:CUL,CUN,CUR " .
"loglevel:0,1,2,3,4,5,6 ignore:0,1 addvaltrigger";
"ignore:0,1 addvaltrigger";
$hash->{WriteFn} = "CUL_RFR_Write";
$hash->{GetFn} = "CUL_Get";
@ -93,7 +93,7 @@ CUL_RFR_Parse($$)
my $cde = "${id}${rid}";
if(!$modules{CUL_RFR}{defptr}{$cde}) {
Log 1, "CUL_RFR detected, Id $id, Router $rid, MSG $smsg";
Log3 $iohash, 1, "CUL_RFR detected, Id $id, Router $rid, MSG $smsg";
return "UNDEFINED CUL_RFR_$id CUL_RFR $id $rid";
}
my $hash = $modules{CUL_RFR}{defptr}{$cde};

View File

@ -13,8 +13,7 @@ CUL_HOERMANN_Initialize($)
$hash->{Match} = "^R..........";
$hash->{DefFn} = "CUL_HOERMANN_Define";
$hash->{ParseFn} = "CUL_HOERMANN_Parse";
$hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 " .
"showtime:1,0 loglevel:0,1,2,3,4,5,6";
$hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 showtime:1,0";
}
@ -50,11 +49,11 @@ CUL_HOERMANN_Parse($$)
$def->{CHANGED}[0] = "toggle";
$def->{READINGS}{state}{TIME} = TimeNow();
$def->{READINGS}{state}{VAL} = "toggle";
Log GetLogLevel($name,4), "CUL_HOERMANN $name toggle";
Log3 $name, 4, "CUL_HOERMANN $name toggle";
return $name;
} else {
Log 3, "CUL_HOERMANN Unknown device $cde, please define it";
Log3 $hash, 3, "CUL_HOERMANN Unknown device $cde, please define it";
return "UNDEFINED CUL_HOERMANN_$cde CUL_HOERMANN $cde";
}
}
@ -92,7 +91,6 @@ CUL_HOERMANN_Parse($$)
<ul>
<li><a href="#do_not_notify">do_not_notify</a></li>
<li><a href="#showtime">showtime</a></li>
<li><a href="#loglevel">loglevel</a></li>
</ul>
<br>
</ul>

View File

@ -67,7 +67,7 @@ NetIO230B_Initialize($)
$hash->{SetFn} = "NetIO230B_Set";
$hash->{GetFn} = "NetIO230B_Get";
$hash->{DefFn} = "NetIO230B_Define";
$hash->{AttrList} = "loglevel:0,1,2,3,4,5,6";
$hash->{AttrList} = "";
}
@ -99,7 +99,7 @@ NetIO230B_Set($@)
$result = NetIO230B_Request($hash, "set", join("",@values));
}
Log 3, "NetIO230B set @a => $result";
Log3 $hash, 3, "NetIO230B set @a => $result";
return undef;
}
@ -110,7 +110,7 @@ NetIO230B_Get($@)
{
my ($hash, @a) = @_;
my $result = NetIO230B_Request($hash, "get");
Log 3, "NetIO230B get @a => $result";
Log3 $hash, 3, "NetIO230B get @a => $result";
return $hash->{STATE};
}
@ -134,7 +134,7 @@ NetIO230B_Request($@)
my $response = GetFileFromURL("http://"."$hash->{HOST}/tgi/control.tgi?l=p:". $hash->{USER}.":".$hash->{PASS}."&p=".$parm, $timeout, undef, $noshutdown );
if(!$response or length($response)==0)
{
Log 3, "NetIO230B_Request failed: ".$log;
Log3 $hash, 3, "NetIO230B_Request failed: ".$log;
return("");
}
@ -173,7 +173,7 @@ NetIO230B_Request($@)
# debug output
#my %k = %{$hash->{READINGS}};
#foreach my $r (sort keys %k) {
# Log 1, "$r S: $k{$r}{VAL} T: $k{$r}{TIME}";
# Log3 $hash, 1, "$r S: $k{$r}{VAL} T: $k{$r}{TIME}";
#}
return $response;
@ -188,7 +188,7 @@ NetIO230B_Define($$)
my @a = split("[ \t][ \t]*", $def);
my $paramCount = int(@a);
Log 3, "Wrong syntax: use 'define <name> NetIO230B <ip-address>:<portnumber> [<socket_number> <username> <password>]' or 'define <name> NetIO230B <ip-address>:<portnumber> [<socket_number> <configfilename>]'" if(int(@a) < 4); #5 = mit user/pass #4 = mit config
Log3 $hash, 3, "Wrong syntax: use 'define <name> NetIO230B <ip-address>:<portnumber> [<socket_number> <username> <password>]' or 'define <name> NetIO230B <ip-address>:<portnumber> [<socket_number> <configfilename>]'" if(int(@a) < 4); #5 = mit user/pass #4 = mit config
#provide some default settings
$hash->{CONFIGFILEPATH} = "/var/log/fhem/netio.conf"; #default file path is /var/log/fhem/netio.conf
@ -233,7 +233,7 @@ NetIO230B_Define($$)
$hash->{PASS} = $config{password} if (defined($config{password}));
} else {
Log 3, "NetIO230B: Configuration could not be read. Trying default values...\n";
Log3 $hash, 3, "NetIO230B: Configuration could not be read. Trying default values...\n";
}
} else {
@ -242,9 +242,9 @@ NetIO230B_Define($$)
$hash->{PASS} = $a[PARAM_PASS] if defined($a[PARAM_PASS]);
}
Log 1,"NetIO230B: Invalid device-address! Please use an address in the format: <ip-address>:<portnumber>" unless ($hash->{HOST} =~ m/^(.+):([0-9]+)$/);
return "NetIO230B: Invalid device-address! Please use an address in the format: <ip-address>:<portnumber>" unless ($hash->{HOST} =~ m/^(.+):([0-9]+)$/);
Log 3, "NetIO230B: device opened at host: $hash->{HOST} => @a\n";
Log3 $hash, 3, "NetIO230B: device opened at host: $hash->{HOST} => @a\n";
return undef;
}
@ -270,7 +270,7 @@ NetIO230B_GetConfiguration($)
if(!open(CONFIGFILE, $configfilename))
{
Log 3, "NetIO230B: Cannot open settings file '$configfilename'.";
Log3 $hash, 3, "NetIO230B: Cannot open settings file '$configfilename'.";
return ();
}
my @configfile=<CONFIGFILE>;

View File

@ -34,7 +34,7 @@ EM_Initialize($)
$hash->{UndefFn} = "EM_Undef";
$hash->{GetFn} = "EM_Get";
$hash->{SetFn} = "EM_Set";
$hash->{AttrList}= "model:em1010pc dummy:1,0 loglevel:0,1,2,3,4,5,6";
$hash->{AttrList}= "model:em1010pc dummy:1,0 ";
}
#####################################
@ -50,12 +50,12 @@ EM_Define($$)
my $dev = $a[2];
if($dev eq "none") {
Log 1, "EM device is none, commands will be echoed only";
Log3 $name, 1, "EM device is none, commands will be echoed only";
$attr{$name}{dummy} = 1;
return undef;
}
Log 3, "EM opening device $dev";
Log3 $name, 3, "EM opening device $dev";
if ( $^O =~ /Win/) {
eval ("use Win32::SerialPort;");
$po = new Win32::SerialPort ($dev);
@ -65,7 +65,7 @@ EM_Define($$)
}
return "Can't open $dev: $!" if(!$po);
Log 3, "EM opened device $dev";
Log3 $name, 3, "EM opened device $dev";
$po->close();
$hash->{DeviceName} = $dev;
@ -85,7 +85,7 @@ EM_Undef($$)
$defs{$d}{IODev} == $hash)
{
my $lev = ($reread_active ? 4 : 2);
Log GetLogLevel($name, $lev), "deleting port for $d";
Log3 $name, $lev, "deleting port for $d";
delete $defs{$d}{IODev};
}
}
@ -290,7 +290,7 @@ EmGetData($$)
}
if(!$serport) {
Log 1, "EM: Can't open $dev: $!";
Log3 undef, 1, "EM: Can't open $dev: $!";
return undef;
}
$serport->reset_error();
@ -305,7 +305,7 @@ EmGetData($$)
goto DONE;
}
}
Log 4, "EM: Sending " . unpack('H*', $d);
Log3 undef, 4, "EM: Sending " . unpack('H*', $d);
$rm = "EM: timeout reading the answer";
for(my $rep = 0; $rep < 3; $rep++) {
@ -330,7 +330,7 @@ EmGetData($$)
($BlockingFlags, $InBytes, $OutBytes, $ErrorFlags)=$serport->status;
last if $InBytes>0;
}
Log 5,"EM: read returned $InBytes Bytes($i trys)";
Log3 undef, 5,"EM: read returned $InBytes Bytes($i trys)";
last if ($InBytes<1);
$buf = $serport->input();
@ -372,14 +372,14 @@ EmGetData($$)
if(!EmCrcCheck($retval,$l-7)) { $rm = "EM Bad CRC"; goto DONE; }
$serport->close();
my $data=substr($retval, 4, $l-7);
Log 5,"EM: returned ".unpack("H*",$data);
Log3 undef, 5,"EM: returned ".unpack("H*",$data);
return $data;
}
}
}
DONE:
Log 5,$rm;
Log3 undef, 5,$rm;
$serport->close();
return undef;
}
@ -476,7 +476,6 @@ EmGetDevData($)
<ul>
<li><a href="#model">model</a> (em1010pc)</li>
<li><a href="#attrdummy">dummy</a></li>
<li><a href="#loglevel">loglevel</a></li>
</ul>
<br>
</ul>

View File

@ -21,7 +21,7 @@ EMWZ_Initialize($)
$hash->{SetFn} = "EMWZ_Set";
$hash->{DefFn} = "EMWZ_Define";
$hash->{AttrList} = "IODev dummy:1,0 model:EM1000WZ loglevel:0,1,2,3,4,5,6";
$hash->{AttrList} = "IODev dummy:1,0 model:EM1000WZ";
}
@ -43,14 +43,14 @@ EMWZ_GetStatus($)
my $d = IOWrite($hash, sprintf("7a%02x", $dnr-1));
if(!defined($d)) {
my $msg = "EMWZ $name read error (GetStatus 1)";
Log GetLogLevel($name,2), $msg;
Log3 $name, 2, $msg;
return $msg;
}
if($d eq ((pack('H*',"00") x 45) . pack('H*',"FF") x 6)) {
my $msg = "EMWZ no device no. $dnr present";
Log GetLogLevel($name,2), $msg;
Log3 $name, 2, $msg;
return $msg;
}
@ -58,7 +58,7 @@ EMWZ_GetStatus($)
my $ec=w($d,49) / 10;
if($ec <= 0) {
my $msg = "EMWZ read error (GetStatus 2)";
Log GetLogLevel($name,2), $msg;
Log3 $name, 2, $msg;
return $msg;
}
my $cur_energy = $pulses / $ec; # ec = U/kWh
@ -66,7 +66,7 @@ EMWZ_GetStatus($)
if($cur_power > 30) { # 20Amp x 3 Phase
my $msg = "EMWZ Bogus reading: curr. power is reported to be $cur_power";
Log GetLogLevel($name,2), $msg;
Log3 $name, 2, $msg;
return $msg;
}
@ -99,7 +99,7 @@ EMWZ_GetStatus($)
}
$hash->{STATE} = "$cur_power kW";
Log GetLogLevel($name,4), "EMWZ $name: $cur_power kW / $vals{energy}";
Log3 $name, 4, "EMWZ $name: $cur_power kW / $vals{energy}";
return $hash->{STATE};
}
@ -152,13 +152,13 @@ EMWZ_Set($@)
my $ret = IOWrite($hash, $msg);
if(!defined($ret)) {
my $msg = "EMWZ $name read error (Set)";
Log GetLogLevel($name,2), $msg;
Log3 $name, 2, $msg;
return $msg;
}
if(ord(substr($ret,0,1)) != 6) {
$ret = "EMWZ Error occured: " . unpack('H*', $ret);
Log GetLogLevel($name,2), $ret;
Log3 $name, 2, $ret;
return $ret;
}
@ -245,7 +245,6 @@ EMWZ_Define($$)
<ul>
<li><a href="#model">model</a> (EM1000WZ)</li>
<li><a href="#attrdummy">dummy</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#IODev">IODev</a></li><br>
</ul>
<br>

View File

@ -19,7 +19,7 @@ EMEM_Initialize($)
$hash->{GetFn} = "EMEM_Get";
$hash->{DefFn} = "EMEM_Define";
$hash->{AttrList} = "IODev dummy:1,0 model:EM1000EM loglevel:0,1,2,3,4,5,6";
$hash->{AttrList} = "IODev dummy:1,0 model:EM1000EM";
}
###################################
@ -40,13 +40,13 @@ EMEM_GetStatus($)
my $d = IOWrite($hash, sprintf("7a%02x", $dnr-1));
if(!defined($d)) {
my $msg = "EMEM $name read error (GetStatus 1)";
Log GetLogLevel($name,2), $msg;
Log3 $name, 2, $msg;
return $msg;
}
if($d eq ((pack('H*',"00") x 45) . pack('H*',"FF") x 6)) {
my $msg = "EMEM no device no. $dnr present";
Log GetLogLevel($name,2), $msg;
Log3 $name, 2, $msg;
return $msg;
}
@ -58,7 +58,7 @@ EMEM_GetStatus($)
if($cur_power > 30) { # 20Amp x 3 Phase
my $msg = "EMEM Bogus reading: curr. power is reported to be $cur_power, setting to -1";
Log GetLogLevel($name,2), $msg;
Log3 $name, 2, $msg;
#return $msg;
$cur_power = -1.0;
}
@ -93,7 +93,7 @@ EMEM_GetStatus($)
}
$hash->{STATE} = "$cur_power kW";
Log GetLogLevel($name,4), "EMEM $name: $cur_power kW / $vals{energy_kWh} kWh";
Log3 $name, 4, "EMEM $name: $cur_power kW / $vals{energy_kWh} kWh";
return $hash->{STATE};
}
@ -183,7 +183,6 @@ EMEM_Define($$)
<ul>
<li><a href="#model">model</a> (EM1000EM)</li>
<li><a href="#attrdummy">dummy</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#IODev">IODev</a></li><br>
</ul>
<br>

View File

@ -21,7 +21,7 @@ EMGZ_Initialize($)
$hash->{SetFn} = "EMGZ_Set";
$hash->{DefFn} = "EMGZ_Define";
$hash->{AttrList} = "IODev dummy:1,0 model:EM1000GZ loglevel:0,1,2,3,4,5,6";
$hash->{AttrList} = "IODev dummy:1,0 model:EM1000GZ";
}
@ -43,14 +43,14 @@ EMGZ_GetStatus($)
my $d = IOWrite($hash, sprintf("7a%02x", $dnr-1));
if(!defined($d)) {
my $msg = "EMGZ $name read error (GetStatus 1)";
Log GetLogLevel($name,2), $msg;
Log3 $name, 2, $msg;
return $msg;
}
if($d eq ((pack('H*',"00") x 45) . pack('H*',"FF") x 6)) {
my $msg = "EMGZ no device no. $dnr present";
Log GetLogLevel($name,2), $msg;
Log3 $name, 2, $msg;
return $msg;
}
@ -63,7 +63,7 @@ EMGZ_GetStatus($)
if($cur_power > 30) { # depending on "Anschlussleistung"
my $msg = "EMGZ Bogus reading: curr. power is reported to be $cur_power";
Log GetLogLevel($name,2), $msg;
Log3 $name, 2, $msg;
return $msg;
}
@ -93,7 +93,7 @@ EMGZ_GetStatus($)
}
$hash->{STATE} = "$cur_power m3ph";
Log GetLogLevel($name,4), "EMGZ $name: $cur_power m3ph / $vals{act_flow_m3}";
Log3 $name, 4, "EMGZ $name: $cur_power m3ph / $vals{act_flow_m3}";
return $hash->{STATE};
}
@ -139,13 +139,13 @@ EMGZ_Set($@)
my $ret = IOWrite($hash, $msg);
if(!defined($ret)) {
$msg = "EMWZ $name read error (Set)";
Log GetLogLevel($name,2), $msg;
Log3 $name, 2, $msg;
return $msg;
}
if(ord(substr($ret,0,1)) != 6) {
$ret = "EMGZ Error occured: " . unpack('H*', $ret);
Log GetLogLevel($name,2), $ret;
Log3 $name, 2, $ret;
return $ret;
}
@ -222,7 +222,6 @@ EMGZ_Define($$)
<ul>
<li><a href="#model">model</a> (EM1000GZ)</li>
<li><a href="#attrdummy">dummy</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#IODev">IODev</a></li><br>
</ul>
<br>

View File

@ -21,7 +21,7 @@ SCIVT_Initialize($)
$hash->{DefFn} = "SCIVT_Define";
$hash->{GetFn} = "SCIVT_Get";
$hash->{SetFn} = "SCIVT_Set";
$hash->{AttrList}= "model:SCD10,SCD20,SCD30 loglevel:0,1,2,3,4,5,6";
$hash->{AttrList}= "model:SCD10,SCD20,SCD30";
}
#####################################
@ -37,14 +37,14 @@ SCIVT_Define($$)
my $dev = $a[2];
Log 1, "SCIVT device is none, commands will be echoed only"
Log3 $hash, 1, "SCIVT device is none, commands will be echoed only"
if($dev eq "none");
if($dev ne "none") {
Log 3, "SCIVT opening device $dev";
Log3 $hash, 3, "SCIVT opening device $dev";
my $po = new Device::SerialPort ($dev);
return "SCIVT Can't open $dev: $!" if(!$po);
Log 2, "SCIVT opened device $dev";
Log3 $hash, 2, "SCIVT opened device $dev";
$po->close();
}
@ -75,7 +75,7 @@ SCIVT_Set($@)
my ($hash, @a) = @_;
return "\"set SCIVT\" needs at least two parameter" if(@a < 3);
my $name = $hash->{NAME};
Log GetLogLevel($name,4), "SCIVT Set request $a[1] $a[2], old: Timer:$hash->{Timer} Cmd: $hash->{Cmd}";
Log3 $name, 4, "SCIVT Set request $a[1] $a[2], old: Timer:$hash->{Timer} Cmd: $hash->{Cmd}";
return "Unknown argument $a[1], choose one of " . join(" ", sort keys %sets)
if(!defined($sets{$a[1]}));
@ -113,7 +113,7 @@ if($type eq "cmd")
DoTrigger($name, undef) if($init_done);
Log GetLogLevel($name,3), "SCIVT Set result Timer:$hash->{Timer} sec Cmd:$hash->{Cmd}";
Log3 $name, 3, "SCIVT Set result Timer:$hash->{Timer} sec Cmd:$hash->{Cmd}";
return "SCIVT => Timer:$hash->{Timer} Cmd:$hash->{Cmd}";
}
@ -131,7 +131,7 @@ if($a[1] eq "data")
$v = SCIVT_GetLine($hash->{DeviceName}, $hash->{Cmd});
if(!defined($v))
{
Log GetLogLevel($name,2), "SCIVT Get $a[1] error";
Log3 $name, 2, "SCIVT Get $a[1] error";
return "$a[0] $a[1] => Error";
}
$v =~ s/[\r\n]//g; # Delete the NewLine
@ -150,7 +150,7 @@ else
}
}
Log GetLogLevel($name,3), "SCIVT Get $a[1] $v";
Log3 $name, 3, "SCIVT Get $a[1] $v";
return "$a[0] $a[1] => $v";
}
@ -170,26 +170,26 @@ my $result = SCIVT_GetLine($hash->{DeviceName}, $hash->{Cmd});
if(!defined($result))
{
Log GetLogLevel($name,4), "SCIVT read error, retry $hash->{DeviceName}, $hash->{Cmd}";
Log3 $name, 4, "SCIVT read error, retry $hash->{DeviceName}, $hash->{Cmd}";
$result = SCIVT_GetLine($hash->{DeviceName}, $hash->{Cmd});
}
if(!defined($result))
{
Log GetLogLevel($name,2), "SCIVT read error, abort $hash->{DeviceName}, $hash->{Cmd}";
Log3 $name, 2, "SCIVT read error, abort $hash->{DeviceName}, $hash->{Cmd}";
$hash->{STATE} = "timeout";
return $hash->{STATE};
}
if (length($result) < 10)
{
Log GetLogLevel($name,2), "SCIVT incomplete line ($result)";
Log3 $name, 2, "SCIVT incomplete line ($result)";
$hash->{STATE} = "incomplete";
}
else
{
$result =~ s/^.*R://;
$result =~ s/[\r\n ]//g;
Log GetLogLevel($name,3), "SCIVT $result (raw)";
Log3 $name, 3, "SCIVT $result (raw)";
$result=~ s/,/./g;
my @data = split(";", $result);
@ -223,7 +223,7 @@ my ($dev,$cmd) = @_;
my $serport = new Device::SerialPort ($dev);
if(!$serport) {
Log 1, "SCIVT: Can't open $dev: $!";
Log3 undef, 1, "SCIVT: Can't open $dev: $!";
return undef;
}
$serport->reset_error();
@ -267,7 +267,7 @@ my ($dev,$cmd) = @_;
DONE:
$serport->close();
Log 3, "SCIVT $rm";
Log3 undef, 3, "SCIVT $rm";
return undef;
}
@ -318,7 +318,6 @@ DONE:
<a name="SVICTattr"></a>
<b>Attributes</b>
<ul>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#model">model</a> (SCD)</li>
</ul>
<br>

View File

@ -16,8 +16,7 @@ at_Initialize($)
$hash->{UndefFn} = "at_Undef";
$hash->{AttrFn} = "at_Attr";
$hash->{StateFn} = "at_State";
$hash->{AttrList} = "disable:0,1 skip_next:0,1 loglevel:0,1,2,3,4,5,6 ".
"alignTime";
$hash->{AttrList} = "disable:0,1 skip_next:0,1 alignTime";
}
@ -120,8 +119,7 @@ at_Exec($)
return if($hash->{DELETED}); # Just deleted
my $name = $hash->{NAME};
my $ll5 = GetLogLevel($name,5);
Log $ll5, "exec at command $name";
Log3 $name, 5, "exec at command $name";
if(defined($attr{$name})) {
$skip = 1 if($attr{$name} && $attr{$name}{skip_next});
@ -132,7 +130,7 @@ at_Exec($)
my (undef, $command) = split("[ \t]+", $hash->{DEF}, 2);
$command = SemicolonEscape($command);
my $ret = AnalyzeCommandChain(undef, $command) if(!$skip && !$disable);
Log GetLogLevel($name,3), "$name: $ret" if($ret);
Log3 $name, 3, "$name: $ret" if($ret);
return if($hash->{DELETED}); # Deleted in the Command
@ -150,7 +148,7 @@ at_Exec($)
if($count) {
$def =~ s/{\d+}/{$count}/ if($def =~ m/^\+?\*{\d+}/); # Replace the count
Log $ll5, "redefine at command $name as $def";
Log3 $name, 5, "redefine at command $name as $def";
$data{AT_RECOMPUTE} = 1; # Tell sunrise compute the next day
CommandDefine(undef, "$name at $def"); # Recompute the next TRIGGERTIME

View File

@ -18,7 +18,7 @@ eventTypes_Initialize($)
$hash->{GetFn} = "eventTypes_Get";
$hash->{SetFn} = "eventTypes_Set";
$hash->{AttrFn} = "eventTypes_Attr";
$hash->{AttrList} = "disable:0,1 loglevel:0,1,2,3,4,5,6";
$hash->{AttrList} = "disable:0,1";
}
@ -60,7 +60,6 @@ eventTypes_Notify($$)
my $t = $eventSrc->{TYPE};
my $n = $eventSrc->{NAME};
my $ll4 = GetLogLevel($ln, 4);
my $ret = "";
foreach my $oe (@{$eventSrc->{CHANGED}}) {
@ -68,7 +67,7 @@ eventTypes_Notify($$)
my $ne = $oe;
$ne =~ s/\b-?\d*\.?\d+\b/.*/g;
$ne =~ s/set_\d+/set_.*/; # HM special :/
Log $ll4, "$ln: $t $n $oe -> $ne";
Log3 $ln, 4, "$ln: $t $n $oe -> $ne";
$modules{eventTypes}{ldata}{$n}{$ne}++;
}
return undef;
@ -182,7 +181,6 @@ eventTypes_Get($@)
<b>Attributes</b>
<ul>
<li><a href="#disable">disable</a></li>
<li><a href="#loglevel">loglevel</a></li>
</ul>
<br>

View File

@ -14,7 +14,7 @@ notify_Initialize($)
$hash->{DefFn} = "notify_Define";
$hash->{NotifyFn} = "notify_Exec";
$hash->{AttrFn} = "notify_Attr";
$hash->{AttrList} = "disable:0,1 forwardReturnValue:0,1 loglevel:0,1,2,3,4,5,6";
$hash->{AttrList} = "disable:0,1 forwardReturnValue:0,1";
}
@ -68,7 +68,7 @@ notify_Exec($$)
$found = ("$n:$s" =~ m/^$re$/);
}
if($found) {
Log GetLogLevel($ln, 5), "Triggering $ln";
Log3 $ln, 5, "Triggering $ln";
my (undef, $exec) = split("[ \t]+", $ntfy->{DEF}, 2);
my %specials= (
@ -79,7 +79,7 @@ notify_Exec($$)
$exec= EvalSpecials($exec, %specials);
my $r = AnalyzeCommandChain(undef, $exec);
Log GetLogLevel($ln, 3), "$ln return value: $r" if($r);
Log3 $ln, 3, "$ln return value: $r" if($r);
$ret .= " $r" if($r);
}
}
@ -219,7 +219,6 @@ notify_Attr(@)
<b>Attributes</b>
<ul>
<li><a href="#disable">disable</a></li>
<li><a href="#loglevel">loglevel</a></li>
<a name="forwardReturnValue"></a>
<li>forwardReturnValue<br>
Forward the return value of the executed command to the caller,

View File

@ -15,7 +15,7 @@ sequence_Initialize($)
$hash->{DefFn} = "sequence_Define";
$hash->{UndefFn} = "sequence_Undef";
$hash->{NotifyFn} = "sequence_Notify";
$hash->{AttrList} = "disable:0,1 loglevel:0,1,2,3,4,5,6";
$hash->{AttrList} = "disable:0,1";
}
@ -71,13 +71,13 @@ sequence_Notify($$)
RemoveInternalTimer($ln);
my $idx = $hash->{IDX} + 2;
Log GetLogLevel($ln,5), "sequence $ln matched $idx";
Log3 $ln, 5, "sequence $ln matched $idx";
my @d = split("[ \t]+", $hash->{DEF});
if($idx > $hash->{MAX}) { # Last element reached
Log GetLogLevel($ln,5), "sequence $ln triggered";
Log3 $ln, 5, "sequence $ln triggered";
DoTrigger($ln, "trigger");
$idx = 0;
@ -104,7 +104,7 @@ sequence_Trigger($)
my @d = split("[ \t]+", $hash->{DEF});
$hash->{RE} = $d[0];
$hash->{IDX} = 0;
Log GetLogLevel($ln,5), "sequence $ln timeout";
Log3 $ln, 5, "sequence $ln timeout";
}
sub
@ -155,7 +155,6 @@ sequence_Undef($$)
<b>Attributes</b>
<ul>
<li><a href="#disable">disable</a></li>
<li><a href="#loglevel">loglevel</a></li>
</ul>
<br>

View File

@ -15,8 +15,7 @@ watchdog_Initialize($)
$hash->{DefFn} = "watchdog_Define";
$hash->{UndefFn} = "watchdog_Undef";
$hash->{NotifyFn} = "watchdog_Notify";
$hash->{AttrList} = "disable:0,1 regexp1WontReactivate:0,1 ".
"loglevel:0,1,2,3,4,5,6";
$hash->{AttrList} = "disable:0,1 regexp1WontReactivate:0,1";
}
@ -124,7 +123,7 @@ watchdog_Trigger($)
return "";
}
Log(GetLogLevel($name,3), "Watchdog $name triggered");
Log3 $name, 3, "Watchdog $name triggered";
my $exec = SemicolonEscape($watchdog->{CMD});;
$watchdog->{STATE} = "triggered";
@ -132,7 +131,7 @@ watchdog_Trigger($)
$watchdog->{READINGS}{Triggered}{VAL} = $watchdog->{STATE};
my $ret = AnalyzeCommandChain(undef, $exec);
Log(GetLogLevel($name,3), $ret) if($ret);
Log3 $name, 3, $ret if($ret);
}
sub
@ -228,7 +227,6 @@ watchdog_Undef($$)
<b>Attributes</b>
<ul>
<li><a href="#disable">disable</a></li>
<li><a href="#loglevel">loglevel</a></li>
<li><a name="regexp1WontReactivate">regexp1WontReactivate</a><br>
When a watchdog is active, a second event matching regexp1 will
normally reset the timeout. Set this attribute to prevents this.

View File

@ -37,8 +37,7 @@ FileLog_Initialize($)
$hash->{NotifyFn} = "FileLog_Log";
$hash->{AttrFn} = "FileLog_Attr";
# logtype is used by the frontend
$hash->{AttrList} = "disable:0,1 logtype nrarchive archivedir archivecmd ".
"loglevel";
$hash->{AttrList} = "disable:0,1 logtype nrarchive archivedir archivecmd";
$hash->{FW_summaryFn} = "FileLog_fhemwebFn";
$hash->{FW_detailFn} = "FileLog_fhemwebFn";
@ -107,7 +106,7 @@ FileLog_Switch($)
HandleArchiving($log);
$fh = new IO::File ">>$cn";
if(!defined($fh)) {
Log(0, "Can't open $cn");
Log3 $log, 0, "Can't open $cn";
return;
}
$log->{currentlogfile} = $cn;
@ -273,7 +272,7 @@ FileLog_loadSVG()
{
if(!$modules{SVG}{LOADED} && -f "$attr{global}{modpath}/FHEM/98_SVG.pm") {
my $ret = CommandReload(undef, "98_SVG");
Log 1, $ret if($ret);
Log3 undef, 1, $ret if($ret);
}
}
@ -505,7 +504,6 @@ FileLog_Get($@)
my $internal;
my $name = $hash->{NAME};
my $ll = GetLogLevel($name,4);
if($outf eq "INT") {
$outf = "-";
@ -547,7 +545,7 @@ FileLog_Get($@)
}
$inf = $linf;
}
Log $ll, "$name get: Input file $inf, from:$from to:$to";
Log3 $name, 4, "$name get: Input file $inf, from:$from to:$to";
my $ifh = new IO::File $inf if($inf);
seekTo($inf, $ifh, $hash, $from) if($ifh);
@ -776,8 +774,9 @@ RESCAN:
$data{"currval$j"} = $lastv[$i];
$data{"currdate$j"} = $lastd[$i];
Log $ll, "$name get: line $j, regexp:".$d[$i]->{re}.", col:".$d[$i]->{col}.
", output lines:".$data{"cnt$j"};
Log3 $name, 4,
"$name get: line $j, regexp:".$d[$i]->{re}.", col:".$d[$i]->{col}.
", output lines:".$data{"cnt$j"};
}
if($internal) {
@ -1048,7 +1047,6 @@ seekTo($$$$)
</li><br>
<li><a href="#disable">disable</a></li>
<li><a href="#loglevel">loglevel</a></li>
<a name="logtype"></a>
<li>logtype<br>

View File

@ -29,8 +29,7 @@ FHEM2FHEM_Initialize($)
# Normal devices
$hash->{DefFn} = "FHEM2FHEM_Define";
$hash->{UndefFn} = "FHEM2FHEM_Undef";
$hash->{AttrList}= "dummy:1,0 " .
"loglevel:0,1,2,3,4,5,6 ";
$hash->{AttrList}= "dummy:1,0";
}
#####################################
@ -43,7 +42,7 @@ FHEM2FHEM_Define($$)
if(@a < 4 || @a > 5 || !($a[3] =~ m/^(LOG|RAW):(.*)$/)) {
my $msg = "wrong syntax: define <name> FHEM2FHEM host[:port][:SSL] ".
"[LOG:regexp|RAW:device] {portpasswort}";
Log 2, $msg;
Log3 $hash, 2, $msg;
return $msg;
}
@ -131,14 +130,14 @@ FHEM2FHEM_Read($)
}
my $data = $hash->{PARTIAL};
Log 5, "FHEM2FHEM/RAW: $data/$buf";
Log3 $hash, 5, "FHEM2FHEM/RAW: $data/$buf";
$data .= $buf;
while($data =~ m/\n/) {
my $rmsg;
($rmsg,$data) = split("\n", $data, 2);
$rmsg =~ s/\r//;
Log GetLogLevel($name,4), "$name: $rmsg";
Log3 $name, 4, "$name: $rmsg";
if($hash->{informType} eq "LOG") {
my ($type, $name, $msg) = split(" ", $rmsg, 3);
@ -209,7 +208,7 @@ FHEM2FHEM_OpenDev($$)
my $name = $hash->{NAME};
$hash->{PARTIAL} = "";
Log 3, "FHEM2FHEM opening $name at $dev"
Log3 $name, 3, "FHEM2FHEM opening $name at $dev"
if(!$reopen);
# This part is called every time the timeout (5sec) is expired _OR_
@ -223,7 +222,7 @@ FHEM2FHEM_OpenDev($$)
my $conn;
if($hash->{SSL}) {
eval "use IO::Socket::SSL";
Log 1, $@ if($@);
Log3 $name, 1, $@ if($@);
$conn = IO::Socket::SSL->new(PeerAddr => "$dev") if(!$@);
} else {
$conn = IO::Socket::INET->new(PeerAddr => $dev);
@ -233,7 +232,7 @@ FHEM2FHEM_OpenDev($$)
delete($hash->{NEXT_OPEN})
} else {
Log(3, "Can't connect to $dev: $!") if(!$reopen);
Log3($name, 3, "Can't connect to $dev: $!") if(!$reopen);
$readyfnlist{"$name.$dev"} = $hash;
$hash->{STATE} = "disconnected";
$hash->{NEXT_OPEN} = time()+60;
@ -246,9 +245,9 @@ FHEM2FHEM_OpenDev($$)
$selectlist{"$name.$dev"} = $hash;
if($reopen) {
Log 1, "FHEM2FHEM $dev reappeared ($name)";
Log3 $name, 1, "FHEM2FHEM $dev reappeared ($name)";
} else {
Log 3, "FHEM2FHEM device opened ($name)";
Log3 $name, 3, "FHEM2FHEM device opened ($name)";
}
$hash->{STATE}= "connected";
@ -268,7 +267,7 @@ FHEM2FHEM_Disconnected($)
my $name = $hash->{NAME};
return if(!defined($hash->{FD})); # Already deleted
Log 1, "$dev disconnected, waiting to reappear";
Log3 $name, 1, "$dev disconnected, waiting to reappear";
FHEM2FHEM_CloseDev($hash);
$readyfnlist{"$name.$dev"} = $hash; # Start polling
$hash->{STATE} = "disconnected";
@ -376,7 +375,6 @@ FHEM2FHEM_SimpleRead($)
<b>Attributes</b>
<ul>
<li><a href="#dummy">dummy</a></li>
<li><a href="#loglevel">loglevel</a></li>
</ul>
</ul>

View File

@ -59,9 +59,8 @@ PachLog_Initialize($)
$hash->{DefFn} = "PachLog_Define";
$hash->{SetFn} = "PachLog_Set";
$hash->{GetFn} = "PachLog_Get";
$hash->{NotifyFn} = "PachLog_Notify";
$hash->{AttrList} = "do_not_notify:0,1 loglevel:0,5 disable:0,1";
$hash->{AttrList} = "do_not_notify:0,1";
}
#######################################################################
sub PachLog_Define($@)
@ -71,8 +70,6 @@ sub PachLog_Define($@)
# X-API-Key steht im DEF %defs{<NAME>}{DEF}
# Alternativ nach $defs{<NAME>}{XAPIKEY}
my($package, $filename, $line, $subroutine) = caller(3);
# Log 0 , "PachLog_Define => $package: $filename LINE: $line SUB: $subroutine \n";
Log 5, Dumper(@_) . "\n";
return "Unknown argument count " . int(@a) . " , usage set <name> dataset value or set <name> delete dataset" if(int(@a) != 1);
return undef;
@ -91,7 +88,8 @@ sub PachLog_Set($@)
# READINGS setzten oder l?schen
if($a[1] eq "DEL")
{
GetLogLevel($a[0],2),"PACHLOG -> DELETE: A0= ". $a[0] . " A1= " . $a[1] . " A2=" . $a[2];
Log3 $hash, 2,
"PACHLOG -> DELETE: A0= ". $a[0] . " A1= " . $a[1] . " A2=" . $a[2];
if(defined($hash->{READINGS}{$a[2]}))
{
delete($hash->{READINGS}{$a[2]})
@ -130,15 +128,7 @@ sub PachLog_Set($@)
return "Unknown argument count " . int(@a) . " , usage set <name> ADD/DEL <DEVICE-NAME> FEED:STREAM:VALUE:STREAM:VALUE&FEED-2:STREAM,VALUE" if(int(@a) != 4);
}
#######################################################################
sub PachLog_Get()
{
# OHNE FUNKTION ....
my ($name, $x_key) = @_;
my($package, $filename, $line, $subroutine) = caller(3);
Log 5, "PachLog_Get => $package: $filename LINE: $line SUB: $subroutine \n";
Log 5, Dumper(@_) . "\n";
}
#######################################################################
sub PachLog_Notify ($$)
{
@ -146,14 +136,10 @@ sub PachLog_Notify ($$)
my $d = $me->{NAME};
return "" if($attr{$d} && $attr{$d}{disable});
my $t = $trigger->{NAME};
#LogLevel
my $ll;
if(defined($attr{$d}{'loglevel'})){$ll = $attr{$d}{'loglevel'};}
else {$ll = 5;}
# Eintrag fuer Trigger-Device vorhanden
if(!defined($defs{$d}{READINGS}{$t}))
{
Log $ll, ("PACHLOG[INFO] => " . $t . " => Nicht definiert");
Log3 $d, 5, ("PACHLOG[INFO] => " . $t . " => Nicht definiert");
return undef;}
# Umwandeln 1234:0:temperature:1:humidity => %feed
@ -179,11 +165,9 @@ sub PachLog_Notify ($$)
# Einheit -> 21,1 (celsius) -> 21,1
# FS20: VAL = on => 1 && VAL = off => 0
# @a = split(' ', $i);
# $feed{$feednr}{$r}{VAL} = &ReadingToNumber($a[0]) ;
$feed{$feednr}{$r}{VAL} = &ReadingToNumber($i,$ll) ;
$feed{$feednr}{$r}{VAL} = ReadingToNumber($i,$d) ;
}
# Log $ll, "PACHLOG => dumper(FEED) => " .Dumper(%feed);
# CVS-Data
my @cvs = ();
@ -191,7 +175,7 @@ sub PachLog_Notify ($$)
$cvs[$feed{$feednr}{$r}{STREAM}] = $feed{$feednr}{$r}{VAL};
}
my $cvs_data = join(',',@cvs);
Log $ll, "PACHLOG[CVSDATA] => $cvs_data";
Log3 $d, 5, "PACHLOG[CVSDATA] => $cvs_data";
# Aufbereiten %feed als EEML-Data
my $eeml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
@ -202,7 +186,7 @@ sub PachLog_Notify ($$)
$eeml .= "<data id=\"" . $feed{$feednr}{$r}{STREAM} . "\">\n";
$eeml .= "<value>" . $feed{$feednr}{$r}{VAL} . "</value>\n";
# Unit fuer EEML: <unit symbol="C" type="derivedSI">Celsius</unit>
my ($u_name,$u_symbol,$u_type,$u_tag) = split(',',&PachLog_ReadingToUnit($r,$ll));
my ($u_name,$u_symbol,$u_type,$u_tag) = split(',',PachLog_ReadingToUnit($r,$d));
if(defined($u_name)) {
$eeml .= "<tag>". $u_tag . "</tag>\n";
$eeml .= "<unit symbol=\"" . $u_symbol. "\" type=\"" . $u_type. "\">" . $u_name . "<\/unit>\n";
@ -211,7 +195,7 @@ sub PachLog_Notify ($$)
}
$eeml .= "</environment>\n";
$eeml .= "</eeml>\n";
Log $ll, "PACHLOG -> " . $t . " EEML => " . $eeml;
Log3 $d, 5, "PACHLOG -> " . $t . " EEML => " . $eeml;
# Pachube-Update per EEML -> XML
my ($res,$ret,$ua,$apiKey,$url);
$apiKey = $defs{$d}{DEF};
@ -224,11 +208,12 @@ sub PachLog_Notify ($$)
# Ueberpruefen wir, ob alles okay war:
if ($res->is_success())
{
Log 5,("PACHLOG => Update[" . $t ."]: " . $cvs_data . " >> SUCCESS\n");
Log3 $d, 5,("PACHLOG => Update[" . $t ."]: " . $cvs_data . " >> SUCCESS\n");
# Time setzten
$defs{$d}{READINGS}{$t}{TIME} = TimeNow();
}
else {Log 0,("PACHLOG => Update[" . $t ."] ERROR: " . ($res->as_string) . "\n");}
} else {
Log3 $d, 0,("PACHLOG => Update[" . $t ."] ERROR: " .
($res->as_string) . "\n");}
}
################################################################################
sub PachLog_ReadingToUnit($$)
@ -238,21 +223,23 @@ sub PachLog_ReadingToUnit($$)
# Output: Name,symbol,Type,Tag z.B. Celsius,C,derivedSI
# weiters => www.eeml.org
# No Match = undef
my ($in,$ll) = @_;
my %unit = ();
%unit = (
'temperature' => "Celsius,C,derivedSI,Temperature",
'dewpoint' => "Celsius,C,derivedSI,Temperature",
'current' => "Power,kW,derivedSI,EnergyConsumption",
'humidity' => "Humidity,rel%,contextDependentUnits,Humidity",
'rain' => "Rain,l/m2,contextDependentUnits,Rain",
'rain_now' => "Rain,l/m2,contextDependentUnits,Rain",
'wind' => "Wind,m/s,contextDependentUnits,Wind",
);
if(defined($unit{$in})) {
Log $ll ,("PACHLOG[ReadingToUnit] " . $in . " >> " . $unit{$in} );
return $unit{$in};}
else {return undef;}
my ($in,$d) = @_;
my %unit = ();
%unit = (
'temperature' => "Celsius,C,derivedSI,Temperature",
'dewpoint' => "Celsius,C,derivedSI,Temperature",
'current' => "Power,kW,derivedSI,EnergyConsumption",
'humidity' => "Humidity,rel%,contextDependentUnits,Humidity",
'rain' => "Rain,l/m2,contextDependentUnits,Rain",
'rain_now' => "Rain,l/m2,contextDependentUnits,Rain",
'wind' => "Wind,m/s,contextDependentUnits,Wind",
);
if(defined($unit{$in})) {
Log3 $d,5,("PACHLOG[ReadingToUnit] " . $in . " >> " . $unit{$in} );
return $unit{$in};
} else {
return undef;
}
}
################################################################################
sub ReadingToNumber($$)
@ -261,28 +248,28 @@ sub ReadingToNumber($$)
# Output: 21.1 oder 10
# ERROR = undef
# Alles au?er Nummern loeschen $t =~ s/[^0123456789.-]//g;
my ($in,$ll) = @_;
Log $ll, "PACHLOG[ReadingToNumber] => in => $in";
# Bekannte READINGS FS20 Devices oder FHT
if($in =~ /^on|Switch.*on/i) {$in = 1;}
if($in =~ /^off|Switch.*off|lime-protection/i) {$in = 0;}
# Keine Zahl vorhanden
if($in !~ /\d{1}/) {
Log $ll, "PACHLOG[ReadingToNumber] No Number: $in";
return undef;}
# Mehrfachwerte in READING z.B. CUM_DAY: 5.040 CUM: 334.420 COST: 0.00
my @b = split(' ', $in);
if(int(@b) gt 2) {
Log $ll, "PACHLOG[ReadingToNumber] Not Supportet Reading: $in";
return undef;}
# Nur noch Zahlen z.B. dim10% = 10 oder 21.1 (Celsius) = 21.1
if (int(@b) eq 2){
Log $ll, "PACHLOG[ReadingToNumber] Split:WhiteSpace-0- $b[0]";
$in = $b[0];
}
$in =~ s/[^0123456789.-]//g;
Log $ll, "PACHLOG[ReadingToNumber] => out => $in";
return $in
my ($in,$d) = @_;
Log3 $d, 5, "PACHLOG[ReadingToNumber] => in => $in";
# Bekannte READINGS FS20 Devices oder FHT
if($in =~ /^on|Switch.*on/i) {$in = 1;}
if($in =~ /^off|Switch.*off|lime-protection/i) {$in = 0;}
# Keine Zahl vorhanden
if($in !~ /\d{1}/) {
Log3 $d, 5, "PACHLOG[ReadingToNumber] No Number: $in";
return undef;}
# Mehrfachwerte in READING z.B. CUM_DAY: 5.040 CUM: 334.420 COST: 0.00
my @b = split(' ', $in);
if(int(@b) gt 2) {
Log3 $d, 5, "PACHLOG[ReadingToNumber] Not Supportet Reading: $in";
return undef;}
# Nur noch Zahlen z.B. dim10% = 10 oder 21.1 (Celsius) = 21.1
if (int(@b) eq 2){
Log3 $d, 5, "PACHLOG[ReadingToNumber] Split:WhiteSpace-0- $b[0]";
$in = $b[0];
}
$in =~ s/[^0123456789.-]//g;
Log3 $d, 5, "PACHLOG[ReadingToNumber] => out => $in";
return $in
}
1;
@ -340,7 +327,6 @@ sub ReadingToNumber($$)
<b>Attributes</b>
<ul>
<li><a href="#do_not_notify">do_not_notify</a></li><br>
<li><a href="#loglevel">loglevel</a></li><br>
<li>disable<br>
Disables PachLog.
Nor more Logging to www.pachube.com

View File

@ -80,9 +80,9 @@ CommandCULflash($$)
CUL_SimpleWrite($defs{$cul}, "B01");
sleep(4); # B01 needs 2 seconds for the reset
}
Log 1, "CULflash $cmd";
Log3 undef, 1, "CULflash $cmd";
my $result = `$cmd`;
Log 1, "CULflash $result";
Log3 undef, 1, "CULflash $result";
return $result;
}

View File

@ -17,7 +17,7 @@ PID_Initialize($)
$hash->{DefFn} = "PID_Define";
$hash->{SetFn} = "PID_Set";
$hash->{NotifyFn} = "PID_Notify";
$hash->{AttrList} = "disable:0,1 loglevel:0,1,2,3,4,5,6 roundValveValue:0,1";
$hash->{AttrList} = "disable:0,1 roundValveValue:0,1";
}
@ -39,7 +39,7 @@ PID_Define($$$)
my ($sensor, $reading, $regexp) = split(":", $a[2], 3);
if(!$defs{$sensor}) {
my $msg = "$pn: Unknown sensor device $sensor specified";
Log 2, $msg;
Log3 $pn, 2, $msg;
return $msg;
}
$pid->{sensor} = $sensor;
@ -50,7 +50,7 @@ PID_Define($$$)
$regexp = '([\\d\\.]*)';
} else {
my $msg = "$pn: Unknown sensor type $t, specify regexp";
Log 2, $msg;
Log3 $pn, 2, $msg;
return $msg;
}
}
@ -64,7 +64,7 @@ PID_Define($$$)
my ($p_p, $p_i, $p_d) = (0, 0, 0);
if(!$defs{$actor}) {
my $msg = "$pn: Unknown actor device $actor specified";
Log 2, $msg;
Log3 $pn, 2, $msg;
return $msg;
}
$pid->{actor} = $actor;
@ -79,7 +79,7 @@ PID_Define($$$)
$p_d = 15.0/2.55;
} else {
my $msg = "$pn: Unknown actor type $t, specify command:min:max";
Log 2, $msg;
Log3 $pn, 2, $msg;
return $msg;
}
}
@ -122,7 +122,7 @@ PID_Set($@)
} elsif ($arg eq "desired" ) {
return "Set desired needs a numeric parameter"
if(@a != 3 || $a[2] !~ m/^[\d\.]*$/);
Log GetLogLevel($pn,3), "PID set $pn $arg $a[2]";
Log3 $pn, 3, "PID set $pn $arg $a[2]";
PID_sv($pid, 'desired', $a[2]);
PID_setValue($pid);
@ -199,7 +199,7 @@ PID_setValue($)
$inStr = $defs{$sensor}{READINGS}{$reading}{VAL}
if($defs{$sensor}{READINGS} && $defs{$sensor}{READINGS}{$reading});
if(!$inStr) {
Log GetLogLevel($pn,4), "PID $pn: no $reading yet for $sensor";
Log3 $pn, 4, "PID $pn: no $reading yet for $sensor";
return;
}
$inStr =~ m/$re/;
@ -220,14 +220,14 @@ PID_setValue($)
my $a = PID_saturate($pid, $p + $i + $d);
PID_sv($pid, 'actuation', $a);
Log GetLogLevel($pn,4), sprintf("PID $pn: p:%.2f i:%.2f d:%.2f", $p, $i, $d);
Log3 $pn, 4, sprintf("PID $pn: p:%.2f i:%.2f d:%.2f", $p, $i, $d);
# Hack to round.
my ($satMin, $satMax) = ($pid->{satMin}, $pid->{satMax});
$a = int($a) if(AttrVal($pn, "roundValveValue", ($satMax-$satMin >= 100)));
my $ret = fhem sprintf("set %s %s %g", $pid->{actor}, $pid->{command}, $a);
Log GetLogLevel($pn,1), "output of $pn command: $ret" if($ret);
Log3 $pn, 1, "output of $pn command: $ret" if($ret);
$pid->{STATE} = "$in (delta $delta)";
}
@ -304,7 +304,6 @@ PID_setValue($)
<b>Attributes</b>
<ul>
<li><a href="#disable">disable</a></li>
<li><a href="#loglevel">loglevel</a></li>
<a name="roundValveValue"></a>
<li>roundValveValue<br>
round the valve value to an integer, of the attribute is set to 1.

View File

@ -199,12 +199,12 @@ SVG_sel($$$@)
}
sub
SVG_getRegFromFile($)
SVG_getRegFromFile($$)
{
my ($fName) = @_;
my ($wName, $fName) = @_;
my $fh = new IO::File $fName;
if(!$fh) {
Log 1, "$fName: $!";
Log3 $wName, 1, "$fName: $!";
return (3, "NoFile", "NoFile");
}
$fh->seek(0, 2); # Go to the end
@ -284,7 +284,7 @@ SVG_PEdit($$$$)
$ret .= "<td>Input:Column,Regexp,DefaultValue,Function</td>";
$ret .=" <td>Y-Axis,Plot-Type,Style,Width</td></tr>";
my ($colnums, $colregs, $coldata) = SVG_getRegFromFile($file);
my ($colnums, $colregs, $coldata) = SVG_getRegFromFile($FW_wname, $file);
$colnums = join(",", 3..$colnums);
my %tickh;
@ -918,7 +918,7 @@ SVG_render($$$$$$$$$)
SVG_pO join("", <FH>);
close(FH);
} else {
Log 0, "Can't open $parent_dir/svg_style.css"
Log3 $name, 0, "Can't open $parent_dir/svg_style.css"
}
SVG_pO "]]></style>";
@ -929,7 +929,7 @@ SVG_render($$$$$$$$$)
SVG_pO join("", <FH>);
close(FH);
} else {
Log 0, "Can't open $parent_dir/svg_defs.svg"
Log3 $name, 0, "Can't open $parent_dir/svg_defs.svg"
}
######################
@ -1168,7 +1168,7 @@ SVG_render($$$$$$$$$)
$hstep{$a} = $step;
$axdrawn{$a} = 0;
#Log 2, "Axis $a has interval [$hmin{$a},$hmax{$a}], step $hstep{$a}, tics $htics{$a}\n";
#Log3 $name, 2, "Axis $a has interval [$hmin{$a},$hmax{$a}], step $hstep{$a}, tics $htics{$a}\n";
}
#-- run through all axes for drawing (each only once !)

View File

@ -96,8 +96,7 @@ autocreate_Initialize($)
$hash->{DefFn} = "autocreate_Define";
$hash->{NotifyFn} = "autocreate_Notify";
$hash->{AttrFn} = "autocreate_Attr";
$hash->{AttrList}= "loglevel:0,1,2,3,4,5,6 " .
"autosave filelog device_room weblink weblink_room " .
$hash->{AttrList}= "autosave filelog device_room weblink weblink_room " .
"disable ignoreTypes";
my %ahash = ( Fn=>"CommandCreateLog",
Hlp=>"<device>,create log/weblink for <device>" );
@ -136,7 +135,6 @@ autocreate_Notify($$)
my ($ntfy, $dev) = @_;
my $me = $ntfy->{NAME};
my ($ll1, $ll2) = (GetLogLevel($me,1), GetLogLevel($me,2));
my $max = int(@{$dev->{CHANGED}});
my $ret = "";
my $nrcreated;
@ -160,10 +158,10 @@ autocreate_Notify($$)
####################
if(!$hash) {
$cmd = "$name $type $arg";
Log $ll2, "autocreate: define $cmd";
Log3 $me, 2, "autocreate: define $cmd";
$ret = CommandDefine(undef, $cmd);
if($ret) {
Log $ll1, "ERROR: $ret";
Log3 $me, 1, "ERROR: $ret";
last;
}
}
@ -195,10 +193,10 @@ autocreate_Notify($$)
last;
}
$cmd = "$flname FileLog $fl $filter";
Log $ll2, "autocreate: define $cmd";
Log3 $me, 2, "autocreate: define $cmd";
$ret = CommandDefine(undef, $cmd);
if($ret) {
Log $ll1, "ERROR: $ret";
Log3 $me, 1, "ERROR: $ret";
last;
}
$attr{$flname}{room} = $room if($room);
@ -223,10 +221,10 @@ autocreate_Notify($$)
$wnr++;
delete($defs{$wlname}); # If we are re-creating it with createlog.
$cmd = "$wlname weblink fileplot $flname:$gplotfile:CURRENT";
Log $ll2, "autocreate: define $cmd";
Log3 $me, 2, "autocreate: define $cmd";
$ret = CommandDefine(undef, $cmd);
if($ret) {
Log $ll1, "ERROR: $ret";
Log3 $me, 1, "ERROR: $ret";
last;
}
$attr{$wlname}{room} = $room if($room);
@ -251,7 +249,7 @@ autocreate_Notify($$)
$hash->{DEF} =~ s/$old/$new/g;
rename($oldlogfile, $hash->{currentlogfile});
Log $ll2, "autocreate: renamed FileLog_$old to FileLog_$new";
Log3 $me, 2, "autocreate: renamed FileLog_$old to FileLog_$new";
$nrcreated++;
}
@ -261,7 +259,7 @@ autocreate_Notify($$)
$hash->{LINK} =~ s/$old/$new/g;
$hash->{DEF} =~ s/$old/$new/g;
$attr{"weblink_$new"}{label} =~ s/$old/$new/g;
Log $ll2, "autocreate: renamed weblink_$old to weblink_$new";
Log3 $me, 2, "autocreate: renamed weblink_$old to weblink_$new";
$nrcreated++;
}
}
@ -378,7 +376,7 @@ CommandUsb($$)
require "$attr{global}{modpath}/FHEM/DevIo.pm";
Log 1, "usb $n starting";
Log3 undef, 1, "usb $n starting";
################
# First try to flash unflashed CULs
if($^O eq "linux") {
@ -394,7 +392,7 @@ CommandUsb($$)
$culType = "CUL_V2" if($lsusb =~ m/03eb:2ffa/);
if($culType) {
$msg = "$culType: flash it with: CULflash none $culType";
Log 2, $msg; $ret .= $msg . "\n";
Log3 undef, 2, $msg; $ret .= $msg . "\n";
if(!$scan) {
AnalyzeCommand(undef, "culflash none $culType"); # Enable autoload
sleep(4); # Leave time for linux to load th drivers
@ -413,7 +411,7 @@ CommandUsb($$)
$PARAM =~ s/[^A-Za-z0-9]//g;
my $name = $thash->{NAME};
$msg = "### $dev: checking if it is a $name";
Log 4, $msg; $ret .= $msg . "\n";
Log3 undef, 4, $msg; $ret .= $msg . "\n";
# Check if it already used
foreach my $d (keys %defs) {
@ -421,7 +419,7 @@ CommandUsb($$)
$defs{$d}{DeviceName} =~ m/$dev/ &&
$defs{$d}{FD}) {
$msg = "already used by the $d fhem device";
Log 4, $msg; $ret .= $msg . "\n";
Log3 undef, 4, $msg; $ret .= $msg . "\n";
goto NEXTDEVICE;
}
}
@ -434,7 +432,7 @@ CommandUsb($$)
if(!defined($hash->{USBDev})) {
DevIo_CloseDev($hash); # remove the ReadyFn loop
$msg = "cannot open the device";
Log 4, $msg; $ret .= $msg . "\n";
Log3 undef, 4, $msg; $ret .= $msg . "\n";
goto NEXTDEVICE;
}
@ -453,7 +451,7 @@ CommandUsb($$)
if($answer !~ m/$thash->{response}/) {
$msg = "got wrong answer for a $name";
Log 4, $msg; $ret .= $msg . "\n";
Log3 undef, 4, $msg; $ret .= $msg . "\n";
next;
}
@ -461,10 +459,10 @@ CommandUsb($$)
$define =~ s/PARAM/$PARAM/g;
$define =~ s,DEVICE,$dir/$dev,g;
$msg = "create as a fhem device with: define $define";
Log 4, $msg; $ret .= $msg . "\n";
Log3 undef, 4, $msg; $ret .= $msg . "\n";
if(!$scan) {
Log 1, "define $define";
Log3 undef, 1, "define $define";
CommandDefine($cl, $define);
}
@ -474,7 +472,7 @@ CommandUsb($$)
}
NEXTDEVICE:
}
Log 1, "usb $n end";
Log3 undef, 1, "usb $n end";
return ($scan ? $ret : undef);
}

View File

@ -60,7 +60,7 @@ average_Notify($$)
# Filtering
next if(!defined($s));
my ($evName, $val) = split(" ", $s, 2); # resets $1
# Log 1,"mytestavg pre-filter: ".$devName.$evName." s=".$s;
# Log3 $avgName, 1,"mytestavg pre-filter: ".$devName.$evName." s=".$s;
next if($devName !~ m/^$re$/ && "$devName:$s" !~ m/^$re$/ || $s =~ m/_avg_/);
if(defined($1)) {
my $reArg = $1;
@ -73,7 +73,7 @@ average_Notify($$)
next if(!defined($val) || $val !~ m/^(-?\d+\.?\d*)/);
$val = $1;
# Log 1,"mytestavg pst-filter: ".$devName.$evName." val=".$val;
# Log3 $avgName, 1,"mytestavg pst-filter: ".$devName.$evName." val=".$val;
################
# Avg computing

View File

@ -12,7 +12,7 @@ dummy_Initialize($)
$hash->{SetFn} = "dummy_Set";
$hash->{DefFn} = "dummy_Define";
$hash->{AttrList} = "loglevel:0,1,2,3,4,5,6 setList ". $readingFnAttributes;
$hash->{AttrList} = "setList ". $readingFnAttributes;
}
###################################
@ -27,7 +27,7 @@ dummy_Set($@)
return "Unknown argument ?, choose one of $setList" if($a[0] eq "?");
my $v = join(" ", @a);
Log GetLogLevel($name,4), "dummy set $name $v";
Log3 $name, 4, "dummy set $name $v";
readingsSingleUpdate($hash,"state",$v,1);
return undef;
@ -84,7 +84,6 @@ dummy_Define($$)
<a name="dummyattr"></a>
<b>Attributes</b>
<ul>
<li><a href="#loglevel">loglevel</a></li>
<li><a name="setList">setList</a><br>
Space separated list of commands, which will be returned upon "set name ?",
so the FHEMWEB frontend can construct a dropdown and offer on/off

View File

@ -42,7 +42,7 @@ structure_Initialize($)
$hash->{SetFn} = "structure_Set";
$hash->{AttrFn} = "structure_Attr";
$hash->{AttrList} = "clientstate_priority ".
"clientstate_behavior:relative,absolute,last loglevel:0,5 ".
"clientstate_behavior:relative,absolute,last ".
$readingFnAttributes;
addToAttrList("structexclude");
@ -130,7 +130,6 @@ structure_getChangedDevice($)
sub structure_Notify($$)
{
my ($hash, $dev) = @_;
#Log 1, Dumper($hash);
my $me = $hash->{NAME};
my $devmap = $hash->{ATTR}."_map";
@ -184,7 +183,7 @@ sub structure_Notify($$)
return "" if($hash->{INSET}); # Do not trigger for our own set
if($hash->{INNTFY}) {
Log 1, "ERROR: endless loop detected in structure_Notify $me";
Log3 $me, 1, "ERROR: endless loop detected in structure_Notify $me";
return "";
}
$hash->{INNTFY} = 1;
@ -208,7 +207,7 @@ sub structure_Notify($$)
}
undef @foo;
undef @structPrio;
#Log 1, Dumper(%priority) . "\n";
#Log3 $me, 1, Dumper(%priority) . "\n";
my $minprio = 99999;
my $devstate;
@ -263,7 +262,7 @@ sub structure_Notify($$)
# wird beim ersten Auftreten sonst nicht weiter geprueft
}
}
# Log 1, "Dev: ".$d." Anzahl: ".@value." Value:".$value[0]." devstate:
# Log3 $me, 1, "Dev:".$d." Anzahl:".@value." Val:".$value[0]." devstate:
# ".$devstate;
$minprio = $priority{$devstate}
if(defined($devstate) &&
@ -301,7 +300,7 @@ sub structure_Notify($$)
}
Log GetLogLevel($me,5), "Update structure '$me' to $newState" .
Log3 $me, 5, "Update structure '$me' to $newState" .
" because device $dev->{NAME} has changed";
readingsBeginUpdate($hash);
readingsBulkUpdate($hash, "LastDevice", $dev->{NAME});
@ -382,7 +381,7 @@ structure_Set($@)
foreach my $d (sort keys %{ $hash->{CONTENT} }) {
next if(!$defs{$d});
if($defs{$d}{INSET}) {
Log 1, "ERROR: endless loop detected for $d in " . $hash->{NAME};
Log3 $hash, 1, "ERROR: endless loop detected for $d in " . $hash->{NAME};
next;
}
@ -403,7 +402,7 @@ structure_Set($@)
}
}
delete($hash->{INSET});
Log GetLogLevel($hash->{NAME},5), "SET: $ret" if($ret);
Log3 $hash, 5, "SET: $ret" if($ret);
return $list[1] eq "?"
? "Unknown argument ?, choose one of " . join(" ", sort keys(%pars))
: undef;
@ -424,7 +423,7 @@ structure_Attr($@)
my $hash = $defs{$me};
if($hash->{INATTR}) {
Log 1, "ERROR: endless loop detected in structure_Attr for $me";
Log3 $me, 1, "ERROR: endless loop detected in structure_Attr for $me";
next;
}
$hash->{INATTR} = 1;
@ -450,7 +449,7 @@ structure_Attr($@)
}
}
delete($hash->{INATTR});
Log GetLogLevel($me,4), "Stucture attr $type: $ret" if($ret);
Log3 $me, 4, "Stucture attr $type: $ret" if($ret);
return undef;
}

View File

@ -20,7 +20,7 @@ telnet_Initialize($)
$hash->{UndefFn} = "telnet_Undef";
$hash->{AttrFn} = "telnet_Attr";
$hash->{NotifyFn}= "telnet_SecurityCheck";
$hash->{AttrList} = "loglevel:0,1,2,3,4,5,6 globalpassword password ".
$hash->{AttrList} = "globalpassword password ".
"allowfrom SSL connectTimeout connectInterval ".
"encoding:utf8,latin1";
$hash->{ActivateInformFn} = "telnet_ActivateInform";
@ -80,7 +80,7 @@ telnet_ClientConnect($)
$hash->{DEF} =~ m/^(IPV6:)?(.*):(\d+)$/;
my ($isIPv6, $server, $port) = ($1, $2, $3);
Log GetLogLevel($name,4), "$name: Connecting to $server:$port...";
Log3 $name, 4, "$name: Connecting to $server:$port...";
my @opts = (
PeerAddr => "$server:$port",
Timeout => AttrVal($name, "connectTimeout", 2),
@ -100,7 +100,7 @@ telnet_ClientConnect($)
$selectlist{$name} = $hash;
$hash->{STATE} = "Connected";
RemoveInternalTimer($hash);
Log(GetLogLevel($name,3), "$name: connected to $server:$port");
Log3 $name, 3, "$name: connected to $server:$port";
} else {
telnet_ClientDisconnect($hash, 1);
@ -122,9 +122,9 @@ telnet_ClientDisconnect($$)
InternalTimer(gettimeofday()+AttrVal($name, "connectInterval", 60),
"telnet_ClientConnect", $hash, 0);
if($connect) {
Log GetLogLevel($name,4), "$name: Connect failed.";
Log3 $name, 4, "$name: Connect failed.";
} else {
Log GetLogLevel($name,3), "$name: Disconnected";
Log3 $name, 3, "$name: Disconnected";
}
}
@ -150,7 +150,7 @@ telnet_Define($$$)
if($isServer) {
my $ret = TcpServer_Open($hash, $port, $global);
if($ret && !$init_done) {
Log 1, "$ret. Exiting.";
Log3 $name, 1, "$ret. Exiting.";
exit(1);
}
return $ret;
@ -233,7 +233,7 @@ telnet_Read($)
if($pw =~ m/^{.*}$/) { # Expression as pw
my $password = $cmd;
$ret = eval $pw;
Log 1, "password expression: $@" if($@);
Log3 $name, 1, "password expression: $@" if($@);
}
if($ret) {
@ -313,7 +313,7 @@ telnet_Attr(@)
TcpServer_SetSSL($hash);
if($hash->{CD}) {
my $ret = IO::Socket::SSL->start_SSL($hash->{CD});
Log 1, "$hash->{NAME} start_SSL: $ret" if($ret);
Log3 $a[1], 1, "$hash->{NAME} start_SSL: $ret" if($ret);
}
}
return undef;
@ -402,9 +402,6 @@ telnet_ActivateInform($)
<a name="telnetattr"></a>
<b>Attributes:</b>
<ul>
<li><a href="#loglevel">loglevel</a></li>
<br>
<a name="password"></a>
<li>password<br>
Specify a password, which has to be entered as the very first string

View File

@ -37,7 +37,7 @@ weblink_Define($$)
}
if($wltype eq "fileplot" || $wltype eq "dbplot") {
Log 1, "Converting weblink $name ($wltype) to SVG";
Log3 $name, 1, "Converting weblink $name ($wltype) to SVG";
my $newm = LoadModule("SVG");
return "Cannot load module SVG" if($newm eq "UNDEFINED");
$hash->{TYPE} = "SVG";

View File

@ -78,7 +78,7 @@ sr_alt($$$$$$$)
# default
$long = AttrVal("global", "longitude", "8.686");
$lat = AttrVal("global", "latitude", "50.112");
Log 5, "Compute sunrise/sunset for latitude $lat , longitude $long";
Log3 undef, 5, "Compute sunrise/sunset for latitude $lat , longitude $long";
my $nt = time;

View File

@ -104,7 +104,7 @@ DevIo_OpenDev($$$)
($dev, $baudrate) = split("@", $dev);
$hash->{PARTIAL} = "";
Log 3, "Opening $name device $dev"
Log3 $name, 3, "Opening $name device $dev"
if(!$reopen);
if($dev =~ m/^UNIX:(SEQPACKET|STREAM):(.*)$/) { # FBAHA
@ -116,12 +116,12 @@ DevIo_OpenDev($$$)
Type=>($type eq "STREAM" ? SOCK_STREAM:SOCK_SEQPACKET), Peer=>$fname);
};
if($@) {
Log 1, $@;
Log3 $name, 1, $@;
return $@;
}
if(!$conn) {
Log(3, "Can't connect to $dev: $!") if(!$reopen);
Log3 $name, 3, "Can't connect to $dev: $!" if(!$reopen);
$readyfnlist{"$name.$dev"} = $hash;
$hash->{STATE} = "disconnected";
return "";
@ -147,7 +147,7 @@ DevIo_OpenDev($$$)
delete($hash->{NEXT_OPEN})
} else {
Log(3, "Can't connect to $dev: $!") if(!$reopen);
Log3 $name, 3, "Can't connect to $dev: $!") if(!$reopen);
$readyfnlist{"$name.$dev"} = $hash;
$hash->{STATE} = "disconnected";
$hash->{NEXT_OPEN} = time()+60;
@ -163,7 +163,7 @@ DevIo_OpenDev($$$)
if(!open($po, "+<$dev")) {
return undef if($reopen);
Log(3, "Can't open $dev: $!");
Log3 $name, 3, "Can't open $dev: $!";
$readyfnlist{"$name.$dev"} = $hash;
$hash->{STATE} = "disconnected";
return "";
@ -194,13 +194,13 @@ DevIo_OpenDev($$$)
}
}
if($@) {
Log 1, $@;
Log3 $name, 1, $@;
return $@;
}
if(!$po) {
return undef if($reopen);
Log(3, "Can't open $dev: $!");
Log3 $name, 3, "Can't open $dev: $!";
$readyfnlist{"$name.$dev"} = $hash;
$hash->{STATE} = "disconnected";
return "";
@ -216,7 +216,7 @@ DevIo_OpenDev($$$)
if($baudrate) {
$po->reset_error();
Log 3, "Setting $name baudrate to $baudrate";
Log3 $name, 3, "Setting $name baudrate to $baudrate";
$po->baudrate($baudrate);
$po->databits(8);
$po->parity('none');
@ -248,9 +248,9 @@ DevIo_OpenDev($$$)
}
if($reopen) {
Log 1, "$dev reappeared ($name)";
Log3 $name, 1, "$dev reappeared ($name)";
} else {
Log 3, "$name device opened";
Log3 $name, 3, "$name device opened";
}
$hash->{STATE}="opened";
@ -260,7 +260,7 @@ DevIo_OpenDev($$$)
my $ret = &$initfn($hash);
if($ret) {
DevIo_CloseDev($hash);
Log 1, "Cannot init $dev, ignoring it";
Log3 $name, 1, "Cannot init $dev, ignoring it";
}
}
@ -320,7 +320,7 @@ DevIo_Disconnected($)
return if(!defined($hash->{FD})); # Already deleted or RFR
Log 1, "$dev disconnected, waiting to reappear";
Log3 $name, 1, "$dev disconnected, waiting to reappear";
DevIo_CloseDev($hash);
$readyfnlist{"$name.$dev"} = $hash; # Start polling
$hash->{STATE} = "disconnected";

View File

@ -66,7 +66,8 @@ CustomGetFileFromURL($$@)
my $displayurl= $quiet ? "<hidden>" : $url;
if($url !~ /^(http|https):\/\/(([^:\/]+):([^:\/]+)@)?([^:\/]+)(:\d+)?(\/.*)$/) {
Log $loglevel, "CustomGetFileFromURL $displayurl: malformed or unsupported URL";
Log3 undef, $loglevel,
"CustomGetFileFromURL $displayurl: malformed or unsupported URL";
return undef;
}
@ -88,7 +89,7 @@ CustomGetFileFromURL($$@)
if($protocol eq "https") {
eval "use IO::Socket::SSL";
if($@) {
Log $loglevel, $@;
Log3 undef, $loglevel, $@;
} else {
$conn = IO::Socket::SSL->new(PeerAddr=>"$host:$port", Timeout=>$timeout);
}
@ -96,7 +97,8 @@ CustomGetFileFromURL($$@)
$conn = IO::Socket::INET->new(PeerAddr=>"$host:$port", Timeout=>$timeout);
}
if(!$conn) {
Log $loglevel, "CustomGetFileFromURL $displayurl: Can't connect to $protocol://$host:$port\n";
Log3 undef, $loglevel,
"CustomGetFileFromURL $displayurl: Can't connect to $protocol://$host:$port\n";
undef $conn;
return undef;
}
@ -122,7 +124,7 @@ CustomGetFileFromURL($$@)
vec($rin, $conn->fileno(), 1) = 1;
my $nfound = select($rout=$rin, undef, undef, $timeout);
if($nfound <= 0) {
Log $loglevel, "CustomGetFileFromURL $displayurl: Select timeout/error: $!";
Log3 undef, $loglevel, "CustomGetFileFromURL $displayurl: Select timeout/error: $!";
undef $conn;
return undef;
}
@ -135,20 +137,21 @@ CustomGetFileFromURL($$@)
$ret=~ s/(.*?)\r\n\r\n//s; # Not greedy: switch off the header.
my @header= split("\r\n", $1);
my $hostpath= $quiet ? "<hidden>" : $host . $path;
Log 4, "CustomGetFileFromURL $displayurl: Got data, length: ".length($ret);
Log3 undef, 4,
"CustomGetFileFromURL $displayurl: Got data, length: ".length($ret);
if(!length($ret)) {
Log 4, "CustomGetFileFromURL $displayurl: Zero length data, header follows...";
Log3 undef, 4, "CustomGetFileFromURL $displayurl: Zero length data, header follows...";
for (@header) {
Log 4, "CustomGetFileFromURL $displayurl: $_";
Log3 undef, 4, "CustomGetFileFromURL $displayurl: $_";
}
}
undef $conn;
return $ret;
}
##################
# Compatibility mode
sub
GetFileFromURL($@)
{

View File

@ -70,7 +70,8 @@ SetExtensions($$@)
my $hms_till = sprintf("%02d:%02d:%02d", $hr, $min, $sec);
my $hms_now = sprintf("%02d:%02d:%02d", $lt[2], $lt[1], $lt[0]);
if($hms_now ge $hms_till) {
Log 4, "$cmd: won't switch as now ($hms_now) is later than $hms_till";
Log $hash, 4,
"$cmd: won't switch as now ($hms_now) is later than $hms_till";
return "";
}
DoSet($name, $cmd1);

View File

@ -16,8 +16,8 @@ TcpServer_Open($$$)
$port = $1;
eval "require IO::Socket::INET6; use Socket6;";
if($@) {
Log 1, $@;
Log 1, "$name: Can't load INET6, falling back to IPV4";
Log3 $hash, 1, $@;
Log3 $hash, 1, "$name: Can't load INET6, falling back to IPV4";
} else {
$hash->{IPV6} = 1;
}
@ -43,7 +43,7 @@ TcpServer_Open($$$)
$hash->{PORT} = $hash->{SERVERSOCKET}->sockport();
$selectlist{"$name.$port"} = $hash;
Log(3, "$name: port ". $hash->{PORT} ." opened");
Log3 $hash, 3, "$name: port ". $hash->{PORT} ." opened";
return undef;
}
@ -53,10 +53,9 @@ TcpServer_Accept($$)
my ($hash, $type) = @_;
my $name = $hash->{NAME};
my $ll = GetLogLevel($name,4);
my @clientinfo = $hash->{SERVERSOCKET}->accept();
if(!@clientinfo) {
Log 1, "Accept failed ($name: $!)";
Log3 $name, 1, "Accept failed ($name: $!)";
return undef;
}
$hash->{CONNECTS}++;
@ -73,7 +72,7 @@ TcpServer_Accept($$)
if($caddr !~ m/$af/) {
my $hostname = gethostbyaddr($iaddr, AF_INET);
if(!$hostname || $hostname !~ m/$af/) {
Log 1, "Connection refused from $caddr:$port";
Log3 $name, 1, "Connection refused from $caddr:$port";
close($clientinfo[0]);
return undef;
}
@ -90,7 +89,7 @@ TcpServer_Accept($$)
SSL_cert_file => "$mp/certs/server-cert.pem",
});
if(!$ret && $! ne "Socket is not connected") {
Log 1, "$type SSL/HTTPS error: $!";
Log3 $name, 1, "$type SSL/HTTPS error: $!";
close($clientinfo[0]);
return undef;
}
@ -112,7 +111,7 @@ TcpServer_Accept($$)
$selectlist{$nhash{NAME}} = \%nhash;
Log($ll, "Connection accepted from $nhash{NAME}");
Log3 $name, 4, "Connection accepted from $nhash{NAME}";
return \%nhash;
}
@ -122,8 +121,8 @@ TcpServer_SetSSL($)
my ($hash) = @_;
eval "require IO::Socket::SSL";
if($@) {
Log 1, $@;
Log 1, "Can't load IO::Socket::SSL, falling back to HTTP";
Log3 $hash, 1, $@;
Log3 $hash, 1, "Can't load IO::Socket::SSL, falling back to HTTP";
} else {
$hash->{SSL} = 1;
}

View File

@ -321,6 +321,21 @@ A line ending with \ will be concatenated with the next one, so long lines
Attributes used by all devices:
<ul>
<a name="verbose"></a>
<li>verbose<br>
Set the verbosity level. Possible values:
<ul>
<li>0 - server start/stop
<li>1 - error messages or unknown packets
<li>2 - major events/alarms.
<li>3 - commands sent out will be logged.
<li>4 - you'll see whats received by the different devices.
<li>5 - debugging.</li>
</ul>
The value for the <a href="#global">global</a> device is a default for
other devices without own verbose attribute set.
</li>
<a name="comment"></a>
<li>comment<br>
Add an arbitrary comment.
@ -1244,20 +1259,6 @@ A line ending with \ will be concatenated with the next one, so long lines
(in order to prevent typos).
</li><br>
<a name="verbose"></a>
<li>verbose<br>
Set the verbosity level. Possible values:
<ul>
<li>0 - server start/stop
<li>1 - error messages or unknown packets
<li>2 - major events/alarms.
<li>3 - commands sent out will be logged.
<li>4 - you'll see whats received by the different devices.
<li>5 - debugging.</li>
</ul>
Recommended level is 3 for normal use.
</li><br>
<a name="dupTimeout"></a>
<li>dupTimeout<br>
Define the timeout for which 2 identical events from two different

View File

@ -331,36 +331,57 @@ Zeilen erstreckende Befehle, indem man keine \ am Zeilenende eingeben muss.</p>
<p>Attribute, die f&uuml;r
alle Ger&auml;te anwendbar sind: </p>
<ul>
<a name="verbose"></a>
<li>verbose<br>
Setzt den Schwellwert f&uuml;r die Logfile-Meldungen.
M&ouml;gliche Werte sind:
<ul>
<li>0 - Server start/stop
</li><li>1 - Fehlermeldungen oder unbekannte Pakete
</li><li>2 - bedeutende Ereigbisse/Alarme.
</li><li>3 - ausgesendete Kommandos werden gelogged.
</li><li>4 - von den einzelnen Ger&auml;ten empfangene Daten.
</li><li>5 - Fehlersuche.</li>
</ul>
Der f&uuml;r die <a href="#global">global</a> Instanz gesetzte Wert gilt
als Voreinstellung f&uuml;r die Instanzen, die dieses Attribut nicht
gesetzt haben.
</li>
<a name="comment"></a>
<li>comment<br>
F&uuml;gt einen beliebigen Kommentar hinzu.
<a name="alias"></a>
</li><li>alias<br>
Wird in FHEMWEB benutzt, um ein en anderen Namen f&uuml;r ein Ger&auml;t anzuzeigen
z.B. wenn Sonderzeichen/Leerzeichen nicht in der Ger&auml;tedefinition verwendet
werden k&ouml;nnen.
Wird in FHEMWEB benutzt, um ein en anderen Namen f&uuml;r ein Ger&auml;t
anzuzeigen z.B. wenn Sonderzeichen/Leerzeichen nicht in der
Ger&auml;tedefinition verwendet werden k&ouml;nnen.
<a name="room"></a>
</li><li>room<br>
Filtert/gruppiert Ger&auml;te. Verwendbar unter web-pgm2 und web-pgm3.
Ein Ger&auml;te kann zu mehr als einem Raum zugeordnet werden. In diesem Fall
m&uuml;ssen die Raumzuordnungen&nbsp; durch Kommata getrennt angegeben werden.<br>
Ger&auml;te, die dem Raum mit der Bezeichnung "hidden" zugeordnet werden,
erscheinen nicht auf der Webseite, es sei denn Sie ber&uuml;cksichtigen <a href="#hiddenroom"> FHEMWEB attribute to selectively disable
rooms for certain FHEMWEB instances.
</a></li><a href="#hiddenroom">
Filtert/gruppiert Ger&auml;te.
Ein Ger&auml;t kann zu mehr als einem Raum zugeordnet werden. In diesem
Fall m&uuml;ssen die Raumzuordnungen durch Kommata getrennt
angegeben werden.<br>
Ger&auml;te, die dem Raum mit der Bezeichnung "hidden" zugeordnet
werden, erscheinen nicht auf der Webseite.
</a><a name="group"></a>
<a name="group"></a>
<li>group<br>
Ger&auml;tegruppen, anwendbar unter web-pgm2 (Modul <a href="#FHEMWEB">FHEMWEB</a>) zeigt Ger&auml;te die in die gleiche Gruppe geh&ouml;ren auch in einer
gemeinsamen Box an. Das benutzt man, um sp&auml;ter Ger&auml;te zu gruppieren. Ein
Ger&auml;t kann zu mehr als einer Gruppe geh&ouml;ren. In diesem Fall m&uuml;ssen die
entsprechenden Gruppen, durch Kommata getrennt, eingetragen werden<p>
Wenn dieses Attribut nicht gesetzt ist, wird der in der Ger&auml;tegruppe
gesetzte Ger&auml;tetyp verwendet.&nbsp;</li><a name="showtime"></a></p>
Ger&auml;tegruppen. FHEMWEB zeigt Ger&auml;te die in die gleiche Gruppe
geh&ouml;ren auch in einer gemeinsamen Box an. Ein Ger&auml;t kann zu
mehr als einer Gruppe geh&ouml;ren. In diesem Fall m&uuml;ssen die
entsprechenden Gruppen durch Kommata getrennt eingetragen werden. Wenn
dieses Attribut nicht gesetzt ist, wird der in der Ger&auml;tegruppe
gesetzte Ger&auml;tetyp verwendet.
</li>
<a name="showtime"></a>
<li>showtime<br>
Wird im Webfrontend pgm2 verwendet, um die Zeit der letzten Aktivit&auml;t
anstelle des Status in der Gesamtansicht anzuzeigen. N&uuml;tzlich z.B. f&uuml;r FS20
PIRI Ger&auml;te.</span>
Wird im FHEMWEB verwendet, um die Zeit der letzten Aktivit&auml;t
anstelle des Status in der Gesamtansicht anzuzeigen. N&uuml;tzlich z.B.
f&uuml;r FS20 PIRI Ger&auml;te.</span>
</li>
<br><br>
@ -1302,21 +1323,6 @@ Zeilen erstreckende Befehle, indem man keine \ am Zeilenende eingeben muss.</p>
definiert werden, bevor sie angewendet werden k&ouml;nnen.
</li><br>
<a name="verbose"></a>
<li>verbose<br>
Setzt den Wert f&uuml;r die H&auml;ufigkeit/Intensit&auml;t von
Nachrichten. M&ouml;gliche Werte sind:
<ul>
<li>0 - Server start/stop
</li><li>1 - Fehlermeldungen oder unbekannte Pakete
</li><li>2 - bedeutende Ereigbisse/Alarme.
</li><li>3 - ausgesendete Kommandos werden gelogged.
</li><li>4 - Sie sehen was von den einzelnen Ger&auml;ten empfangen wird.
</li><li>5 - Fehlersuche.</li>
</ul>
Es wird der Wert 3 f&uuml;r den Normalgebrauch empfohlen.
</li><br>
<a name="dupTimeout"></a>
<li>dupTimeout<br>
Definert die Wartezeit, nach der 2 identische Ereignisse zweier

View File

@ -50,7 +50,6 @@ sub AssignIoPort($);
sub AttrVal($$$);
sub CallFn(@);
sub CheckDuplicate($$@);
sub rejectDuplicate($$$);
sub CommandChain($$);
sub Dispatch($$$);
sub DoTrigger($$@);
@ -64,11 +63,12 @@ sub HandleArchiving($);
sub HandleTimeout();
sub IOWrite($@);
sub InternalTimer($$$$);
sub IsDisabled($);
sub IsDummy($);
sub IsIgnored($);
sub IsDisabled($);
sub LoadModule($);
sub Log($$);
sub Log3($$$);
sub OpenLogfile($);
sub PrintHash($$);
sub ReadingsVal($$$);
@ -86,21 +86,20 @@ sub addToAttrList($);
sub createInterfaceDefinitions();
sub devspec2array($);
sub doGlobalDef($);
sub evalStateFormat($);
sub fhem($@);
sub fhz($);
sub getAllGets($);
sub getAllSets($);
sub latin1ToUtf8($);
sub readingsBeginUpdate($);
sub readingsBulkUpdate($$$@);
sub readingsEndUpdate($$);
sub readingsSingleUpdate($$$$);
sub redirectStdinStdErr();
sub rejectDuplicate($$$);
sub setGlobalAttrBeforeFork($);
sub setReadingsVal($$$$);
sub evalStateFormat($);
sub latin1ToUtf8($);
sub Log($$);
sub Log3($$$);
sub CommandAttr($$);
sub CommandDefaultAttr($$);
@ -176,7 +175,8 @@ use vars qw(%inform); # Used by telnet_ActivateInform
use vars qw($reread_active);
my $AttrList = "room group comment alias eventMap userReadings";
my $AttrList = "verbose:0,1,2,3,4,5 room group comment alias ".
"eventMap userReadings";
my %comments; # Comments from the include files
my $ipv6; # Using IPV6
@ -208,7 +208,7 @@ $modules{Global}{LOADED} = 1;
$modules{Global}{AttrList} =
"archivecmd apiversion archivedir configfile lastinclude logfile " .
"modpath nrarchive pidfilename port statefile title userattr " .
"verbose:1,2,3,4,5 mseclog:1,0 version nofork:1,0 logdir holiday2we " .
"mseclog:1,0 version nofork:1,0 logdir holiday2we " .
"autoload_undefined_devices:1,0 dupTimeout latitude longitude altitude " .
"backupcmd backupdir backupsymlink backup_before_update " .
"exclude_from_update motd updatebranch uniqueID ".
@ -586,7 +586,7 @@ Log3($$$)
if(defined($dev) &&
defined($attr{$dev}) &&
defined (my $devlevel = $attr{$dev}{loglevel})) {
defined (my $devlevel = $attr{$dev}{verbose})) {
return if($loglevel > $devlevel);
} else {
@ -2330,7 +2330,7 @@ CommandChain($$)
my $oid = $init_done;
$init_done = 0; # Rudi: ???
$attr{global}{verbose} = 1;
$attr{global}{verbose} = 1; # ???
foreach my $cmd (@{$list}) {
for(my $n = 0; $n < $retry; $n++) {
Log 1, sprintf("Trying again $cmd (%d out of %d)", $n+1,$retry) if($n>0);