Compare commits
331 Commits
Author | SHA1 | Date | |
---|---|---|---|
a66daa7d5a | |||
617b7a7531 | |||
f498829347 | |||
4cc3ecc40a | |||
95446cc91e | |||
63393b4cd4 | |||
6a62226a39 | |||
cbd058773d | |||
1016b7d087 | |||
649d21f19b | |||
93bd0cd22e | |||
62a4a249b4 | |||
e66aa0cb4d | |||
34afd51a11 | |||
a2c878e333 | |||
bb1d139ed7 | |||
ef5b9a982e | |||
4c1d6c7885 | |||
2b12b9ed10 | |||
6babb451c9 | |||
9afc3ccf97 | |||
bee5ff33ae | |||
9ba046452a | |||
5e60229c7a | |||
8009a27869 | |||
0b048e7dc0 | |||
bd6e901ca1 | |||
f36101f48a | |||
f51cdf4943 | |||
2c68ae8406 | |||
697cdd1089 | |||
d3af20bc01 | |||
7882128336 | |||
c25c395a5b | |||
d89a05632b | |||
879caa1b25 | |||
f5004dbc93 | |||
c1b71c12b4 | |||
93420b80f1 | |||
52fe367c81 | |||
7b988a395d | |||
4d968405fd | |||
774fe63a26 | |||
aadc88c570 | |||
7f7fcae522 | |||
7454200c7a | |||
c5b1a03c65 | |||
273e53fb83 | |||
9e41936dcd | |||
f6085b2df8 | |||
4851ecb6a7 | |||
df27f70161 | |||
dd75295e94 | |||
c3f7191f70 | |||
70644d715d | |||
2012ec1fc3 | |||
36285e57bb | |||
f1124548da | |||
9a3dd21e26 | |||
489a7d829f | |||
4f2af22628 | |||
a0c08bdfc0 | |||
c63f4d64d5 | |||
c6e25e391b | |||
bfeadd0bbf | |||
ba4d2203f4 | |||
07c4755845 | |||
98529d3c15 | |||
cd080e1d4d | |||
9eda91cac1 | |||
c18f128722 | |||
8e93599f3b | |||
0289358b83 | |||
4ceb3a1ab8 | |||
e74c9a8b28 | |||
4604fcb0b0 | |||
3bb26eb255 | |||
b0805d0fc8 | |||
b71a74b52e | |||
2c6f8bacab | |||
121b9063ea | |||
5cfcd4de2b | |||
1a8685eae3 | |||
b69493ac6f | |||
31e2afe553 | |||
09fd5cd36b | |||
a2d88bddf2 | |||
7b55671166 | |||
61d9f29ad7 | |||
3535042915 | |||
154f6a58de | |||
70a56ddf3b | |||
7ef429c80f | |||
9439e3b2e2 | |||
95f520901a | |||
13134ebcdb | |||
8a5a6cafdd | |||
fbca7af3c6 | |||
7f88f4c82f | |||
d1b04fcdce | |||
0b4a5a0d4f | |||
338db55e05 | |||
5d270eca3a | |||
7a154a5f85 | |||
933b4f1c91 | |||
ed1325e735 | |||
4792dcea10 | |||
b0ff527957 | |||
eb28fef84f | |||
fa82a77665 | |||
84da158b64 | |||
684f91b697 | |||
8329cf35d1 | |||
9eef44ca3a | |||
27cf612b2f | |||
58f86d05e0 | |||
a27233869b | |||
770be1d91e | |||
f74ec772b9 | |||
00eeb93318 | |||
b7160fa8b4 | |||
d9ae8152d1 | |||
864138a2e3 | |||
f8800e910b | |||
269288c24a | |||
ea8813cd2c | |||
b6bb0af471 | |||
11870789e1 | |||
468d5713b2 | |||
b8488ebdc2 | |||
2850f6394f | |||
417ecbf8fd | |||
2bafc3d433 | |||
a37b6eddb9 | |||
b6034b7357 | |||
4ffcc1a7ef | |||
daf94c9483 | |||
1efe3b576c | |||
b928c021c2 | |||
5df984048d | |||
c6b76320a4 | |||
3f8397a6a2 | |||
05479ffdd6 | |||
8812be8fca | |||
924363fe18 | |||
837ad71c48 | |||
82934125fe | |||
185fe7576b | |||
331b0b0432 | |||
857683fbe2 | |||
bb6f4860f9 | |||
026904e898 | |||
554195f476 | |||
0d168b488a | |||
7200ebfbb3 | |||
254c84ffe1 | |||
9bbd2445e2 | |||
af7894753c | |||
9f2eeea6d8 | |||
4a5b4d9ac1 | |||
109a67e388 | |||
83fe657171 | |||
af727cd2f2 | |||
ad1c541891 | |||
c69b72c081 | |||
7b83072b83 | |||
7511e4254b | |||
242de9523b | |||
cd2adb49f3 | |||
cb7c3f8667 | |||
63f86165ba | |||
d3e05719f0 | |||
92a9175fe3 | |||
c607e9b81a | |||
20584f6294 | |||
245a9b7357 | |||
7a60b04777 | |||
8d748b65ce | |||
c356217eaf | |||
d5d8d5a116 | |||
2d2c10ed9c | |||
9fafc505ae | |||
b79ab5efaf | |||
2bd44d3073 | |||
60db9c4f5d | |||
b2a70e6917 | |||
6d755015aa | |||
d34d71277c | |||
80831c167b | |||
5ab7c09712 | |||
4e493e6a4b | |||
c1695ae811 | |||
1b90829744 | |||
9b3ca6618a | |||
5ddf5adfad | |||
3b31474e18 | |||
f3979f090f | |||
c19f9728a0 | |||
4e0e9203c9 | |||
578b96a4ff | |||
e5ce1f40e3 | |||
fd708c2685 | |||
a5d1582d5a | |||
29e35be498 | |||
0fa7dc308c | |||
82a9d2c930 | |||
ccbe471931 | |||
242e056069 | |||
2dc5da70c2 | |||
419bba1e74 | |||
b440b1b96e | |||
3b5cb7730f | |||
ca56067e5c | |||
6ab65372d2 | |||
2e7deafc55 | |||
ac818f6250 | |||
e87578a082 | |||
a61adbef0c | |||
9d0a1b0141 | |||
15b186b4c7 | |||
2a2122f93a | |||
c1a4c5a470 | |||
20191f4565 | |||
806074325f | |||
1a2b8f52cd | |||
ce5fb58b34 | |||
9268276518 | |||
47066ea068 | |||
7a0aad9ff7 | |||
0498d0323b | |||
d98e5a903c | |||
005340a2fa | |||
9d77ac4811 | |||
3e7becaf89 | |||
2a90962675 | |||
fc81592a32 | |||
63ec20cde6 | |||
e4a2f82419 | |||
107a2b1c96 | |||
ed5be615e0 | |||
9ed15f90fe | |||
fbc7a39fe0 | |||
0e8137eb09 | |||
dc4982fa19 | |||
770fd0d26f | |||
775219b034 | |||
1f99f0fbd7 | |||
f50f20f197 | |||
65708ae9ec | |||
c87353f204 | |||
6ad0baabe5 | |||
3607269e72 | |||
c0104a3c53 | |||
453794ecd5 | |||
18b6286cbc | |||
6fa8fa8817 | |||
164a85edaa | |||
f61ceaf6f0 | |||
df93a8b8c1 | |||
78427bf1bc | |||
95349ce3db | |||
b1025d746d | |||
b2e035b6a2 | |||
9b96323f3e | |||
a38a29a99d | |||
ab54aba823 | |||
aad143c2cc | |||
a871e70dec | |||
b60ddfd90b | |||
9a5ef3654e | |||
2338089eba | |||
219187bd7b | |||
8a9db0fd8f | |||
d7adb36ca5 | |||
62caa1d5c3 | |||
f311bcf9cb | |||
3e1fe3f329 | |||
9d050b7b28 | |||
878bf99a16 | |||
3ef0ae9ccf | |||
42007fa86b | |||
831f8a37ff | |||
cb8f3d693a | |||
f59c40ead6 | |||
9fcf615af8 | |||
208bac6ae0 | |||
0e9a212aa0 | |||
b608d511ce | |||
4bdb540368 | |||
46eb9da8c8 | |||
4454838eba | |||
0081b53d16 | |||
412243e2bd | |||
fa552d8a25 | |||
caddb87d57 | |||
68f9f46fb5 | |||
f8218646a7 | |||
d421be61d1 | |||
2ddda0c622 | |||
bca593a36c | |||
72a35e94d2 | |||
44b4837664 | |||
42e4fdcc44 | |||
85d5ffefba | |||
f2548ee6fa | |||
f718eeabf8 | |||
87d18928c0 | |||
eeffd9b16b | |||
02c16ebc6c | |||
e361bc037e | |||
97a9e2fce4 | |||
3396c515b9 | |||
a3333949ae | |||
3f90155119 | |||
11029985ee | |||
c27a8b46ba | |||
b4927e169f | |||
eb61c5c7e0 | |||
4d52cd52a4 | |||
58544edf2a | |||
11782224c9 | |||
60ae53a9cf | |||
1776f8bd3b | |||
3ae315d1e3 | |||
f654d4f8a5 | |||
a7519695f6 | |||
34d87eef17 | |||
3bfe619164 | |||
7c37fe11b6 | |||
a11eb2487d | |||
ac3c2bb14b |
File diff suppressed because it is too large
Load Diff
1467
FHEM/73_AutoShuttersControl.pm
Normal file
1467
FHEM/73_AutoShuttersControl.pm
Normal file
File diff suppressed because it is too large
Load Diff
16
controls_AutoShuttersControl.txt
Normal file
16
controls_AutoShuttersControl.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
UPD 2021-10-24_07:33:53 111901 FHEM/73_AutoShuttersControl.pm
|
||||||
|
UPD 2021-10-24_17:15:09 74468 lib/FHEM/Automation/ShuttersControl.pm
|
||||||
|
UPD 2021-10-09_07:12:54 2657 lib/FHEM/Automation/ShuttersControl/Dev.pm
|
||||||
|
UPD 2021-10-09_07:12:54 2494 lib/FHEM/Automation/ShuttersControl/Roommate.pm
|
||||||
|
UPD 2021-10-24_07:33:53 31900 lib/FHEM/Automation/ShuttersControl/Shutters.pm
|
||||||
|
UPD 2021-10-09_07:12:54 25333 lib/FHEM/Automation/ShuttersControl/Shading.pm
|
||||||
|
UPD 2021-10-24_07:33:53 109522 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm
|
||||||
|
UPD 2021-10-09_07:12:54 40628 lib/FHEM/Automation/ShuttersControl/Helper.pm
|
||||||
|
UPD 2021-10-09_07:12:54 2173 lib/FHEM/Automation/ShuttersControl/Window.pm
|
||||||
|
UPD 2021-10-09_07:12:54 11739 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm
|
||||||
|
UPD 2021-10-09_07:12:54 7249 lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm
|
||||||
|
UPD 2021-10-09_07:12:54 52523 lib/FHEM/Automation/ShuttersControl/Shutters/Attr.pm
|
||||||
|
UPD 2021-10-09_07:12:54 2901 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm
|
||||||
|
UPD 2021-10-09_07:12:54 3978 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm
|
||||||
|
UPD 2021-10-09_07:12:54 2286 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm
|
||||||
|
UPD 2021-10-24_07:33:53 6693 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm
|
53
hooks/pre-commit
Executable file
53
hooks/pre-commit
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use File::Basename;
|
||||||
|
use POSIX qw(strftime);
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
my @filenames = ( 'FHEM/73_AutoShuttersControl.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Dev.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Roommate.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Shutters.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Shading.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Helper.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Window.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Shutters/Attr.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Window/Attr.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Window/Readings.pm',
|
||||||
|
'lib/FHEM/Automation/ShuttersControl/Rainprotection.pm'
|
||||||
|
);
|
||||||
|
|
||||||
|
my $controlsfile = 'controls_AutoShuttersControl.txt';
|
||||||
|
|
||||||
|
open(FH, ">$controlsfile") || return("Can't open $controlsfile: $!");
|
||||||
|
|
||||||
|
for my $filename (@filenames) {
|
||||||
|
my @statOutput = stat($filename);
|
||||||
|
|
||||||
|
if (scalar @statOutput != 13) {
|
||||||
|
printf 'error: stat has unexpected return value for ' . $filename . "\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $mtime = $statOutput[9];
|
||||||
|
my $date = POSIX::strftime("%Y-%m-%d", localtime($mtime));
|
||||||
|
my $time = POSIX::strftime("%H:%M:%S", localtime($mtime));
|
||||||
|
my $filetime = $date."_".$time;
|
||||||
|
|
||||||
|
my $filesize = $statOutput[7];
|
||||||
|
|
||||||
|
printf FH 'UPD ' . $filetime . ' ' . $filesize . ' ' .$filename . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
close(FH);
|
||||||
|
|
||||||
|
system("git add $controlsfile");
|
||||||
|
|
||||||
|
print 'Create controls File succesfully' . "\n";
|
||||||
|
|
||||||
|
exit 0;
|
2052
lib/FHEM/Automation/ShuttersControl.pm
Normal file
2052
lib/FHEM/Automation/ShuttersControl.pm
Normal file
File diff suppressed because it is too large
Load Diff
83
lib/FHEM/Automation/ShuttersControl/Dev.pm
Normal file
83
lib/FHEM/Automation/ShuttersControl/Dev.pm
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Developed with Kate
|
||||||
|
#
|
||||||
|
# (c) 2018-2021 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;
|
406
lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm
Normal file
406
lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm
Normal file
@ -0,0 +1,406 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Developed with Kate
|
||||||
|
#
|
||||||
|
# (c) 2018-2021 Copyright: Marko Oldenburg (fhemdevelopment@cooltux.net)
|
||||||
|
# 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::Helper::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::Helper::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::Helper::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::Helper::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 : 'rain' );
|
||||||
|
$self->{ASC_rainSensor}->{triggermax} = (
|
||||||
|
( $max ne 'none'
|
||||||
|
&& $max =~ m{\A(-?\d+(\.\d+)?)\z}xms )
|
||||||
|
? $max
|
||||||
|
: 1000 );
|
||||||
|
|
||||||
|
$self->{ASC_rainSensor}->{triggerhyst} = (
|
||||||
|
$hyst ne 'none'
|
||||||
|
? $self->{ASC_rainSensor}->{triggermax} - $hyst
|
||||||
|
: ( $self->{ASC_rainSensor}->{triggermax} * 0 )
|
||||||
|
);
|
||||||
|
|
||||||
|
$self->{ASC_rainSensor}->{shuttersClosedPos} =
|
||||||
|
( $pos ne 'none'
|
||||||
|
? $pos
|
||||||
|
: $FHEM::Automation::ShuttersControl::shutters->getClosedPos );
|
||||||
|
$self->{ASC_rainSensor}->{waitingTime} =
|
||||||
|
( $wait ne 'none' ? $wait : 0 );
|
||||||
|
|
||||||
|
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::Helper::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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
sub getAdvDate {
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
my $name = $self->{name};
|
||||||
|
|
||||||
|
return AttrVal( $name, 'ASC_advDate', 'FirstAdvent' );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
287
lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm
Normal file
287
lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm
Normal file
@ -0,0 +1,287 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Developed with Kate
|
||||||
|
#
|
||||||
|
# (c) 2018-2021 Copyright: Marko Oldenburg (fhemdevelopment@cooltux.net)
|
||||||
|
# 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;
|
2466
lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm
Normal file
2466
lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm
Normal file
File diff suppressed because it is too large
Load Diff
1083
lib/FHEM/Automation/ShuttersControl/Helper.pm
Normal file
1083
lib/FHEM/Automation/ShuttersControl/Helper.pm
Normal file
File diff suppressed because it is too large
Load Diff
180
lib/FHEM/Automation/ShuttersControl/Rainprotection.pm
Normal file
180
lib/FHEM/Automation/ShuttersControl/Rainprotection.pm
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Developed with Kate
|
||||||
|
#
|
||||||
|
# (c) 2018-2021 Copyright: Marko Oldenburg (fhemdevelopment@cooltux.net)
|
||||||
|
# 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$
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
## unserer packagename
|
||||||
|
package FHEM::Automation::ShuttersControl::Rainprotection;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use utf8;
|
||||||
|
|
||||||
|
use FHEM::Automation::ShuttersControl::Helper qw (:ALL);
|
||||||
|
|
||||||
|
require Exporter;
|
||||||
|
our @ISA = qw(Exporter);
|
||||||
|
our @EXPORT_OK = qw(
|
||||||
|
RainProcessing
|
||||||
|
);
|
||||||
|
our %EXPORT_TAGS = (
|
||||||
|
ALL => [
|
||||||
|
qw(
|
||||||
|
RainProcessing
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
sub RainProcessing {
|
||||||
|
my ( $hash, $val, $triggerMax, $triggerMin ) = @_;
|
||||||
|
|
||||||
|
my $rainClosedPos = $FHEM::Automation::ShuttersControl::ascDev
|
||||||
|
->getRainSensorShuttersClosedPos;
|
||||||
|
|
||||||
|
for my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) {
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev(
|
||||||
|
$shuttersDev);
|
||||||
|
|
||||||
|
next
|
||||||
|
if (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getRainProtection eq
|
||||||
|
'off' );
|
||||||
|
|
||||||
|
if ( $val > $triggerMax
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
|
||||||
|
$rainClosedPos
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getRainProtectionStatus eq 'unprotected'
|
||||||
|
|| ( $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getRainProtectionStatus eq 'unprotected'
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getRainUnprotectionDelayObj ne 'none')
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_RainProtected();
|
||||||
|
}
|
||||||
|
elsif ( ( $val == 0 || $val < $triggerMin )
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getStatus ==
|
||||||
|
$rainClosedPos
|
||||||
|
&& IsAfterShuttersManualBlocking($shuttersDev)
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getRainProtectionStatus eq 'protected' )
|
||||||
|
{
|
||||||
|
my %funcHash = (
|
||||||
|
shuttersdevice => $shuttersDev,
|
||||||
|
);
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj(\%funcHash);
|
||||||
|
::InternalTimer( ::gettimeofday() + $FHEM::Automation::ShuttersControl::ascDev->getRainWaitingTime
|
||||||
|
, \&_RainUnprotected
|
||||||
|
, \%funcHash );
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->setRainProtectionStatus('unprotected');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ( $FHEM::Automation::ShuttersControl::shutters->getStatus != $rainClosedPos
|
||||||
|
&& ($val == 0 || $val < $triggerMin) )
|
||||||
|
{
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->setRainProtectionStatus('unprotected');
|
||||||
|
}
|
||||||
|
elsif ($val > $triggerMax) {
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->setRainProtectionStatus('protected');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
### es muss noch beobachtet werden ob die Auswahl des Rollos welches bearbeitet werden soll bestehen bleibt oder mit in die neuen Funktionen übergeben werden muss
|
||||||
|
sub _RainProtected {
|
||||||
|
::RemoveInternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj)
|
||||||
|
if($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj ne 'none');
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj('none');
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setLastDrive(
|
||||||
|
'rain protected');
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setDriveCmd(
|
||||||
|
$FHEM::Automation::ShuttersControl::ascDev
|
||||||
|
->getRainSensorShuttersClosedPos);
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->setRainProtectionStatus('protected');
|
||||||
|
}
|
||||||
|
|
||||||
|
sub _RainUnprotected {
|
||||||
|
my $h = shift;
|
||||||
|
|
||||||
|
my $shuttersDev = $h->{shuttersdevice};
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev(
|
||||||
|
$shuttersDev);
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setLastDrive(
|
||||||
|
'rain un-protected');
|
||||||
|
|
||||||
|
if ( $FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj ne 'none' ) {
|
||||||
|
::RemoveInternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj);
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj('none');
|
||||||
|
}
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setDriveCmd(
|
||||||
|
(
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getIsDay
|
||||||
|
? $FHEM::Automation::ShuttersControl::shutters->getLastPos
|
||||||
|
: (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getPrivacyDownStatus == 2
|
||||||
|
? $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getPrivacyDownPos
|
||||||
|
: $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getClosedPos
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->setRainProtectionStatus('unprotected');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
80
lib/FHEM/Automation/ShuttersControl/Roommate.pm
Normal file
80
lib/FHEM/Automation/ShuttersControl/Roommate.pm
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Developed with Kate
|
||||||
|
#
|
||||||
|
# (c) 2018-2021 Copyright: Marko Oldenburg (fhemdevelopment@cooltux.net)
|
||||||
|
# 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;
|
664
lib/FHEM/Automation/ShuttersControl/Shading.pm
Normal file
664
lib/FHEM/Automation/ShuttersControl/Shading.pm
Normal file
@ -0,0 +1,664 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Developed with Kate
|
||||||
|
#
|
||||||
|
# (c) 2018-2021 Copyright: Marko Oldenburg (fhemdevelopment@cooltux.net)
|
||||||
|
# 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$
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
## unserer packagename
|
||||||
|
package FHEM::Automation::ShuttersControl::Shading;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use POSIX qw(strftime);
|
||||||
|
use utf8;
|
||||||
|
|
||||||
|
use FHEM::Automation::ShuttersControl::Helper qw (IsInTime);
|
||||||
|
|
||||||
|
require Exporter;
|
||||||
|
our @ISA = qw(Exporter);
|
||||||
|
our @EXPORT_OK = qw(
|
||||||
|
CheckASC_ConditionsForShadingFn
|
||||||
|
ShadingProcessing
|
||||||
|
ShadingProcessingDriveCommand
|
||||||
|
);
|
||||||
|
our %EXPORT_TAGS = (
|
||||||
|
ALL => [
|
||||||
|
qw(
|
||||||
|
CheckASC_ConditionsForShadingFn
|
||||||
|
ShadingProcessing
|
||||||
|
ShadingProcessingDriveCommand
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
use GPUtils qw(GP_Import);
|
||||||
|
## Import der FHEM Funktionen
|
||||||
|
BEGIN {
|
||||||
|
GP_Import(
|
||||||
|
qw(
|
||||||
|
Log3
|
||||||
|
gettimeofday
|
||||||
|
InternalTimer
|
||||||
|
ReadingsVal
|
||||||
|
readingsBeginUpdate
|
||||||
|
readingsBulkUpdate
|
||||||
|
readingsBulkUpdateIfChanged
|
||||||
|
readingsEndUpdate
|
||||||
|
defs
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub CheckASC_ConditionsForShadingFn {
|
||||||
|
my $hash = shift;
|
||||||
|
my $value = shift;
|
||||||
|
|
||||||
|
my $error;
|
||||||
|
|
||||||
|
$error .=
|
||||||
|
' no valid data from the ASC temperature sensor, is ASC_tempSensor attribut set?'
|
||||||
|
if ( $FHEM::Automation::ShuttersControl::ascDev->getOutTemp == -100 );
|
||||||
|
$error .= ' no twilight device found'
|
||||||
|
if ( $FHEM::Automation::ShuttersControl::ascDev->_getTwilightDevice eq
|
||||||
|
'none' );
|
||||||
|
|
||||||
|
my $count = 1;
|
||||||
|
for my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) {
|
||||||
|
my %funcHash = (
|
||||||
|
hash => $hash,
|
||||||
|
shuttersdevice => $shuttersDev,
|
||||||
|
value => $value,
|
||||||
|
attrEvent => 0,
|
||||||
|
);
|
||||||
|
|
||||||
|
InternalTimer(
|
||||||
|
gettimeofday() + $count,
|
||||||
|
'FHEM::Automation::ShuttersControl::Shading::_CheckShuttersConditionsForShadingFn',
|
||||||
|
\%funcHash
|
||||||
|
);
|
||||||
|
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
defined($error)
|
||||||
|
? $error
|
||||||
|
: 'none'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub _CheckShuttersConditionsForShadingFn {
|
||||||
|
my $funcHash = shift;
|
||||||
|
|
||||||
|
my $hash = $funcHash->{hash};
|
||||||
|
my $shuttersDev = $funcHash->{shuttersdevice};
|
||||||
|
my $value = $funcHash->{value};
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev);
|
||||||
|
my $shuttersDevHash = $defs{$shuttersDev};
|
||||||
|
my $message = '';
|
||||||
|
my $errorMessage;
|
||||||
|
my $warnMessage;
|
||||||
|
my $infoMessage;
|
||||||
|
|
||||||
|
if ( $value eq 'off' ) {
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus('out');
|
||||||
|
$infoMessage .= ' shading was deactivated ' . ($funcHash->{attrEvent} ? 'in the device' : 'globally');
|
||||||
|
$errorMessage .= '';
|
||||||
|
ShadingProcessingDriveCommand( $hash, $shuttersDev );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$infoMessage .= (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingMode ne 'off'
|
||||||
|
&& $FHEM::Automation::ShuttersControl::ascDev
|
||||||
|
->getAutoShuttersControlShading eq 'on'
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getOutTemp == -100
|
||||||
|
? ' shading active, global temp sensor is set, but shutters temperature sensor is not set'
|
||||||
|
: ''
|
||||||
|
);
|
||||||
|
|
||||||
|
$warnMessage .= (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingMode eq 'off'
|
||||||
|
&& $FHEM::Automation::ShuttersControl::ascDev
|
||||||
|
->getAutoShuttersControlShading eq 'on'
|
||||||
|
? ' global shading active but ASC_Shading_Mode attribut is not set or off'
|
||||||
|
: ''
|
||||||
|
);
|
||||||
|
|
||||||
|
$errorMessage .= (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingMode ne 'off'
|
||||||
|
&& $FHEM::Automation::ShuttersControl::ascDev
|
||||||
|
->getAutoShuttersControlShading ne 'on'
|
||||||
|
&& $FHEM::Automation::ShuttersControl::ascDev
|
||||||
|
->getAutoShuttersControlShading ne 'off'
|
||||||
|
? ' ASC_Shading_Mode attribut is set but global shading has errors, look at ASC device '
|
||||||
|
. '<a href="'
|
||||||
|
. '/fhem?detail='
|
||||||
|
. ReadingsVal( $shuttersDev, 'associatedWith', 'ASC device' )
|
||||||
|
. $::FW_CSRF . '">'
|
||||||
|
. ReadingsVal( $shuttersDev, 'associatedWith', 'ASC device' )
|
||||||
|
. '</a>'
|
||||||
|
: ''
|
||||||
|
);
|
||||||
|
|
||||||
|
$errorMessage .= (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getBrightness == -1
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getShadingMode ne
|
||||||
|
'off'
|
||||||
|
? ' no brightness sensor found, please set ASC_BrightnessSensor attribut'
|
||||||
|
: ''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$message .= ' ERROR: ' . $errorMessage
|
||||||
|
if ( defined($errorMessage)
|
||||||
|
&& $errorMessage ne '' );
|
||||||
|
|
||||||
|
$message .= ' WARN: ' . $warnMessage
|
||||||
|
if ( defined($warnMessage)
|
||||||
|
&& $warnMessage ne ''
|
||||||
|
&& $errorMessage eq '' );
|
||||||
|
|
||||||
|
$message .= ' INFO: ' . $infoMessage
|
||||||
|
if ( defined($infoMessage)
|
||||||
|
&& $infoMessage ne ''
|
||||||
|
&& $errorMessage eq '' );
|
||||||
|
|
||||||
|
readingsBeginUpdate($shuttersDevHash);
|
||||||
|
readingsBulkUpdateIfChanged( $shuttersDevHash, 'ASC_ShadingMessage',
|
||||||
|
'<html>' . $message . ' </html>' );
|
||||||
|
readingsEndUpdate( $shuttersDevHash, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
sub ShadingProcessing {
|
||||||
|
### angleMinus ist $FHEM::Automation::ShuttersControl::shutters->getShadingAzimuthLeft
|
||||||
|
### anglePlus ist $FHEM::Automation::ShuttersControl::shutters->getShadingAzimuthRight
|
||||||
|
### winPos ist die Fensterposition $FHEM::Automation::ShuttersControl::shutters->getDirection
|
||||||
|
my ( $hash, $shuttersDev, $azimuth, $elevation, $outTemp,
|
||||||
|
$azimuthLeft, $azimuthRight )
|
||||||
|
= @_;
|
||||||
|
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev);
|
||||||
|
my $brightness =
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getBrightnessAverage;
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShadingBetweenTheTimeSuspend(
|
||||||
|
( IsInTime($FHEM::Automation::ShuttersControl::shutters->getShadingBetweenTheTime)
|
||||||
|
? 0
|
||||||
|
: 1 )
|
||||||
|
);
|
||||||
|
|
||||||
|
FHEM::Automation::ShuttersControl::ASC_Debug(
|
||||||
|
'ShadingProcessing: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
|
||||||
|
. ' - Übergebende Werte - Azimuth:'
|
||||||
|
. $azimuth
|
||||||
|
. ', Elevation: '
|
||||||
|
. $elevation
|
||||||
|
. ', Brightness: '
|
||||||
|
. $brightness
|
||||||
|
. ', OutTemp: '
|
||||||
|
. $outTemp
|
||||||
|
. ', Azimut Beschattung: '
|
||||||
|
. $azimuthLeft
|
||||||
|
. ', Azimut Endschattung: '
|
||||||
|
. $azimuthRight
|
||||||
|
. ', Ist es nach der Zeitblockadezeit: '
|
||||||
|
. (
|
||||||
|
FHEM::Automation::ShuttersControl::Helper::IsAfterShuttersTimeBlocking(
|
||||||
|
$shuttersDev) ? 'JA' : 'NEIN'
|
||||||
|
)
|
||||||
|
. ', Das Rollo ist in der Beschattung und wurde manuell gefahren: '
|
||||||
|
. (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingManualDriveStatus ? 'JA' : 'NEIN'
|
||||||
|
)
|
||||||
|
. ', Ist es nach der Hälfte der Beschattungswartezeit: '
|
||||||
|
. (
|
||||||
|
(
|
||||||
|
int( gettimeofday() ) -
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingStatusTimestamp
|
||||||
|
) < (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingWaitingPeriod / 2
|
||||||
|
) ? 'NEIN' : 'JA'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
Log3( $name, 4,
|
||||||
|
"AutoShuttersControl ($name) - Shading Processing, Rollladen: "
|
||||||
|
. $shuttersDev
|
||||||
|
. " Azimuth: "
|
||||||
|
. $azimuth
|
||||||
|
. " Elevation: "
|
||||||
|
. $elevation
|
||||||
|
. " Brightness: "
|
||||||
|
. $brightness
|
||||||
|
. " OutTemp: "
|
||||||
|
. $outTemp );
|
||||||
|
|
||||||
|
return
|
||||||
|
if (
|
||||||
|
$azimuth == -1
|
||||||
|
|| $elevation == -1
|
||||||
|
|| $brightness == -1
|
||||||
|
|| $outTemp == -100
|
||||||
|
|| (
|
||||||
|
int( gettimeofday() ) -
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingStatusTimestamp ) < (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingWaitingPeriod / 2
|
||||||
|
)
|
||||||
|
|| $FHEM::Automation::ShuttersControl::shutters->getShadingMode eq 'off'
|
||||||
|
|| $FHEM::Automation::ShuttersControl::ascDev
|
||||||
|
->getAutoShuttersControlShading eq 'off'
|
||||||
|
);
|
||||||
|
|
||||||
|
Log3( $name, 4,
|
||||||
|
"AutoShuttersControl ($name) - Shading Processing, Rollladen: "
|
||||||
|
. $shuttersDev
|
||||||
|
. " Nach dem return" );
|
||||||
|
|
||||||
|
my $getShadingPos =
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingPos;
|
||||||
|
my $getStatus = $FHEM::Automation::ShuttersControl::shutters->getStatus;
|
||||||
|
my $oldShadingStatus =
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus;
|
||||||
|
my $shuttersDevHash = $defs{$shuttersDev};
|
||||||
|
|
||||||
|
my $getModeUp = $FHEM::Automation::ShuttersControl::shutters->getModeUp;
|
||||||
|
my $homemode = $FHEM::Automation::ShuttersControl::shutters->getHomemode;
|
||||||
|
|
||||||
|
FHEM::Automation::ShuttersControl::ASC_Debug( 'ShadingProcessing: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
|
||||||
|
. ' - Alle Werte für die weitere Verarbeitung sind korrekt vorhanden und es wird nun mit der Beschattungsverarbeitung begonnen'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
(
|
||||||
|
$outTemp < $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingMinOutsideTemperature - 4
|
||||||
|
|| $azimuth < $azimuthLeft
|
||||||
|
|| $azimuth > $azimuthRight
|
||||||
|
|| ( !$FHEM::Automation::ShuttersControl::shutters->getIsDay
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getSunriseUnixTime
|
||||||
|
- ( int( gettimeofday() ) ) > 7200 )
|
||||||
|
)
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getShadingStatus ne
|
||||||
|
'out'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus('out');
|
||||||
|
|
||||||
|
FHEM::Automation::ShuttersControl::ASC_Debug( 'ShadingProcessing: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
|
||||||
|
. ' - Es ist Nacht oder die Aussentemperatur unterhalb der Shading Temperatur. Die Beschattung wird Zwangsbeendet'
|
||||||
|
);
|
||||||
|
|
||||||
|
Log3( $name, 4,
|
||||||
|
"AutoShuttersControl ($name) - Shading Processing - Der Sonnenstand ist ausserhalb der Winkelangaben oder die Aussentemperatur unterhalb der Shading Temperatur "
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elsif ($azimuth < $azimuthLeft
|
||||||
|
|| $azimuth > $azimuthRight
|
||||||
|
|| $elevation <
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingMinElevation
|
||||||
|
|| $elevation >
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingMaxElevation
|
||||||
|
|| $brightness < $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingStateChangeCloudy
|
||||||
|
|| $outTemp < $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingMinOutsideTemperature - 1 )
|
||||||
|
{
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus(
|
||||||
|
'out reserved')
|
||||||
|
if ( $FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq
|
||||||
|
'in'
|
||||||
|
|| $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
eq 'in reserved' );
|
||||||
|
|
||||||
|
if (
|
||||||
|
(
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
eq 'out reserved'
|
||||||
|
and (
|
||||||
|
int( gettimeofday() ) -
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingStatusTimestamp )
|
||||||
|
) > $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingWaitingPeriod
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus(
|
||||||
|
'out');
|
||||||
|
}
|
||||||
|
|
||||||
|
Log3( $name, 4,
|
||||||
|
"AutoShuttersControl ($name) - Shading Processing, Rollladen: "
|
||||||
|
. $shuttersDev
|
||||||
|
. " In der Out Abfrage, Shadingwert: "
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
. ", Zeitstempel: "
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingStatusTimestamp );
|
||||||
|
|
||||||
|
FHEM::Automation::ShuttersControl::ASC_Debug( 'ShadingProcessing: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
|
||||||
|
. ' - Einer der Beschattungsbedingungen wird nicht mehr erfüllt und somit wird der Beschattungsstatus um eine Stufe reduziert. Alter Status: '
|
||||||
|
. $oldShadingStatus
|
||||||
|
. ' Neuer Status: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elsif ($azimuth > $azimuthLeft
|
||||||
|
&& $azimuth < $azimuthRight
|
||||||
|
&& $elevation >
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingMinElevation
|
||||||
|
&& $elevation <
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingMaxElevation
|
||||||
|
&& $brightness >
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingStateChangeSunny
|
||||||
|
&& $outTemp > $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingMinOutsideTemperature )
|
||||||
|
{
|
||||||
|
if ( $FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq
|
||||||
|
'out'
|
||||||
|
|| $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
eq 'out reserved' )
|
||||||
|
{
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus(
|
||||||
|
'in reserved');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq
|
||||||
|
'in reserved'
|
||||||
|
and (
|
||||||
|
int( gettimeofday() ) -
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingStatusTimestamp ) > (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingWaitingPeriod / 2
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus(
|
||||||
|
'in');
|
||||||
|
}
|
||||||
|
|
||||||
|
Log3( $name, 4,
|
||||||
|
"AutoShuttersControl ($name) - Shading Processing, Rollladen: "
|
||||||
|
. $shuttersDev
|
||||||
|
. " In der In Abfrage, Shadingwert: "
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
. ", Zeitstempel: "
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingStatusTimestamp );
|
||||||
|
|
||||||
|
FHEM::Automation::ShuttersControl::ASC_Debug( 'ShadingProcessing: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
|
||||||
|
. ' - Alle Beschattungsbedingungen wurden erfüllt und somit wird der Beschattungsstatus um eine Stufe angehoben. Alter Status: '
|
||||||
|
. $oldShadingStatus
|
||||||
|
. ' Neuer Status: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShadingProcessingDriveCommand( $hash, $shuttersDev )
|
||||||
|
if (
|
||||||
|
FHEM::Automation::ShuttersControl::Helper::IsAfterShuttersTimeBlocking(
|
||||||
|
$shuttersDev)
|
||||||
|
&& !$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingManualDriveStatus
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getRoommatesStatus ne
|
||||||
|
'gotosleep'
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getRoommatesStatus ne
|
||||||
|
'asleep'
|
||||||
|
&& (
|
||||||
|
(
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
eq 'out'
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingLastStatus eq 'in'
|
||||||
|
)
|
||||||
|
|| ( $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
eq 'in'
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingLastStatus eq 'out' )
|
||||||
|
)
|
||||||
|
&& ( $FHEM::Automation::ShuttersControl::shutters->getShadingMode eq
|
||||||
|
'always'
|
||||||
|
|| $FHEM::Automation::ShuttersControl::shutters->getShadingMode eq
|
||||||
|
$homemode )
|
||||||
|
&& (
|
||||||
|
$getModeUp eq 'always'
|
||||||
|
|| $getModeUp eq
|
||||||
|
$homemode
|
||||||
|
|| $getModeUp eq 'off'
|
||||||
|
|| $getModeUp eq
|
||||||
|
'absent'
|
||||||
|
|| $getModeUp eq
|
||||||
|
'gone'
|
||||||
|
|| ( $getModeUp eq
|
||||||
|
'home'
|
||||||
|
&& $homemode ne 'asleep' )
|
||||||
|
)
|
||||||
|
&& (
|
||||||
|
(
|
||||||
|
(
|
||||||
|
int( gettimeofday() ) -
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingStatusTimestamp
|
||||||
|
) < 2
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getClosedPos
|
||||||
|
)
|
||||||
|
|| (
|
||||||
|
!$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getQueryShuttersPos(
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingPos
|
||||||
|
)
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getIfInShading
|
||||||
|
)
|
||||||
|
|| ( !$FHEM::Automation::ShuttersControl::shutters->getIfInShading
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getStatus ==
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingPos
|
||||||
|
)
|
||||||
|
|| ( !$FHEM::Automation::ShuttersControl::shutters->getShadingBetweenTheTimeSuspend
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingPos )
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
readingsBeginUpdate($shuttersDevHash);
|
||||||
|
readingsBulkUpdate(
|
||||||
|
$shuttersDevHash,
|
||||||
|
'ASC_ShadingMessage',
|
||||||
|
'INFO: current shading status is \''
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
. '\''
|
||||||
|
. ' - next check in '
|
||||||
|
. (
|
||||||
|
(
|
||||||
|
(
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingLastStatus eq 'out reserved'
|
||||||
|
|| $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingLastStatus eq 'out'
|
||||||
|
)
|
||||||
|
? $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingWaitingPeriod
|
||||||
|
: $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingWaitingPeriod / 2
|
||||||
|
)
|
||||||
|
) / 60
|
||||||
|
. 'm'
|
||||||
|
);
|
||||||
|
readingsEndUpdate( $shuttersDevHash, 1 );
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub ShadingProcessingDriveCommand {
|
||||||
|
my $hash = shift;
|
||||||
|
my $shuttersDev = shift;
|
||||||
|
my $marker = shift // 0;
|
||||||
|
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev);
|
||||||
|
|
||||||
|
my $getShadingPos =
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingPos;
|
||||||
|
my $getStatus = $FHEM::Automation::ShuttersControl::shutters->getStatus;
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus(
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus );
|
||||||
|
|
||||||
|
if ( IsInTime($FHEM::Automation::ShuttersControl::shutters->getShadingBetweenTheTime)
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'in'
|
||||||
|
&& $getShadingPos != $getStatus
|
||||||
|
&& ( $getStatus != $FHEM::Automation::ShuttersControl::shutters->getClosedPos
|
||||||
|
|| ( $getStatus == $FHEM::Automation::ShuttersControl::shutters->getClosedPos
|
||||||
|
&& $marker
|
||||||
|
)
|
||||||
|
)
|
||||||
|
&& ( $getStatus != $FHEM::Automation::ShuttersControl::shutters->getSleepPos
|
||||||
|
|| ( $getStatus == $FHEM::Automation::ShuttersControl::shutters->getSleepPos
|
||||||
|
&& $marker
|
||||||
|
)
|
||||||
|
)
|
||||||
|
&& (
|
||||||
|
FHEM::Automation::ShuttersControl::CheckIfShuttersWindowRecOpen(
|
||||||
|
$shuttersDev) != 2
|
||||||
|
|| $FHEM::Automation::ShuttersControl::shutters->getShuttersPlace
|
||||||
|
ne 'terrace'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setLastDrive(
|
||||||
|
'shading in');
|
||||||
|
FHEM::Automation::ShuttersControl::ShuttersCommandSet( $hash,
|
||||||
|
$shuttersDev, $getShadingPos );
|
||||||
|
|
||||||
|
FHEM::Automation::ShuttersControl::ASC_Debug(
|
||||||
|
'ShadingProcessingDriveCommand: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
|
||||||
|
. ' - Der aktuelle Beschattungsstatus ist: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
. ' und somit wird nun in die Position: '
|
||||||
|
. $getShadingPos
|
||||||
|
. ' zum Beschatten gefahren' );
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setShadingLastPos(
|
||||||
|
$getShadingPos);
|
||||||
|
}
|
||||||
|
elsif (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'out'
|
||||||
|
&& $getShadingPos == $getStatus )
|
||||||
|
{
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setLastDrive(
|
||||||
|
'shading out');
|
||||||
|
|
||||||
|
FHEM::Automation::ShuttersControl::ShuttersCommandSet(
|
||||||
|
$hash,
|
||||||
|
$shuttersDev,
|
||||||
|
(
|
||||||
|
(
|
||||||
|
$getShadingPos ==
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getLastPos
|
||||||
|
|| $getShadingPos ==
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingLastPos
|
||||||
|
)
|
||||||
|
? $FHEM::Automation::ShuttersControl::shutters->getOpenPos
|
||||||
|
: (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getQueryShuttersPos(
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->getLastPos
|
||||||
|
)
|
||||||
|
? (
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getLastPos ==
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getSleepPos
|
||||||
|
? $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getOpenPos
|
||||||
|
: $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getLastPos
|
||||||
|
)
|
||||||
|
: $FHEM::Automation::ShuttersControl::shutters->getOpenPos
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) if ( $FHEM::Automation::ShuttersControl::shutters->getIsDay
|
||||||
|
|| $FHEM::Automation::ShuttersControl::shutters->getShuttersPlace eq 'awning' );
|
||||||
|
|
||||||
|
FHEM::Automation::ShuttersControl::ASC_Debug(
|
||||||
|
'ShadingProcessingDriveCommand: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
|
||||||
|
. ' - Der aktuelle Beschattungsstatus ist: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
. ' und somit wird nun in die Position: '
|
||||||
|
. $getShadingPos
|
||||||
|
. ' zum beenden der Beschattung gefahren' );
|
||||||
|
}
|
||||||
|
|
||||||
|
Log3( $name, 4,
|
||||||
|
"AutoShuttersControl ($name) - Shading Processing - In der Routine zum fahren der Rollläden, Shading Wert: "
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus );
|
||||||
|
|
||||||
|
FHEM::Automation::ShuttersControl::ASC_Debug(
|
||||||
|
'ShadingProcessingDriveCommand: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
|
||||||
|
. ' - Der aktuelle Beschattungsstatus ist: '
|
||||||
|
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
|
||||||
|
. ', Beschattungsstatus Zeitstempel: '
|
||||||
|
. strftime(
|
||||||
|
"%Y.%m.%d %T",
|
||||||
|
localtime(
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getShadingStatusTimestamp
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
1100
lib/FHEM/Automation/ShuttersControl/Shutters.pm
Normal file
1100
lib/FHEM/Automation/ShuttersControl/Shutters.pm
Normal file
File diff suppressed because it is too large
Load Diff
1986
lib/FHEM/Automation/ShuttersControl/Shutters/Attr.pm
Normal file
1986
lib/FHEM/Automation/ShuttersControl/Shutters/Attr.pm
Normal file
File diff suppressed because it is too large
Load Diff
94
lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm
Normal file
94
lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Developed with Kate
|
||||||
|
#
|
||||||
|
# (c) 2018-2021 Copyright: Marko Oldenburg (fhemdevelopment@cooltux.net)
|
||||||
|
# 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;
|
53
lib/FHEM/Automation/ShuttersControl/Window.pm
Normal file
53
lib/FHEM/Automation/ShuttersControl/Window.pm
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Developed with Kate
|
||||||
|
#
|
||||||
|
# (c) 2018-2021 Copyright: Marko Oldenburg (fhemdevelopment@cooltux.net)
|
||||||
|
# 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;
|
128
lib/FHEM/Automation/ShuttersControl/Window/Attr.pm
Normal file
128
lib/FHEM/Automation/ShuttersControl/Window/Attr.pm
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Developed with Kate
|
||||||
|
#
|
||||||
|
# (c) 2018-2021 Copyright: Marko Oldenburg (fhemdevelopment@cooltux.net)
|
||||||
|
# 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::Helper::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;
|
66
lib/FHEM/Automation/ShuttersControl/Window/Readings.pm
Normal file
66
lib/FHEM/Automation/ShuttersControl/Window/Readings.pm
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Developed with Kate
|
||||||
|
#
|
||||||
|
# (c) 2018-2021 Copyright: Marko Oldenburg (fhemdevelopment@cooltux.net)
|
||||||
|
# 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;
|
Reference in New Issue
Block a user