mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-07 16:59:18 +00:00
RESIDENTStk: keep dedicated holiday2we handling for now
git-svn-id: https://svn.fhem.de/fhem/trunk@19788 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2e04fb18bf
commit
9eb1ba7bb2
@ -1997,9 +1997,10 @@ m/^((?:next[rR]un)?\s*(off|OFF|([\+\-])?(([0-9]{2}):([0-9]{2})|([1-9]+[0-9]*)))?
|
||||
my $wakeupEnforced =
|
||||
ReadingsVal( $NAME, "wakeupEnforced",
|
||||
AttrVal( $NAME, "wakeupEnforced", 0 ) );
|
||||
my $wakeupResetSwitcher = AttrVal( $NAME, "wakeupResetSwitcher", 0 );
|
||||
my $room = AttrVal( $NAME, "room", 0 );
|
||||
my $userattr = AttrVal( $NAME, "userattr", 0 );
|
||||
my $wakeupResetSwitcher = AttrVal( $NAME, "wakeupResetSwitcher", 0 );
|
||||
my $holidayDevices = AttrVal( "global", "holiday2we", 0 );
|
||||
my $room = AttrVal( $NAME, "room", 0 );
|
||||
my $userattr = AttrVal( $NAME, "userattr", 0 );
|
||||
my $lastRun = ReadingsVal( $NAME, "lastRun", "07:00" );
|
||||
my $nextRun = ReadingsVal( $NAME, "nextRun", "07:00" );
|
||||
my $running = ReadingsVal( $NAME, "running", 0 );
|
||||
@ -2646,6 +2647,35 @@ return;;\
|
||||
fhem "attr $wakeupAtdevice computeAfterInit 1";
|
||||
}
|
||||
|
||||
# verify holiday2we attribute
|
||||
if ( $wakeupHolidays ne "" ) {
|
||||
if ( !$holidayDevices ) {
|
||||
Log3 $NAME, 3,
|
||||
"RESIDENTStk $NAME: "
|
||||
. "ERROR - wakeupHolidays set in this alarm clock but global attribute holiday2we not set!";
|
||||
return "ERROR: "
|
||||
. "wakeupHolidays set in this alarm clock but global attribute holiday2we not set!";
|
||||
}
|
||||
else {
|
||||
foreach my $holidayDevice ( split( ',', $holidayDevices ) ) {
|
||||
if ( !IsDevice($holidayDevice) ) {
|
||||
Log3 $NAME, 3,
|
||||
"RESIDENTStk $NAME: "
|
||||
. "ERROR - global attribute holiday2we has reference to non-existing device $holidayDevice";
|
||||
return "ERROR: "
|
||||
. "global attribute holiday2we has reference to non-existing device $holidayDevice";
|
||||
}
|
||||
elsif ( !IsDevice( $holidayDevice, "holiday" ) ) {
|
||||
Log3 $NAME, 3,
|
||||
"RESIDENTStk $NAME: "
|
||||
. "ERROR - global attribute holiday2we seems to have invalid device reference - $holidayDevice is not of type 'holiday'";
|
||||
return "ERROR: "
|
||||
. "global attribute holiday2we seems to have invalid device reference - $holidayDevice is not of type 'holiday'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# start
|
||||
#
|
||||
if ( $cmd eq "start" ) {
|
||||
@ -2956,8 +2986,9 @@ sub RESIDENTStk_wakeupRun($;$) {
|
||||
my $wakeupEnforced =
|
||||
ReadingsVal( $NAME, "wakeupEnforced",
|
||||
AttrVal( $NAME, "wakeupEnforced", 0 ) );
|
||||
my $wakeupResetSwitcher = AttrVal( $NAME, "wakeupResetSwitcher", 0 );
|
||||
my $wakeupWaitPeriod = AttrVal( $NAME, "wakeupWaitPeriod", 360 );
|
||||
my $wakeupResetSwitcher = AttrVal( $NAME, "wakeupResetSwitcher", 0 );
|
||||
my $wakeupWaitPeriod = AttrVal( $NAME, "wakeupWaitPeriod", 360 );
|
||||
my $holidayDevices = AttrVal( "global", "holiday2we", 0 );
|
||||
my $lastRun = ReadingsVal( $NAME, "lastRun", "06:00" );
|
||||
my $nextRun = ReadingsVal( $NAME, "nextRun", "06:00" );
|
||||
my $wakeupUserdeviceState = ReadingsVal( $wakeupUserdevice, "state", 0 );
|
||||
@ -2968,7 +2999,11 @@ sub RESIDENTStk_wakeupRun($;$) {
|
||||
my $holidayToday = 0;
|
||||
|
||||
if ( $wakeupHolidays ne "" ) {
|
||||
$holidayToday = IsWe();
|
||||
foreach my $holidayDevice ( split( ',', $holidayDevices ) ) {
|
||||
$holidayToday = 1
|
||||
unless ( !IsDevice( $holidayDevice, "holiday" )
|
||||
|| ReadingsVal( $holidayDevice, "state", "none" ) eq "none" );
|
||||
}
|
||||
$wakeupHolidays = "" unless ($holidayToday);
|
||||
}
|
||||
|
||||
@ -3289,6 +3324,8 @@ sub RESIDENTStk_wakeupGetNext($;$) {
|
||||
my $definitiveNextTodayDev;
|
||||
my $definitiveNextTomorrowDev;
|
||||
|
||||
my $holidayDevices = AttrVal( "global", "holiday2we", 0 );
|
||||
|
||||
# check for each registered wake-up device
|
||||
for my $wakeupDevice ( split /,/, $wakeupDeviceList ) {
|
||||
if ( !IsDevice($wakeupDevice) ) {
|
||||
@ -3355,8 +3392,22 @@ sub RESIDENTStk_wakeupGetNext($;$) {
|
||||
"RESIDENTStk $wakeupDevice: 01 - Not considering any holidays";
|
||||
}
|
||||
else {
|
||||
$holidayToday = IsWe();
|
||||
$holidayTomorrow = IsWe('tomorrow');
|
||||
foreach my $holidayDevice ( split( ',', $holidayDevices ) ) {
|
||||
if ( IsDevice( $holidayDevice, "holiday" ) ) {
|
||||
$holidayToday = 1
|
||||
unless (
|
||||
ReadingsVal( $holidayDevice, "state", "none" ) eq
|
||||
"none" );
|
||||
$holidayTomorrow = 1
|
||||
unless (
|
||||
ReadingsVal( $holidayDevice, "tomorrow", "none" ) eq
|
||||
"none" );
|
||||
|
||||
Log3 $name, 4,
|
||||
"RESIDENTStk $wakeupDevice: "
|
||||
. "01 - Holidays to be considered ($wakeupHolidays) - holidayToday=$holidayToday holidayTomorrow=$holidayTomorrow";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# set day scope for today
|
||||
|
Loading…
x
Reference in New Issue
Block a user