diff --git a/fhem/CHANGED b/fhem/CHANGED index 21c2782de..760ff30bd 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,8 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 73_AutoShuttersControl: add set commands and readings for + aktivate shadding, add drive in shading position then + come home and shading mode is home and asc is in shading - feature: 73_DoorBird: UDP events for doorbell and motion-sensor implemented - feature: 74_UnifiClient: add new Module UnifiClient as BETA - feature: 74_Unifi: add new Module UnifiClient diff --git a/fhem/FHEM/73_AutoShuttersControl.pm b/fhem/FHEM/73_AutoShuttersControl.pm index cafd01538..0e30e3208 100644 --- a/fhem/FHEM/73_AutoShuttersControl.pm +++ b/fhem/FHEM/73_AutoShuttersControl.pm @@ -9,6 +9,7 @@ # - Bernd (Cluni) this module is based on the logic of his script "Rollladensteuerung für HM/ROLLO inkl. Abschattung und Komfortfunktionen in Perl" (https://forum.fhem.de/index.php/topic,73964.0.html) # - Beta-User for many tests and ideas # - pc1246 write english commandref +# - FunkOdyssey commandref style # - sledge fix many typo in commandref # - many User that use with modul and report bugs # @@ -44,7 +45,7 @@ use strict; use warnings; use FHEM::Meta; -my $version = '0.6.9'; +my $version = '0.6.11'; sub AutoShuttersControl_Initialize($) { my ($hash) = @_; @@ -338,6 +339,8 @@ sub Notify($$) { if ( $ascDev->getSelfDefense eq 'none' ); readingsSingleUpdate( $hash, 'controlShading', 'off', 0 ) if ( $ascDev->getAutoShuttersControlShading eq 'none' ); + readingsSingleUpdate( $hash, 'ascEnable', 'on', 0 ) + if ( $ascDev->getASCenable eq 'none' ); # Ist der Event ein globaler und passt zum Rest der Abfrage oben wird nach neuen Rolläden Devices gescannt und eine Liste im Rolladenmodul sortiert nach Raum generiert ShuttersDeviceScan($hash) @@ -504,20 +507,41 @@ sub Set($$@) { return "usage: $cmd" if ( @args > 1 ); readingsSingleUpdate( $hash, $cmd, join( ' ', @args ), 1 ); } + elsif ( lc $cmd eq 'ascenable' ) { + return "usage: $cmd" if ( @args > 1 ); + readingsSingleUpdate( $hash, $cmd, join( ' ', @args ), 1 ); + } + elsif ( lc $cmd eq 'shutterascenabletoggle' ) { + return "usage: $cmd" if ( @args > 1 ); + readingsSingleUpdate( + $defs{ $args[0] }, + 'ASC_Enable', + ( + ReadingsVal( $args[0], 'ASC_Enable', 'off' ) eq 'on' + ? 'off' + : 'on' + ), + 1 + ); + } elsif ( lc $cmd eq 'wiggle' ) { return "usage: $cmd" if ( @args > 1 ); ( $args[0] eq 'all' ? wiggleAll($hash) : wiggle( $hash, $args[0] ) ); } else { - my $list = "scanForShutters:noArg"; + my $list = 'scanForShutters:noArg'; $list .= -" renewSetSunriseSunsetTimer:noArg partyMode:on,off hardLockOut:on,off sunriseTimeWeHoliday:on,off controlShading:on,off selfDefense:on,off wiggle:all," +' renewSetSunriseSunsetTimer:noArg partyMode:on,off hardLockOut:on,off sunriseTimeWeHoliday:on,off controlShading:on,off selfDefense:on,off ascEnable:on,off wiggle:all,' . join( ',', @{ $hash->{helper}{shuttersList} } ) if ( ReadingsVal( $name, 'userAttrList', 'none' ) eq 'rolled out' ); - $list .= " createNewNotifyDev:noArg" + $list .= ' createNewNotifyDev:noArg' if ( ReadingsVal( $name, 'userAttrList', 'none' ) eq 'rolled out' and AttrVal( $name, 'ASC_expert', 0 ) == 1 ); + $list .= + ' shutterASCenableToggle:' + . join( ',', @{ $hash->{helper}{shuttersList} } ) + if ( ReadingsVal( $name, 'userAttrList', 'none' ) eq 'rolled out' ); return "Unknown argument $cmd,choose one of $list"; } @@ -596,6 +620,8 @@ sub ShuttersDeviceScan($) { $shutters->setShadingStatus( ( $shutters->getStatus != $shutters->getShadingPos ? 'out' : 'in' ) ); + readingsSingleUpdate( $defs{$_}, 'ASC_Enable', 'on', 0 ) + if ( ReadingsVal( $_, 'ASC_Enable', 'none' ) eq 'none' ); } ### Temporär und muss später entfernt werden @@ -1190,6 +1216,18 @@ sub EventProcessingResidents($@) { $shutters->setLastDrive('residents home'); $shutters->setDriveCmd( $shutters->getClosedPos ); } + elsif ( + $shutters->getShadingMode eq 'home' + and IsDay($shuttersDev) + and $shutters->getIfInShading + and $shutters->getStatus != $shutters->getShadingPos + and not( CheckIfShuttersWindowRecOpen($shuttersDev) == 2 + and $shutters->getShuttersPlace eq 'terrace' ) + ) + { + $shutters->setLastDrive('shading in'); + $shutters->setDriveCmd( $shutters->getShadingPos ); + } elsif ( $ascDev->getSelfDefense eq 'on' and CheckIfShuttersWindowRecOpen($shuttersDev) != 0 @@ -1356,10 +1394,12 @@ sub EventProcessingBrightness($@) { computeAlignTime( '24:00', $shutters->getTimeUpEarly ) / 86400 ) - and ( not IsWe() - or (IsWe() - and $ascDev->getSunriseTimeWeHoliday eq 'off') - ) ) + and ( + not IsWe() + or ( IsWe() + and $ascDev->getSunriseTimeWeHoliday eq 'off' ) + ) + ) or ( int( gettimeofday() / 86400 ) != int( computeAlignTime( '24:00', @@ -1435,10 +1475,12 @@ sub EventProcessingBrightness($@) { computeAlignTime( '24:00', $shutters->getTimeUpEarly ) / 86400 ) - and ( not IsWe() - or (IsWe() - and $ascDev->getSunriseTimeWeHoliday eq 'off') - ) ) + and ( + not IsWe() + or ( IsWe() + and $ascDev->getSunriseTimeWeHoliday eq 'off' ) + ) + ) or ( int( gettimeofday() / 86400 ) != int( computeAlignTime( '24:00', @@ -1824,10 +1866,16 @@ sub ShadingProcessing($@) { . ' - Alle Werte für die weitere Verarbeitung sind korrekt vorhanden und es wird nun mit der Beschattungsverarbeitung begonnen' ); + # minimalen und maximalen Winkel des Fensters bestimmen. wenn die aktuelle Sonnenposition z.B. bei 205° läge und der Wert für angleMin/Max 85° wäre, dann würden zwischen 120° und 290° beschattet. + my $winPosMin = $winPos - $angleMinus; + my $winPosMax = $winPos + $anglePlus; + if ( ( $outTemp < $shutters->getShadingMinOutsideTemperature - 3 or not IsDay($shuttersDev) + or $azimuth < $winPosMin + or $azimuth > $winPosMax ) and $shutters->getShadingStatus ne 'out' and $getStatus != $getShadingPos @@ -1848,10 +1896,6 @@ sub ShadingProcessing($@) { ); } -# minimalen und maximalen Winkel des Fensters bestimmen. wenn die aktuelle Sonnenposition z.B. bei 205° läge und der Wert für angleMin/Max 85° wäre, dann würden zwischen 120° und 290° beschattet. - my $winPosMin = $winPos - $angleMinus; - my $winPosMax = $winPos + $anglePlus; - if ( $azimuth < $winPosMin or $azimuth > $winPosMax or $elevation < $shutters->getShadingMinElevation @@ -2096,12 +2140,10 @@ sub ShuttersCommandSet($$$) { or $shutters->getComfortOpenPos != $posValue ) and $shutters->getVentilateOpen eq 'on' ) - or ( - CheckIfShuttersWindowRecOpen($shuttersDev) == 2 + or ( CheckIfShuttersWindowRecOpen($shuttersDev) == 2 and $shutters->getSubTyp eq 'threestate' and $ascDev->getAutoShuttersControlComfort eq 'on' - and $shutters->getVentilateOpen eq 'off' - ) + and $shutters->getVentilateOpen eq 'off' ) or ( CheckIfShuttersWindowRecOpen($shuttersDev) == 2 and ( $shutters->getLockOut eq 'soft' @@ -2341,7 +2383,7 @@ sub SunSetShuttersAfterTimerFn($) { $shutters->setSunset(1); $shutters->setSunrise(0); - + my $posValue; if ( CheckIfShuttersWindowRecOpen($shuttersDev) == 0 or $shutters->getVentilateOpen eq 'off' ) @@ -2391,7 +2433,7 @@ sub SunRiseShuttersAfterTimerFn($) { my $hash = $funcHash->{hash}; my $shuttersDev = $funcHash->{shuttersdevice}; $shutters->setShuttersDev($shuttersDev); - + $shutters->setSunset(0); $shutters->setSunrise(1); @@ -3286,7 +3328,8 @@ sub SetCmdFn($) { if ( defined( $h->{lastDrive} ) ); return - unless ( $shutters->getASC != 0 ); + unless ( $shutters->getASCenable eq 'on' + and $ascDev->getASCenable eq 'on' ); if ( $shutters->getStatus != $posValue ) { $shutters->setLastPos( $shutters->getStatus ); @@ -3857,13 +3900,6 @@ BEGIN { ); } -sub getASC { - ## Dient der Erkennung des Rolladen, 0 bedeutet soll nicht erkannt werden beim ersten Scan und soll nicht bediehnt werden wenn Events kommen - my $self = shift; - - return AttrVal( $self->{shuttersDev}, 'ASC', 0 ); -} - sub getAntiFreezePos { my $self = shift; @@ -4391,6 +4427,12 @@ sub getDelayCmd { return $self->{ $self->{shuttersDev} }{delayCmd}; } +sub getASCenable { + my $self = shift; + + return ReadingsVal( $self->{shuttersDev}, 'ASC_Enable', 'on' ); +} + ## Klasse Fenster (Window) und die Subklassen Attr und Readings ## package ASC_Window; our @ISA = qw(ASC_Window::Attr ASC_Window::Readings); @@ -4658,6 +4700,13 @@ sub getElevation { return $elevation; } +sub getASCenable { + my $self = shift; + my $name = $self->{name}; + + return ReadingsVal( $name, 'ascEnable', 'none' ); +} + ## Subklasse Attr ## package ASC_Dev::Attr; @@ -4970,402 +5019,223 @@ sub getblockAscDrivesAfterManual { =begin html -

Automatische Rollladensteuerung - ASC

- +

AutoShuttersControl

+

+ We apologize.
+ The english translation will follow soon.
+ Please use the german manual until then. +

=end html =begin html_DE -

Automatische Rollladensteuerung - ASC

+

AutoShuttersControl