mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
93_DbRep: use fhem default vars in attr executeBeforeProc/AfterProc
git-svn-id: https://svn.fhem.de/fhem/trunk@28267 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
795c0296b5
commit
237263bcd3
@ -1,5 +1,6 @@
|
||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||
# Do not insert empty lines here, update check depends on it.
|
||||
- bugfix: 93_DbRep: use fhem default vars in attr executeBeforeProc/AfterProc
|
||||
- feature: 76_SolarForecast: plant check reviews SolarForecast widget files
|
||||
- bugfix: 38_netatmo: fixed login problems by adapting to latest auth changes
|
||||
- feature: 76_SolarForecast: new get ftuiFramefiles command
|
||||
|
@ -59,6 +59,8 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
|
||||
|
||||
# Version History intern
|
||||
my %DbRep_vNotesIntern = (
|
||||
"8.52.15" => "08.12.2023 fix use fhem default variables in attr executeBeforeProc/executeAfterProc ".
|
||||
"forum: https://forum.fhem.de/index.php?msg=1296146 ",
|
||||
"8.52.14" => "08.11.2023 fix period calculation when using attr timeYearPeriod ",
|
||||
"8.52.13" => "07.11.2023 dumpMySQL clientSide: add create database to dump file ",
|
||||
"8.52.12" => "05.11.2023 dumpMySQL clientSide: change the dump file to stricter rights ",
|
||||
@ -1651,6 +1653,13 @@ sub DbRep_Attr {
|
||||
if($cmd eq "set") {
|
||||
if ($aVal =~ m/^\s*(\{.*\}|{.*|.*})\s*$/xs && $aVal !~ /{".*"}/xs) {
|
||||
$aVal = $1;
|
||||
|
||||
my $fdv = __DbRep_fhemDefVars ();
|
||||
my ($today, $hms, $we) = ($fdv->{today}, $fdv->{hms}, $fdv->{we});
|
||||
my ($sec, $min, $hour) = ($fdv->{sec}, $fdv->{min}, $fdv->{hour});
|
||||
my ($mday, $month, $year) = ($fdv->{mday}, $fdv->{month}, $fdv->{year});
|
||||
my ($wday, $yday, $isdst) = ($fdv->{wday}, $fdv->{yday}, $fdv->{isdst});
|
||||
|
||||
eval $aVal;
|
||||
return $@ if ($@);
|
||||
}
|
||||
@ -12650,13 +12659,17 @@ sub _DbRep_procCode {
|
||||
$fn =~ s/\s*#.*//g; # Kommentare entfernen
|
||||
$fn = join ' ', split /\s+/sx, $fn; # Funktion serialisieren
|
||||
|
||||
if ($fn =~ m/^\s*(\{.*\})\s*$/xs) { # unnamed Funktion direkt mit {...}
|
||||
if ($fn =~ m/^\s*(\{.*\})\s*$/xs) { # unnamed Funktion direkt mit {...}
|
||||
$fn = $1;
|
||||
|
||||
|
||||
my $fdv = __DbRep_fhemDefVars ();
|
||||
my ($today, $hms, $we) = ($fdv->{today}, $fdv->{hms}, $fdv->{we});
|
||||
my ($sec, $min, $hour) = ($fdv->{sec}, $fdv->{min}, $fdv->{hour});
|
||||
my ($mday, $month, $year) = ($fdv->{mday}, $fdv->{month}, $fdv->{year});
|
||||
my ($wday, $yday, $isdst) = ($fdv->{wday}, $fdv->{yday}, $fdv->{isdst});
|
||||
|
||||
eval $fn;
|
||||
if ($@) {
|
||||
$err = $@;
|
||||
}
|
||||
$err = $@ if($@);
|
||||
}
|
||||
else {
|
||||
$err = AnalyzeCommandChain (undef, $fn);
|
||||
@ -12665,6 +12678,39 @@ sub _DbRep_procCode {
|
||||
return $err;
|
||||
}
|
||||
|
||||
###################################################################################
|
||||
# FHEM Standardvariablen bereitstellen identisch fhem.pl sub AnalyzePerlCommand
|
||||
# AnalyzePerlCommand kann nicht verwendet werden ohne die bisherige Syntax
|
||||
# (Übergabe von $name, $hash) zu brechen.
|
||||
###################################################################################
|
||||
sub __DbRep_fhemDefVars {
|
||||
my ($sec, $min, $hour, $mday, $month, $year, $wday, $yday, $isdst) = localtime (gettimeofday());
|
||||
$month++;
|
||||
$year += 1900;
|
||||
my $today = sprintf '%04d-%02d-%02d', $year, $month, $mday;
|
||||
my $hms = sprintf '%02d:%02d:%02d', $hour, $min, $sec;
|
||||
my $we = IsWe (undef, $wday);
|
||||
|
||||
my $retvals = {
|
||||
sec => $sec,
|
||||
min => $min,
|
||||
hour => $hour,
|
||||
mday => $mday,
|
||||
|
||||
month => $month,
|
||||
year => $year,
|
||||
wday => $wday,
|
||||
yday => $yday,
|
||||
isdst => $isdst,
|
||||
|
||||
today => $today,
|
||||
hms => $hms,
|
||||
we => $we
|
||||
};
|
||||
|
||||
return $retvals;
|
||||
}
|
||||
|
||||
##############################################################################################
|
||||
# timestamp_begin, timestamp_end bei Einsatz datetime-Picker entsprechend
|
||||
# den Anforderungen formatieren
|
||||
|
Loading…
Reference in New Issue
Block a user