mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
98_alarmclock.pm: add WeekprofileName
git-svn-id: https://svn.fhem.de/fhem/trunk@14771 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
f1f6e56362
commit
34f85eb74a
@ -148,6 +148,7 @@ sub alarmclock_Initialize($)
|
|||||||
. " RepRoutine3Repeats"
|
. " RepRoutine3Repeats"
|
||||||
. " RepRoutine3Mode:Alarm,PreAlarm,off"
|
. " RepRoutine3Mode:Alarm,PreAlarm,off"
|
||||||
. " RepRoutine3Stop:Snooze,off"
|
. " RepRoutine3Stop:Snooze,off"
|
||||||
|
. " WeekprofileName"
|
||||||
. " disable:1,0"
|
. " disable:1,0"
|
||||||
. " $readingFnAttributes";
|
. " $readingFnAttributes";
|
||||||
|
|
||||||
@ -213,6 +214,8 @@ sub alarmclock_Set($$)
|
|||||||
my $opt = shift @param;
|
my $opt = shift @param;
|
||||||
my $value = join("", @param);
|
my $value = join("", @param);
|
||||||
|
|
||||||
|
my $Weekprofile = AttrVal($hash->{NAME},"WeekprofileName","Weekprofile_1,Weekprofile_2,Weekprofile_3,Weekprofile_4,Weekprofile_5");
|
||||||
|
|
||||||
if(!defined($alarmclock_sets{$opt})) {
|
if(!defined($alarmclock_sets{$opt})) {
|
||||||
my $list = " AlarmTime1_Monday"
|
my $list = " AlarmTime1_Monday"
|
||||||
." AlarmTime2_Tuesday"
|
." AlarmTime2_Tuesday"
|
||||||
@ -228,14 +231,16 @@ sub alarmclock_Set($$)
|
|||||||
." AlarmTime_Weekend"
|
." AlarmTime_Weekend"
|
||||||
." stop:Alarm"
|
." stop:Alarm"
|
||||||
." skip:NextAlarm,None"
|
." skip:NextAlarm,None"
|
||||||
." save:Weekprofile_1,Weekprofile_2,Weekprofile_3,Weekprofile_4,Weekprofile_5"
|
." save:$Weekprofile"
|
||||||
." load:Weekprofile_1,Weekprofile_2,Weekprofile_3,Weekprofile_4,Weekprofile_5"
|
." load:$Weekprofile"
|
||||||
." disable:1,0";
|
." disable:1,0";
|
||||||
|
|
||||||
|
|
||||||
return "Unknown argument $opt, choose one of $list";
|
return "Unknown argument $opt, choose one of $list";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### AlarmTime ###
|
### AlarmTime ###
|
||||||
|
|
||||||
if ($opt =~ /^AlarmTime(1_Monday|2_Tuesday|3_Wednesday|4_Thursday|5_Friday|6_Saturday|7_Sunday|8_Holiday|9_Vacation)/)
|
if ($opt =~ /^AlarmTime(1_Monday|2_Tuesday|3_Wednesday|4_Thursday|5_Friday|6_Saturday|7_Sunday|8_Holiday|9_Vacation)/)
|
||||||
@ -351,13 +356,11 @@ sub alarmclock_Set($$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
### save Weekprofile ###
|
### save Weekprofile ###
|
||||||
|
|
||||||
if ($opt eq "save")
|
if ($opt eq "save")
|
||||||
{
|
{
|
||||||
if ($value =~ /^(Weekprofile_1|Weekprofile_2|Weekprofile_3|Weekprofile_4|Weekprofile_5)$/)
|
|
||||||
{
|
|
||||||
|
|
||||||
my $time1 = ReadingsVal($hash->{NAME},"AlarmTime1_Monday","off");
|
my $time1 = ReadingsVal($hash->{NAME},"AlarmTime1_Monday","off");
|
||||||
my $time2 = ReadingsVal($hash->{NAME},"AlarmTime2_Tuesday","off");
|
my $time2 = ReadingsVal($hash->{NAME},"AlarmTime2_Tuesday","off");
|
||||||
my $time3 = ReadingsVal($hash->{NAME},"AlarmTime3_Wednesday","off");
|
my $time3 = ReadingsVal($hash->{NAME},"AlarmTime3_Wednesday","off");
|
||||||
@ -365,18 +368,12 @@ sub alarmclock_Set($$)
|
|||||||
my $time5 = ReadingsVal($hash->{NAME},"AlarmTime5_Friday","off");
|
my $time5 = ReadingsVal($hash->{NAME},"AlarmTime5_Friday","off");
|
||||||
my $time6 = ReadingsVal($hash->{NAME},"AlarmTime6_Saturday","off");
|
my $time6 = ReadingsVal($hash->{NAME},"AlarmTime6_Saturday","off");
|
||||||
my $time7 = ReadingsVal($hash->{NAME},"AlarmTime7_Sunday","off");
|
my $time7 = ReadingsVal($hash->{NAME},"AlarmTime7_Sunday","off");
|
||||||
|
|
||||||
|
|
||||||
readingsSingleUpdate( $hash, $value,"$time1,$time2,$time3,$time4,$time5,$time6,$time7", 1 );
|
readingsSingleUpdate( $hash, $value,"$time1,$time2,$time3,$time4,$time5,$time6,$time7", 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
### load Weekprofile ###
|
### load Weekprofile ###
|
||||||
|
|
||||||
if ($opt eq "load")
|
if ($opt eq "load")
|
||||||
{
|
|
||||||
if ($value =~ /^(Weekprofile_1|Weekprofile_2|Weekprofile_3|Weekprofile_4|Weekprofile_5)$/)
|
|
||||||
{
|
{
|
||||||
my @time = split(/,/, ReadingsVal($hash->{NAME}, $value,""));
|
my @time = split(/,/, ReadingsVal($hash->{NAME}, $value,""));
|
||||||
|
|
||||||
@ -390,9 +387,6 @@ sub alarmclock_Set($$)
|
|||||||
readingsBulkUpdate( $hash, "AlarmTime7_Sunday", $time[6]);
|
readingsBulkUpdate( $hash, "AlarmTime7_Sunday", $time[6]);
|
||||||
readingsEndUpdate($hash,1);
|
readingsEndUpdate($hash,1);
|
||||||
alarmclock_createtimer($hash);
|
alarmclock_createtimer($hash);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
### skip ###
|
### skip ###
|
||||||
@ -548,7 +542,7 @@ if ((AttrVal($hash->{NAME}, "disable", 0 ) ne "1" ) && (ReadingsVal($hash->{NAME
|
|||||||
alarmclock_holiday_check($hash);
|
alarmclock_holiday_check($hash);
|
||||||
|
|
||||||
my $alarmtimetoday = $alarmday{$hash->{helper}{Today}};
|
my $alarmtimetoday = $alarmday{$hash->{helper}{Today}};
|
||||||
my $alarmtimetommorow = $alarmday{$hash->{helper}{Tomorrow}};
|
my $alarmtimetomorrow = $alarmday{$hash->{helper}{Tomorrow}};
|
||||||
|
|
||||||
|
|
||||||
if ((ReadingsVal($hash->{NAME},$alarmtimetoday,"NONE")) =~ /^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$/)
|
if ((ReadingsVal($hash->{NAME},$alarmtimetoday,"NONE")) =~ /^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$/)
|
||||||
@ -664,7 +658,7 @@ if ((AttrVal($hash->{NAME}, "disable", 0 ) ne "1" ) && (ReadingsVal($hash->{NAME
|
|||||||
### Alarm Reading ###
|
### Alarm Reading ###
|
||||||
|
|
||||||
my $AlarmToday = ReadingsVal($hash->{NAME},$alarmtimetoday," ");
|
my $AlarmToday = ReadingsVal($hash->{NAME},$alarmtimetoday," ");
|
||||||
my $AlarmTomorrow = ReadingsVal($hash->{NAME},$alarmtimetommorow," ");
|
my $AlarmTomorrow = ReadingsVal($hash->{NAME},$alarmtimetomorrow," ");
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
readingsBulkUpdate( $hash, "AlarmToday", $AlarmToday);
|
readingsBulkUpdate( $hash, "AlarmToday", $AlarmToday);
|
||||||
readingsBulkUpdate( $hash, "AlarmTomorrow", $AlarmTomorrow);
|
readingsBulkUpdate( $hash, "AlarmTomorrow", $AlarmTomorrow);
|
||||||
@ -1582,6 +1576,10 @@ sub alarmclock_Notify($$)
|
|||||||
0 disables monitoring the presence device<br>
|
0 disables monitoring the presence device<br>
|
||||||
1 activates monitoring
|
1 activates monitoring
|
||||||
</li>
|
</li>
|
||||||
|
<li><b>WeekprofileName</b> <br>
|
||||||
|
Optional list with name for storing the week profiles<br>
|
||||||
|
Example: attr <name> WeekprofileName MyWeek1,MyWeek2,MyWeek3 <br>
|
||||||
|
</li>
|
||||||
<li><b>disable</b> <br>
|
<li><b>disable</b> <br>
|
||||||
1 disables all alarms<br>
|
1 disables all alarms<br>
|
||||||
0 activates this again
|
0 activates this again
|
||||||
|
Loading…
x
Reference in New Issue
Block a user