2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

73_AutoShuttersControl: add new directory structure, add support for blinds, fix many bugs

git-svn-id: https://svn.fhem.de/fhem/trunk@22228 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
LeonGaultier 2020-06-22 09:42:47 +00:00
parent 32f3c7974c
commit d1dd7eebbe
14 changed files with 9461 additions and 7446 deletions

View File

@ -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 new directory structure
- add support for blinds
- fix many bugs
- bugfix: 55_DWD_OpenData: warncellId, download (forum #83097 msg #1065333)
- bugfix: 70_BOTVAC: tolerable read of schedule data, PBP issues
- feature: 98_backup: add support for backupToStorage modul

File diff suppressed because it is too large Load Diff

View File

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,83 @@
###############################################################################
#
# Developed with Kate
#
# (c) 2018-2020 Copyright: Marko Oldenburg (leongaultier at gmail dot com)
# All rights reserved
#
# 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, 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License,or
# any later version.
#
# The GNU General Public License can be found at
# http://www.gnu.org/copyleft/gpl.html.
# A copy is found in the textfile GPL.txt and important notices to the license
# from the author is found in LICENSE.txt distributed with these scripts.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# $Id$
#
###############################################################################
## Klasse ASC_Dev plus Subklassen ASC_Attr_Dev und ASC_Readings_Dev##
package FHEM::Automation::ShuttersControl::Dev;
use FHEM::Automation::ShuttersControl::Dev::Readings;
use FHEM::Automation::ShuttersControl::Dev::Attr;
our @ISA =
qw(FHEM::Automation::ShuttersControl::Dev::Readings FHEM::Automation::ShuttersControl::Dev::Attr);
use strict;
use warnings;
use utf8;
sub new {
my $class = shift;
my $self = { name => undef, };
bless $self, $class;
return $self;
}
sub setName {
my $self = shift;
my $name = shift;
$self->{name} = $name if ( defined($name) );
return $self->{name};
}
sub setDefault {
my $self = shift;
my $defaultarg = shift;
$self->{defaultarg} = $defaultarg if ( defined($defaultarg) );
return $self->{defaultarg};
}
sub getName {
my $self = shift;
return $self->{name};
}
1;

View File

@ -0,0 +1,389 @@
###############################################################################
#
# Developed with Kate
#
# (c) 2018-2020 Copyright: Marko Oldenburg (leongaultier at gmail dot com)
# All rights reserved
#
# 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, 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License,or
# any later version.
#
# The GNU General Public License can be found at
# http://www.gnu.org/copyleft/gpl.html.
# A copy is found in the textfile GPL.txt and important notices to the license
# from the author is found in LICENSE.txt distributed with these scripts.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# $Id$
#
###############################################################################
## Subklasse Attr ##
package FHEM::Automation::ShuttersControl::Dev::Attr;
use strict;
use warnings;
use utf8;
use GPUtils qw(GP_Import);
## Import der FHEM Funktionen
BEGIN {
GP_Import(
qw(
AttrVal
gettimeofday)
);
}
sub getShuttersOffset {
my $self = shift;
my $name = $self->{name};
return AttrVal( $name, 'ASC_shuttersDriveDelay', -1 );
}
sub getBrightnessMinVal {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_brightness}->{triggermin}
if ( exists( $self->{ASC_brightness}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_brightness}->{LASTGETTIME} ) < 2 );
$FHEM::Automation::ShuttersControl::ascDev->getBrightnessMaxVal;
return $self->{ASC_brightness}->{triggermin};
}
sub getBrightnessMaxVal {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_brightness}->{triggermax}
if ( exists( $self->{ASC_brightness}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_brightness}->{LASTGETTIME} ) < 2 );
$self->{ASC_brightness}->{LASTGETTIME} = int( gettimeofday() );
my ( $triggermax, $triggermin ) =
FHEM::Automation::ShuttersControl::GetAttrValues( $name,
'ASC_brightnessDriveUpDown', '800:500' );
## erwartetes Ergebnis
# max:min
$self->{ASC_brightness}->{triggermin} = $triggermin;
$self->{ASC_brightness}->{triggermax} = $triggermax;
return $self->{ASC_brightness}->{triggermax};
}
sub _getTwilightDevice {
my $self = shift;
my $name = $self->{name};
return AttrVal( $name, 'ASC_twilightDevice', 'none' );
}
sub getAutoAstroModeEvening {
my $self = shift;
my $name = $self->{name};
return AttrVal( $name, 'ASC_autoAstroModeEvening', 'REAL' );
}
sub getAutoAstroModeEveningHorizon {
my $self = shift;
my $name = $self->{name};
return AttrVal( $name, 'ASC_autoAstroModeEveningHorizon', 0 );
}
sub getAutoAstroModeMorning {
my $self = shift;
my $name = $self->{name};
return AttrVal( $name, 'ASC_autoAstroModeMorning', 'REAL' );
}
sub getAutoAstroModeMorningHorizon {
my $self = shift;
my $name = $self->{name};
return AttrVal( $name, 'ASC_autoAstroModeMorningHorizon', 0 );
}
sub getAutoShuttersControlMorning {
my $self = shift;
my $name = $self->{name};
return AttrVal( $name, 'ASC_autoShuttersControlMorning', 'on' );
}
sub getAutoShuttersControlEvening {
my $self = shift;
my $name = $self->{name};
return AttrVal( $name, 'ASC_autoShuttersControlEvening', 'on' );
}
sub getAutoShuttersControlComfort {
my $self = shift;
my $name = $self->{name};
return AttrVal( $name, 'ASC_autoShuttersControlComfort', 'off' );
}
sub getFreezeTemp {
my $self = shift;
my $name = $self->{name};
return AttrVal( $name, 'ASC_freezeTemp', 3 );
}
sub getSlatDriveCmdInverse {
my $self = shift;
my $name = $self->{name};
return AttrVal( $name, 'ASC_slatDriveCmdInverse', 0 );
}
sub _getTempSensor {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_tempSensor}->{device}
if ( exists( $self->{ASC_tempSensor}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_tempSensor}->{LASTGETTIME} ) < 2 );
$self->{ASC_tempSensor}->{LASTGETTIME} = int( gettimeofday() );
my ( $device, $reading ) =
FHEM::Automation::ShuttersControl::GetAttrValues( $name, 'ASC_tempSensor',
'none' );
## erwartetes Ergebnis
# DEVICE:READING
$self->{ASC_tempSensor}->{device} = $device;
$self->{ASC_tempSensor}->{reading} =
( $reading ne 'none' ? $reading : 'temperature' );
return $self->{ASC_tempSensor}->{device};
}
sub getTempSensorReading {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_tempSensor}->{reading}
if ( exists( $self->{ASC_tempSensor}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_tempSensor}->{LASTGETTIME} ) < 2 );
$FHEM::Automation::ShuttersControl::ascDev->_getTempSensor;
return $self->{ASC_tempSensor}->{reading};
}
sub _getResidentsDev {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_residentsDev}->{device}
if ( exists( $self->{ASC_residentsDev}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_residentsDev}->{LASTGETTIME} ) < 2 );
$self->{ASC_residentsDev}->{LASTGETTIME} = int( gettimeofday() );
my ( $device, $reading ) =
FHEM::Automation::ShuttersControl::GetAttrValues( $name,
'ASC_residentsDev', 'none' );
$self->{ASC_residentsDev}->{device} = $device;
$self->{ASC_residentsDev}->{reading} =
( $reading ne 'none' ? $reading : 'state' );
return $self->{ASC_residentsDev}->{device};
}
sub getResidentsReading {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_residentsDev}->{reading}
if ( exists( $self->{ASC_residentsDev}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_residentsDev}->{LASTGETTIME} ) < 2 );
$FHEM::Automation::ShuttersControl::ascDev->_getResidentsDev;
return $self->{ASC_residentsDev}->{reading};
}
sub _getRainSensor {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_rainSensor}->{device}
if ( exists( $self->{ASC_rainSensor}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_rainSensor}->{LASTGETTIME} ) < 2 );
$self->{ASC_rainSensor}->{LASTGETTIME} = int( gettimeofday() );
my ( $device, $reading, $max, $hyst, $pos, $wait ) =
FHEM::Automation::ShuttersControl::GetAttrValues( $name, 'ASC_rainSensor',
'none' );
## erwartetes Ergebnis
# DEVICE:READING MAX:HYST
return $device if ( $device eq 'none' );
$self->{ASC_rainSensor}->{device} = $device;
$self->{ASC_rainSensor}->{reading} =
( $reading ne 'none' ? $reading : 'state' );
$self->{ASC_rainSensor}->{triggermax} = ( $max ne 'none' ? $max : 1000 );
$self->{ASC_rainSensor}->{triggerhyst} = (
$hyst ne 'none'
? $max - $hyst
: ( $self->{ASC_rainSensor}->{triggermax} * 0 )
);
$self->{ASC_rainSensor}->{shuttersClosedPos} =
( $pos ne 'none'
? $pos
: $FHEM::Automation::ShuttersControl::shutters->getClosedPos );
$self->{ASC_rainSensor}->{waitingTime} =
( $pos ne 'none' ? $wait : 900 );
return $self->{ASC_rainSensor}->{device};
}
sub getRainSensorReading {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_rainSensor}->{reading}
if ( exists( $self->{ASC_rainSensor}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_rainSensor}->{LASTGETTIME} ) < 2 );
$FHEM::Automation::ShuttersControl::ascDev->_getRainSensor;
return $self->{ASC_rainSensor}->{reading};
}
sub getRainTriggerMax {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_rainSensor}->{triggermax}
if ( exists( $self->{ASC_rainSensor}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_rainSensor}->{LASTGETTIME} ) < 2 );
$FHEM::Automation::ShuttersControl::ascDev->_getRainSensor;
return $self->{ASC_rainSensor}->{triggermax};
}
sub getRainTriggerMin {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_rainSensor}->{triggerhyst}
if ( exists( $self->{ASC_rainSensor}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_rainSensor}->{LASTGETTIME} ) < 2 );
$FHEM::Automation::ShuttersControl::ascDev->_getRainSensor;
return $self->{ASC_rainSensor}->{triggerhyst};
}
sub getRainSensorShuttersClosedPos {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_rainSensor}->{shuttersClosedPos}
if ( exists( $self->{ASC_rainSensor}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_rainSensor}->{LASTGETTIME} ) < 2 );
$FHEM::Automation::ShuttersControl::ascDev->_getRainSensor;
return $self->{ASC_rainSensor}->{shuttersClosedPos};
}
sub getRainWaitingTime {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_rainSensor}->{waitingTime}
if ( exists( $self->{ASC_rainSensor}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_rainSensor}->{LASTGETTIME} ) < 2 );
$FHEM::Automation::ShuttersControl::ascDev->_getRainSensor;
return $self->{ASC_rainSensor}->{waitingTime};
}
sub _getWindSensor {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_windSensor}->{device}
if ( exists( $self->{ASC_windSensor}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_windSensor}->{LASTGETTIME} ) < 2 );
$self->{ASC_windSensor}->{LASTGETTIME} = int( gettimeofday() );
my ( $device, $reading ) =
FHEM::Automation::ShuttersControl::GetAttrValues( $name, 'ASC_windSensor',
'none' );
return $device if ( $device eq 'none' );
$self->{ASC_windSensor}->{device} = $device;
$self->{ASC_windSensor}->{reading} =
( $reading ne 'none' ? $reading : 'wind' );
return $self->{ASC_windSensor}->{device};
}
sub getWindSensorReading {
my $self = shift;
my $name = $self->{name};
return $self->{ASC_windSensor}->{reading}
if ( exists( $self->{ASC_windSensor}->{LASTGETTIME} )
&& ( gettimeofday() - $self->{ASC_windSensor}->{LASTGETTIME} ) < 2 );
$FHEM::Automation::ShuttersControl::ascDev->_getWindSensor;
return (
defined( $self->{ASC_windSensor}->{reading} )
? $self->{ASC_windSensor}->{reading}
: 'wind'
);
}
sub getBlockAscDrivesAfterManual {
my $self = shift;
my $name = $self->{name};
return AttrVal( $name, 'ASC_blockAscDrivesAfterManual', 0 );
}
1;

View File

@ -0,0 +1,287 @@
###############################################################################
#
# Developed with Kate
#
# (c) 2018-2020 Copyright: Marko Oldenburg (leongaultier at gmail dot com)
# All rights reserved
#
# 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, 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License,or
# any later version.
#
# The GNU General Public License can be found at
# http://www.gnu.org/copyleft/gpl.html.
# A copy is found in the textfile GPL.txt and important notices to the license
# from the author is found in LICENSE.txt distributed with these scripts.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# $Id$
#
###############################################################################
## Subklasse Readings ##
package FHEM::Automation::ShuttersControl::Dev::Readings;
use strict;
use warnings;
use utf8;
use GPUtils qw(GP_Import);
## Import der FHEM Funktionen
BEGIN {
GP_Import(
qw(
readingsSingleUpdate
ReadingsVal
defs)
);
}
sub setDelayCmdReading {
my $self = shift;
my $name = $self->{name};
my $hash = $defs{$name};
readingsSingleUpdate(
$hash,
$FHEM::Automation::ShuttersControl::shutters->getShuttersDev
. '_lastDelayPosValue',
$FHEM::Automation::ShuttersControl::shutters->getDelayCmd,
1
);
return;
}
sub setStateReading {
my $self = shift;
my $value = shift;
my $name = $self->{name};
my $hash = $defs{$name};
readingsSingleUpdate(
$hash, 'state',
(
defined($value)
? $value
: $FHEM::Automation::ShuttersControl::shutters->getLastDrive
),
1
);
return;
}
sub setPosReading {
my $self = shift;
my $name = $self->{name};
my $hash = $defs{$name};
readingsSingleUpdate(
$hash,
$FHEM::Automation::ShuttersControl::shutters->getShuttersDev
. '_PosValue',
$FHEM::Automation::ShuttersControl::shutters->getStatus,
1
);
return;
}
sub setLastPosReading {
my $self = shift;
my $name = $self->{name};
my $hash = $defs{$name};
readingsSingleUpdate(
$hash,
$FHEM::Automation::ShuttersControl::shutters->getShuttersDev
. '_lastPosValue',
$FHEM::Automation::ShuttersControl::shutters->getLastPos,
1
);
return;
}
sub getPartyMode {
my $self = shift;
my $name = $self->{name};
return ReadingsVal( $name, 'partyMode', 'off' );
}
sub getHardLockOut {
my $self = shift;
my $name = $self->{name};
return ReadingsVal( $name, 'hardLockOut', 'none' );
}
sub getSunriseTimeWeHoliday {
my $self = shift;
my $name = $self->{name};
return ReadingsVal( $name, 'sunriseTimeWeHoliday', 'none' );
}
sub getMonitoredDevs {
my $self = shift;
my $name = $self->{name};
$self->{monitoredDevs} = ReadingsVal( $name, '.monitoredDevs', 'none' );
return $self->{monitoredDevs};
}
sub getOutTemp {
my $self = shift;
return ReadingsVal(
$FHEM::Automation::ShuttersControl::ascDev->_getTempSensor,
$FHEM::Automation::ShuttersControl::ascDev->getTempSensorReading,
-100 );
}
sub getResidentsStatus {
my $self = shift;
my $val =
ReadingsVal( $FHEM::Automation::ShuttersControl::ascDev->_getResidentsDev,
$FHEM::Automation::ShuttersControl::ascDev->getResidentsReading,
'none' );
if ( $val =~ m{^(?:(.+)_)?(.+)$}xms ) {
return ( $1, $2 ) if (wantarray);
return $1 && $1 eq 'pet' ? 'absent' : $2;
}
elsif (
ReadingsVal(
$FHEM::Automation::ShuttersControl::ascDev->_getResidentsDev,
'homealoneType', '-' ) eq 'PET'
)
{
return ( 'pet', 'absent' ) if (wantarray);
return 'absent';
}
else {
return ( undef, $val ) if (wantarray);
return $val;
}
}
sub getResidentsLastStatus {
my $self = shift;
my $val =
ReadingsVal( $FHEM::Automation::ShuttersControl::ascDev->_getResidentsDev,
'lastState', 'none' );
if ( $val =~ m{^(?:(.+)_)?(.+)$}xms ) {
return ( $1, $2 ) if (wantarray);
return $1 && $1 eq 'pet' ? 'absent' : $2;
}
elsif (
ReadingsVal(
$FHEM::Automation::ShuttersControl::ascDev->_getResidentsDev,
'lastHomealoneType', '-' ) eq 'PET'
)
{
return ( 'pet', 'absent' ) if (wantarray);
return 'absent';
}
else {
return ( undef, $val ) if (wantarray);
return $val;
}
}
sub getAutoShuttersControlShading {
my $self = shift;
my $name = $self->{name};
return ReadingsVal( $name, 'controlShading', 'none' );
}
sub getSelfDefense {
my $self = shift;
my $name = $self->{name};
return ReadingsVal( $name, 'selfDefense', 'none' );
}
sub getAzimuth {
my $self = shift;
my $azimuth;
$azimuth = ReadingsVal(
$FHEM::Automation::ShuttersControl::ascDev->_getTwilightDevice,
'azimuth', -1 )
if (
$defs{ $FHEM::Automation::ShuttersControl::ascDev->_getTwilightDevice }
->{TYPE} eq 'Twilight' );
$azimuth = ReadingsVal(
$FHEM::Automation::ShuttersControl::ascDev->_getTwilightDevice,
'SunAz', -1 )
if (
$defs{ $FHEM::Automation::ShuttersControl::ascDev->_getTwilightDevice }
->{TYPE} eq 'Astro' );
return $azimuth;
}
sub getElevation {
my $self = shift;
my $elevation;
$elevation = ReadingsVal(
$FHEM::Automation::ShuttersControl::ascDev->_getTwilightDevice,
'elevation', -1 )
if (
$defs{ $FHEM::Automation::ShuttersControl::ascDev->_getTwilightDevice }
->{TYPE} eq 'Twilight' );
$elevation = ReadingsVal(
$FHEM::Automation::ShuttersControl::ascDev->_getTwilightDevice,
'SunAlt', -1 )
if (
$defs{ $FHEM::Automation::ShuttersControl::ascDev->_getTwilightDevice }
->{TYPE} eq 'Astro' );
return $elevation;
}
sub getASCenable {
my $self = shift;
my $name = $self->{name};
return ReadingsVal( $name, 'ascEnable', 'none' );
}
1;

View File

@ -0,0 +1,77 @@
###############################################################################
#
# Developed with Kate
#
# (c) 2018-2020 Copyright: Marko Oldenburg (leongaultier at gmail dot com)
# All rights reserved
#
# 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, 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License,or
# any later version.
#
# The GNU General Public License can be found at
# http://www.gnu.org/copyleft/gpl.html.
# A copy is found in the textfile GPL.txt and important notices to the license
# from the author is found in LICENSE.txt distributed with these scripts.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# $Id$
#
###############################################################################
## Klasse ASC_Roommate ##
package FHEM::Automation::ShuttersControl::Roommate;
use strict;
use warnings;
use utf8;
use GPUtils qw(GP_Import);
## Import der FHEM Funktionen
BEGIN {
GP_Import(
qw(
ReadingsVal)
);
}
sub _getRoommateStatus {
my $self = shift;
my $roommate = $self->{roommate};
return ReadingsVal( $roommate,
$FHEM::Automation::ShuttersControl::shutters->getRoommatesReading,
'none' );
}
sub _getRoommateLastStatus {
my $self = shift;
my $roommate = $self->{roommate};
my $default = $self->{defaultarg};
$default = 'none' if ( !defined($default) );
return ReadingsVal( $roommate, 'lastState', $default );
}
1;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,94 @@
###############################################################################
#
# Developed with Kate
#
# (c) 2018-2020 Copyright: Marko Oldenburg (leongaultier at gmail dot com)
# All rights reserved
#
# 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, 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License,or
# any later version.
#
# The GNU General Public License can be found at
# http://www.gnu.org/copyleft/gpl.html.
# A copy is found in the textfile GPL.txt and important notices to the license
# from the author is found in LICENSE.txt distributed with these scripts.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# $Id$
#
###############################################################################
## Subklasse Readings von ASC_Shutters ##
package FHEM::Automation::ShuttersControl::Shutters::Readings;
use strict;
use warnings;
use utf8;
use GPUtils qw(GP_Import);
## Import der FHEM Funktionen
BEGIN {
GP_Import(
qw(
ReadingsVal
ReadingsNum)
);
}
sub getBrightness {
my $self = shift;
return ReadingsNum(
$FHEM::Automation::ShuttersControl::shutters->_getBrightnessSensor,
$FHEM::Automation::ShuttersControl::shutters->getBrightnessReading,
-1 );
}
sub getWindStatus {
my $self = shift;
return ReadingsVal(
$FHEM::Automation::ShuttersControl::ascDev->_getWindSensor,
$FHEM::Automation::ShuttersControl::ascDev->getWindSensorReading, -1 );
}
sub getStatus {
my $self = shift;
return ReadingsNum( $self->{shuttersDev},
$FHEM::Automation::ShuttersControl::shutters->getPosCmd, 0 );
}
sub getDelayCmd {
my $self = shift;
return $self->{ $self->{shuttersDev} }{delayCmd};
}
sub getASCenable {
my $self = shift;
return ReadingsVal( $self->{shuttersDev}, 'ASC_Enable', 'on' );
}
1;

View File

@ -0,0 +1,53 @@
###############################################################################
#
# Developed with Kate
#
# (c) 2018-2020 Copyright: Marko Oldenburg (leongaultier at gmail dot com)
# All rights reserved
#
# 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, 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License,or
# any later version.
#
# The GNU General Public License can be found at
# http://www.gnu.org/copyleft/gpl.html.
# A copy is found in the textfile GPL.txt and important notices to the license
# from the author is found in LICENSE.txt distributed with these scripts.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# $Id$
#
###############################################################################
## Klasse Fenster (Window) und die Subklassen Attr und Readings ##
package FHEM::Automation::ShuttersControl::Window;
use strict;
use warnings;
use utf8;
use FHEM::Automation::ShuttersControl::Window::Attr;
use FHEM::Automation::ShuttersControl::Window::Readings;
our @ISA =
qw(FHEM::Automation::ShuttersControl::Window::Attr FHEM::Automation::ShuttersControl::Window::Readings);
1;

View File

@ -0,0 +1,128 @@
###############################################################################
#
# Developed with Kate
#
# (c) 2018-2020 Copyright: Marko Oldenburg (leongaultier at gmail dot com)
# All rights reserved
#
# 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, 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License,or
# any later version.
#
# The GNU General Public License can be found at
# http://www.gnu.org/copyleft/gpl.html.
# A copy is found in the textfile GPL.txt and important notices to the license
# from the author is found in LICENSE.txt distributed with these scripts.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# $Id$
#
###############################################################################
## Subklasse Attr von Klasse ASC_Window ##
package FHEM::Automation::ShuttersControl::Window::Attr;
use strict;
use warnings;
use utf8;
use GPUtils qw(GP_Import);
## Import der FHEM Funktionen
BEGIN {
GP_Import(
qw(
AttrVal
gettimeofday)
);
}
sub setSubTyp {
my $self = shift;
my $attrVal = shift;
_setAttributs( $self->{shuttersDev}, 'ASC_WindowRec_subType', $attrVal );
return;
}
sub getSubTyp {
my $self = shift;
return AttrVal( $self->{shuttersDev}, 'ASC_WindowRec_subType', 'twostate' );
}
sub setWinDev {
my $self = shift;
my $attrVal = shift;
_setAttributs( $self->{shuttersDev}, 'ASC_WindowRec', $attrVal );
return;
}
sub _getWinDev {
my $self = shift;
return $self->{ $self->{shuttersDev} }->{ASC_WindowRec}->{device}
if (
exists(
$self->{ $self->{shuttersDev} }->{ASC_WindowRec}->{LASTGETTIME}
)
&& ( gettimeofday() -
$self->{ $self->{shuttersDev} }->{ASC_WindowRec}->{LASTGETTIME} ) <
2
);
$self->{ $self->{shuttersDev} }->{ASC_WindowRec}->{LASTGETTIME} =
int( gettimeofday() );
my ( $device, $reading ) =
FHEM::Automation::ShuttersControl::GetAttrValues( $self->{shuttersDev},
'ASC_WindowRec', 'none' );
### erwartetes Ergebnis
# DEVICE:READING VALUEACTIVE:VALUEINACTIVE POSACTIVE:POSINACTIVE
$self->{ $self->{shuttersDev} }->{ASC_WindowRec}->{device} =
$device;
$self->{ $self->{shuttersDev} }->{ASC_WindowRec}->{reading} =
( $reading ne 'none' ? $reading : 'state' );
return $self->{ $self->{shuttersDev} }->{ASC_WindowRec}->{device};
}
sub getWinDevReading {
my $self = shift;
return $self->{ $self->{shuttersDev} }->{ASC_WindowRec}->{reading}
if (
exists(
$self->{ $self->{shuttersDev} }->{ASC_WindowRec}->{LASTGETTIME}
)
&& ( gettimeofday() -
$self->{ $self->{shuttersDev} }->{ASC_WindowRec}->{LASTGETTIME} ) <
2
);
$FHEM::Automation::ShuttersControl::shutters->_getWinDev;
return $self->{ $self->{shuttersDev} }->{ASC_WindowRec}->{reading};
}
1;

View File

@ -0,0 +1,66 @@
###############################################################################
#
# Developed with Kate
#
# (c) 2018-2020 Copyright: Marko Oldenburg (leongaultier at gmail dot com)
# All rights reserved
#
# 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, 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License,or
# any later version.
#
# The GNU General Public License can be found at
# http://www.gnu.org/copyleft/gpl.html.
# A copy is found in the textfile GPL.txt and important notices to the license
# from the author is found in LICENSE.txt distributed with these scripts.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# $Id$
#
###############################################################################
## Subklasse Readings von Klasse ASC_Window ##
package FHEM::Automation::ShuttersControl::Window::Readings;
use strict;
use warnings;
use utf8;
use GPUtils qw(GP_Import);
## Import der FHEM Funktionen
BEGIN {
GP_Import(
qw(
ReadingsVal)
);
}
sub getWinStatus {
my $self = shift;
return ReadingsVal(
$FHEM::Automation::ShuttersControl::shutters->_getWinDev,
$FHEM::Automation::ShuttersControl::shutters->getWinDevReading,
'closed' );
}
1;