mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
conversion from Log to Log3
git-svn-id: https://svn.fhem.de/fhem/trunk@3858 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
19b9b06386
commit
34d36c436d
@ -73,8 +73,7 @@ sub Twilight_Initialize($)
|
||||
$hash->{DefFn} = "Twilight_Define";
|
||||
$hash->{UndefFn} = "Twilight_Undef";
|
||||
$hash->{GetFn} = "Twilight_Get";
|
||||
$hash->{AttrList}= "loglevel:0,1,2,3,4,5 ".
|
||||
$readingFnAttributes;
|
||||
$hash->{AttrList}= $readingFnAttributes;
|
||||
}
|
||||
#
|
||||
#
|
||||
@ -236,7 +235,7 @@ sub Twilight_TwilightTimes($$)
|
||||
($hash->{TW}{$sr}{TIME}, $hash->{TW}{$ss}{TIME})=
|
||||
Twilight_calc($latitude, $longitude, $deg, $declination, $timezone, $midseconds, $timediff);
|
||||
|
||||
Log 3, "$hash->{TW}{$sr}{NAME}, $hash->{TW}{$ss}{NAME} are not defined(nan)" if ($hash->{TW}{$sr}{TIME} eq "nan");
|
||||
Log3 $hash, 3, "$hash->{TW}{$sr}{NAME}, $hash->{TW}{$ss}{NAME} are not defined(nan)" if ($hash->{TW}{$sr}{TIME} eq "nan");
|
||||
$hash->{TW}{$sr}{TIME} += 0.01*$idx if ($hash->{TW}{$sr}{TIME} ne "nan");
|
||||
$hash->{TW}{$ss}{TIME} -= 0.01*$idx if ($hash->{TW}{$ss}{TIME} ne "nan");
|
||||
|
||||
@ -349,12 +348,10 @@ sub Twilight_fireEvent($)
|
||||
my $light = $hash->{TW}{$sx_name}{LIGHT};
|
||||
my $state = $hash->{TW}{$sx_name}{STATE};
|
||||
|
||||
my $ll = GetLogLevel ($hash->{NAME}, 5);
|
||||
|
||||
my $nextEvent = $hash->{TW}{$sx_name}{NEXTE};
|
||||
my $nextEventTime = "undefined";
|
||||
$nextEventTime = strftime("%H:%M:%S",localtime($hash->{TW}{$nextEvent}{TIME})) if ($hash->{TW}{$nextEvent}{TIME} ne "nan");
|
||||
Log 3, "[".$hash->{NAME}."] " . sprintf ("%-10s state=%-2s light=%-2s nextEvent=%-10s %-14s deg=%+.1f°",$sx_name, $state, $light, $nextEvent, strftime("%d.%m.%Y %H:%M:%S",localtime($hash->{TW}{$nextEvent}{TIME})), $deg);
|
||||
Log3 $hash, 4, "[".$hash->{NAME}."] " . sprintf ("%-10s state=%-2s light=%-2s nextEvent=%-10s %-14s deg=%+.1f°",$sx_name, $state, $light, $nextEvent, strftime("%d.%m.%Y %H:%M:%S",localtime($hash->{TW}{$nextEvent}{TIME})), $deg);
|
||||
|
||||
my $eventTime = $hash->{TW}{$sx_name}{TIME};
|
||||
my $now = time();
|
||||
@ -368,7 +365,7 @@ sub Twilight_fireEvent($)
|
||||
readingsBulkUpdate ($hash, "nextEvent", $nextEvent);
|
||||
readingsBulkUpdate ($hash, "nextEventTime", $nextEventTime);
|
||||
|
||||
my $doNotTrigger = $hash->{LOCAL};
|
||||
my $doNotTrigger = ((defined($hash->{LOCAL})) ? 1 : 0);
|
||||
$doNotTrigger = $doNotTrigger || ($delta > 5);
|
||||
readingsEndUpdate ($hash, !$doNotTrigger);
|
||||
|
||||
@ -400,7 +397,6 @@ sub Twilight_getWeatherHorizon($)
|
||||
my $hash=shift; # 0
|
||||
|
||||
my $mod = "[".$hash->{NAME} ."] ";
|
||||
my $ll = GetLogLevel ($hash->{NAME}, 5);
|
||||
my @a_current = (25,25,25,25,20,10,10,10,10,10,
|
||||
10, 7, 7, 7, 5,10,10, 6, 6, 6,
|
||||
10, 6 ,6, 6, 6, 6, 6, 5, 5, 3,
|
||||
@ -411,7 +407,6 @@ sub Twilight_getWeatherHorizon($)
|
||||
my $location=$hash->{WEATHER};
|
||||
my $url = "http://weather.yahooapis.com/forecastrss?w=".$location."&u=c";
|
||||
my $xml = GetFileFromURL($url, 3, undef, 1);
|
||||
#Log $ll, $mod. "xml:\n" .$xml;
|
||||
|
||||
my $current, my $cond, my $temp, my $aktTemp;
|
||||
if($xml=~/text="(.*)"(\ *)code="(.*)"(\ *)temp="(.*)"(\ *)date/){
|
||||
@ -433,7 +428,7 @@ sub Twilight_getWeatherHorizon($)
|
||||
}
|
||||
}
|
||||
|
||||
Log 3, "[$hash->{NAME}] "
|
||||
Log3 $hash, 3, "[$hash->{NAME}] "
|
||||
."No Weather location found at yahoo weather for location ID: $location\n"
|
||||
."=======\n"
|
||||
.$xml
|
||||
@ -460,7 +455,7 @@ sub Twilight_sunpos($)
|
||||
############################
|
||||
my $dLongitude = $hash->{LONGITUDE};
|
||||
my $dLatitude = $hash->{LATITUDE};
|
||||
Log 5, "Compute sunpos for latitude $dLatitude , longitude $dLongitude";
|
||||
Log3 $hash, 5, "Compute sunpos for latitude $dLatitude , longitude $dLongitude";
|
||||
|
||||
my $pi=3.14159265358979323846;
|
||||
my $twopi=(2*$pi);
|
||||
|
@ -38,7 +38,7 @@ Heating_Control_Initialize($)
|
||||
$hash->{UndefFn} = "Heating_Control_Undef";
|
||||
$hash->{GetFn} = "Heating_Control_Get";
|
||||
$hash->{UpdFn} = "Heating_Control_Update";
|
||||
$hash->{AttrList}= "disable:0,1 loglevel:0,1,2,3,4,5 ".
|
||||
$hash->{AttrList}= "disable:0,1".
|
||||
$readingFnAttributes;
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ Heating_Control_Define($$)
|
||||
if(!($time =~ m/^[0-2][0-9]:[0-5][0-9]$/g));
|
||||
|
||||
for (my $d=0; $d<@days; $d++) {
|
||||
#Log 3, "Switchingtime: $switchingtimes[$i] : $days[$d] -> $time -> $para ";
|
||||
#Log3 $hash, 3, "Switchingtime: $switchingtimes[$i] : $days[$d] -> $time -> $para ";
|
||||
$hash->{helper}{SWITCHINGTIME}{$days[$d]}{$time} = $para;
|
||||
}
|
||||
}
|
||||
@ -255,9 +255,6 @@ Heating_Control_Update($)
|
||||
my $nextSwitch = 0;
|
||||
my $nowSwitch = 0;
|
||||
|
||||
my $loglevel = GetLogLevel ($hash->{NAME}, 5);
|
||||
# $loglevel = 3;
|
||||
|
||||
my $startIdx;
|
||||
for (my $d=-1; $d>=-7; $d--) {
|
||||
my $wd = ($d+$wday) % 7;
|
||||
@ -277,7 +274,7 @@ Heating_Control_Update($)
|
||||
my $next = $now + $secondsToSwitch;
|
||||
|
||||
if ($secondsToSwitch<=10 && $secondsToSwitch>=-20) {
|
||||
Log $loglevel, $mod." Jetzt:".strftime('%d.%m.%Y %H:%M:%S',localtime($now))." -> Next: ".strftime('%d.%m.%Y %H:%M:%S',localtime($next))." -> Temp: $hash->{helper}{SWITCHINGTIME}{$wd}{$st} ".$secondsToSwitch;
|
||||
Log3 $hash, 4, $mod." Jetzt:".strftime('%d.%m.%Y %H:%M:%S',localtime($now))." -> Next: ".strftime('%d.%m.%Y %H:%M:%S',localtime($next))." -> Temp: $hash->{helper}{SWITCHINGTIME}{$wd}{$st} ".$secondsToSwitch;
|
||||
}
|
||||
if ($secondsToSwitch<=0) {
|
||||
$newDesTemperature = $hash->{helper}{SWITCHINGTIME}{$wd}{$st};
|
||||
@ -297,8 +294,8 @@ Heating_Control_Update($)
|
||||
my $command;
|
||||
|
||||
#$nextSwitch += get_SummerTimeOffset($now, $nextSwitch);
|
||||
Log $loglevel, $mod .strftime('%d.%m.%Y %H:%M:%S',localtime($nowSwitch))." ; AktDesiredTemp: $AktDesiredTemp ; newDesTemperature: $newDesTemperature";
|
||||
Log $loglevel, $mod .strftime('%d.%m.%Y %H:%M:%S',localtime($nextSwitch));
|
||||
Log3 $hash, 4, $mod .strftime('%d.%m.%Y %H:%M:%S',localtime($nowSwitch))." ; AktDesiredTemp: $AktDesiredTemp ; newDesTemperature: $newDesTemperature";
|
||||
Log3 $hash, 4, $mod .strftime('%d.%m.%Y %H:%M:%S',localtime($nextSwitch));
|
||||
|
||||
if ($nowSwitch gt "" && $AktDesiredTemp ne $newDesTemperature ) {
|
||||
if (defined $hash->{helper}{CONDITION}) {
|
||||
@ -314,9 +311,9 @@ Heating_Control_Update($)
|
||||
$command =~ s/@/$hash->{DEVICE}/g;
|
||||
$command =~ s/%/$newDesTemperature/g;
|
||||
$command = SemicolonEscape($command);
|
||||
Log $loglevel, $mod."command: $command";
|
||||
Log3 $hash, 4, $mod."command: $command";
|
||||
my $ret = AnalyzeCommandChain(undef, $command);
|
||||
Log GetLogLevel($name,3), $ret if($ret);
|
||||
Log3 ($hash, 3, $ret) if($ret);
|
||||
}
|
||||
|
||||
my $active = 1;
|
||||
@ -348,9 +345,9 @@ sub Heating_Control_SetAllTemps() { # {Heating_Control_SetAllTemps()}
|
||||
}
|
||||
}
|
||||
Heating_Control_Update($hash);
|
||||
Log 3, "Heating_Control_Update() for $hash->{NAME} done!";
|
||||
Log3 undef, 3, "Heating_Control_Update() for $hash->{NAME} done!";
|
||||
}
|
||||
Log 3, "Heating_Control_SetAllTemps() done!";
|
||||
Log3 undef, 3, "Heating_Control_SetAllTemps() done!";
|
||||
}
|
||||
|
||||
sub SortNumber {
|
||||
@ -448,7 +445,6 @@ sub SortNumber {
|
||||
<b>Attributes</b>
|
||||
<ul>
|
||||
<li><a href="#disable">disable</a></li>
|
||||
<li><a href="#loglevel">loglevel</a></li>
|
||||
<li><a href="#event-on-update-reading">event-on-update-reading</a></li>
|
||||
<li><a href="#event-on-change-reading">event-on-change-reading</a></li>
|
||||
<li><a href="#stateFormat">stateFormat</a></li>
|
||||
@ -541,7 +537,6 @@ sub SortNumber {
|
||||
<b>Attributes</b>
|
||||
<ul>
|
||||
<li><a href="#disable">disable</a></li>
|
||||
<li><a href="#loglevel">loglevel</a></li>
|
||||
<li><a href="#event-on-update-reading">event-on-update-reading</a></li>
|
||||
<li><a href="#event-on-change-reading">event-on-change-reading</a></li>
|
||||
<li><a href="#stateFormat">stateFormat</a></li>
|
||||
|
@ -19,10 +19,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with fhem. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# define t1 RandomTimer *23:01:10 Zirkulation 23:02:10 100; attr t1 loglevel 3;
|
||||
# define t2 RandomTimer *23:01:20 Zirkulation 23:03:20 100; attr t2 loglevel 3;
|
||||
# define t3 RandomTimer *23:01:30 Zirkulation 23:04:30 100; attr t3 loglevel 3;
|
||||
# define t4 RandomTimer *23:01:40 Zirkulation 23:02:40 100; attr t4 loglevel 3;
|
||||
# define t1 RandomTimer *23:01:10 Zirkulation 23:02:10 100; attr t1 verbose 5;
|
||||
# define t2 RandomTimer *23:01:20 Zirkulation 23:03:20 100; attr t2 verbose 5;
|
||||
# define t3 RandomTimer *23:01:30 Zirkulation 23:04:30 100; attr t3 verbose 5;
|
||||
# define t4 RandomTimer *23:01:40 Zirkulation 23:02:40 100; attr t4 verbose 5;
|
||||
#
|
||||
##############################################################################
|
||||
package main;
|
||||
@ -38,7 +38,7 @@ sub RandomTimer_Initialize($)
|
||||
|
||||
$hash->{DefFn} = "RandomTimer_Define";
|
||||
$hash->{UndefFn} = "RandomTimer_Undef";
|
||||
$hash->{AttrList} = "loglevel:0,1,2,3,4,5,6 onCmd offCmd switchmode disable:0,1 disableCond ".
|
||||
$hash->{AttrList} = "onCmd offCmd switchmode disable:0,1 disableCond ".
|
||||
$readingFnAttributes;
|
||||
}
|
||||
#
|
||||
@ -126,8 +126,6 @@ sub RandomTimer_ExecRepeater($)
|
||||
($thour, $tmin, $tsec) = split(/:/, $hash->{STARTTIME});
|
||||
}
|
||||
|
||||
my $logLevel = GetLogLevel ($hash->{NAME}, 5);
|
||||
|
||||
my $now = time();
|
||||
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime($now);
|
||||
|
||||
@ -156,7 +154,7 @@ sub RandomTimer_ExecRepeater($)
|
||||
}
|
||||
}
|
||||
|
||||
Log $logLevel, "[".$hash->{NAME}. "]"." Next timer ".strftime("%d.%m.%Y %H:%M:%S",localtime($timeToExec));
|
||||
Log3 $hash, 4, "[".$hash->{NAME}. "]"." Next timer ".strftime("%d.%m.%Y %H:%M:%S",localtime($timeToExec));
|
||||
|
||||
delete $hash->{ABSCHALTZEIT};
|
||||
RemoveInternalTimer($hash);
|
||||
@ -170,7 +168,6 @@ sub RandomTimer_Exec($)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
|
||||
my $ll = GetLogLevel ($hash->{NAME}, 5);
|
||||
my $now1 = time();
|
||||
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime($now1);
|
||||
|
||||
@ -181,14 +178,14 @@ sub RandomTimer_Exec($)
|
||||
$hash->{COMMAND} = "off";
|
||||
$hash->{STATE} = "off";
|
||||
fhem ("set $hash->{DEVICE} $hash->{COMMAND}");
|
||||
Log 3, "[".$hash->{NAME}. "]" . " $hash->{DEVICE} disabled - going down ...";
|
||||
Log3 $hash, 3, "[".$hash->{NAME}. "]" . " $hash->{DEVICE} disabled - going down ...";
|
||||
delete $hash->{ABSCHALTZEIT};
|
||||
} else {
|
||||
Log $ll, "[".$hash->{NAME}. "]" . " $hash->{DEVICE} timer disabled - no start";
|
||||
Log3 $hash, 4, "[".$hash->{NAME}. "]" . " $hash->{DEVICE} timer disabled - no start";
|
||||
}
|
||||
if ($hash->{REP} gt "") {
|
||||
my $midnight = $now1 + 24*3600 - (3600*$hour + 60*$min + $sec);
|
||||
Log $ll, "[".$hash->{NAME}. "]"." Next Timer ".strftime("%d.%m.%Y %H:%M:%S",localtime($midnight));
|
||||
Log3 $hash, 4, "[".$hash->{NAME}. "]"." Next Timer ".strftime("%d.%m.%Y %H:%M:%S",localtime($midnight));
|
||||
InternalTimer($midnight, "RandomTimer_ExecRepeater_verzoegert", $hash, 0);
|
||||
}
|
||||
return;
|
||||
@ -208,10 +205,8 @@ sub RandomTimer_Exec($)
|
||||
}
|
||||
}
|
||||
|
||||
my $logLevel = GetLogLevel ($hash->{NAME}, 5);
|
||||
|
||||
if ($now ge $hash->{ABSCHALTZEIT}) {
|
||||
Log 3, "[".$hash->{NAME}."]"." $hash->{DEVICE} going down ...";
|
||||
Log3 $hash, 3, "[".$hash->{NAME}."]"." $hash->{DEVICE} going down ...";
|
||||
$hash->{COMMAND} = "off";
|
||||
$hash->{STATE} = "off";
|
||||
fhem ("set $hash->{DEVICE} $hash->{COMMAND}");
|
||||
@ -284,11 +279,11 @@ sub abschaltUhrZeitErmitteln ($)
|
||||
|
||||
my $timespec_stop = $hash->{TIMESPEC_STOP};
|
||||
|
||||
Log (3, "Wrong timespec_stop <$timespec_stop>, use \"[+][*]<time or func>\"" )
|
||||
Log3 ($hash, 3, "Wrong timespec_stop <$timespec_stop>, use \"[+][*]<time or func>\"" )
|
||||
if($timespec_stop !~ m/^(\+)?(\*)?(.*)$/i);
|
||||
my ($srel, $srep, $stspec) = ($1, $2, $3);
|
||||
my ($err, $h, $m, $s, $fn) = GetTimeSpec($stspec);
|
||||
Log (3, $err) if($err);
|
||||
Log3 ($hash, 3, $err) if($err);
|
||||
$h -=24 if ($h >= 24);
|
||||
|
||||
if ($hash->{S_REL}) {
|
||||
@ -311,10 +306,8 @@ sub toggleDevice ($)
|
||||
|
||||
my $sigma = ($hash->{COMMAND} eq "on") ? $hash->{SIGMAON} : $hash->{SIGMAOFF};
|
||||
|
||||
my $logLevel = GetLogLevel ($hash->{NAME}, 5);
|
||||
|
||||
my $zufall = int(rand(1000));
|
||||
Log $logLevel, "[".$hash->{NAME}."]"." $hash->{COMMAND} $sigma $zufall";
|
||||
Log3 $hash, 4, "[".$hash->{NAME}."]"." Zustand:$hash->{COMMAND} sigma:$sigma random:$zufall";
|
||||
|
||||
if ($zufall <= $sigma ) {
|
||||
$hash->{COMMAND} = ($hash->{COMMAND} eq "on") ? "off" : "on";
|
||||
@ -327,10 +320,10 @@ sub toggleDevice ($)
|
||||
}
|
||||
$command =~ s/@/$hash->{DEVICE}/g;
|
||||
$command = SemicolonEscape($command);
|
||||
Log $logLevel, "[".$hash->{NAME}. "]"." command: $command";
|
||||
Log3 $hash, 4, "[".$hash->{NAME}. "]"." command: $command";
|
||||
|
||||
my $ret = AnalyzeCommandChain(undef, $command);
|
||||
Log GetLogLevel($hash->{NAME},3), $ret if($ret);
|
||||
Log3 ($hash, 3, $ret) if($ret);
|
||||
}
|
||||
$hash->{STATE} = $hash->{COMMAND};
|
||||
}
|
||||
@ -347,7 +340,7 @@ sub get_switchmode ($) {
|
||||
my $switchmode = AttrVal($hash->{NAME}, $attr, $default);
|
||||
|
||||
if(!($switchmode =~ m/^([0-9]{3,3})\/([0-9]{3,3})$/i)) {
|
||||
Log 1, $mod . "invalid switchMode <$switchmode>, use 999/999";
|
||||
Log3 undef, 3, $mod . "invalid switchMode <$switchmode>, use 999/999";
|
||||
$attr{$hash->{NAME}}{$attr} = $default;
|
||||
} else {
|
||||
my ($sigmaoff, $sigmaon) = ($1, $2);
|
||||
@ -360,7 +353,6 @@ sub get_switchmode ($) {
|
||||
sub RandomTimer_disable($) {
|
||||
|
||||
my ($hash) = @_;
|
||||
my $logLevel = GetLogLevel ($hash->{NAME}, 5);
|
||||
|
||||
my $disable = AttrVal($hash->{NAME}, "disable", 0 );
|
||||
my $disableCond = AttrVal($hash->{NAME}, "disableCond", "");
|
||||
|
Loading…
Reference in New Issue
Block a user