2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-07 16:59:18 +00:00

98_WeekdayTimer.pm: small changes in initialisation, forum #112014

git-svn-id: https://svn.fhem.de/fhem/trunk@22535 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User 2020-08-04 04:34:34 +00:00
parent 5e7b58f15b
commit 44be73288e

View File

@ -73,6 +73,18 @@ sub WeekdayTimer_Define {
$hash->{DEVICE} = $device;
my $language = WeekdayTimer_Language ($hash, \@arr);
my $idx = 0;
$hash->{'.dayNumber'} = {map {$_ => $idx++} @{$hash->{'.shortDays'}{$language}}};
$hash->{helper}{daysRegExp} = '(' . join ("|", @{$hash->{'.shortDays'}{$language}}) . ")";
$hash->{helper}{daysRegExpMessage} = $hash->{helper}{daysRegExp};
$hash->{helper}{daysRegExp} =~ s{\$}{\\\$}gxms;
$hash->{helper}{daysRegExp} =~ s{\!}{\\\!}gxms;
$hash->{CONDITION} = "";
$hash->{COMMAND} = "";
addToDevAttrList($name, "weekprofile") if $def =~ m{weekprofile}xms;
return InternalTimer(time(), "WeekdayTimer_Start",$hash,0);
@ -103,17 +115,6 @@ sub WeekdayTimer_Start {
my $language = WeekdayTimer_Language ($hash, \@arr);
$hash->{CONDITION} = "";
$hash->{COMMAND} = "";
my $idx = 0;
$hash->{'.dayNumber'} = {map {$_ => $idx++} @{$hash->{'.shortDays'}{$language}}};
$hash->{helper}{daysRegExp} = '(' . join ("|", @{$hash->{'.shortDays'}{$language}}) . ")";
$hash->{helper}{daysRegExpMessage} = $hash->{helper}{daysRegExp};
$hash->{helper}{daysRegExp} =~ s{\$}{\\\$}gxms;
$hash->{helper}{daysRegExp} =~ s{\!}{\\\!}gxms;
WeekdayTimer_GlobalDaylistSpec ($hash, \@arr);
my @switchingtimes = WeekdayTimer_gatherSwitchingTimes ($hash, \@arr);