mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-28 11:01:59 +00:00
RESIDENTStk: use IsDay(), (Forum #98583)
git-svn-id: https://svn.fhem.de/fhem/trunk@19769 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ec4c72d604
commit
77a069b3a5
@ -9,6 +9,7 @@ use FHEM::Meta;
|
|||||||
use Time::HiRes qw(gettimeofday);
|
use Time::HiRes qw(gettimeofday);
|
||||||
use Time::Local;
|
use Time::Local;
|
||||||
use Unit;
|
use Unit;
|
||||||
|
|
||||||
#use Data::Dumper;
|
#use Data::Dumper;
|
||||||
|
|
||||||
our ( @RESIDENTStk_attr, %RESIDENTStk_types, %RESIDENTStk_subTypes );
|
our ( @RESIDENTStk_attr, %RESIDENTStk_types, %RESIDENTStk_subTypes );
|
||||||
@ -1997,7 +1998,6 @@ m/^((?:next[rR]un)?\s*(off|OFF|([\+\-])?(([0-9]{2}):([0-9]{2})|([1-9]+[0-9]*)))?
|
|||||||
ReadingsVal( $NAME, "wakeupEnforced",
|
ReadingsVal( $NAME, "wakeupEnforced",
|
||||||
AttrVal( $NAME, "wakeupEnforced", 0 ) );
|
AttrVal( $NAME, "wakeupEnforced", 0 ) );
|
||||||
my $wakeupResetSwitcher = AttrVal( $NAME, "wakeupResetSwitcher", 0 );
|
my $wakeupResetSwitcher = AttrVal( $NAME, "wakeupResetSwitcher", 0 );
|
||||||
my $holidayDevice = AttrVal( "global", "holiday2we", 0 );
|
|
||||||
my $room = AttrVal( $NAME, "room", 0 );
|
my $room = AttrVal( $NAME, "room", 0 );
|
||||||
my $userattr = AttrVal( $NAME, "userattr", 0 );
|
my $userattr = AttrVal( $NAME, "userattr", 0 );
|
||||||
my $lastRun = ReadingsVal( $NAME, "lastRun", "07:00" );
|
my $lastRun = ReadingsVal( $NAME, "lastRun", "07:00" );
|
||||||
@ -2646,31 +2646,6 @@ return;;\
|
|||||||
fhem "attr $wakeupAtdevice computeAfterInit 1";
|
fhem "attr $wakeupAtdevice computeAfterInit 1";
|
||||||
}
|
}
|
||||||
|
|
||||||
# verify holiday2we attribute
|
|
||||||
if ( $wakeupHolidays ne "" ) {
|
|
||||||
if ( !$holidayDevice ) {
|
|
||||||
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!";
|
|
||||||
}
|
|
||||||
elsif ( !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
|
# start
|
||||||
#
|
#
|
||||||
if ( $cmd eq "start" ) {
|
if ( $cmd eq "start" ) {
|
||||||
@ -2983,7 +2958,6 @@ sub RESIDENTStk_wakeupRun($;$) {
|
|||||||
AttrVal( $NAME, "wakeupEnforced", 0 ) );
|
AttrVal( $NAME, "wakeupEnforced", 0 ) );
|
||||||
my $wakeupResetSwitcher = AttrVal( $NAME, "wakeupResetSwitcher", 0 );
|
my $wakeupResetSwitcher = AttrVal( $NAME, "wakeupResetSwitcher", 0 );
|
||||||
my $wakeupWaitPeriod = AttrVal( $NAME, "wakeupWaitPeriod", 360 );
|
my $wakeupWaitPeriod = AttrVal( $NAME, "wakeupWaitPeriod", 360 );
|
||||||
my $holidayDevice = AttrVal( "global", "holiday2we", 0 );
|
|
||||||
my $lastRun = ReadingsVal( $NAME, "lastRun", "06:00" );
|
my $lastRun = ReadingsVal( $NAME, "lastRun", "06:00" );
|
||||||
my $nextRun = ReadingsVal( $NAME, "nextRun", "06:00" );
|
my $nextRun = ReadingsVal( $NAME, "nextRun", "06:00" );
|
||||||
my $wakeupUserdeviceState = ReadingsVal( $wakeupUserdevice, "state", 0 );
|
my $wakeupUserdeviceState = ReadingsVal( $wakeupUserdevice, "state", 0 );
|
||||||
@ -2993,14 +2967,9 @@ sub RESIDENTStk_wakeupRun($;$) {
|
|||||||
my $preventRun = 0;
|
my $preventRun = 0;
|
||||||
my $holidayToday = 0;
|
my $holidayToday = 0;
|
||||||
|
|
||||||
if ( $wakeupHolidays ne ""
|
if ( $wakeupHolidays ne "" ) {
|
||||||
&& IsDevice( $holidayDevice, "holiday" ) )
|
$holidayToday = IsWe();
|
||||||
{
|
$wakeupHolidays = "" unless ($holidayToday);
|
||||||
$holidayToday = 1
|
|
||||||
unless ( ReadingsVal( $holidayDevice, "state", "none" ) eq "none" );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$wakeupHolidays = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my ( $sec, $min, $hour, $mday, $mon, $year, $today, $yday, $isdst ) =
|
my ( $sec, $min, $hour, $mday, $mon, $year, $today, $yday, $isdst ) =
|
||||||
@ -3320,8 +3289,6 @@ sub RESIDENTStk_wakeupGetNext($;$) {
|
|||||||
my $definitiveNextTodayDev;
|
my $definitiveNextTodayDev;
|
||||||
my $definitiveNextTomorrowDev;
|
my $definitiveNextTomorrowDev;
|
||||||
|
|
||||||
my $holidayDevice = AttrVal( "global", "holiday2we", 0 );
|
|
||||||
|
|
||||||
# check for each registered wake-up device
|
# check for each registered wake-up device
|
||||||
for my $wakeupDevice ( split /,/, $wakeupDeviceList ) {
|
for my $wakeupDevice ( split /,/, $wakeupDeviceList ) {
|
||||||
if ( !IsDevice($wakeupDevice) ) {
|
if ( !IsDevice($wakeupDevice) ) {
|
||||||
@ -3387,17 +3354,9 @@ sub RESIDENTStk_wakeupGetNext($;$) {
|
|||||||
Log3 $name, 4,
|
Log3 $name, 4,
|
||||||
"RESIDENTStk $wakeupDevice: 01 - Not considering any holidays";
|
"RESIDENTStk $wakeupDevice: 01 - Not considering any holidays";
|
||||||
}
|
}
|
||||||
elsif ( IsDevice( $holidayDevice, "holiday" ) ) {
|
else {
|
||||||
$holidayToday = 1
|
$holidayToday = IsWe();
|
||||||
unless (
|
$holidayTomorrow = IsWe('tomorrow');
|
||||||
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
|
# set day scope for today
|
||||||
|
Loading…
x
Reference in New Issue
Block a user