73_AutoShuttersControl: fix many bugs, code expand's and new logic values
git-svn-id: https://svn.fhem.de/fhem/trunk@19630 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- bugfix: 73_AutoShuttersControl: fix many bugs, code expand's and new
|
||||||
|
logic values
|
||||||
- bugfix: 73_GardenaSmartBridge: fix undefined value
|
- bugfix: 73_GardenaSmartBridge: fix undefined value
|
||||||
as an ARRAY reference bug
|
as an ARRAY reference bug
|
||||||
- update: 59_Weather.pm: API Files try to use JSON::MaybeXS wrapper for chance
|
- update: 59_Weather.pm: API Files try to use JSON::MaybeXS wrapper for chance
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use FHEM::Meta;
|
use FHEM::Meta;
|
||||||
|
|
||||||
my $version = '0.6.17';
|
my $version = '0.6.18';
|
||||||
|
|
||||||
sub AutoShuttersControl_Initialize($) {
|
sub AutoShuttersControl_Initialize($) {
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
@@ -718,6 +718,9 @@ sub ShuttersDeviceScan($) {
|
|||||||
$shutters->setShadingStatus(
|
$shutters->setShadingStatus(
|
||||||
( $shutters->getStatus != $shutters->getShadingPos ? 'out' : 'in' )
|
( $shutters->getStatus != $shutters->getShadingPos ? 'out' : 'in' )
|
||||||
);
|
);
|
||||||
|
$shutters->setShadingLastStatus(
|
||||||
|
( $shutters->getStatus != $shutters->getShadingPos ? 'in' : 'out' )
|
||||||
|
);
|
||||||
readingsSingleUpdate( $defs{$_}, 'ASC_Enable', 'on', 0 )
|
readingsSingleUpdate( $defs{$_}, 'ASC_Enable', 'on', 0 )
|
||||||
if ( ReadingsVal( $_, 'ASC_Enable', 'none' ) eq 'none' );
|
if ( ReadingsVal( $_, 'ASC_Enable', 'none' ) eq 'none' );
|
||||||
}
|
}
|
||||||
@@ -1823,6 +1826,7 @@ sub EventProcessingShadingBrightness($@) {
|
|||||||
and $shutters->getWindProtectionStatus eq 'unprotected' )
|
and $shutters->getWindProtectionStatus eq 'unprotected' )
|
||||||
{
|
{
|
||||||
$shutters->setShadingStatus('out');
|
$shutters->setShadingStatus('out');
|
||||||
|
$shutters->setShadingLastStatus('in');
|
||||||
ShadingProcessingDriveCommand( $hash, $shuttersDev );
|
ShadingProcessingDriveCommand( $hash, $shuttersDev );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1903,9 +1907,12 @@ sub EventProcessingTwilightDevice($@) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$shutters->setShadingStatus('out')
|
if ( not IsDay($shuttersDev)
|
||||||
if ( not IsDay($shuttersDev)
|
and $shutters->getShadingStatus ne 'out' )
|
||||||
and $shutters->getShadingStatus ne 'out' );
|
{
|
||||||
|
$shutters->setShadingStatus('out');
|
||||||
|
$shutters->setShadingLastStatus('in');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1920,6 +1927,12 @@ sub ShadingProcessing($@) {
|
|||||||
) = @_;
|
) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
$shutters->setShuttersDev($shuttersDev);
|
$shutters->setShuttersDev($shuttersDev);
|
||||||
|
$shutters->setShadingLastStatus( $shutters->getShadingStatus )
|
||||||
|
if (
|
||||||
|
$shutters->getShadingLastStatus ne $shutters->getShadingStatus
|
||||||
|
and ( $shutters->getShadingStatus eq 'in'
|
||||||
|
or $shutters->getShadingStatus eq 'out' )
|
||||||
|
);
|
||||||
|
|
||||||
ASC_Debug(
|
ASC_Debug(
|
||||||
'ShadingProcessing: '
|
'ShadingProcessing: '
|
||||||
@@ -2088,8 +2101,14 @@ sub ShadingProcessing($@) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ShadingProcessingDriveCommand( $hash, $shuttersDev )
|
ShadingProcessingDriveCommand( $hash, $shuttersDev )
|
||||||
if ( $shutters->getShadingStatus eq 'out'
|
if (
|
||||||
or $shutters->getShadingStatus eq 'in' );
|
(
|
||||||
|
$shutters->getShadingStatus eq 'out'
|
||||||
|
and $shutters->getShadingLastStatus eq 'in'
|
||||||
|
)
|
||||||
|
or ( $shutters->getShadingStatus eq 'in'
|
||||||
|
and $shutters->getShadingLastStatus eq 'out' )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub ShadingProcessingDriveCommand($$) {
|
sub ShadingProcessingDriveCommand($$) {
|
||||||
@@ -2626,11 +2645,18 @@ sub SunRiseShuttersAfterTimerFn($) {
|
|||||||
or ( $ascDev->getSelfDefense eq 'on'
|
or ( $ascDev->getSelfDefense eq 'on'
|
||||||
and CheckIfShuttersWindowRecOpen($shuttersDev) == 0 )
|
and CheckIfShuttersWindowRecOpen($shuttersDev) == 0 )
|
||||||
)
|
)
|
||||||
and $shutters->getShadingStatus ne 'in'
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$shutters->setLastDrive('day open');
|
if ( not $shutters->getIfInShading ) {
|
||||||
ShuttersCommandSet( $hash, $shuttersDev, $shutters->getOpenPos );
|
$shutters->setLastDrive('day open');
|
||||||
|
ShuttersCommandSet( $hash, $shuttersDev,
|
||||||
|
$shutters->getOpenPos );
|
||||||
|
}
|
||||||
|
elsif ( $shutters->getIfInShading ) {
|
||||||
|
$shutters->setLastDrive('shading in');
|
||||||
|
ShuttersCommandSet( $hash, $shuttersDev,
|
||||||
|
$shutters->getShadingPos );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4003,6 +4029,18 @@ sub setShadingStatus {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub setShadingLastStatus {
|
||||||
|
my ( $self, $value ) = @_;
|
||||||
|
### Werte für value = in, out
|
||||||
|
|
||||||
|
$self->{ $self->{shuttersDev} }{ShadingLastStatus}{VAL} = $value
|
||||||
|
if ( defined($value) );
|
||||||
|
$self->{ $self->{shuttersDev} }{ShadingLastStatus}{TIME} =
|
||||||
|
int( gettimeofday() )
|
||||||
|
if ( defined( $self->{ $self->{shuttersDev} }{ShadingLastStatus} ) );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
sub setWindProtectionStatus { # Werte protected, unprotected
|
sub setWindProtectionStatus { # Werte protected, unprotected
|
||||||
my ( $self, $value ) = @_;
|
my ( $self, $value ) = @_;
|
||||||
|
|
||||||
@@ -4027,15 +4065,23 @@ sub getShadingStatus { # Werte für value = in, out, in reserved, out reserved
|
|||||||
and defined( $self->{ $self->{shuttersDev} }{ShadingStatus}{VAL} ) );
|
and defined( $self->{ $self->{shuttersDev} }{ShadingStatus}{VAL} ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub getShadingLastStatus { # Werte für value = in, out
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
return $self->{ $self->{shuttersDev} }{ShadingLastStatus}{VAL}
|
||||||
|
if ( defined( $self->{ $self->{shuttersDev} }{ShadingLastStatus} )
|
||||||
|
and defined( $self->{ $self->{shuttersDev} }{ShadingLastStatus}{VAL} )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
sub getIfInShading {
|
sub getIfInShading {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
(
|
(
|
||||||
$shutters->getShadingMode eq 'always'
|
$shutters->getShadingMode ne 'off'
|
||||||
or $shutters->getShadingMode eq 'home'
|
and $shutters->getShadingStatus eq 'in'
|
||||||
)
|
) ? 1 : 0
|
||||||
and $shutters->getShadingStatus eq 'in' ? 1 : 0
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5738,7 +5784,7 @@ sub getblockAscDrivesAfterManual {
|
|||||||
Shading is only available if the following prerequests are met:
|
Shading is only available if the following prerequests are met:
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
The <em>ASC_autoShuttersControlShading</em> attribute is set to on, and there is a device
|
The <em>controlShading</em> reading is set to on, and there is a device
|
||||||
of type Astro or Twilight configured to <em>ASC_twilightDevice</em>, and <em>ASC_tempSensor</em>
|
of type Astro or Twilight configured to <em>ASC_twilightDevice</em>, and <em>ASC_tempSensor</em>
|
||||||
is set.
|
is set.
|
||||||
</li>
|
</li>
|
||||||
@@ -6112,7 +6158,7 @@ sub getblockAscDrivesAfterManual {
|
|||||||
<ul>
|
<ul>
|
||||||
<strong><u>Beschreibung der Beschattungsfunktion</u></strong>
|
<strong><u>Beschreibung der Beschattungsfunktion</u></strong>
|
||||||
</br>Damit die Beschattung Funktion hat, müssen folgende Anforderungen erfüllt sein.
|
</br>Damit die Beschattung Funktion hat, müssen folgende Anforderungen erfüllt sein.
|
||||||
</br><strong>Im ASC Device</strong> das Attribut "ASC_autoShuttersControlShading" mit dem Wert on, sowie ein Astro/Twilight Device im Attribut "ASC_twilightDevice" und das Attribut "ASC_tempSensor".
|
</br><strong>Im ASC Device</strong> das Reading "controlShading" mit dem Wert on, sowie ein Astro/Twilight Device im Attribut "ASC_twilightDevice" und das Attribut "ASC_tempSensor".
|
||||||
</br><strong>In den Rollladendevices</strong> benötigt ihr ein Helligkeitssensor als Attribut "ASC_BrightnessSensor", sofern noch nicht vorhanden. Findet der Sensor nur für die Beschattung Verwendung ist der Wert DEVICENAME[:READING] ausreichend.
|
</br><strong>In den Rollladendevices</strong> benötigt ihr ein Helligkeitssensor als Attribut "ASC_BrightnessSensor", sofern noch nicht vorhanden. Findet der Sensor nur für die Beschattung Verwendung ist der Wert DEVICENAME[:READING] ausreichend.
|
||||||
</br>Alle weiteren Attribute sind optional und wenn nicht gesetzt mit Default-Werten belegt. Ihr solltet sie dennoch einmal anschauen und entsprechend Euren Gegebenheiten setzen. Die Werte für; die Fensterposition und den Vor- Nachlaufwinkel sowie die Grenzwerte für die StateChange_Cloudy und StateChange_Sunny solltet ihr besondere Beachtung dabei schenken.
|
</br>Alle weiteren Attribute sind optional und wenn nicht gesetzt mit Default-Werten belegt. Ihr solltet sie dennoch einmal anschauen und entsprechend Euren Gegebenheiten setzen. Die Werte für; die Fensterposition und den Vor- Nachlaufwinkel sowie die Grenzwerte für die StateChange_Cloudy und StateChange_Sunny solltet ihr besondere Beachtung dabei schenken.
|
||||||
<li><strong>ASC_Shading_Angle_Left</strong> - Vorlaufwinkel im Bezug zum Fenster, ab wann abgeschattet wird. Beispiel: Fenster 180° - 85° ==> ab Sonnenpos. 95° wird abgeschattet (default: 75)</li>
|
<li><strong>ASC_Shading_Angle_Left</strong> - Vorlaufwinkel im Bezug zum Fenster, ab wann abgeschattet wird. Beispiel: Fenster 180° - 85° ==> ab Sonnenpos. 95° wird abgeschattet (default: 75)</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user