Compare commits

...

2 Commits

Author SHA1 Message Date
Marko Oldenburg
208bac6ae0 remove all prototyps 2020-03-24 09:47:27 +01:00
Marko Oldenburg
0e9a212aa0 remove IsWeTomorrow Fn and change IsWe Fn to use tomorrow 2020-03-24 09:29:42 +01:00

View File

@ -46,7 +46,7 @@ package main;
use strict;
use warnings;
sub ascAPIget($@) {
sub ascAPIget {
my ( $getCommand, $shutterDev, $value ) = @_;
return AutoShuttersControl_ascAPIget( $getCommand, $shutterDev, $value );
@ -57,7 +57,7 @@ package FHEM::AutoShuttersControl;
use strict;
use warnings;
use POSIX;
use POSIX qw(strftime);
use utf8;
use Encode;
use FHEM::Meta;
@ -273,7 +273,7 @@ my %posSetCmds = (
my $shutters = new ASC_Shutters();
my $ascDev = new ASC_Dev();
sub ascAPIget($@) {
sub ascAPIget {
my ( $getCommand, $shutterDev, $value ) = @_;
my $getter = 'get' . $getCommand;
@ -291,7 +291,7 @@ sub ascAPIget($@) {
}
}
sub Initialize($) {
sub Initialize {
my ($hash) = @_;
## Da ich mit package arbeite müssen in die Initialize für die jeweiligen hash Fn Funktionen der Funktionsname
@ -328,7 +328,7 @@ sub Initialize($) {
return FHEM::Meta::InitMod( __FILE__, $hash );
}
sub Define($$) {
sub Define {
my ( $hash, $def ) = @_;
my @a = split( '[ \t][ \t]*', $def );
@ -374,7 +374,7 @@ sub Define($$) {
return undef;
}
sub Undef($$) {
sub Undef {
my ( $hash, $arg ) = @_;
my $name = $hash->{NAME};
@ -389,7 +389,7 @@ sub Undef($$) {
return undef;
}
sub Attr(@) {
sub Attr {
my ( $cmd, $name, $attrName, $attrVal ) = @_;
# my $hash = $defs{$name};
@ -397,7 +397,7 @@ sub Attr(@) {
return undef;
}
sub Notify($$) {
sub Notify {
my ( $hash, $dev ) = @_;
my $name = $hash->{NAME};
@ -510,7 +510,7 @@ sub Notify($$) {
return;
}
sub EventProcessingGeneral($$$) {
sub EventProcessingGeneral {
my ( $hash, $devname, $events ) = @_;
my $name = $hash->{NAME};
@ -589,7 +589,7 @@ m#^(DELETEATTR|ATTR)\s(.*)\s(ASC_autoAstroModeMorning|ASC_autoAstroModeMorningHo
}
}
sub Set($$@) {
sub Set {
my ( $hash, $name, @aa ) = @_;
my ( $cmd, @args ) = @aa;
@ -676,7 +676,7 @@ sub Set($$@) {
return undef;
}
sub Get($$@) {
sub Get {
my ( $hash, $name, @aa ) = @_;
my ( $cmd, @args ) = @aa;
@ -696,7 +696,7 @@ sub Get($$@) {
}
}
sub ShuttersDeviceScan($) {
sub ShuttersDeviceScan {
my $hash = shift;
my $name = $hash->{NAME};
@ -787,7 +787,7 @@ sub ShuttersDeviceScan($) {
}
## Die Funktion schreibt in das Moduldevice Readings welche Rolläden in welchen Räumen erfasst wurden.
sub WriteReadingsShuttersList($) {
sub WriteReadingsShuttersList {
my $hash = shift;
my $name = $hash->{NAME};
@ -828,7 +828,7 @@ sub WriteReadingsShuttersList($) {
readingsEndUpdate( $hash, 0 );
}
sub UserAttributs_Readings_ForShutters($$) {
sub UserAttributs_Readings_ForShutters {
my ( $hash, $cmd ) = @_;
my $name = $hash->{NAME};
@ -900,7 +900,7 @@ sub UserAttributs_Readings_ForShutters($$) {
}
## Fügt dem NOTIFYDEV Hash weitere Devices hinzu
sub AddNotifyDev($@) {
sub AddNotifyDev {
### Beispielaufruf: AddNotifyDev( $hash, $3, $1, $2 ) if ( $3 ne 'none' );
my ( $hash, $dev, $shuttersDev, $shuttersAttr ) = @_;
@ -930,7 +930,7 @@ sub AddNotifyDev($@) {
}
## entfernt aus dem NOTIFYDEV Hash Devices welche als Wert in Attributen steckten
sub DeleteNotifyDev($@) {
sub DeleteNotifyDev {
my ( $hash, $shuttersDev, $shuttersAttr ) = @_;
my $name = $hash->{NAME};
@ -960,7 +960,7 @@ sub DeleteNotifyDev($@) {
}
## Sub zum steuern der Rolläden bei einem Fenster Event
sub EventProcessingWindowRec($@) {
sub EventProcessingWindowRec {
my ( $hash, $shuttersDev, $events ) = @_;
my $name = $hash->{NAME};
@ -1141,7 +1141,7 @@ sub EventProcessingWindowRec($@) {
}
## Sub zum steuern der Rolladen bei einem Bewohner/Roommate Event
sub EventProcessingRoommate($@) {
sub EventProcessingRoommate {
my ( $hash, $shuttersDev, $events ) = @_;
my $name = $hash->{NAME};
@ -1356,7 +1356,7 @@ sub EventProcessingRoommate($@) {
}
}
sub EventProcessingResidents($@) {
sub EventProcessingResidents {
my ( $hash, $device, $events ) = @_;
my $name = $device;
@ -1562,7 +1562,7 @@ sub EventProcessingResidents($@) {
}
}
sub EventProcessingRain($@) {
sub EventProcessingRain {
#### Ist noch nicht fertig, es fehlt noch das verzögerte Prüfen auf erhalten bleiben des getriggerten Wertes.
@ -1584,7 +1584,7 @@ sub EventProcessingRain($@) {
}
}
sub RainProtection(@) {
sub RainProtection {
my ( $hash, $val, $triggerMax, $closedPos ) = @_;
foreach my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) {
@ -1623,7 +1623,7 @@ sub RainProtection(@) {
}
}
sub EventProcessingWind($@) {
sub EventProcessingWind {
my ( $hash, $shuttersDev, $events ) = @_;
my $name = $hash->{NAME};
$shutters->setShuttersDev($shuttersDev);
@ -1696,7 +1696,7 @@ sub EventProcessingWind($@) {
}
##########
sub EventProcessingBrightness($@) {
sub EventProcessingBrightness {
my ( $hash, $shuttersDev, $events ) = @_;
my $name = $hash->{NAME};
$shutters->setShuttersDev($shuttersDev);
@ -2068,7 +2068,7 @@ sub EventProcessingBrightness($@) {
}
}
sub EventProcessingShadingBrightness($@) {
sub EventProcessingShadingBrightness {
my ( $hash, $shuttersDev, $events ) = @_;
my $name = $hash->{NAME};
$shutters->setShuttersDev($shuttersDev);
@ -2127,7 +2127,7 @@ sub EventProcessingShadingBrightness($@) {
}
}
sub EventProcessingTwilightDevice($@) {
sub EventProcessingTwilightDevice {
my ( $hash, $device, $events ) = @_;
# Twilight
@ -2199,7 +2199,7 @@ sub EventProcessingTwilightDevice($@) {
}
}
sub ShadingProcessing($@) {
sub ShadingProcessing {
### angleMinus ist $shutters->getShadingAzimuthLeft
### anglePlus ist $shutters->getShadingAzimuthRight
### winPos ist die Fensterposition $shutters->getDirection
@ -2384,7 +2384,7 @@ sub ShadingProcessing($@) {
);
}
sub ShadingProcessingDriveCommand($$) {
sub ShadingProcessingDriveCommand {
my ( $hash, $shuttersDev ) = @_;
my $name = $hash->{NAME};
@ -2470,7 +2470,7 @@ sub ShadingProcessingDriveCommand($$) {
}
}
sub EventProcessingPartyMode($) {
sub EventProcessingPartyMode {
my $hash = shift;
my $name = $hash->{NAME};
@ -2520,7 +2520,7 @@ sub EventProcessingPartyMode($) {
}
}
sub EventProcessingAdvShuttersClose($) {
sub EventProcessingAdvShuttersClose {
my $hash = shift;
my $name = $hash->{NAME};
@ -2544,7 +2544,7 @@ sub EventProcessingAdvShuttersClose($) {
}
}
sub EventProcessingShutters($@) {
sub EventProcessingShutters {
my ( $hash, $shuttersDev, $events ) = @_;
my $name = $hash->{NAME};
@ -2604,7 +2604,7 @@ sub EventProcessingShutters($@) {
);
}
sub EventProcessingExternalTriggerDevice($@) {
sub EventProcessingExternalTriggerDevice {
my ( $hash, $shuttersDev, $events ) = @_;
my $name = $hash->{NAME};
@ -2657,7 +2657,7 @@ sub EventProcessingExternalTriggerDevice($@) {
}
# Sub für das Zusammensetzen der Rolläden Steuerbefehle
sub ShuttersCommandSet($$$) {
sub ShuttersCommandSet {
my ( $hash, $shuttersDev, $posValue ) = @_;
my $name = $hash->{NAME};
$shutters->setShuttersDev($shuttersDev);
@ -2736,7 +2736,7 @@ sub ShuttersCommandSet($$$) {
}
## Sub welche die InternalTimer nach entsprechenden Sunset oder Sunrise zusammen stellt
sub CreateSunRiseSetShuttersTimer($$) {
sub CreateSunRiseSetShuttersTimer {
my ( $hash, $shuttersDev ) = @_;
my $name = $hash->{NAME};
my $shuttersDevHash = $defs{$shuttersDev};
@ -2850,7 +2850,7 @@ sub CreateSunRiseSetShuttersTimer($$) {
}
## Funktion zum neu setzen der Timer und der Readings für Sunset/Rise
sub RenewSunRiseSetShuttersTimer($) {
sub RenewSunRiseSetShuttersTimer {
my $hash = shift;
foreach ( @{ $hash->{helper}{shuttersList} } ) {
@ -2945,7 +2945,7 @@ sub RenewSunRiseSetShuttersTimer($) {
}
## Funktion zum hardwareseitigen setzen des lock-out oder blocking beim Rolladen selbst
sub HardewareBlockForShutters($$) {
sub HardewareBlockForShutters {
my ( $hash, $cmd ) = @_;
foreach ( @{ $hash->{helper}{shuttersList} } ) {
$shutters->setShuttersDev($_);
@ -2954,7 +2954,7 @@ sub HardewareBlockForShutters($$) {
}
## Funktion für das wiggle aller Shutters zusammen
sub wiggleAll($) {
sub wiggleAll {
my $hash = shift;
foreach ( @{ $hash->{helper}{shuttersList} } ) {
@ -2962,7 +2962,7 @@ sub wiggleAll($) {
}
}
sub wiggle($$) {
sub wiggle {
my ( $hash, $shuttersDev ) = @_;
$shutters->setShuttersDev($shuttersDev);
$shutters->setNoDelay(1);
@ -3001,7 +3001,7 @@ sub wiggle($$) {
####
## Funktion welche beim Ablaufen des Timers für Sunset aufgerufen werden soll
sub SunSetShuttersAfterTimerFn($) {
sub SunSetShuttersAfterTimerFn {
my $funcHash = shift;
my $hash = $funcHash->{hash};
my $shuttersDev = $funcHash->{shuttersdevice};
@ -3071,7 +3071,7 @@ sub SunSetShuttersAfterTimerFn($) {
}
## Funktion welche beim Ablaufen des Timers für Sunrise aufgerufen werden soll
sub SunRiseShuttersAfterTimerFn($) {
sub SunRiseShuttersAfterTimerFn {
my $funcHash = shift;
my $hash = $funcHash->{hash};
my $shuttersDev = $funcHash->{shuttersdevice};
@ -3171,7 +3171,7 @@ sub SunRiseShuttersAfterTimerFn($) {
CreateSunRiseSetShuttersTimer( $hash, $shuttersDev );
}
sub CreateNewNotifyDev($) {
sub CreateNewNotifyDev {
my $hash = shift;
my $name = $hash->{NAME};
@ -3213,7 +3213,7 @@ sub CreateNewNotifyDev($) {
$hash->{NOTIFYDEV} = $hash->{NOTIFYDEV} . $shuttersList;
}
sub ShuttersInformation($@) {
sub ShuttersInformation {
my ( $FW_wname, $d, $room, $pageHash ) = @_;
my $hash = $defs{$d};
@ -3300,7 +3300,7 @@ sub ShuttersInformation($@) {
return $ret;
}
sub GetMonitoredDevs($) {
sub GetMonitoredDevs {
my $hash = shift;
my $notifydevs = eval {
decode_json( ReadingsVal( $hash->{NAME}, '.monitoredDevs', 'none' ) );
@ -3348,7 +3348,7 @@ sub GetMonitoredDevs($) {
## my little helper
#################################
sub PositionValueWindowRec($$) {
sub PositionValueWindowRec {
my ( $shuttersDev, $posValue ) = @_;
if ( CheckIfShuttersWindowRecOpen($shuttersDev) == 1
@ -3379,7 +3379,7 @@ sub PositionValueWindowRec($$) {
return $posValue;
}
sub AutoSearchTwilightDev($) {
sub AutoSearchTwilightDev {
my $hash = shift;
my $name = $hash->{NAME};
@ -3392,7 +3392,7 @@ sub AutoSearchTwilightDev($) {
}
}
sub GetAttrValues($@) {
sub GetAttrValues {
my ( $dev, $attribut, $default ) = @_;
my @values = split( ' ',
@ -3418,7 +3418,7 @@ sub GetAttrValues($@) {
}
# Hilfsfunktion welche meinen ReadingString zum finden der getriggerten Devices und der Zurdnung was das Device überhaupt ist und zu welchen Rolladen es gehört aus liest und das Device extraiert
sub ExtractNotifyDevFromEvent($$$) {
sub ExtractNotifyDevFromEvent {
my ( $hash, $shuttersDev, $shuttersAttr ) = @_;
my %notifyDevs;
while ( my $notifyDev = each %{ $hash->{monitoredDevs} } ) {
@ -3446,7 +3446,7 @@ sub ExtractNotifyDevFromEvent($$$) {
}
## Ist Tag oder Nacht für den entsprechende Rolladen
sub _IsDay($) {
sub _IsDay {
my ($shuttersDev) = @_;
$shutters->setShuttersDev($shuttersDev);
@ -3566,7 +3566,7 @@ sub _IsDay($) {
return $respIsDay;
}
sub ShuttersSunrise($$) {
sub ShuttersSunrise {
my ( $shuttersDev, $tm ) =
@_; # Tm steht für Timemode und bedeutet Realzeit oder Unixzeit
my $autoAstroMode;
@ -3590,11 +3590,11 @@ sub ShuttersSunrise($$) {
if ( $tm eq 'unix' ) {
if ( $shutters->getUp eq 'astro' ) {
if ( ( IsWe() or IsWeTomorrow() )
if ( ( IsWe() or IsWe('tomorrow') )
and $ascDev->getSunriseTimeWeHoliday eq 'on'
and $shutters->getTimeUpWeHoliday ne '01:25' )
{
if ( not IsWeTomorrow() ) {
if ( not IsWe('tomorrow') ) {
if (
IsWe()
and int( gettimeofday() / 86400 ) == int(
@ -3781,11 +3781,11 @@ sub ShuttersSunrise($$) {
}
if ( defined($oldFuncHash)
and ref($oldFuncHash) eq 'HASH'
and ( IsWe() or IsWeTomorrow() )
and ( IsWe() or IsWe('tomorrow') )
and $ascDev->getSunriseTimeWeHoliday eq 'on'
and $shutters->getTimeUpWeHoliday ne '01:25' )
{
if ( not IsWeTomorrow() ) {
if ( not IsWe('tomorrow') ) {
if (
int( gettimeofday() / 86400 ) == int(
(
@ -3818,11 +3818,11 @@ sub ShuttersSunrise($$) {
}
}
elsif ( $shutters->getUp eq 'time' ) {
if ( ( IsWe() or IsWeTomorrow() )
if ( ( IsWe() or IsWe('tomorrow') )
and $ascDev->getSunriseTimeWeHoliday eq 'on'
and $shutters->getTimeUpWeHoliday ne '01:25' )
{
if ( not IsWeTomorrow() ) {
if ( not IsWe('tomorrow') ) {
if (
int( gettimeofday() / 86400 ) == int(
computeAlignTime( '24:00',
@ -3900,11 +3900,11 @@ sub ShuttersSunrise($$) {
}
}
elsif ( $shutters->getUp eq 'brightness' ) {
if ( ( IsWe() or IsWeTomorrow() )
if ( ( IsWe() or IsWe('tomorrow') )
and $ascDev->getSunriseTimeWeHoliday eq 'on'
and $shutters->getTimeUpWeHoliday ne '01:25' )
{
if ( not IsWeTomorrow() ) {
if ( not IsWe('tomorrow') ) {
if (
IsWe()
and int( gettimeofday() / 86400 ) == int(
@ -4002,7 +4002,7 @@ sub ShuttersSunrise($$) {
}
}
sub IsAfterShuttersTimeBlocking($) {
sub IsAfterShuttersTimeBlocking {
my ($shuttersDev) = @_;
$shutters->setShuttersDev($shuttersDev);
@ -4025,7 +4025,7 @@ sub IsAfterShuttersTimeBlocking($) {
else { return 1 }
}
sub IsAfterShuttersManualBlocking($) {
sub IsAfterShuttersManualBlocking {
my $shuttersDev = shift;
$shutters->setShuttersDev($shuttersDev);
@ -4050,7 +4050,7 @@ sub IsAfterShuttersManualBlocking($) {
else { return 1 }
}
sub ShuttersSunset($$) {
sub ShuttersSunset {
my ( $shuttersDev, $tm ) =
@_; # Tm steht für Timemode und bedeutet Realzeit oder Unixzeit
my $autoAstroMode;
@ -4114,7 +4114,7 @@ sub ShuttersSunset($$) {
}
## Kontrolliert ob das Fenster von einem bestimmten Rolladen offen ist
sub CheckIfShuttersWindowRecOpen($) {
sub CheckIfShuttersWindowRecOpen {
my $shuttersDev = shift;
$shutters->setShuttersDev($shuttersDev);
@ -4132,8 +4132,8 @@ sub CheckIfShuttersWindowRecOpen($) {
} # CK: covers: close|closed
}
sub makeReadingName($) {
my ($rname) = @_;
sub makeReadingName {
my ($rname) = shift;
my %charHash = (
chr(0xe4) => "ae", # ä
chr(0xc4) => "Ae", # Ä
@ -4151,7 +4151,7 @@ sub makeReadingName($) {
return $rname;
}
sub TimeMin2Sec($) {
sub TimeMin2Sec {
my $min = shift;
my $sec;
@ -4159,17 +4159,11 @@ sub TimeMin2Sec($) {
return $sec;
}
sub IsWe() {
my $we = main::IsWe();
return $we;
sub IsWe {
return main::IsWe(shift, shift);
}
sub IsWeTomorrow() {
my $we = main::IsWe('tomorrow');
return $we;
}
sub _SetCmdFn($) {
sub _SetCmdFn {
my $h = shift;
my $shuttersDev = $h->{shuttersDev};
my $posValue = $h->{posValue};
@ -4224,7 +4218,7 @@ sub _SetCmdFn($) {
and $shutters->getSelfDefenseAbsentTimerrun );
}
sub _setShuttersLastDriveDelayed($) {
sub _setShuttersLastDriveDelayed {
my $h = shift;
my $shuttersDevHash = $h->{devHash};
@ -4234,7 +4228,7 @@ sub _setShuttersLastDriveDelayed($) {
$lastDrive, 1 );
}
sub ASC_Debug($) {
sub ASC_Debug {
return
unless ( AttrVal( $ascDev->getName, 'ASC_debug', 0 ) );
@ -4248,14 +4242,14 @@ sub ASC_Debug($) {
);
}
sub _averageBrightness(@) {
sub _averageBrightness {
my @input = @_;
use List::Util qw(sum);
return int( sum(@input) / @input );
}
sub _perlCodeCheck($) {
sub _perlCodeCheck {
my $exec = shift;
my $val = undef;
@ -4266,7 +4260,7 @@ sub _perlCodeCheck($) {
return $val;
}
sub PrivacyUpTime($$) {
sub PrivacyUpTime {
my ( $shuttersDevHash, $shuttersSunriseUnixtime ) = @_;
my $privacyUpUnixtime;
@ -4307,7 +4301,7 @@ sub PrivacyUpTime($$) {
return $shuttersSunriseUnixtime;
}
sub PrivacyDownTime($$) {
sub PrivacyDownTime {
my ( $shuttersDevHash, $shuttersSunsetUnixtime ) = @_;
my $privacyDownUnixtime;
@ -4371,7 +4365,7 @@ sub _IsAdv {
return $adv;
}
sub DevStateIcon($) {
sub DevStateIcon {
my ($hash) = @_;
$hash = $defs{$hash} if ( ref($hash) ne 'HASH' );
@ -8038,7 +8032,7 @@ sub getBlockAscDrivesAfterManual {
],
"release_status": "testing",
"license": "GPL_2",
"version": "v0.8.20",
"version": "v0.8.21",
"author": [
"Marko Oldenburg <leongaultier@gmail.com>"
],