diff --git a/fhem/CHANGED b/fhem/CHANGED index a095142a6..293824821 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # 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. + - bugfix: 73_AutoShuttersControl: add new english commandref, fix many bugs + change manual drive detection code - bugfix: 73_DoorBird: bugfix for History-Image on event. - bugfix: 93_DbLog: fix ignore MinInterval if value is "0", Forum: #100344 - change: 36_Vallox: added reading for handling homebridge speed control diff --git a/fhem/FHEM/73_AutoShuttersControl.pm b/fhem/FHEM/73_AutoShuttersControl.pm index e8d012065..845ad345f 100644 --- a/fhem/FHEM/73_AutoShuttersControl.pm +++ b/fhem/FHEM/73_AutoShuttersControl.pm @@ -7,13 +7,14 @@ # # Special thanks goes to: # - 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 +# - Beta-User for many tests, many suggestions and good discussions # - pc1246 write english commandref # - FunkOdyssey commandref style # - sledge fix many typo in commandref # - many User that use with modul and report bugs # - Christoph (christoph.kaiser.in) Patch that expand RegEx for Window Events # - Julian (Loredo) expand Residents Events for new Residents functions +# - Christoph (Christoph Morrison) for fix Commandref, many suggestions and good discussions # # # This script is free software; you can redistribute it and/or modify @@ -47,22 +48,22 @@ use strict; use warnings; use FHEM::Meta; -my $version = '0.6.14'; +my $version = '0.6.15'; sub AutoShuttersControl_Initialize($) { my ($hash) = @_; - ### alte Attribute welche entfernt werden - my $oldAttr = - 'ASC_temperatureSensor ' - . 'ASC_temperatureReading ' - . 'ASC_residentsDevice ' - . 'ASC_residentsDeviceReading ' - . 'ASC_rainSensorDevice ' - . 'ASC_rainSensorReading ' - . 'ASC_rainSensorShuttersClosedPos:0,10,20,30,40,50,60,70,80,90,100 ' - . 'ASC_brightnessMinVal ' - . 'ASC_brightnessMaxVal '; +# ### alte Attribute welche entfernt werden +# my $oldAttr = +# 'ASC_temperatureSensor ' +# . 'ASC_temperatureReading ' +# . 'ASC_residentsDevice ' +# . 'ASC_residentsDeviceReading ' +# . 'ASC_rainSensorDevice ' +# . 'ASC_rainSensorReading ' +# . 'ASC_rainSensorShuttersClosedPos:0,10,20,30,40,50,60,70,80,90,100 ' +# . 'ASC_brightnessMinVal ' +# . 'ASC_brightnessMaxVal '; ## Da ich mit package arbeite müssen in die Initialize für die jeweiligen hash Fn Funktionen der Funktionsname # und davor mit :: getrennt der eigentliche package Name des Modules @@ -91,7 +92,7 @@ sub AutoShuttersControl_Initialize($) { . 'ASC_expert:1 ' . 'ASC_blockAscDrivesAfterManual:0,1 ' . 'ASC_debug:1 ' - . $oldAttr +# . $oldAttr . $readingFnAttributes; $hash->{NotifyOrderPrefix} = '51-'; # Order Nummer für NotifyFn @@ -220,7 +221,7 @@ my %userAttrList = ( my %posSetCmds = ( ZWave => 'dim', - Siro => 'position', + Siro => 'pct', CUL_HM => 'pct', ROLLO => 'pct', SOMFY => 'position', @@ -316,7 +317,8 @@ sub Undef($$) { sub Attr(@) { my ( $cmd, $name, $attrName, $attrVal ) = @_; - my $hash = $defs{$name}; + + # my $hash = $defs{$name}; return undef; } @@ -621,17 +623,17 @@ sub ShuttersDeviceScan($) { push( @{ $hash->{helper}{shuttersList} }, $_ ) ; ## einem Hash wird ein Array zugewiesen welches die Liste der erkannten Rollos beinhaltet - delFromDevAttrList( $_, 'ASC_Wind_SensorDevice' ) - ; # temporär muss später gelöscht werden ab Version 0.4.0.10 - delFromDevAttrList( $_, 'ASC_Wind_SensorReading' ) - ; # temporär muss später gelöscht werden ab Version 0.4.0.10 - delFromDevAttrList( $_, 'ASC_Wind_minMaxSpeed' ) - ; # temporär muss später gelöscht werden ab Version 0.4.11beta6 - delFromDevAttrList( $_, 'ASC_Wind_Pos' ) - ; # temporär muss später gelöscht werden ab Version 0.4.11beta6 - CommandDeleteReading( undef, $_ . ' ASC_Time_PrivacyDriveUp' ) - if ( ReadingsVal( $_, 'ASC_Time_PrivacyDriveUp', 'none' ) ne 'none' ) - ; # temporär muss später gelöscht werden ab Version 0.6.3 +# delFromDevAttrList( $_, 'ASC_Wind_SensorDevice' ) +# ; # temporär muss später gelöscht werden ab Version 0.4.0.10 +# delFromDevAttrList( $_, 'ASC_Wind_SensorReading' ) +# ; # temporär muss später gelöscht werden ab Version 0.4.0.10 +# delFromDevAttrList( $_, 'ASC_Wind_minMaxSpeed' ) +# ; # temporär muss später gelöscht werden ab Version 0.4.11beta6 +# delFromDevAttrList( $_, 'ASC_Wind_Pos' ) +# ; # temporär muss später gelöscht werden ab Version 0.4.11beta6 +# CommandDeleteReading( undef, $_ . ' ASC_Time_PrivacyDriveUp' ) +# if ( ReadingsVal( $_, 'ASC_Time_PrivacyDriveUp', 'none' ) ne 'none' ) +# ; # temporär muss später gelöscht werden ab Version 0.6.3 $shuttersList = $shuttersList . ',' . $_; $shutters->setShuttersDev($_); @@ -647,52 +649,52 @@ sub ShuttersDeviceScan($) { if ( ReadingsVal( $_, 'ASC_Enable', 'none' ) eq 'none' ); } - ### Temporär und muss später entfernt werden - CommandAttr( undef, - $name - . ' ASC_tempSensor ' - . AttrVal( $name, 'ASC_temperatureSensor', 'none' ) . ':' - . AttrVal( $name, 'ASC_temperatureReading', 'temperature' ) ) - if ( AttrVal( $name, 'ASC_temperatureSensor', 'none' ) ne 'none' ); - CommandAttr( undef, - $name - . ' ASC_residentsDev ' - . AttrVal( $name, 'ASC_residentsDevice', 'none' ) . ':' - . AttrVal( $name, 'ASC_residentsDeviceReading', 'state' ) ) - if ( AttrVal( $name, 'ASC_residentsDevice', 'none' ) ne 'none' ); - CommandAttr( undef, - $name - . ' ASC_rainSensor ' - . AttrVal( $name, 'ASC_rainSensorDevice', 'none' ) . ':' - . AttrVal( $name, 'ASC_rainSensorReading', 'rain' ) . ' 100 ' - . AttrVal( $name, 'ASC_rainSensorShuttersClosedPos', 50 ) ) - if ( AttrVal( $name, 'ASC_rainSensorDevice', 'none' ) ne 'none' ); - CommandAttr( undef, - $name - . ' ASC_brightnessDriveUpDown ' - . AttrVal( $name, 'ASC_brightnessMinVal', 500 ) . ':' - . AttrVal( $name, 'ASC_brightnessMaxVal', 800 ) ) - if ( AttrVal( $name, 'ASC_brightnessMinVal', 'none' ) ne 'none' ); - - CommandDeleteAttr( undef, $name . ' ASC_temperatureSensor' ) - if ( AttrVal( $name, 'ASC_temperatureSensor', 'none' ) ne 'none' ); - CommandDeleteAttr( undef, $name . ' ASC_temperatureReading' ) - if ( AttrVal( $name, 'ASC_temperatureReading', 'none' ) ne 'none' ); - CommandDeleteAttr( undef, $name . ' ASC_residentsDevice' ) - if ( AttrVal( $name, 'ASC_residentsDevice', 'none' ) ne 'none' ); - CommandDeleteAttr( undef, $name . ' ASC_residentsDeviceReading' ) - if ( AttrVal( $name, 'ASC_residentsDeviceReading', 'none' ) ne 'none' ); - CommandDeleteAttr( undef, $name . ' ASC_rainSensorDevice' ) - if ( AttrVal( $name, 'ASC_rainSensorDevice', 'none' ) ne 'none' ); - CommandDeleteAttr( undef, $name . ' ASC_rainSensorReading' ) - if ( AttrVal( $name, 'ASC_rainSensorReading', 'none' ) ne 'none' ); - CommandDeleteAttr( undef, $name . ' ASC_rainSensorShuttersClosedPos' ) - if ( - AttrVal( $name, 'ASC_rainSensorShuttersClosedPos', 'none' ) ne 'none' ); - CommandDeleteAttr( undef, $name . ' ASC_brightnessMinVal' ) - if ( AttrVal( $name, 'ASC_brightnessMinVal', 'none' ) ne 'none' ); - CommandDeleteAttr( undef, $name . ' ASC_brightnessMaxVal' ) - if ( AttrVal( $name, 'ASC_brightnessMaxVal', 'none' ) ne 'none' ); +# ### Temporär und muss später entfernt werden +# CommandAttr( undef, +# $name +# . ' ASC_tempSensor ' +# . AttrVal( $name, 'ASC_temperatureSensor', 'none' ) . ':' +# . AttrVal( $name, 'ASC_temperatureReading', 'temperature' ) ) +# if ( AttrVal( $name, 'ASC_temperatureSensor', 'none' ) ne 'none' ); +# CommandAttr( undef, +# $name +# . ' ASC_residentsDev ' +# . AttrVal( $name, 'ASC_residentsDevice', 'none' ) . ':' +# . AttrVal( $name, 'ASC_residentsDeviceReading', 'state' ) ) +# if ( AttrVal( $name, 'ASC_residentsDevice', 'none' ) ne 'none' ); +# CommandAttr( undef, +# $name +# . ' ASC_rainSensor ' +# . AttrVal( $name, 'ASC_rainSensorDevice', 'none' ) . ':' +# . AttrVal( $name, 'ASC_rainSensorReading', 'rain' ) . ' 100 ' +# . AttrVal( $name, 'ASC_rainSensorShuttersClosedPos', 50 ) ) +# if ( AttrVal( $name, 'ASC_rainSensorDevice', 'none' ) ne 'none' ); +# CommandAttr( undef, +# $name +# . ' ASC_brightnessDriveUpDown ' +# . AttrVal( $name, 'ASC_brightnessMinVal', 500 ) . ':' +# . AttrVal( $name, 'ASC_brightnessMaxVal', 800 ) ) +# if ( AttrVal( $name, 'ASC_brightnessMinVal', 'none' ) ne 'none' ); +# +# CommandDeleteAttr( undef, $name . ' ASC_temperatureSensor' ) +# if ( AttrVal( $name, 'ASC_temperatureSensor', 'none' ) ne 'none' ); +# CommandDeleteAttr( undef, $name . ' ASC_temperatureReading' ) +# if ( AttrVal( $name, 'ASC_temperatureReading', 'none' ) ne 'none' ); +# CommandDeleteAttr( undef, $name . ' ASC_residentsDevice' ) +# if ( AttrVal( $name, 'ASC_residentsDevice', 'none' ) ne 'none' ); +# CommandDeleteAttr( undef, $name . ' ASC_residentsDeviceReading' ) +# if ( AttrVal( $name, 'ASC_residentsDeviceReading', 'none' ) ne 'none' ); +# CommandDeleteAttr( undef, $name . ' ASC_rainSensorDevice' ) +# if ( AttrVal( $name, 'ASC_rainSensorDevice', 'none' ) ne 'none' ); +# CommandDeleteAttr( undef, $name . ' ASC_rainSensorReading' ) +# if ( AttrVal( $name, 'ASC_rainSensorReading', 'none' ) ne 'none' ); +# CommandDeleteAttr( undef, $name . ' ASC_rainSensorShuttersClosedPos' ) +# if ( +# AttrVal( $name, 'ASC_rainSensorShuttersClosedPos', 'none' ) ne 'none' ); +# CommandDeleteAttr( undef, $name . ' ASC_brightnessMinVal' ) +# if ( AttrVal( $name, 'ASC_brightnessMinVal', 'none' ) ne 'none' ); +# CommandDeleteAttr( undef, $name . ' ASC_brightnessMaxVal' ) +# if ( AttrVal( $name, 'ASC_brightnessMaxVal', 'none' ) ne 'none' ); $hash->{NOTIFYDEV} = "global," . $name . $shuttersList; @@ -1330,20 +1332,20 @@ sub EventProcessingRain($@) { if ( $val > $triggerMax and $shutters->getStatus != $closedPos and IsAfterShuttersManualBlocking($shuttersDev) - and $shutters->getRainProtectionStatus eq 'unprotection' ) + and $shutters->getRainProtectionStatus eq 'unprotected' ) { - $shutters->setLastDrive('rain protection'); + $shutters->setLastDrive('rain protected'); $shutters->setDriveCmd($closedPos); - $shutters->setRainProtectionStatus('protection'); + $shutters->setRainProtectionStatus('protected'); } elsif ( ( $val == 0 or $val < $triggerMax ) and $shutters->getStatus == $closedPos and IsAfterShuttersManualBlocking($shuttersDev) - and $shutters->getRainProtectionStatus eq 'protection' ) + and $shutters->getRainProtectionStatus eq 'protected' ) { - $shutters->setLastDrive('rain un-protection'); + $shutters->setLastDrive('rain un-protected'); $shutters->setDriveCmd( $shutters->getLastPos ); - $shutters->setRainProtectionStatus('unprotection'); + $shutters->setRainProtectionStatus('unprotected'); } } } @@ -1380,18 +1382,18 @@ sub EventProcessingWind($@) { ); if ( $1 > $shutters->getWindMax - and $shutters->getWindProtectionStatus eq 'unprotection' ) + and $shutters->getWindProtectionStatus eq 'unprotected' ) { - $shutters->setLastDrive('wind protection'); + $shutters->setLastDrive('wind protected'); $shutters->setDriveCmd( $shutters->getWindPos ); - $shutters->setWindProtectionStatus('protection'); + $shutters->setWindProtectionStatus('protected'); } elsif ( $1 < $shutters->getWindMin - and $shutters->getWindProtectionStatus eq 'protection' ) + and $shutters->getWindProtectionStatus eq 'protected' ) { - $shutters->setLastDrive('wind un-protection'); + $shutters->setLastDrive('wind un-protected'); $shutters->setDriveCmd( $shutters->getLastPos ); - $shutters->setWindProtectionStatus('unprotection'); + $shutters->setWindProtectionStatus('unprotected'); } ASC_Debug( 'EventProcessingWind: ' @@ -1720,8 +1722,8 @@ sub EventProcessingShadingBrightness($@) { ) and IsDay($shuttersDev) and $ascDev->getAutoShuttersControlShading eq 'on' - and $shutters->getRainProtectionStatus eq 'unprotection' - and $shutters->getWindProtectionStatus eq 'unprotection' + and $shutters->getRainProtectionStatus eq 'unprotected' + and $shutters->getWindProtectionStatus eq 'unprotected' ) { ShadingProcessing( @@ -1743,8 +1745,8 @@ sub EventProcessingShadingBrightness($@) { } elsif ( $shutters->getShadingStatus eq 'in' and $shutters->getShadingMode ne $homemode - and $shutters->getRainProtectionStatus eq 'unprotection' - and $shutters->getWindProtectionStatus eq 'unprotection' ) + and $shutters->getRainProtectionStatus eq 'unprotected' + and $shutters->getWindProtectionStatus eq 'unprotected' ) { $shutters->setShadingStatus('out'); ShadingProcessingDriveCommand( $hash, $shuttersDev ); @@ -1805,8 +1807,8 @@ sub EventProcessingTwilightDevice($@) { ) and IsDay($shuttersDev) and $ascDev->getAutoShuttersControlShading eq 'on' - and $shutters->getRainProtectionStatus eq 'unprotection' - and $shutters->getWindProtectionStatus eq 'unprotection' + and $shutters->getRainProtectionStatus eq 'unprotected' + and $shutters->getWindProtectionStatus eq 'unprotected' ) { ShadingProcessing( @@ -2174,6 +2176,17 @@ sub EventProcessingShutters($@) { $shutters->setLastDriveReading; $ascDev->setStateReading; $shutters->setLastManPos($1); + + ASC_Debug( + 'EventProcessingShutters: eine manualle Fahrt wurde erkannt!'); + } + else { + $shutters->setLastDriveReading; + $ascDev->setStateReading; + + ASC_Debug( +'EventProcessingShutters: eine automatisierte Fahrt durch ASC wurde erkannt! Es werden nun die LastDriveReading und StateReading Werte gesetzt!' + ); } } } @@ -2360,24 +2373,24 @@ sub RenewSunRiseSetShuttersTimer($) { $shutters->setInTimerFuncHash(undef); CreateSunRiseSetShuttersTimer( $hash, $_ ); - ### Temporär angelegt damit die neue Attributs Parameter Syntax verteilt werden kann +# ### Temporär angelegt damit die neue Attributs Parameter Syntax verteilt werden kann # CommandAttr(undef, $_ . ' ASC_BrightnessSensor '.AttrVal($_, 'ASC_Brightness_Sensor', 'none').':'.AttrVal($_, 'ASC_Brightness_Reading', 'brightness').' '.AttrVal($_, 'ASC_BrightnessMinVal', 500).':'.AttrVal($_, 'ASC_BrightnessMaxVal', 700)) if ( AttrVal($_, 'ASC_Brightness_Sensor', 'none') ne 'none' ); - $attr{$_}{'ASC_BrightnessSensor'} = - AttrVal( $_, 'ASC_Brightness_Sensor', 'none' ) . ':' - . AttrVal( $_, 'ASC_Brightness_Reading', 'brightness' ) . ' ' - . AttrVal( $_, 'ASC_BrightnessMinVal', 500 ) . ':' - . AttrVal( $_, 'ASC_BrightnessMaxVal', 700 ) - if ( AttrVal( $_, 'ASC_Brightness_Sensor', 'none' ) ne 'none' ); - - delFromDevAttrList( $_, 'ASC_Brightness_Sensor' ) - ; # temporär muss später gelöscht werden ab Version 0.4.11beta9 - delFromDevAttrList( $_, 'ASC_Brightness_Reading' ) - ; # temporär muss später gelöscht werden ab Version 0.4.11beta9 - delFromDevAttrList( $_, 'ASC_BrightnessMinVal' ) - ; # temporär muss später gelöscht werden ab Version 0.4.11beta9 - delFromDevAttrList( $_, 'ASC_BrightnessMaxVal' ) - ; # temporär muss später gelöscht werden ab Version 0.4.11beta9 +# $attr{$_}{'ASC_BrightnessSensor'} = +# AttrVal( $_, 'ASC_Brightness_Sensor', 'none' ) . ':' +# . AttrVal( $_, 'ASC_Brightness_Reading', 'brightness' ) . ' ' +# . AttrVal( $_, 'ASC_BrightnessMinVal', 500 ) . ':' +# . AttrVal( $_, 'ASC_BrightnessMaxVal', 700 ) +# if ( AttrVal( $_, 'ASC_Brightness_Sensor', 'none' ) ne 'none' ); +# +# delFromDevAttrList( $_, 'ASC_Brightness_Sensor' ) +# ; # temporär muss später gelöscht werden ab Version 0.4.11beta9 +# delFromDevAttrList( $_, 'ASC_Brightness_Reading' ) +# ; # temporär muss später gelöscht werden ab Version 0.4.11beta9 +# delFromDevAttrList( $_, 'ASC_BrightnessMinVal' ) +# ; # temporär muss später gelöscht werden ab Version 0.4.11beta9 +# delFromDevAttrList( $_, 'ASC_BrightnessMaxVal' ) +# ; # temporär muss später gelöscht werden ab Version 0.4.11beta9 } } @@ -3410,8 +3423,6 @@ sub SetCmdFn($) { if ( $shutters->getStatus != $posValue ) { $shutters->setLastPos( $shutters->getStatus ); - $shutters->setLastDriveReading; - $ascDev->setStateReading; } else { $shutters->setLastDrive( @@ -3522,7 +3533,7 @@ sub setHardLockOut { CommandSet( undef, $self->{shuttersDev} . ' ' . ( $cmd eq 'on' ? 'protectionOn' : 'protectionOff' ) ) - if ( $shutters->getLockOutCmd eq 'protection' ); + if ( $shutters->getLockOutCmd eq 'protected' ); } return 0; } @@ -3884,7 +3895,7 @@ sub setShadingStatus { return 0; } -sub setWindProtectionStatus { # Werte protection, unprotection +sub setWindProtectionStatus { # Werte protected, unprotected my ( $self, $value ) = @_; $self->{ $self->{shuttersDev} }->{ASC_WindParameters}->{VAL} = $value @@ -3892,7 +3903,7 @@ sub setWindProtectionStatus { # Werte protection, unprotection return 0; } -sub setRainProtectionStatus { # Werte protection, unprotection +sub setRainProtectionStatus { # Werte protected, unprotected my ( $self, $value ) = @_; $self->{ $self->{shuttersDev} }->{RainProtection}->{VAL} = $value @@ -3920,7 +3931,7 @@ sub getIfInShading { ); } -sub getWindProtectionStatus { # Werte protection, unprotection +sub getWindProtectionStatus { # Werte protected, unprotected my $self = shift; return ( @@ -3931,11 +3942,11 @@ sub getWindProtectionStatus { # Werte protection, unprotection ) ) ? $self->{ $self->{shuttersDev} }->{ASC_WindParameters}->{VAL} - : 'unprotection' + : 'unprotected' ); } -sub getRainProtectionStatus { # Werte protection, unprotection +sub getRainProtectionStatus { # Werte protected, unprotected my $self = shift; return ( @@ -3946,7 +3957,7 @@ sub getRainProtectionStatus { # Werte protection, unprotection ) ) ? $self->{ $self->{shuttersDev} }->{RainProtection}->{VAL} - : 'unprotection' + : 'unprotected' ); } @@ -4144,17 +4155,15 @@ sub getShadingWaitingPeriod { sub getOffset { my $self = shift; - return AttrVal( $self->{shuttersDev}, 'ASC_Drive_Offset', -1 ); + my $val = AttrVal( $self->{shuttersDev}, 'ASC_Drive_Offset', -1 ); + return ( $val =~ /^\d+$/ ? $val : -1 ); } sub getOffsetStart { my $self = shift; - return ( - AttrVal( $self->{shuttersDev}, 'ASC_Drive_OffsetStart', -1 ) > 0 - ? AttrVal( $self->{shuttersDev}, 'ASC_Drive_OffsetStart', -1 ) - : -1 - ); + my $val = AttrVal( $self->{shuttersDev}, 'ASC_Drive_OffsetStart', -1 ); + return ( ( $val > 0 and $val =~ /^\d+$/ ) ? $val : -1 ); } sub getBlockingTimeAfterManual { @@ -5128,11 +5137,603 @@ sub getblockAscDrivesAfterManual {

AutoShuttersControl

-

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

+