From 19a18429c7be8adf5ec494f175ce14538e9fa03f Mon Sep 17 00:00:00 2001 From: LeonGaultier Date: Tue, 13 Aug 2019 06:59:03 +0000 Subject: [PATCH] 73_AutoShuttersControl: fix UTF8 Problem und Initialisierungfehler, fix brightness morning and evening drive, add more condition for roommate and shading git-svn-id: https://svn.fhem.de/fhem/trunk@19995 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 3 ++ fhem/FHEM/73_AutoShuttersControl.pm | 74 +++++++++++++++-------------- 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 6ffcfe46c..0bab14a8d 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. + - bugfix: 73_AutoShuttersControl: fix UTF8 Problem und Initialisierungfehler, + fix brightness morning and evening drive, add more condition + for roommate and shading - bugfix: 82_LGTV_WebOS: fix Forum #966380 - feature: 93_DbLog: new attr DbLogValueFn propagated as device specific attribute if DbLog is used diff --git a/fhem/FHEM/73_AutoShuttersControl.pm b/fhem/FHEM/73_AutoShuttersControl.pm index e14b62253..55582aef9 100644 --- a/fhem/FHEM/73_AutoShuttersControl.pm +++ b/fhem/FHEM/73_AutoShuttersControl.pm @@ -1149,7 +1149,8 @@ sub EventProcessingRoommate($@) { { if ( $shutters->getIfInShading and not $shutters->getShadingManualDriveStatus - and $shutters->getStatus == $shutters->getOpenPos ) + and $shutters->getStatus == $shutters->getOpenPos + and $shutters->getShadingMode 'home') { $shutters->setLastDrive('shading in'); $posValue = $shutters->getShadingPos; @@ -1157,7 +1158,8 @@ sub EventProcessingRoommate($@) { ShuttersCommandSet( $hash, $shuttersDev, $posValue ); } elsif ( - not $shutters->getIfInShading + ( not $shutters->getIfInShading + or $shutters->getShadingMode eq 'absent' ) and ( $shutters->getStatus == $shutters->getClosedPos or $shutters->getStatus == $shutters->getShadingPos ) @@ -1217,13 +1219,13 @@ sub EventProcessingRoommate($@) { { $posValue = $shutters->getShadingPos; $shutters->setLastDrive('shading in'); + ShuttersCommandSet( $hash, $shuttersDev, $posValue ); } - else { + elsif ( not $shutters->getIsDay ) { $posValue = $shutters->getClosedPos; $shutters->setLastDrive('roommate absent'); + ShuttersCommandSet( $hash, $shuttersDev, $posValue ); } - - ShuttersCommandSet( $hash, $shuttersDev, $posValue ); } } } @@ -1553,8 +1555,8 @@ sub EventProcessingBrightness($@) { return EventProcessingShadingBrightness( $hash, $shuttersDev, $events ) unless ( ( - $shutters->getModeDown eq 'brightness' - or $shutters->getModeUp eq 'brightness' + $shutters->getDown eq 'brightness' + or $shutters->getUp eq 'brightness' ) or ( ( @@ -1682,7 +1684,6 @@ sub EventProcessingBrightness($@) { my $homemode = $shutters->getRoommatesStatus; $homemode = $ascDev->getResidentsStatus if ( $homemode eq 'none' ); - $shutters->setLastDrive('maximum brightness threshold exceeded'); if ( $shutters->getModeUp eq $homemode @@ -1707,6 +1708,7 @@ sub EventProcessingBrightness($@) { and $ascDev->getResidentsStatus eq 'home' ) ) { + $shutters->setLastDrive('maximum brightness threshold exceeded'); $shutters->setSunrise(1); $shutters->setSunset(0); ShuttersCommandSet( $hash, $shuttersDev, @@ -1749,24 +1751,9 @@ sub EventProcessingBrightness($@) { . ' - Verarbeitungszeit für Sunset wurd erkannt. Prüfe Status der Roommates' ); - my $posValue; - if ( CheckIfShuttersWindowRecOpen($shuttersDev) == 2 - and $shutters->getSubTyp eq 'threestate' - and $ascDev->getAutoShuttersControlComfort eq 'on' ) - { - $posValue = $shutters->getComfortOpenPos; - } - elsif ( CheckIfShuttersWindowRecOpen($shuttersDev) == 0 - or $shutters->getVentilateOpen eq 'off' ) - { - $posValue = $shutters->getClosedPos; - } - else { $posValue = $shutters->getVentilatePos; } - my $homemode = $shutters->getRoommatesStatus; $homemode = $ascDev->getResidentsStatus if ( $homemode eq 'none' ); - $shutters->setLastDrive('minimum brightness threshold fell below'); if ( $shutters->getModeDown eq $homemode @@ -1775,6 +1762,21 @@ sub EventProcessingBrightness($@) { or $shutters->getModeDown eq 'always' ) { + my $posValue; + if ( CheckIfShuttersWindowRecOpen($shuttersDev) == 2 + and $shutters->getSubTyp eq 'threestate' + and $ascDev->getAutoShuttersControlComfort eq 'on' ) + { + $posValue = $shutters->getComfortOpenPos; + } + elsif ( CheckIfShuttersWindowRecOpen($shuttersDev) == 0 + or $shutters->getVentilateOpen eq 'off' ) + { + $posValue = $shutters->getClosedPos; + } + else { $posValue = $shutters->getVentilatePos; } + + $shutters->setLastDrive('minimum brightness threshold fell below'); $shutters->setSunrise(0); $shutters->setSunset(1); ShuttersCommandSet( $hash, $shuttersDev, $posValue ); @@ -3413,9 +3415,11 @@ sub IsAfterShuttersTimeBlocking($) { ( int( gettimeofday() ) - $shutters->getLastManPosTimestamp ) < $shutters->getBlockingTimeAfterManual or ( not $shutters->getIsDay + and defined( $shutters->getSunriseUnixTime ) and $shutters->getSunriseUnixTime - ( int( gettimeofday() ) ) < $shutters->getBlockingTimeBeforDayOpen ) or ( $shutters->getIsDay + and defined( $shutters->getSunriseUnixTime ) and $shutters->getSunsetUnixTime - ( int( gettimeofday() ) ) < $shutters->getBlockingTimeBeforNightClose ) ) @@ -3535,18 +3539,18 @@ sub CheckIfShuttersWindowRecOpen($) { sub makeReadingName($) { my ($rname) = @_; my %charHash = ( - "ä" => "ae", - "Ä" => "Ae", - "ü" => "ue", - "Ü" => "Ue", - "ö" => "oe", - "Ö" => "Oe", - "ß" => "ss" + chr(0xe4) => "ae", # ä + chr(0xc4) => "Ae", # Ä + chr(0xfc) => "ue", # ü + chr(0xdc) => "Ue", # Ü + chr(0xf6) => "oe", # ö + chr(0xd6) => "Oe", # Ö + chr(0xdf) => "ss" # ß ); - my $charHashkeys = join( "|", keys(%charHash) ); + my $charHashkeys = join( "", keys(%charHash) ); return $rname if ( $rname =~ m/^\./ ); - $rname =~ s/($charHashkeys)/$charHash{$1}/gi; + $rname =~ s/([$charHashkeys])/$charHash{$1}/gi; $rname =~ s/[^a-z0-9._\-\/]/_/gi; return $rname; } @@ -5768,7 +5772,7 @@ sub getblockAscDrivesAfterManual {
  • ASC_residentsDev DEVICENAME[:READINGNAME] - DEVICENAME points to a device for presence, e.g. of type RESIDENTS. READINGNAME points to a reading at - DEVICENAME which contains a presence state, e.g. rgr_Residents:presence. The target + DEVICENAME which contains a presence state, e.g. rgr_Residents:state. The target should contain values alike the RESIDENTS family.
  • @@ -6327,7 +6331,7 @@ sub getblockAscDrivesAfterManual {
  • ASC_rainSensor - DEVICENAME[:READINGNAME] MAXTRIGGER[:HYSTERESE] [CLOSEDPOS] - der Inhalt ist eine Kombination aus Devicename, Readingname, Wert ab dem getriggert werden soll, Hysterese Wert ab dem der Status Regenschutz aufgehoben werden soll und der "wegen Regen geschlossen Position".
  • -
  • ASC_residentsDev - DEVICENAME[:READINGNAME] - der Inhalt ist eine Kombination aus Devicenamen und Readingnamen des Residents-Device der obersten Ebene (z.B. rgr_Residents:presence)
  • +
  • ASC_residentsDev - DEVICENAME[:READINGNAME] - der Inhalt ist eine Kombination aus Devicenamen und Readingnamen des Residents-Device der obersten Ebene (z.B. rgr_Residents:state)
  • ASC_shuttersDriveOffset - maximale Zufallsverzögerung in Sekunden bei der Berechnung der Fahrzeiten. 0 bedeutet keine Verzögerung
  • @@ -6487,7 +6491,7 @@ sub getblockAscDrivesAfterManual { ], "release_status": "under develop", "license": "GPL_2", - "version": "v0.6.25", + "version": "v0.6.26", "x_developmentversion": "v0.6.19.34", "author": [ "Marko Oldenburg "