2018-08-15 10:27:53 +02:00
###############################################################################
2018-10-14 18:19:23 +02:00
#
2018-08-15 10:27:53 +02:00
# Developed with Kate
#
# (c) 2018 Copyright: Marko Oldenburg (leongaultier at gmail dot com)
# All rights reserved
#
# Special thanks goes to:
2018-09-02 23:00:40 +02:00
# - 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)
2018-09-03 22:19:25 +02:00
# - Beta-User for many tests and ideas
2018-11-11 12:31:20 +01:00
# - pc1246 write english commandref
2018-11-12 12:56:18 +01:00
# - sledge fix many typo in commandref
# - many User that use with modul and report bugs
2018-08-15 10:27:53 +02:00
#
#
# 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
2018-10-14 18:19:23 +02:00
# the Free Software Foundation; either version 2 of the License,or
2018-08-15 10:27:53 +02:00
# 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$
#
###############################################################################
2018-09-24 15:29:39 +02:00
### Notizen
2018-09-28 08:57:25 +02:00
# - Feststellen ob ein Rolladen fährt oder nicht
2018-09-04 11:42:47 +02:00
2018-08-15 10:27:53 +02:00
package main ;
use strict ;
use warnings ;
2018-11-17 17:10:45 +01:00
my $ version = "0.2.0.7" ;
2018-08-15 10:27:53 +02:00
sub AutoShuttersControl_Initialize ($) {
my ( $ hash ) = @ _ ;
2018-08-29 14:58:10 +02:00
## Da ich mit package arbeite müssen in die Initialize für die jeweiligen hash Fn Funktionen der Funktionsname
2018-10-14 18:19:23 +02:00
# und davor mit :: getrennt der eigentliche package Name des Modules
$ hash - > { SetFn } = "AutoShuttersControl::Set" ;
$ hash - > { GetFn } = "AutoShuttersControl::Get" ;
$ hash - > { DefFn } = "AutoShuttersControl::Define" ;
$ hash - > { NotifyFn } = "AutoShuttersControl::Notify" ;
$ hash - > { UndefFn } = "AutoShuttersControl::Undef" ;
$ hash - > { AttrFn } = "AutoShuttersControl::Attr" ;
$ hash - > { AttrList } =
"disable:0,1 "
. "disabledForIntervals "
. "ASC_guestPresence:on,off "
. "ASC_temperatureSensor "
. "ASC_temperatureReading "
. "ASC_brightnessMinVal "
. "ASC_brightnessMaxVal "
. "ASC_autoShuttersControlMorning:on,off "
. "ASC_autoShuttersControlEvening:on,off "
2018-11-14 15:26:32 +01:00
. "ASC_autoShuttersControlShading:on,off "
2018-10-14 18:19:23 +02:00
. "ASC_autoShuttersControlComfort:on,off "
. "ASC_residentsDevice "
. "ASC_residentsDeviceReading "
2018-10-27 13:36:11 +02:00
. "ASC_rainSensorDevice "
. "ASC_rainSensorReading "
. "ASC_rainSensorShuttersClosedPos:0,10,20,30,40,50,60,70,80,90,100 "
2018-10-14 18:19:23 +02:00
. "ASC_autoAstroModeMorning:REAL,CIVIL,NAUTIC,ASTRONOMIC,HORIZON "
. "ASC_autoAstroModeMorningHorizon:-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9 "
. "ASC_autoAstroModeEvening:REAL,CIVIL,NAUTIC,ASTRONOMIC,HORIZON "
. "ASC_autoAstroModeEveningHorizon:-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9 "
2018-11-08 08:32:47 +01:00
. "ASC_freezeTemp:-5,-4,-3,-2,-1,0,1,2,3,4,5 "
2018-10-14 18:19:23 +02:00
. "ASC_timeUpHolidayDevice "
2018-11-08 08:32:47 +01:00
. "ASC_timeUpHolidayReading "
2018-10-30 08:18:09 +01:00
. "ASC_shuttersDriveOffset "
2018-11-09 08:11:16 +01:00
. "ASC_twilightDevice "
2018-11-11 12:31:20 +01:00
. "ASC_expert:1 "
2018-10-14 18:19:23 +02:00
. $ readingFnAttributes ;
2018-10-27 13:36:11 +02:00
$ hash - > { NotifyOrderPrefix } = "51-" ; # Order Nummer für NotifyFn
2018-08-15 10:27:53 +02:00
2018-08-29 14:58:10 +02:00
## Ist nur damit sich bei einem reload auch die Versionsnummer erneuert.
2018-10-14 18:19:23 +02:00
foreach my $ d ( sort keys % { $ modules { AutoShuttersControl } { defptr } } ) {
2018-08-15 10:27:53 +02:00
my $ hash = $ modules { AutoShuttersControl } { defptr } { $ d } ;
2018-10-14 18:19:23 +02:00
$ hash - > { VERSION } = $ version ;
2018-08-15 10:27:53 +02:00
}
}
2018-10-15 14:51:04 +02:00
## unserer packagename
2018-08-15 10:27:53 +02:00
package AutoShuttersControl ;
2018-11-09 09:11:13 +01:00
2018-08-15 10:27:53 +02:00
use strict ;
use warnings ;
use POSIX ;
2018-10-14 18:19:23 +02:00
use GPUtils qw( :all )
; # wird für den Import der FHEM Funktionen aus der fhem.pl benötigt
use Data::Dumper ; #only for Debugging
2018-08-28 19:49:01 +02:00
use Date::Parse ;
2018-08-15 10:27:53 +02:00
my $ missingModul = "" ;
2018-09-30 21:05:30 +02:00
eval "use JSON qw(decode_json encode_json);1" or $ missingModul . = "JSON " ;
2018-08-15 10:27:53 +02:00
2018-08-29 14:58:10 +02:00
## Import der FHEM Funktionen
2018-08-15 10:27:53 +02:00
BEGIN {
2018-10-14 18:19:23 +02:00
GP_Import (
qw( devspec2array
readingsSingleUpdate
readingsBulkUpdate
readingsBulkUpdateIfChanged
readingsBeginUpdate
readingsEndUpdate
defs
modules
Log3
CommandAttr
attr
CommandDeleteAttr
CommandDeleteReading
CommandSet
AttrVal
ReadingsVal
Value
IsDisabled
deviceEvents
init_done
addToDevAttrList
addToAttrList
delFromDevAttrList
delFromAttrList
gettimeofday
sunset_abs
sunrise_abs
InternalTimer
RemoveInternalTimer
computeAlignTime
ReplaceEventMap )
) ;
}
2018-08-15 10:27:53 +02:00
2018-08-29 14:58:10 +02:00
## Die Attributsliste welche an die Rolläden verteilt wird. Zusammen mit Default Werten
2018-10-14 18:19:23 +02:00
my % userAttrList = (
2018-10-19 20:13:01 +02:00
'ASC_Mode_Up:absent,always,off,home' = > 'always' ,
'ASC_Mode_Down:absent,always,off,home' = > 'always' ,
2018-10-14 18:19:23 +02:00
'ASC_Up:time,astro,brightness' = > 'astro' ,
'ASC_Down:time,astro,brightness' = > 'astro' ,
'ASC_AutoAstroModeMorning:REAL,CIVIL,NAUTIC,ASTRONOMIC,HORIZON' = > 'none' ,
'ASC_AutoAstroModeMorningHorizon:-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9'
= > 'none' ,
'ASC_AutoAstroModeEvening:REAL,CIVIL,NAUTIC,ASTRONOMIC,HORIZON' = > 'none' ,
'ASC_AutoAstroModeEveningHorizon:-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9'
= > 'none' ,
'ASC_Open_Pos:0,10,20,30,40,50,60,70,80,90,100' = > [ '' , 0 , 100 ] ,
'ASC_Closed_Pos:0,10,20,30,40,50,60,70,80,90,100' = > [ '' , 100 , 0 ] ,
2018-11-07 08:22:11 +01:00
'ASC_Pos_Reading' = > [ '' , 'position' , 'pct' ] ,
2018-10-14 18:19:23 +02:00
'ASC_Time_Up_Early' = > '04:30' ,
'ASC_Time_Up_Late' = > '09:00' ,
'ASC_Time_Up_WE_Holiday' = > '08:30' ,
'ASC_Time_Down_Early' = > '15:30' ,
'ASC_Time_Down_Late' = > '22:30' ,
'ASC_WindowRec' = > 'none' ,
'ASC_Ventilate_Window_Open:on,off' = > 'on' ,
2018-11-14 15:26:32 +01:00
'ASC_LockOut:soft,hard,off' = > 'off' ,
'ASC_LockOut_Cmd:inhibit,blocked' = > 'none' ,
2018-11-03 19:01:29 +01:00
2018-11-16 10:44:54 +01:00
# 'ASC_Shading_Direction' => 178,
# 'ASC_Shading_Pos:10,20,30,40,50,60,70,80,90,100' => [ '', 70, 30 ],
# 'ASC_Shading_Mode:on,off,home,absent' => 'off',
# 'ASC_Shading_Angle_Left:0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90'
# => 85,
# 'ASC_Shading_Angle_Right:0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90'
# => 85,
2018-11-17 22:57:09 +01:00
'ASC_Shading_Brightness_Sensor' = > 'none' ,
'ASC_Shading_Brightness_Reading' = > 'brightness' ,
2018-11-16 10:44:54 +01:00
#
# 'ASC_Shading_StateChange_Sunny' => '6000',
# 'ASC_Shading_StateChange_Cloudy' => '4000',
# 'ASC_Shading_WaitingPeriod' => 20,
# 'ASC_Shading_Min_Elevation' => 'none',
# 'ASC_Shading_Min_OutsideTemperature' => 18,
# 'ASC_Shading_BlockingTime_After_Manual' => 20,
# 'ASC_Shading_BlockingTime_Twilight' => 45,
# 'ASC_Shading_Fast_Open:on,off' => 'none',
# 'ASC_Shading_Fast_Close:on,off' => 'none',
2018-10-30 08:18:09 +01:00
'ASC_Drive_Offset' = > - 1 ,
2018-10-14 18:19:23 +02:00
'ASC_WindowRec_subType:twostate,threestate' = > 'twostate' ,
2018-10-22 08:05:19 +02:00
'ASC_ShuttersPlace:window,terrace' = > 'window' ,
2018-10-14 18:19:23 +02:00
'ASC_Ventilate_Pos:10,20,30,40,50,60,70,80,90,100' = > [ '' , 70 , 30 ] ,
2018-11-15 10:15:36 +01:00
'ASC_ComfortOpen_Pos:0,10,20,30,40,50,60,70,80,90,100' = >
2018-10-14 18:19:23 +02:00
[ '' , 20 , 80 ] ,
'ASC_GuestRoom:on,off' = > 'none' ,
2018-11-16 09:28:18 +01:00
'ASC_Antifreeze:off,soft,hard,am,pm' = > 'off' ,
2018-11-17 22:57:09 +01:00
'ASC_Antifreeze_Pos:5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100' = > [ '' , 85 , 15 ] ,
2018-10-14 18:19:23 +02:00
'ASC_Partymode:on,off' = > 'off' ,
'ASC_Roommate_Device' = > 'none' ,
'ASC_Roommate_Reading' = > 'state' ,
'ASC_Self_Defense_Exclude:on,off' = > 'off' ,
2018-10-16 10:30:10 +02:00
'ASC_BrightnessMinVal' = > - 1 ,
'ASC_BrightnessMaxVal' = > - 1 ,
2018-11-12 12:56:18 +01:00
'ASC_WiggleValue' = > 5 ,
2018-10-14 18:19:23 +02:00
) ;
2018-11-07 08:22:11 +01:00
my % posSetCmds = (
2018-11-08 08:32:47 +01:00
ZWave = > 'dim' ,
Siro = > 'position' ,
CUL_HM = > 'pct' ,
ROLLO = > 'pct' ,
SOMFY = > 'position' ,
tahoma = > 'dim' ,
KLF200Node = > 'pct' ,
DUOFERN = > 'position' ,
2018-11-07 08:22:11 +01:00
) ;
2018-10-14 18:19:23 +02:00
my $ shutters = new ASC_Shutters ( ) ;
my $ ascDev = new ASC_Dev ( ) ;
2018-10-10 10:43:42 +02:00
2018-10-14 18:19:23 +02:00
sub Define ($$) {
my ( $ hash , $ def ) = @ _ ;
my @ a = split ( "[ \t][ \t]*" , $ def ) ;
2018-08-15 10:27:53 +02:00
2018-10-14 18:19:23 +02:00
return "only one AutoShuttersControl instance allowed"
if ( devspec2array ( 'TYPE=AutoShuttersControl' ) > 1 )
; # es wird geprüft ob bereits eine Instanz unseres Modules existiert,wenn ja wird abgebrochen
return "too few parameters: define <name> ShuttersControl" if ( @ a != 2 ) ;
return
"Cannot define ShuttersControl device. Perl modul ${missingModul}is missing."
if ( $ missingModul )
; # Abbruch wenn benötigte Hilfsmodule nicht vorhanden sind / vorerst unwichtig
my $ name = $ a [ 0 ] ;
$ hash - > { VERSION } = $ version ;
$ hash - > { MID } = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
; # eine Ein Eindeutige ID für interne FHEM Belange / nicht weiter wichtig
2018-10-27 13:36:11 +02:00
$ hash - > { NOTIFYDEV } = "global,"
2018-10-14 18:19:23 +02:00
. $ name ; # Liste aller Devices auf deren Events gehört werden sollen
$ ascDev - > setName ( $ name ) ;
2018-08-15 10:27:53 +02:00
2018-11-15 10:15:36 +01:00
readingsSingleUpdate (
$ hash ,
2018-10-14 18:19:23 +02:00
"state" ,
2018-11-15 10:15:36 +01:00
"please set attribute ASC with value 1 or 2 in all auto controlled shutter devices and then execute 'set DEVICENAME scanForShutters'" ,
1
) ;
2018-11-15 00:44:41 +01:00
2018-10-14 18:19:23 +02:00
CommandAttr ( undef , $ name . ' room ASC' )
if ( AttrVal ( $ name , 'room' , 'none' ) eq 'none' ) ;
CommandAttr ( undef , $ name . ' icon fts_shutter_automatic' )
if ( AttrVal ( $ name , 'icon' , 'none' ) eq 'none' ) ;
CommandAttr ( undef , $ name . ' ASC_autoAstroModeEvening REAL' )
if ( $ ascDev - > getAutoAstroModeEvening eq 'none' ) ;
CommandAttr ( undef , $ name . ' ASC_autoAstroModeMorning REAL' )
if ( $ ascDev - > getAutoAstroModeMorning eq 'none' ) ;
CommandAttr ( undef , $ name . ' ASC_autoShuttersControlMorning on' )
if ( $ ascDev - > getAutoShuttersControlMorning eq 'none' ) ;
CommandAttr ( undef , $ name . ' ASC_autoShuttersControlEvening on' )
if ( $ ascDev - > getAutoShuttersControlEvening eq 'none' ) ;
CommandAttr ( undef , $ name . ' ASC_temperatureReading temperature' )
if ( $ ascDev - > getTempReading eq 'none' ) ;
2018-11-08 08:32:47 +01:00
CommandAttr ( undef , $ name . ' ASC_freezeTemp 3' )
2018-11-12 12:56:18 +01:00
if ( $ ascDev - > getFreezeTemp eq 'none' ) ;
2018-11-08 08:32:47 +01:00
CommandAttr ( undef ,
$ name
. ' devStateIcon selfeDefense.terrace:fts_door_tilt created.new.drive.timer:clock .*asleep:scene_sleeping roommate.(awoken|home):user_available residents.(home|awoken):status_available manual:fts_shutter_manual selfeDefense.active:status_locked selfeDefense inactive:status_open day.open:scene_day night close:scene_night'
) if ( AttrVal ( $ name , 'devStateIcon' , 'none' ) eq 'none' ) ;
2018-08-15 10:27:53 +02:00
2018-10-14 18:19:23 +02:00
addToAttrList ( 'ASC:0,1,2' ) ;
2018-08-15 10:27:53 +02:00
2018-10-14 18:19:23 +02:00
Log3 ( $ name , 3 , "AutoShuttersControl ($name) - defined" ) ;
2018-08-15 10:27:53 +02:00
2018-10-14 18:19:23 +02:00
$ modules { AutoShuttersControl } { defptr } { $ hash - > { MID } } = $ hash ;
2018-08-15 10:27:53 +02:00
return undef ;
}
sub Undef ($$) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ arg ) = @ _ ;
2018-08-15 10:27:53 +02:00
my $ name = $ hash - > { NAME } ;
2018-10-14 18:19:23 +02:00
UserAttributs_Readings_ForShutters ( $ hash , 'del' )
; # es sollen alle Attribute und Readings in den Rolläden Devices gelöscht werden welche vom Modul angelegt wurden
2018-09-27 10:19:41 +02:00
delFromAttrList ( 'ASC:0,1,2' ) ;
2018-10-14 18:19:23 +02:00
delete ( $ modules { AutoShuttersControl } { defptr } { $ hash - > { MID } } ) ;
Log3 ( $ name , 3 , "AutoShuttersControl ($name) - delete device $name" ) ;
2018-08-15 10:27:53 +02:00
return undef ;
}
sub Attr (@) {
my ( $ cmd , $ name , $ attrName , $ attrVal ) = @ _ ;
2018-10-14 18:19:23 +02:00
my $ hash = $ defs { $ name } ;
2018-08-15 10:27:53 +02:00
2018-10-14 18:19:23 +02:00
if ( $ attrName eq "disable" ) {
if ( $ cmd eq "set" and $ attrVal eq "1" ) {
Log3 ( $ name , 3 , "AutoShuttersControl ($name) - disabled" ) ;
}
elsif ( $ cmd eq "del" ) {
Log3 ( $ name , 3 , "AutoShuttersControl ($name) - enabled" ) ;
2018-08-15 10:27:53 +02:00
}
}
2018-10-14 18:19:23 +02:00
elsif ( $ attrName eq "disabledForIntervals" ) {
if ( $ cmd eq "set" ) {
return
"check disabledForIntervals Syntax HH:MM-HH:MM or 'HH:MM-HH:MM HH:MM-HH:MM ...'"
unless ( $ attrVal =~ /^((\d{2}:\d{2})-(\d{2}:\d{2})\s?)+$/ ) ;
Log3 ( $ name , 3 ,
"AutoShuttersControl ($name) - disabledForIntervals" ) ;
#readingsSingleUpdate ($hash,"state","disabled",1);
2018-08-15 10:27:53 +02:00
}
2018-10-14 18:19:23 +02:00
elsif ( $ cmd eq "del" ) {
Log3 ( $ name , 3 , "AutoShuttersControl ($name) - enabled" ) ;
#readingsSingleUpdate ($hash,"state","active",1);
2018-08-15 10:27:53 +02:00
}
}
return undef ;
}
sub Notify ($$) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ dev ) = @ _ ;
2018-08-15 10:27:53 +02:00
my $ name = $ hash - > { NAME } ;
2018-10-14 18:19:23 +02:00
return if ( IsDisabled ( $ name ) ) ;
2018-09-03 22:19:25 +02:00
2018-08-15 10:27:53 +02:00
my $ devname = $ dev - > { NAME } ;
my $ devtype = $ dev - > { TYPE } ;
2018-10-14 18:19:23 +02:00
my $ events = deviceEvents ( $ dev , 1 ) ;
return if ( ! $ events ) ;
2018-11-16 10:44:54 +01:00
Log3 ( $ name , 4 ,
2018-10-14 18:19:23 +02:00
"AutoShuttersControl ($name) - Devname: "
. $ devname
. " Name: "
. $ name
. " Notify: "
. Dumper $ events ) ; # mit Dumper
if (
(
grep /^DEFINED.$name$/ ,
@ { $ events } and $ devname eq 'global' and $ init_done
)
or (
grep /^INITIALIZED$/ ,
@ { $ events } or grep /^REREADCFG$/ ,
@ { $ events } or grep /^MODIFIED.$name$/ ,
@ { $ events }
)
2018-08-15 10:27:53 +02:00
and $ devname eq 'global'
2018-10-14 18:19:23 +02:00
)
{
readingsSingleUpdate ( $ hash , 'partyMode' , 'off' , 0 )
2018-11-03 19:01:29 +01:00
if ( $ ascDev - > getPartyMode eq 'none' ) ;
2018-10-14 18:19:23 +02:00
readingsSingleUpdate ( $ hash , 'lockOut' , 'off' , 0 )
if ( $ ascDev - > getLockOut eq 'none' ) ;
readingsSingleUpdate ( $ hash , 'sunriseTimeWeHoliday' , 'off' , 0 )
if ( $ ascDev - > getSunriseTimeWeHoliday eq 'none' ) ;
readingsSingleUpdate ( $ hash , 'selfDefense' , 'off' , 0 )
if ( $ ascDev - > getSelfDefense eq 'none' ) ;
# Ist der Event ein globaler und passt zum Rest der Abfrage oben wird nach neuen Rolläden Devices gescannt und eine Liste im Rolladenmodul sortiert nach Raum generiert
ShuttersDeviceScan ( $ hash )
unless ( ReadingsVal ( $ name , 'userAttrList' , 'none' ) eq 'none' ) ;
}
return
unless ( ref ( $ hash - > { helper } { shuttersList } ) eq 'ARRAY'
and scalar ( @ { $ hash - > { helper } { shuttersList } } ) > 0 ) ;
2018-10-19 20:13:01 +02:00
2018-10-17 15:58:05 +02:00
my $ posReading = $ shutters - > getPosCmd ;
2018-10-14 18:19:23 +02:00
if ( $ devname eq $ name ) {
if ( grep /^userAttrList:.rolled.out$/ , @ { $ events } ) {
unless ( scalar ( @ { $ hash - > { helper } { shuttersList } } ) == 0 ) {
2018-09-04 11:42:47 +02:00
WriteReadingsShuttersList ( $ hash ) ;
2018-10-14 18:19:23 +02:00
UserAttributs_Readings_ForShutters ( $ hash , 'add' ) ;
InternalTimer ( gettimeofday ( ) + 3 ,
'AutoShuttersControl::RenewSunRiseSetShuttersTimer' ,
$ hash ) ;
2018-11-15 00:44:41 +01:00
InternalTimer ( gettimeofday ( ) + 5 ,
'AutoShuttersControl::AutoSearchTwilightDev' ,
$ hash ) ;
2018-09-04 11:42:47 +02:00
}
2018-10-14 18:19:23 +02:00
}
elsif ( grep /^partyMode:.off$/ , @ { $ events } ) {
2018-11-12 12:56:18 +01:00
EventProcessingPartyMode ( $ hash ) ;
2018-10-14 18:19:23 +02:00
}
elsif ( grep /^sunriseTimeWeHoliday:.(on|off)$/ , @ { $ events } ) {
2018-09-18 09:35:45 +02:00
RenewSunRiseSetShuttersTimer ( $ hash ) ;
2018-09-04 11:42:47 +02:00
}
2018-10-14 18:19:23 +02:00
}
elsif ( $ devname eq "global" )
{ # Kommt ein globales Event und beinhaltet folgende Syntax wird die Funktion zur Verarbeitung aufgerufen
if (
grep
2018-11-11 12:31:20 +01:00
/^(ATTR|DELETEATTR)\s(.*ASC_Roommate_Device|.*ASC_WindowRec|.*ASC_residentsDevice|.*ASC_rainSensorDevice|.*ASC_Shading_Brightness_Sensor|.*ASC_twilightDevice)(\s.*|$)/ ,
2018-10-14 18:19:23 +02:00
@ { $ events }
)
{
2018-11-12 12:56:18 +01:00
EventProcessingGeneral ( $ hash , undef , join ( ' ' , @ { $ events } ) ) ;
2018-10-14 18:19:23 +02:00
}
2018-10-27 13:36:11 +02:00
elsif (
grep
2018-11-07 08:22:11 +01:00
/^(ATTR|DELETEATTR)\s(.*ASC_Time_Up_WE_Holiday|.*ASC_Up|.*ASC_Down|.*ASC_AutoAstroModeMorning|.*ASC_AutoAstroModeMorningHorizon|.*ASC_AutoAstroModeEvening|.*ASC_AutoAstroModeEveningHorizon|.*ASC_Time_Up_Early|.*ASC_Time_Up_Late|.*ASC_Time_Down_Early|.*ASC_Time_Down_Late|.*ASC_autoAstroModeMorning|.*ASC_autoAstroModeMorningHorizon|.*ASC_autoAstroModeEvening|.*ASC_autoAstroModeEveningHorizon)(\s.*|$)/ ,
2018-10-27 13:36:11 +02:00
@ { $ events }
)
2018-10-14 18:19:23 +02:00
{
2018-11-12 12:56:18 +01:00
EventProcessingGeneral ( $ hash , undef , join ( ' ' , @ { $ events } ) ) ;
2018-08-16 10:37:09 +02:00
}
2018-08-15 10:27:53 +02:00
}
2018-10-19 20:13:01 +02:00
elsif ( grep /^($posReading):\s\d+$/ , @ { $ events } ) {
2018-11-12 12:56:18 +01:00
EventProcessingShutters ( $ hash , $ devname , join ( ' ' , @ { $ events } ) ) ;
2018-10-19 20:13:01 +02:00
}
2018-10-14 18:19:23 +02:00
else {
2018-11-12 12:56:18 +01:00
EventProcessingGeneral ( $ hash , $ devname , join ( ' ' , @ { $ events } ) )
2018-10-14 18:19:23 +02:00
; # bei allen anderen Events wird die entsprechende Funktion zur Verarbeitung aufgerufen
}
2018-08-15 10:27:53 +02:00
return ;
}
2018-11-12 12:56:18 +01:00
sub EventProcessingGeneral ($$$) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ devname , $ events ) = @ _ ;
my $ name = $ hash - > { NAME } ;
2018-08-16 10:37:09 +02:00
2018-10-14 18:19:23 +02:00
if ( defined ( $ devname ) and ( $ devname ) )
{ # es wird lediglich der Devicename der Funktion mitgegeben wenn es sich nicht um global handelt daher hier die Unterschiedung
while ( my ( $ device , $ deviceAttr ) =
each % { $ hash - > { monitoredDevs } { $ devname } } )
{
2018-11-12 12:56:18 +01:00
EventProcessingWindowRec ( $ hash , $ device , $ events )
2018-10-14 18:19:23 +02:00
if ( $ deviceAttr eq 'ASC_WindowRec' )
; # ist es ein Fensterdevice wird die Funktion gestartet
2018-11-12 12:56:18 +01:00
EventProcessingRoommate ( $ hash , $ device , $ events )
2018-10-14 18:19:23 +02:00
if ( $ deviceAttr eq 'ASC_Roommate_Device' )
; # ist es ein Bewohner Device wird diese Funktion gestartet
2018-11-12 12:56:18 +01:00
EventProcessingResidents ( $ hash , $ device , $ events )
2018-10-14 18:19:23 +02:00
if ( $ deviceAttr eq 'ASC_residentsDevice' ) ;
2018-11-12 12:56:18 +01:00
EventProcessingRain ( $ hash , $ device , $ events )
2018-10-27 13:36:11 +02:00
if ( $ deviceAttr eq 'ASC_rainSensorDevice' ) ;
2018-11-14 03:41:38 +01:00
EventProcessingTwilightDevice ( $ hash , $ device , $ events )
if ( $ deviceAttr eq 'ASC_twilightDevice' ) ;
2018-10-14 18:19:23 +02:00
$ shutters - > setShuttersDev ( $ device )
if ( $ deviceAttr eq 'ASC_Shading_Brightness_Sensor' ) ;
2018-11-14 03:41:38 +01:00
if (
$ deviceAttr eq 'ASC_Shading_Brightness_Sensor'
and ( $ shutters - > getDown eq 'brightness'
or $ shutters - > getUp eq 'brightness' )
) {
EventProcessingBrightness ( $ hash , $ device , $ events ) ;
}
elsif ( $ deviceAttr eq 'ASC_Shading_Brightness_Sensor' ) {
EventProcessingShadingBrightness ( $ hash , $ device , $ events ) ;
}
2018-08-28 19:49:01 +02:00
}
2018-10-14 18:19:23 +02:00
}
else { # alles was kein Devicenamen mit übergeben hat landet hier
if ( $ events =~
2018-11-11 12:31:20 +01:00
m #^ATTR\s(.*)\s(ASC_Roommate_Device|ASC_WindowRec|ASC_residentsDevice|ASC_rainSensorDevice|ASC_Shading_Brightness_Sensor|ASC_twilightDevice)\s(.*)$#
2018-10-14 18:19:23 +02:00
)
{ # wurde den Attributen unserer Rolläden ein Wert zugewiesen ?
2018-11-07 08:22:11 +01:00
AddNotifyDev ( $ hash , $ 3 , $ 1 , $ 2 ) if ( $ 3 ne 'none' ) ;
2018-10-14 18:19:23 +02:00
Log3 ( $ name , 4 ,
"AutoShuttersControl ($name) - EventProcessing: ATTR" ) ;
2018-08-28 19:49:01 +02:00
}
2018-10-14 18:19:23 +02:00
elsif ( $ events =~
2018-11-11 12:31:20 +01:00
m #^DELETEATTR\s(.*)\s(ASC_Roommate_Device|ASC_WindowRec|ASC_residentsDevice|ASC_rainSensorDevice|ASC_Shading_Brightness_Sensor|ASC_twilightDevice)$#
2018-10-14 18:19:23 +02:00
)
{ # wurde das Attribut unserer Rolläden gelöscht ?
Log3 ( $ name , 4 ,
"AutoShuttersControl ($name) - EventProcessing: DELETEATTR" ) ;
DeleteNotifyDev ( $ hash , $ 1 , $ 2 ) ;
2018-08-27 11:08:08 +02:00
}
2018-10-27 13:36:11 +02:00
elsif ( $ events =~
2018-11-07 08:22:11 +01:00
m #^ATTR\s(.*)\s(ASC_Time_Up_WE_Holiday|ASC_Up|ASC_Down|ASC_AutoAstroModeMorning|ASC_AutoAstroModeMorningHorizon|ASC_AutoAstroModeEvening|ASC_AutoAstroModeEveningHorizon|ASC_Time_Up_Early|ASC_Time_Up_Late|ASC_Time_Down_Early|ASC_Time_Down_Late)\s(.*)$#
2018-10-27 13:36:11 +02:00
)
{
CreateSunRiseSetShuttersTimer ( $ hash , $ 1 )
if (
$ 2 ne 'ASC_Time_Up_WE_Holiday'
or ( $ 2 eq 'ASC_Time_Up_WE_Holiday'
and $ ascDev - > getSunriseTimeWeHoliday eq 'on' )
) ;
}
2018-11-07 08:22:11 +01:00
elsif ( $ events =~
m #^ATTR\s(.*)\s(ASC_autoAstroModeMorning|ASC_autoAstroModeMorningHorizon|ASC_autoAstroModeEvening|ASC_autoAstroModeEveningHorizon)\s(.*)$#
)
{
RenewSunRiseSetShuttersTimer ( $ hash ) ;
}
2018-08-16 10:37:09 +02:00
}
}
2018-08-15 10:27:53 +02:00
sub Set ($$@) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ name , @ aa ) = @ _ ;
my ( $ cmd , @ args ) = @ aa ;
if ( lc $ cmd eq 'renewsetsunrisesunsettimer' ) {
return "usage: $cmd" if ( @ args != 0 ) ;
2018-08-29 14:58:10 +02:00
RenewSunRiseSetShuttersTimer ( $ hash ) ;
2018-10-14 18:19:23 +02:00
}
elsif ( lc $ cmd eq 'scanforshutters' ) {
return "usage: $cmd" if ( @ args != 0 ) ;
2018-09-03 22:19:25 +02:00
ShuttersDeviceScan ( $ hash ) ;
2018-10-14 18:19:23 +02:00
}
elsif ( lc $ cmd eq 'createnewnotifydev' ) {
return "usage: $cmd" if ( @ args != 0 ) ;
2018-10-08 03:59:51 +02:00
CreateNewNotifyDev ( $ hash ) ;
2018-10-14 18:19:23 +02:00
}
elsif ( lc $ cmd eq 'partymode' ) {
return "usage: $cmd" if ( @ args > 1 ) ;
readingsSingleUpdate ( $ hash , $ cmd , join ( ' ' , @ args ) , 1 ) ;
}
elsif ( lc $ cmd eq 'lockout' ) {
return "usage: $cmd" if ( @ args > 1 ) ;
readingsSingleUpdate ( $ hash , $ cmd , join ( ' ' , @ args ) , 1 ) ;
SetHardewareBlockForShutters ( $ hash , join ( ' ' , @ args ) ) ;
}
elsif ( lc $ cmd eq 'sunrisetimeweholiday' ) {
return "usage: $cmd" if ( @ args > 1 ) ;
readingsSingleUpdate ( $ hash , $ cmd , join ( ' ' , @ args ) , 1 ) ;
}
elsif ( lc $ cmd eq 'selfdefense' ) {
return "usage: $cmd" if ( @ args > 1 ) ;
readingsSingleUpdate ( $ hash , $ cmd , join ( ' ' , @ args ) , 1 ) ;
}
2018-11-07 08:22:11 +01:00
elsif ( lc $ cmd eq 'wiggle' ) {
return "usage: $cmd" if ( @ args > 1 ) ;
2018-11-08 08:32:47 +01:00
( $ args [ 0 ] eq 'all' ? wiggleAll ( $ hash ) : wiggle ( $ hash , $ args [ 0 ] ) ) ;
2018-11-07 08:22:11 +01:00
}
2018-10-14 18:19:23 +02:00
else {
2018-09-03 22:19:25 +02:00
my $ list = "scanForShutters:noArg" ;
2018-10-14 18:19:23 +02:00
$ list . =
2018-11-08 08:32:47 +01:00
" renewSetSunriseSunsetTimer:noArg partyMode:on,off lockOut:on,off sunriseTimeWeHoliday:on,off selfDefense:on,off wiggle:all,"
. join ( ',' , @ { $ hash - > { helper } { shuttersList } } )
2018-10-27 14:09:02 +02:00
if ( ReadingsVal ( $ name , 'userAttrList' , 'none' ) eq 'rolled out' ) ;
2018-11-07 08:22:11 +01:00
$ list . = " createNewNotifyDev:noArg"
2018-10-28 18:12:40 +01:00
if ( ReadingsVal ( $ name , 'userAttrList' , 'none' ) eq 'rolled out'
2018-11-11 12:31:20 +01:00
and AttrVal ( $ name , 'ASC_expert' , 0 ) == 1 ) ;
2018-10-08 03:59:51 +02:00
2018-10-14 18:19:23 +02:00
return "Unknown argument $cmd,choose one of $list" ;
2018-08-15 10:27:53 +02:00
}
return undef ;
}
2018-09-21 08:44:38 +02:00
sub Get ($$@) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ name , @ aa ) = @ _ ;
2018-09-21 08:44:38 +02:00
2018-10-14 18:19:23 +02:00
my ( $ cmd , @ args ) = @ aa ;
2018-09-21 08:44:38 +02:00
2018-10-14 18:19:23 +02:00
if ( lc $ cmd eq 'showshuttersinformations' ) {
return "usage: $cmd" if ( @ args != 0 ) ;
2018-09-21 08:44:38 +02:00
my $ ret = GetShuttersInformation ( $ hash ) ;
return $ ret ;
2018-10-14 18:19:23 +02:00
}
elsif ( lc $ cmd eq 'shownotifydevsinformations' ) {
return "usage: $cmd" if ( @ args != 0 ) ;
2018-10-08 03:59:51 +02:00
my $ ret = GetMonitoredDevs ( $ hash ) ;
return $ ret ;
2018-10-14 18:19:23 +02:00
}
else {
2018-09-21 08:44:38 +02:00
my $ list = "" ;
2018-10-28 18:12:40 +01:00
$ list . = " showShuttersInformations:noArg"
2018-10-14 18:19:23 +02:00
if ( ReadingsVal ( $ name , 'userAttrList' , 'none' ) eq 'rolled out' ) ;
2018-10-27 14:09:02 +02:00
$ list . = " showNotifyDevsInformations:noArg"
2018-10-27 13:36:11 +02:00
if ( ReadingsVal ( $ name , 'userAttrList' , 'none' ) eq 'rolled out'
2018-11-11 12:31:20 +01:00
and AttrVal ( $ name , 'ASC_expert' , 0 ) == 1 ) ;
2018-10-28 18:12:40 +01:00
2018-10-14 18:19:23 +02:00
return "Unknown argument $cmd,choose one of $list" ;
2018-09-21 08:44:38 +02:00
}
}
2018-08-15 10:27:53 +02:00
sub ShuttersDeviceScan ($) {
2018-10-14 18:19:23 +02:00
my $ hash = shift ;
my $ name = $ hash - > { NAME } ;
2018-09-13 10:38:35 +02:00
delete $ hash - > { helper } { shuttersList } ;
2018-08-15 10:27:53 +02:00
my @ list ;
2018-09-27 10:19:41 +02:00
@ list = devspec2array ( 'ASC=[1-2]' ) ;
2018-09-13 15:21:29 +02:00
2018-10-14 18:19:23 +02:00
CommandDeleteReading ( undef , $ name . ' .*_nextAstroTimeEvent' ) ;
unless ( scalar ( @ list ) > 0 ) {
2018-09-03 22:19:25 +02:00
readingsBeginUpdate ( $ hash ) ;
2018-10-14 18:19:23 +02:00
readingsBulkUpdate ( $ hash , 'userAttrList' , 'none' ) ;
readingsBulkUpdate ( $ hash , 'state' , 'no shutters found' ) ;
readingsEndUpdate ( $ hash , 1 ) ;
2018-09-03 22:19:25 +02:00
return ;
}
2018-10-17 15:58:05 +02:00
my $ shuttersList = '' ;
2018-10-14 18:19:23 +02:00
foreach ( @ list ) {
push ( @ { $ hash - > { helper } { shuttersList } } , $ _ )
; ## einem Hash wird ein Array zugewiesen welches die Liste der erkannten Rollos beinhaltet
2018-11-03 19:01:29 +01:00
delFromDevAttrList ( $ _ , 'ASC_Direction' )
; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ ,
'ASC_Shading_Pos:10,20,30,40,50,60,70,80,90,100' )
; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ , 'ASC_Rand_Minutes' )
; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ , 'ASC_Shading:on,off,delayed,present,absent' )
; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ ,
'ASC_Shading_Pos_after_Shading:-1,0,10,20,30,40,50,60,70,80,90,100'
) ; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ ,
'ASC_Shading_Angle_Left:0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90'
) ; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ ,
'ASC_Shading_Angle_Right:0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90'
) ; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ , 'ASC_Shading_StateChange_Sunny' )
; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ , 'ASC_Shading_StateChange_Cloudy' )
; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ , 'ASC_Shading_WaitingPeriod' )
; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ , 'ASC_Shading_Min_Elevation' )
; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ , 'ASC_Shading_Min_OutsideTemperature' )
; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ , 'ASC_Shading_BlockingTime_After_Manual' )
; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ , 'ASC_Shading_BlockingTime_Twilight' )
; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ , 'ASC_Shading_Fast_Open:on,off' )
; # temporär muss später gelöscht werden ab Version 0.1.89
delFromDevAttrList ( $ _ , 'ASC_Shading_Fast_Close:on,off' )
; # temporär muss später gelöscht werden ab Version 0.1.89
2018-11-07 08:22:11 +01:00
delFromDevAttrList ( $ _ , 'ASC_Pos_Cmd' )
; # temporär muss später gelöscht werden ab Version 0.1.93
2018-11-14 15:26:32 +01:00
delFromDevAttrList ( $ _ , 'ASC_lock-out:soft,hard' )
2018-11-15 21:51:02 +01:00
; # temporär muss später gelöscht werden ab Version 0.2.0.6
2018-11-14 15:26:32 +01:00
delFromDevAttrList ( $ _ , 'ASC_lock-outCmd:inhibit,blocked' )
2018-11-15 21:51:02 +01:00
; # temporär muss später gelöscht werden ab Version 0.2.0.6
2018-11-15 10:15:36 +01:00
delFromDevAttrList ( $ _ , 'ASC_Pos_after_ComfortOpen:0,10,20,30,40,50,60,70,80,90,100' )
2018-11-15 21:51:02 +01:00
; # temporär muss später gelöscht werden ab Version 0.2.0.6
delFromDevAttrList ( $ _ , 'ASC_Antifreeze:off,on' )
2018-11-16 09:28:18 +01:00
if ( AttrVal ( $ _ , 'ASC_Antifreeze' , 'on' ) eq 'on'
or AttrVal ( $ _ , 'ASC_Antifreeze' , 'on' ) eq 'off'
2018-11-15 21:51:02 +01:00
)
; # temporär muss später gelöscht werden ab Version 0.2.0.6
2018-11-17 22:57:09 +01:00
delFromDevAttrList ( $ _ , 'ASC_AntifreezePos:5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100' )
; # temporär muss später gelöscht werden ab Version 0.2.0.7
2018-11-03 19:01:29 +01:00
2018-10-17 15:58:05 +02:00
$ shuttersList = $ shuttersList . ',' . $ _ ;
$ shutters - > setShuttersDev ( $ _ ) ;
2018-10-19 20:13:01 +02:00
$ shutters - > setLastManPos ( $ shutters - > getStatus ) ;
2018-10-28 18:12:40 +01:00
$ shutters - > setLastPos ( $ shutters - > getStatus ) ;
2018-10-27 13:36:11 +02:00
$ shutters - > setDelayCmd ( 'none' ) ;
2018-11-07 08:22:11 +01:00
$ shutters - > setNoOffset ( 0 ) ;
2018-11-12 09:12:04 +01:00
$ shutters - > setPosSetCmd ( $ posSetCmds { $ defs { $ _ } - > { TYPE } } ) ;
2018-08-15 10:27:53 +02:00
}
2018-11-14 03:41:38 +01:00
# $hash->{NOTIFYDEV} = $hash->{NOTIFYDEV} . $shuttersList;
$ hash - > { NOTIFYDEV } = "global," . $ name . $ shuttersList ;
2018-10-19 20:13:01 +02:00
2018-10-14 18:19:23 +02:00
if ( $ ascDev - > getMonitoredDevs ne 'none' ) {
$ hash - > { monitoredDevs } =
eval { decode_json ( $ ascDev - > getMonitoredDevs ) } ;
2018-09-07 14:10:46 +02:00
my $ notifyDevString = $ hash - > { NOTIFYDEV } ;
2018-10-14 18:19:23 +02:00
while ( each % { $ hash - > { monitoredDevs } } ) {
2018-10-19 20:13:01 +02:00
$ notifyDevString . = ',' . $ _ ;
2018-08-16 10:37:09 +02:00
}
2018-10-14 18:19:23 +02:00
$ hash - > { NOTIFYDEV } = $ notifyDevString ;
2018-08-16 10:37:09 +02:00
}
2018-10-14 18:19:23 +02:00
readingsSingleUpdate ( $ hash , 'userAttrList' , 'rolled out' , 1 ) ;
2018-08-15 10:27:53 +02:00
}
2018-08-29 14:58:10 +02:00
## Die Funktion schreibt in das Moduldevice Readings welche Rolläden in welchen Räumen erfasst wurden.
2018-08-15 10:27:53 +02:00
sub WriteReadingsShuttersList ($) {
2018-10-14 18:19:23 +02:00
my $ hash = shift ;
my $ name = $ hash - > { NAME } ;
2018-08-15 10:27:53 +02:00
2018-10-14 18:19:23 +02:00
CommandDeleteReading ( undef , $ name . ' room_.*' ) ;
2018-08-15 10:27:53 +02:00
readingsBeginUpdate ( $ hash ) ;
2018-10-14 18:19:23 +02:00
foreach ( @ { $ hash - > { helper } { shuttersList } } ) {
readingsBulkUpdate (
$ hash ,
'room_' . makeReadingName ( AttrVal ( $ _ , 'room' , 'unsorted' ) ) ,
ReadingsVal (
$ name ,
'room_' . makeReadingName ( AttrVal ( $ _ , 'room' , 'unsorted' ) ) ,
''
)
. ','
. $ _
)
if (
ReadingsVal (
$ name ,
'room_' . makeReadingName ( AttrVal ( $ _ , 'room' , 'unsorted' ) ) ,
'none'
) ne 'none'
) ;
readingsBulkUpdate ( $ hash ,
'room_' . makeReadingName ( AttrVal ( $ _ , 'room' , 'unsorted' ) ) , $ _ )
if (
ReadingsVal (
$ name ,
'room_' . makeReadingName ( AttrVal ( $ _ , 'room' , 'unsorted' ) ) ,
'none'
) eq 'none'
) ;
2018-08-15 10:27:53 +02:00
}
2018-10-14 18:19:23 +02:00
readingsBulkUpdate ( $ hash , 'state' , 'active' ) ;
readingsEndUpdate ( $ hash , 0 ) ;
2018-08-15 10:27:53 +02:00
}
2018-08-31 09:32:16 +02:00
sub UserAttributs_Readings_ForShutters ($$) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ cmd ) = @ _ ;
my $ name = $ hash - > { NAME } ;
2018-08-15 10:27:53 +02:00
2018-10-14 18:19:23 +02:00
while ( my ( $ attrib , $ attribValue ) = each % { userAttrList } ) {
foreach ( @ { $ hash - > { helper } { shuttersList } } ) {
addToDevAttrList ( $ _ , $ attrib )
; ## fhem.pl bietet eine Funktion um ein userAttr Attribut zu befüllen. Wir schreiben also in den Attribut userAttr alle unsere Attribute rein. Pro Rolladen immer ein Attribut pro Durchlauf
2018-08-29 14:58:10 +02:00
## Danach werden die Attribute die im userAttr stehen gesetzt und mit default Werten befüllt
2018-10-14 18:19:23 +02:00
if ( $ cmd eq 'add' ) {
if ( ref ( $ attribValue ) ne 'ARRAY' ) {
$ attr { $ _ } { ( split ( ':' , $ attrib ) ) [ 0 ] } = $ attribValue
if (
not
defined ( $ attr { $ _ } { ( split ( ':' , $ attrib ) ) [ 0 ] } ) ) ;
}
else {
$ attr { $ _ } { ( split ( ':' , $ attrib ) ) [ 0 ] } =
$ attribValue - > [ AttrVal ( $ _ , 'ASC' , 2 ) ]
if (
not
defined ( $ attr { $ _ } { ( split ( ':' , $ attrib ) ) [ 0 ] } ) ) ;
2018-09-03 22:19:25 +02:00
}
2018-10-14 18:19:23 +02:00
## Oder das Attribut wird wieder gelöscht.
}
elsif ( $ cmd eq 'del' ) {
2018-10-17 09:50:11 +02:00
$ shutters - > setShuttersDev ( $ _ ) ;
RemoveInternalTimer ( $ shutters - > getInTimerFuncHash ) ;
2018-10-14 18:19:23 +02:00
CommandDeleteReading ( undef ,
$ _ . ' .?(AutoShuttersControl|ASC)_.*' ) ;
CommandDeleteAttr ( undef , $ _ . ' ASC' ) ;
delFromDevAttrList ( $ _ , $ attrib ) ;
2018-08-16 10:37:09 +02:00
}
2018-08-15 10:27:53 +02:00
}
}
}
2018-08-29 14:58:10 +02:00
## Fügt dem NOTIFYDEV Hash weitere Devices hinzu
2018-08-27 11:08:08 +02:00
sub AddNotifyDev ($@) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ dev , $ shuttersDev , $ shuttersAttr ) = @ _ ;
my $ name = $ hash - > { NAME } ;
2018-08-16 10:37:09 +02:00
2018-10-14 18:19:23 +02:00
my $ notifyDev = $ hash - > { NOTIFYDEV } ;
$ notifyDev = "" if ( ! $ notifyDev ) ;
my % hash ;
2018-08-16 10:37:09 +02:00
2018-10-14 18:19:23 +02:00
% hash = map { ( $ _ = > 1 ) }
split ( "," , "$notifyDev,$dev" ) ;
2018-08-29 14:58:10 +02:00
2018-10-14 18:19:23 +02:00
$ hash - > { NOTIFYDEV } = join ( "," , sort keys % hash ) ;
my @ devs = split ( ',' , $ dev ) ;
foreach ( @ devs ) {
$ hash - > { monitoredDevs } { $ _ } { $ shuttersDev } = $ shuttersAttr ;
2018-09-30 21:05:30 +02:00
}
2018-10-14 18:19:23 +02:00
readingsSingleUpdate ( $ hash , '.monitoredDevs' ,
eval { encode_json ( $ hash - > { monitoredDevs } ) } , 0 ) ;
2018-08-16 10:37:09 +02:00
}
2018-08-29 14:58:10 +02:00
## entfernt aus dem NOTIFYDEV Hash Devices welche als Wert in Attributen steckten
2018-09-30 21:05:30 +02:00
sub DeleteNotifyDev ($@) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ shuttersDev , $ shuttersAttr ) = @ _ ;
my $ name = $ hash - > { NAME } ;
2018-08-16 10:37:09 +02:00
2018-10-14 18:19:23 +02:00
my $ notifyDevs =
ExtractNotifyDevFromEvent ( $ hash , $ shuttersDev , $ shuttersAttr ) ;
2018-08-27 11:08:08 +02:00
2018-10-14 18:19:23 +02:00
foreach my $ notifyDev ( keys ( % { $ notifyDevs } ) ) {
Log3 ( $ name , 4 ,
"AutoShuttersControl ($name) - DeleteNotifyDev - NotifyDev: "
. $ _ ) ;
2018-09-30 21:05:30 +02:00
delete $ hash - > { monitoredDevs } { $ notifyDev } { $ shuttersDev } ;
2018-08-27 11:08:08 +02:00
2018-10-14 18:19:23 +02:00
if ( ! keys % { $ hash - > { monitoredDevs } { $ notifyDev } } ) {
2018-09-30 21:05:30 +02:00
delete $ hash - > { monitoredDevs } { $ notifyDev } ;
2018-10-14 18:19:23 +02:00
my $ notifyDevString = $ hash - > { NOTIFYDEV } ;
$ notifyDevString = "" if ( ! $ notifyDevString ) ;
2018-09-30 21:05:30 +02:00
my % hash ;
2018-10-14 18:19:23 +02:00
% hash = map { ( $ _ = > 1 ) }
grep { " $notifyDev " !~ m/ $_ / }
split ( "," , "$notifyDevString,$notifyDev" ) ;
2018-09-30 21:05:30 +02:00
2018-10-14 18:19:23 +02:00
$ hash - > { NOTIFYDEV } = join ( "," , sort keys % hash ) ;
2018-09-30 21:05:30 +02:00
}
2018-09-01 08:14:42 +02:00
}
2018-10-14 18:19:23 +02:00
readingsSingleUpdate ( $ hash , '.monitoredDevs' ,
eval { encode_json ( $ hash - > { monitoredDevs } ) } , 0 ) ;
2018-08-27 11:08:08 +02:00
}
2018-08-29 14:58:10 +02:00
## Sub zum steuern der Rolläden bei einem Fenster Event
2018-11-12 12:56:18 +01:00
sub EventProcessingWindowRec ($@) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ shuttersDev , $ events ) = @ _ ;
my $ name = $ hash - > { NAME } ;
2018-08-29 14:58:10 +02:00
2018-10-14 18:19:23 +02:00
if ( $ events =~ m #state:\s(open|closed|tilted)# ) {
2018-10-10 10:43:42 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-11-07 08:22:11 +01:00
$ shutters - > setNoOffset ( 1 ) ;
2018-10-16 10:30:10 +02:00
my $ queryShuttersPosWinRecTilted = (
2018-11-08 08:32:47 +01:00
$ shutters - > getShuttersPosCmdValueNegate
2018-10-14 18:19:23 +02:00
? $ shutters - > getStatus > $ shutters - > getVentilatePos
2018-10-16 10:30:10 +02:00
: $ shutters - > getStatus < $ shutters - > getVentilatePos
) ;
2018-11-15 15:01:34 +01:00
my $ queryShuttersPosWinRecComfort = (
$ shutters - > getShuttersPosCmdValueNegate
? $ shutters - > getStatus > $ shutters - > getComfortOpenPos
: $ shutters - > getStatus < $ shutters - > getComfortOpenPos
) ;
2018-10-14 18:19:23 +02:00
if ( $ shutters - > getDelayCmd ne 'none' )
{ # Es wird geschaut ob wärend der Fenster offen Phase ein Fahrbefehl über das Modul kam,wenn ja wird dieser aus geführt
if ( $ 1 eq 'closed' ) {
2018-11-14 05:44:02 +01:00
$ shutters - > setLastDrive ( 'delayed closed' ) ;
2018-10-14 18:19:23 +02:00
ShuttersCommandSet ( $ hash , $ shuttersDev ,
$ shutters - > getClosedPos ) ;
2018-08-29 14:58:10 +02:00
}
2018-10-14 18:19:23 +02:00
elsif (
(
$ 1 eq 'tilted'
or ( $ 1 eq 'open' and $ shutters - > getSubTyp eq 'twostate' )
)
and $ shutters - > getVentilateOpen eq 'on'
and $ queryShuttersPosWinRecTilted
)
{
2018-11-14 05:44:02 +01:00
$ shutters - > setLastDrive ( 'delayed ventilate open' ) ;
2018-10-14 18:19:23 +02:00
ShuttersCommandSet ( $ hash , $ shuttersDev ,
$ shutters - > getVentilatePos ) ;
2018-08-29 14:58:10 +02:00
}
2018-10-14 18:19:23 +02:00
}
elsif ( $ 1 eq 'closed'
) # wenn nicht dann wird entsprechend dem Fensterkontakt Event der Rolladen geschlossen oder zum lüften geöffnet
{
2018-11-17 18:23:10 +01:00
if ( $ shutters - > getStatus == $ shutters - > getVentilatePos
or $ shutters - > getStatus == $ shutters - > getComfortOpenPos )
{
$ shutters - > setLastDrive ( 'window closed' ) ;
ShuttersCommandSet ( $ hash , $ shuttersDev , $ shutters - > getClosedPos ) ;
}
2018-10-14 18:19:23 +02:00
}
elsif (
(
$ 1 eq 'tilted'
or ( $ 1 eq 'open' and $ shutters - > getSubTyp eq 'twostate' )
)
and $ shutters - > getVentilateOpen eq 'on'
and $ queryShuttersPosWinRecTilted
)
{
2018-11-14 05:44:02 +01:00
$ shutters - > setLastDrive ( 'ventilate open' ) ;
2018-10-14 18:19:23 +02:00
ShuttersCommandSet ( $ hash , $ shuttersDev ,
$ shutters - > getVentilatePos ) ;
}
elsif ( $ 1 eq 'open'
and $ shutters - > getSubTyp eq 'threestate'
and $ ascDev - > getAutoShuttersControlComfort eq 'on'
2018-11-15 15:01:34 +01:00
and $ queryShuttersPosWinRecComfort )
2018-10-14 18:19:23 +02:00
{
2018-11-14 05:44:02 +01:00
$ shutters - > setLastDrive ( 'comfort open' ) ;
2018-10-14 18:19:23 +02:00
ShuttersCommandSet ( $ hash , $ shuttersDev ,
2018-11-15 15:01:34 +01:00
$ shutters - > getComfortOpenPos ) ;
2018-08-29 14:58:10 +02:00
}
2018-08-27 11:08:08 +02:00
}
}
2018-08-29 14:58:10 +02:00
## Sub zum steuern der Rolladen bei einem Bewohner/Roommate Event
2018-11-12 12:56:18 +01:00
sub EventProcessingRoommate ($@) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ shuttersDev , $ events ) = @ _ ;
my $ name = $ hash - > { NAME } ;
2018-11-07 08:22:11 +01:00
2018-10-10 10:43:42 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-10-14 18:19:23 +02:00
my $ reading = $ shutters - > getRoommatesReading ;
2018-10-30 08:18:09 +01:00
if ( $ events =~ m #$reading:\s(absent|gotosleep|asleep|awoken|home)# ) {
2018-10-14 18:19:23 +02:00
Log3 ( $ name , 4 ,
2018-11-15 15:01:34 +01:00
"AutoShuttersControl ($name) - EventProcessingRoommate: " . $ shutters - > getRoommatesReading
2018-10-14 18:19:23 +02:00
) ;
Log3 ( $ name , 4 ,
2018-11-15 15:01:34 +01:00
"AutoShuttersControl ($name) - EventProcessingRoommate: $shuttersDev und Events $events"
2018-10-14 18:19:23 +02:00
) ;
2018-10-30 19:10:50 +01:00
2018-10-30 08:18:09 +01:00
if (
2018-10-30 19:10:50 +01:00
( $ 1 eq 'home' or $ 1 eq 'awoken' )
and ( $ shutters - > getRoommatesStatus eq 'home'
or $ shutters - > getRoommatesStatus eq 'awoken' )
and $ ascDev - > getAutoShuttersControlMorning eq 'on'
and ( $ shutters - > getModeUp eq 'always'
or $ shutters - > getModeUp eq 'home' )
)
2018-10-30 08:18:09 +01:00
{
2018-11-15 15:01:34 +01:00
Log3 ( $ name , 4 ,
"AutoShuttersControl ($name) - EventProcessingRoommate_1: $shuttersDev und Events $events"
) ;
2018-10-30 19:10:50 +01:00
if (
(
$ shutters - > getRoommatesLastStatus eq 'asleep'
or $ shutters - > getRoommatesLastStatus eq 'awoken'
)
and IsDay ( $ hash , $ shuttersDev )
)
2018-10-30 08:18:09 +01:00
{
2018-11-15 15:01:34 +01:00
Log3 ( $ name , 4 ,
"AutoShuttersControl ($name) - EventProcessingRoommate_2: $shuttersDev und Events $events"
) ;
2018-10-30 08:18:09 +01:00
$ shutters - > setLastDrive ( 'roommate awoken' ) ;
2018-10-30 19:10:50 +01:00
ShuttersCommandSet ( $ hash , $ shuttersDev ,
$ shutters - > getOpenPos ) ;
2018-10-30 08:18:09 +01:00
}
2018-10-30 19:10:50 +01:00
if (
(
$ shutters - > getRoommatesLastStatus eq 'absent'
or $ shutters - > getRoommatesLastStatus eq 'gone'
or $ shutters - > getRoommatesLastStatus eq 'home'
)
2018-11-04 21:31:05 +01:00
and ( $ shutters - > getModeUp eq 'home'
or $ shutters - > getModeUp eq 'always'
or $ shutters - > getModeDown eq 'home'
or $ shutters - > getModeDown eq 'always' )
2018-10-30 19:10:50 +01:00
and $ shutters - > getRoommatesStatus eq 'home'
)
2018-10-30 08:18:09 +01:00
{
2018-10-30 15:26:04 +01:00
if ( not IsDay ( $ hash , $ shuttersDev ) ) {
my $ position ;
2018-11-15 15:01:34 +01:00
$ shutters - > setLastDrive ( 'roommate home' ) ;
2018-10-30 15:26:04 +01:00
if ( CheckIfShuttersWindowRecOpen ( $ shuttersDev ) == 0
or $ shutters - > getVentilateOpen eq 'off' )
{
$ position = $ shutters - > getClosedPos ;
}
2018-11-15 15:01:34 +01:00
else {
$ position = $ shutters - > getVentilatePos ;
$ shutters - > setLastDrive ( $ shutters - > getLastDrive . ' - ventilate mode' ) ;
}
2018-10-30 15:26:04 +01:00
ShuttersCommandSet ( $ hash , $ shuttersDev , $ position ) ;
}
elsif ( IsDay ( $ hash , $ shuttersDev )
2018-10-30 19:10:50 +01:00
and $ shutters - > getStatus == $ shutters - > getClosedPos )
{
2018-10-30 15:26:04 +01:00
$ shutters - > setLastDrive ( 'roommate home' ) ;
2018-10-30 19:10:50 +01:00
ShuttersCommandSet ( $ hash , $ shuttersDev ,
$ shutters - > getOpenPos ) ;
2018-10-30 08:18:09 +01:00
}
}
2018-10-30 19:10:50 +01:00
}
elsif (
(
$ shutters - > getModeDown eq 'always'
2018-11-03 19:01:29 +01:00
or $ shutters - > getModeDown eq 'home'
2018-10-30 19:10:50 +01:00
)
and ( $ 1 eq 'gotosleep' or $ 1 eq 'asleep' )
and $ ascDev - > getAutoShuttersControlEvening eq 'on'
)
2018-10-14 18:19:23 +02:00
{
2018-09-13 08:11:10 +02:00
my $ position ;
2018-11-15 15:01:34 +01:00
$ shutters - > setLastDrive ( 'roommate asleep' ) ;
2018-10-14 18:19:23 +02:00
if ( CheckIfShuttersWindowRecOpen ( $ shuttersDev ) == 0
or $ shutters - > getVentilateOpen eq 'off' )
{
$ position = $ shutters - > getClosedPos ;
2018-09-13 08:11:10 +02:00
}
2018-11-15 15:01:34 +01:00
else {
$ position = $ shutters - > getVentilatePos ;
$ shutters - > setLastDrive ( $ shutters - > getLastDrive . ' - ventilate mode' ) ;
}
2018-10-14 18:19:23 +02:00
ShuttersCommandSet ( $ hash , $ shuttersDev , $ position ) ;
2018-09-10 08:27:11 +02:00
}
2018-10-30 19:10:50 +01:00
elsif ( $ shutters - > getModeDown eq 'absent'
and $ 1 eq 'absent' )
2018-10-30 08:18:09 +01:00
{
$ shutters - > setLastDrive ( 'roommate absent' ) ;
ShuttersCommandSet ( $ hash , $ shuttersDev , $ shutters - > getClosedPos ) ;
}
2018-08-28 19:49:01 +02:00
}
2018-08-27 11:08:08 +02:00
}
2018-11-12 12:56:18 +01:00
sub EventProcessingResidents ($@) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ device , $ events ) = @ _ ;
2018-10-09 18:05:55 +02:00
2018-11-08 08:32:47 +01:00
my $ name = $ device ;
2018-10-14 18:19:23 +02:00
my $ reading = $ ascDev - > getResidentsReading ;
2018-11-03 19:01:29 +01:00
if ( $ events =~ m #$reading:\s(absent)# ) {
2018-10-14 18:19:23 +02:00
foreach my $ shuttersDev ( @ { $ hash - > { helper } { shuttersList } } ) {
2018-10-10 10:43:42 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-10-30 15:26:04 +01:00
2018-10-30 19:10:50 +01:00
if (
2018-11-03 19:01:29 +01:00
CheckIfShuttersWindowRecOpen ( $ shuttersDev ) != 0
and $ ascDev - > getSelfDefense eq 'on'
2018-10-30 19:10:50 +01:00
and $ shutters - > getSelfDefenseExclude eq 'off'
2018-11-03 19:01:29 +01:00
or (
(
$ shutters - > getModeDown eq 'absent'
or $ shutters - > getModeDown eq 'always'
)
and not IsDay ( $ hash , $ shuttersDev )
)
2018-10-30 19:10:50 +01:00
)
2018-10-30 15:26:04 +01:00
{
2018-11-03 19:01:29 +01:00
if ( CheckIfShuttersWindowRecOpen ( $ shuttersDev ) != 0
and $ ascDev - > getSelfDefense eq 'on'
and $ shutters - > getSelfDefenseExclude eq 'off' )
{
$ shutters - > setLastDrive ( 'selfeDefense active' ) ;
}
else { $ shutters - > setLastDrive ( 'residents absent' ) ; }
2018-10-30 15:26:04 +01:00
$ shutters - > setDriveCmd ( $ shutters - > getClosedPos ) ;
}
2018-10-14 18:19:23 +02:00
}
}
2018-10-22 08:05:19 +02:00
elsif ( $ events =~ m #$reading:\s(gone)#
and $ ascDev - > getSelfDefense eq 'on' )
{
foreach my $ shuttersDev ( @ { $ hash - > { helper } { shuttersList } } ) {
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-10-30 19:10:50 +01:00
2018-10-30 15:26:04 +01:00
if ( $ shutters - > getShuttersPlace eq 'terrace' ) {
$ shutters - > setLastDrive ( 'selfeDefense terrace' ) ;
$ shutters - > setDriveCmd ( $ shutters - > getClosedPos ) ;
}
2018-10-22 08:05:19 +02:00
}
}
2018-10-27 13:36:11 +02:00
elsif (
2018-10-30 19:10:50 +01:00
$ events =~ m #$reading:\s(home)#
2018-10-27 13:36:11 +02:00
and ( $ ascDev - > getResidentsLastStatus eq 'absent'
2018-11-03 19:01:29 +01:00
or $ ascDev - > getResidentsLastStatus eq 'gone'
or $ ascDev - > getResidentsLastStatus eq 'asleep'
or $ ascDev - > getResidentsLastStatus eq 'awoken' )
2018-10-27 13:36:11 +02:00
)
2018-10-14 18:19:23 +02:00
{
foreach my $ shuttersDev ( @ { $ hash - > { helper } { shuttersList } } ) {
2018-10-22 08:05:19 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-10-30 19:10:50 +01:00
2018-11-03 19:01:29 +01:00
if (
$ shutters - > getStatus != $ shutters - > getClosedPos
2018-10-30 08:18:09 +01:00
and not IsDay ( $ hash , $ shuttersDev )
2018-11-03 19:01:29 +01:00
and $ shutters - > getRoommatesStatus eq 'none'
and ( $ shutters - > getModeDown eq 'home'
or $ shutters - > getModeDown eq 'always' )
2018-11-16 10:44:54 +01:00
and ( $ ascDev - > getResidentsLastStatus ne 'asleep'
or $ ascDev - > getResidentsLastStatus ne 'awoken' )
2018-11-03 19:01:29 +01:00
)
2018-10-30 08:18:09 +01:00
{
$ shutters - > setLastDrive ( 'residents home' ) ;
$ shutters - > setDriveCmd ( $ shutters - > getClosedPos ) ;
}
2018-10-30 19:10:50 +01:00
elsif (
$ ascDev - > getSelfDefense eq 'on'
2018-10-30 08:18:09 +01:00
and CheckIfShuttersWindowRecOpen ( $ shuttersDev ) != 0
2018-10-27 13:36:11 +02:00
and $ shutters - > getSelfDefenseExclude eq 'off'
or ( $ ascDev - > getResidentsLastStatus eq 'gone'
and $ shutters - > getShuttersPlace eq 'terrace' )
2018-11-03 19:01:29 +01:00
and ( $ shutters - > getModeUp eq 'absent'
or $ shutters - > getModeUp eq 'off' )
2018-10-30 08:18:09 +01:00
)
2018-10-30 19:10:50 +01:00
{
2018-10-30 08:18:09 +01:00
$ shutters - > setLastDrive ( 'selfeDefense inactive' ) ;
$ shutters - > setDriveCmd ( $ shutters - > getLastPos ) ;
}
2018-11-03 19:01:29 +01:00
elsif (
$ shutters - > getStatus == $ shutters - > getClosedPos
and IsDay ( $ hash , $ shuttersDev )
and $ shutters - > getRoommatesStatus eq 'none'
and ( $ shutters - > getModeUp eq 'home'
or $ shutters - > getModeUp eq 'always' )
)
{
if ( $ ascDev - > getResidentsLastStatus eq 'asleep'
or $ ascDev - > getResidentsLastStatus eq 'awoken' )
{
$ shutters - > setLastDrive ( 'residents awoken' ) ;
}
else { $ shutters - > setLastDrive ( 'residents home' ) ; }
$ shutters - > setDriveCmd ( $ shutters - > getOpenPos ) ;
}
2018-10-27 13:36:11 +02:00
}
}
}
2018-11-12 12:56:18 +01:00
sub EventProcessingRain ($@) {
2018-10-27 13:36:11 +02:00
my ( $ hash , $ device , $ events ) = @ _ ;
2018-11-08 08:32:47 +01:00
my $ name = $ device ;
2018-10-27 13:36:11 +02:00
my $ reading = $ ascDev - > getRainSensorReading ;
2018-10-28 18:12:40 +01:00
my $ val ;
2018-10-27 13:36:11 +02:00
2018-10-28 18:12:40 +01:00
if ( $ events =~ m #$reading:\s(\d+|rain|dry)# ) {
if ( $ 1 eq 'rain' ) { $ val = 1000 }
elsif ( $ 1 eq 'dry' ) { $ val = 0 }
else { $ val = $ 1 }
foreach my $ shuttersDev ( @ { $ hash - > { helper } { shuttersList } } ) {
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
if ( $ val > 100
and $ shutters - > getStatus !=
$ ascDev - > getRainSensorShuttersClosedPos )
{
2018-10-27 13:36:11 +02:00
$ shutters - > setLastDrive ( 'rain protection' ) ;
$ shutters - > setDriveCmd (
$ ascDev - > getRainSensorShuttersClosedPos ) ;
}
2018-10-28 18:12:40 +01:00
elsif ( $ val == 0
and $ shutters - > getStatus ==
$ ascDev - > getRainSensorShuttersClosedPos )
{
2018-10-27 13:36:11 +02:00
$ shutters - > setLastDrive ( 'rain un-protection' ) ;
2018-10-28 18:12:40 +01:00
$ shutters - > setDriveCmd ( $ shutters - > getLastPos ) ;
2018-10-27 13:36:11 +02:00
}
2018-10-09 18:05:55 +02:00
}
}
}
2018-11-12 12:56:18 +01:00
sub EventProcessingBrightness ($@) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ shuttersDev , $ events ) = @ _ ;
my $ name = $ hash - > { NAME } ;
2018-10-12 06:32:01 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-11-14 03:41:38 +01:00
return EventProcessingShadingBrightness ( $ hash , $ shuttersDev , $ events )
unless (
int ( gettimeofday ( ) / 86400 ) !=
int ( computeAlignTime ( '24:00' , $ shutters - > getTimeUpEarly ) / 86400 )
and int ( gettimeofday ( ) / 86400 ) ==
int ( computeAlignTime ( '24:00' , $ shutters - > getTimeUpLate ) / 86400 )
or int ( gettimeofday ( ) / 86400 ) !=
int ( computeAlignTime ( '24:00' , $ shutters - > getTimeDownEarly ) / 86400 )
and int ( gettimeofday ( ) / 86400 ) ==
int ( computeAlignTime ( '24:00' , $ shutters - > getTimeDownLate ) / 86400 )
) ;
2018-10-14 18:19:23 +02:00
my $ reading = $ shutters - > getShadingBrightnessReading ;
if ( $ events =~ m #$reading:\s(\d+)# ) {
2018-10-16 10:30:10 +02:00
my $ brightnessMinVal ;
if ( $ shutters - > getBrightnessMinVal > - 1 ) {
$ brightnessMinVal = $ shutters - > getBrightnessMinVal ;
}
else {
$ brightnessMinVal = $ ascDev - > getBrightnessMinVal ;
}
2018-10-14 18:19:23 +02:00
if (
int ( gettimeofday ( ) / 86400 ) != int (
computeAlignTime ( '24:00' , $ shutters - > getTimeUpEarly ) / 86400
)
and int ( gettimeofday ( ) / 86400 ) == int (
computeAlignTime ( '24:00' , $ shutters - > getTimeUpLate ) / 86400
)
2018-10-16 10:30:10 +02:00
and $ 1 > $ brightnessMinVal
2018-11-03 19:01:29 +01:00
and $ shutters - > getUp eq 'brightness'
2018-10-14 18:19:23 +02:00
)
{
Log3 ( $ name , 4 ,
2018-11-12 12:56:18 +01:00
"AutoShuttersControl ($shuttersDev) - EventProcessingBrightness: Steuerung für Morgens"
2018-10-14 18:19:23 +02:00
) ;
2018-10-28 18:12:40 +01:00
my $ homemode = $ shutters - > getRoommatesStatus ;
$ homemode = $ ascDev - > getResidentsStatus
if ( $ homemode eq 'none' ) ;
2018-10-27 13:36:11 +02:00
$ shutters - > setLastDrive ( 'minimum brightness threshold exceeded' ) ;
2018-10-28 18:12:40 +01:00
if ( $ shutters - > getModeUp eq $ homemode
or $ homemode eq 'none'
or $ shutters - > getModeUp eq 'always' )
{
2018-11-14 03:41:38 +01:00
if (
2018-10-28 18:12:40 +01:00
(
$ shutters - > getRoommatesStatus eq 'home'
or $ shutters - > getRoommatesStatus eq 'awoken'
or $ shutters - > getRoommatesStatus eq 'absent'
or $ shutters - > getRoommatesStatus eq 'gone'
or $ shutters - > getRoommatesStatus eq 'none'
)
and $ ascDev - > getSelfDefense eq 'off'
or ( $ ascDev - > getSelfDefense eq 'on'
and CheckIfShuttersWindowRecOpen ( $ shuttersDev ) == 0 )
2018-11-14 03:41:38 +01:00
) {
ShuttersCommandSet ( $ hash , $ shuttersDev , $ shutters - > getOpenPos ) ;
} else { EventProcessingShadingBrightness ( $ hash , $ shuttersDev , $ events ) ; }
2018-10-28 18:12:40 +01:00
}
2018-10-14 18:19:23 +02:00
}
elsif (
int ( gettimeofday ( ) / 86400 ) != int (
computeAlignTime ( '24:00' , $ shutters - > getTimeDownEarly ) / 86400
)
and int ( gettimeofday ( ) / 86400 ) == int (
computeAlignTime ( '24:00' , $ shutters - > getTimeDownLate ) / 86400
)
2018-10-16 10:30:10 +02:00
and $ 1 < $ brightnessMinVal
2018-11-03 19:01:29 +01:00
and $ shutters - > getDown eq 'brightness'
2018-10-14 18:19:23 +02:00
)
{
Log3 ( $ name , 4 ,
2018-11-12 12:56:18 +01:00
"AutoShuttersControl ($shuttersDev) - EventProcessingBrightness: Steuerung für Abends"
2018-10-14 18:19:23 +02:00
) ;
2018-10-28 18:12:40 +01:00
my $ posValue ;
if ( CheckIfShuttersWindowRecOpen ( $ shuttersDev ) == 0
or $ shutters - > getVentilateOpen eq 'off' )
{
$ posValue = $ shutters - > getClosedPos ;
}
else { $ posValue = $ shutters - > getVentilatePos ; }
my $ homemode = $ shutters - > getRoommatesStatus ;
$ homemode = $ ascDev - > getResidentsStatus
if ( $ homemode eq 'none' ) ;
2018-10-27 13:36:11 +02:00
$ shutters - > setLastDrive ( 'minimum brightness threshold fell below' ) ;
2018-10-28 18:12:40 +01:00
2018-11-14 03:41:38 +01:00
if ( $ shutters - > getModeDown eq $ homemode
or $ homemode eq 'none'
or $ shutters - > getModeDown eq 'always'
) {
ShuttersCommandSet ( $ hash , $ shuttersDev , $ shutters - > getClosedPos ) ;
} else { EventProcessingShadingBrightness ( $ hash , $ shuttersDev , $ events ) ; }
2018-10-14 18:19:23 +02:00
}
2018-11-14 03:41:38 +01:00
} else { EventProcessingShadingBrightness ( $ hash , $ shuttersDev , $ events ) ; }
}
sub EventProcessingShadingBrightness ($@) {
my ( $ hash , $ shuttersDev , $ events ) = @ _ ;
my $ name = $ hash - > { NAME } ;
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
my $ reading = $ shutters - > getShadingBrightnessReading ;
if ( $ events =~ m #$reading:\s(\d+)# ) {
ShadingProcessing ( $ hash , $ shuttersDev , $ ascDev - > getAzimuth , $ ascDev - > getElevation , $ 1 , $ ascDev - > getOutTemp , $ shutters - > getDirection , $ shutters - > getShadingAngleLeft , $ shutters - > getShadingAngleRight )
2018-11-14 15:26:32 +01:00
if ( $ shutters - > getShadingMode eq 'on' or $ shutters - > getShadingMode eq $ ascDev - > getResidentsStatus and IsDay ( $ hash , $ shuttersDev ) ) ;
2018-10-12 06:32:01 +02:00
}
}
2018-09-04 11:42:47 +02:00
2018-11-14 03:41:38 +01:00
sub EventProcessingTwilightDevice ($@) {
my ( $ hash , $ device , $ events ) = @ _ ;
2018-11-14 15:26:32 +01:00
# Twilight
# azimuth = azimuth = Sonnenwinkel
# elevation = elevation = Sonnenhöhe
2018-11-14 03:41:38 +01:00
#
2018-11-14 15:26:32 +01:00
# Astro
# SunAz = azimuth = Sonnenwinkel
# SunAlt = evaluation = Sonnenhöhe
2018-11-15 00:44:41 +01:00
if ( $ events =~ m #(azimuth|evaluation|SunAz|SunAlt):\s(\d+.\d+)# ) {
my $ name = $ device ;
2018-11-14 15:26:32 +01:00
my ( $ azimuth , $ elevation , $ outTemp , $ brightness ) ;
$ azimuth = $ 2 if ( $ 1 eq 'azimuth' or $ 1 eq 'SunAz' ) ;
$ elevation = $ 2 if ( $ 1 eq 'evaluation' or $ 1 eq 'SunAlt' ) ;
$ azimuth = $ ascDev - > getAzimuth if ( not defined ( $ azimuth ) and not $ azimuth ) ;
$ elevation = $ ascDev - > getElevation if ( not defined ( $ elevation ) and not $ elevation ) ;
2018-11-15 00:44:41 +01:00
2018-11-14 15:26:32 +01:00
foreach my $ shuttersDev ( @ { $ hash - > { helper } { shuttersList } } ) {
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
ShadingProcessing ( $ hash , $ shuttersDev , $ azimuth , $ elevation , $ shutters - > getBrightness , $ ascDev - > getOutTemp , $ shutters - > getDirection , $ shutters - > getShadingAngleLeft , $ shutters - > getShadingAngleRight )
if ( ( $ shutters - > getShadingMode eq 'on' or $ shutters - > getShadingMode eq $ ascDev - > getResidentsStatus ) and IsDay ( $ hash , $ shuttersDev ) ) ;
}
2018-11-14 03:41:38 +01:00
}
}
sub ShadingProcessing ($@) {
my ( $ hash , $ shuttersDev , $ azimuth , $ elevation , $ brightness , $ outTemp , $ shuttersDirection , $ shuttersShadingAngleLeft , $ shuttersShadingAngleRight ) = @ _ ;
my $ name = $ hash - > { NAME } ;
2018-11-14 15:26:32 +01:00
2018-11-16 10:44:54 +01:00
# Log3( $name, 1,
# "AutoShuttersControl ($name) - Shading Processing, Rollladen: " . $shuttersDev . " Azimuth: " . $azimuth . " Elevation: " . $elevation . " Brightness: " . $brightness . " OutTemp: " . $outTemp
# );
#
# return
# if ( $azimuth == -1 or $elevation == -1 or $brightness == -1 or $outTemp == -100 );
#
#
# # brightness -1
# # outTemp -100
# # azimuth -1
# # elevation -1
#
#
#
#
#
# Log3( $name, 1,
# "AutoShuttersControl ($name) - Shading Processing hinter dem return");
2018-11-14 15:26:32 +01:00
2018-11-14 03:41:38 +01:00
}
2018-11-12 12:56:18 +01:00
sub EventProcessingPartyMode ($) {
2018-10-14 18:19:23 +02:00
my ( $ hash ) = @ _ ;
my $ name = $ hash - > { NAME } ;
2018-09-04 11:42:47 +02:00
2018-10-14 18:19:23 +02:00
foreach my $ shuttersDev ( @ { $ hash - > { helper } { shuttersList } } ) {
2018-10-10 10:43:42 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-11-03 19:01:29 +01:00
if ( not IsDay ( $ hash , $ shuttersDev ) ) {
if ( CheckIfShuttersWindowRecOpen ( $ shuttersDev ) == 2
and $ shutters - > getSubTyp eq 'threestate' )
{
Log3 ( $ name , 4 ,
2018-11-12 12:56:18 +01:00
"AutoShuttersControl ($name) - EventProcessingPartyMode Fenster offen"
2018-11-03 19:01:29 +01:00
) ;
$ shutters - > setDelayCmd ( $ shutters - > getClosedPos ) ;
Log3 ( $ name , 4 ,
2018-11-12 12:56:18 +01:00
"AutoShuttersControl ($name) - EventProcessingPartyMode - Spring in ShuttersCommandDelaySet"
2018-11-03 19:01:29 +01:00
) ;
}
else {
Log3 ( $ name , 4 ,
2018-11-12 12:56:18 +01:00
"AutoShuttersControl ($name) - EventProcessingPartyMode Fenster nicht offen"
2018-11-03 19:01:29 +01:00
) ;
2018-11-14 05:44:02 +01:00
$ shutters - > setLastDrive ( 'drive after party mode' ) ;
2018-11-03 19:01:29 +01:00
ShuttersCommandSet (
$ hash ,
$ shuttersDev ,
(
CheckIfShuttersWindowRecOpen ( $ shuttersDev ) == 0
? $ shutters - > getClosedPos
: $ shutters - > getVentilatePos
)
) ;
}
2018-09-04 11:42:47 +02:00
}
}
}
2018-11-12 12:56:18 +01:00
sub EventProcessingShutters ($@) {
2018-10-17 15:58:05 +02:00
my ( $ hash , $ shuttersDev , $ events ) = @ _ ;
2018-10-19 20:13:01 +02:00
my $ name = $ hash - > { NAME } ;
2018-10-17 15:58:05 +02:00
if ( $ events =~ m #.*:\s(\d+)# ) {
2018-10-19 20:13:01 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-11-04 19:17:11 +01:00
$ ascDev - > setPosReading ;
2018-11-03 19:01:29 +01:00
if ( ( int ( gettimeofday ( ) ) - $ shutters - > getLastPosTimestamp ) > 60
and $ shutters - > getLastPos != $ shutters - > getStatus )
{
2018-10-27 13:36:11 +02:00
$ shutters - > setLastDrive ( 'manual' ) ;
$ shutters - > setLastDriveReading ;
2018-11-07 08:22:11 +01:00
$ ascDev - > setStateReading ;
2018-10-27 13:36:11 +02:00
$ shutters - > setLastManPos ( $ 1 ) ;
}
2018-10-17 15:58:05 +02:00
}
}
2018-08-29 14:58:10 +02:00
# Sub für das Zusammensetzen der Rolläden Steuerbefehle
2018-09-04 11:42:47 +02:00
sub ShuttersCommandSet ($$$) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ shuttersDev , $ posValue ) = @ _ ;
my $ name = $ hash - > { NAME } ;
2018-09-13 08:11:10 +02:00
2018-10-14 18:19:23 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-11-14 15:26:32 +01:00
my $ queryShuttersPosValue = (
$ shutters - > getShuttersPosCmdValueNegate
? $ shutters - > getStatus > $ posValue
: $ shutters - > getStatus < $ posValue
) ;
2018-10-30 19:10:50 +01:00
2018-10-14 18:19:23 +02:00
if (
( $ shutters - > getPartyMode eq 'on' and $ ascDev - > getPartyMode eq 'on' )
or ( CheckIfShuttersWindowRecOpen ( $ shuttersDev ) == 2
and $ shutters - > getSubTyp eq 'threestate'
and $ ascDev - > getAutoShuttersControlComfort eq 'off'
and $ shutters - > getVentilateOpen eq 'on' )
or (
CheckIfShuttersWindowRecOpen ( $ shuttersDev ) == 2
and ( $ shutters - > getLockOut eq 'soft'
or $ shutters - > getLockOut eq 'hard' )
and $ ascDev - > getLockOut eq 'on'
2018-11-14 15:26:32 +01:00
and not $ queryShuttersPosValue
2018-10-14 18:19:23 +02:00
)
)
{
2018-10-27 13:36:11 +02:00
$ shutters - > setDelayCmd ( $ posValue ) ;
$ ascDev - > setDelayCmdReading ;
2018-11-15 15:01:34 +01:00
Log3 ( $ name , 4 ,
"AutoShuttersControl ($name) - ShuttersCommandSet in Delay" ) ;
2018-09-04 11:42:47 +02:00
}
2018-10-14 18:19:23 +02:00
else {
$ shutters - > setDriveCmd ( $ posValue ) ;
2018-10-27 13:36:11 +02:00
$ shutters - > setDelayCmd ( 'none' )
2018-10-14 18:19:23 +02:00
if ( $ shutters - > getDelayCmd ne 'none' )
2018-10-30 08:18:09 +01:00
; # setzt den Wert auf none da der Rolladen nun gesteuert werden kann.
2018-10-27 13:36:11 +02:00
$ ascDev - > setLastPosReading ;
2018-11-15 15:01:34 +01:00
Log3 ( $ name , 4 ,
"AutoShuttersControl ($name) - ShuttersCommandSet setDriveCmd wird aufgerufen" ) ;
2018-10-14 18:19:23 +02:00
}
2018-08-28 19:49:01 +02:00
}
2018-08-29 14:58:10 +02:00
## Sub welche die InternalTimer nach entsprechenden Sunset oder Sunrise zusammen stellt
2018-08-28 19:49:01 +02:00
sub CreateSunRiseSetShuttersTimer ($$) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ shuttersDev ) = @ _ ;
my $ name = $ hash - > { NAME } ;
my $ shuttersDevHash = $ defs { $ shuttersDev } ;
2018-10-10 10:43:42 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-11-07 08:22:11 +01:00
2018-10-14 18:19:23 +02:00
return if ( IsDisabled ( $ name ) ) ;
2018-08-30 10:24:39 +02:00
2018-10-30 19:10:50 +01:00
my $ shuttersSunriseUnixtime =
2018-11-02 05:52:27 +01:00
ShuttersSunrise ( $ hash , $ shuttersDev , 'unix' ) + 1 ;
2018-11-03 19:01:29 +01:00
my $ shuttersSunsetUnixtime =
ShuttersSunset ( $ hash , $ shuttersDev , 'unix' ) + 1 ;
2018-09-13 08:11:10 +02:00
2018-10-28 18:12:40 +01:00
$ shutters - > setSunriseUnixTime ( $ shuttersSunriseUnixtime ) ;
$ shutters - > setSunsetUnixTime ( $ shuttersSunsetUnixtime ) ;
2018-10-14 18:19:23 +02:00
## In jedem Rolladen werden die errechneten Zeiten hinterlegt,es sei denn das autoShuttersControlEvening/Morning auf off steht
2018-09-13 08:11:10 +02:00
readingsBeginUpdate ( $ shuttersDevHash ) ;
2018-10-14 18:19:23 +02:00
readingsBulkUpdate (
$ shuttersDevHash ,
'ASC_Time_DriveDown' ,
(
$ ascDev - > getAutoShuttersControlEvening eq 'on'
? strftime (
"%e.%m.%Y - %H:%M" , localtime ( $ shuttersSunsetUnixtime )
)
: 'AutoShuttersControl off'
) ,
1
) ;
readingsBulkUpdate (
$ shuttersDevHash ,
'ASC_Time_DriveUp' ,
(
$ ascDev - > getAutoShuttersControlMorning eq 'on'
? strftime ( "%e.%m.%Y - %H:%M" ,
localtime ( $ shuttersSunriseUnixtime ) )
: 'AutoShuttersControl off'
) ,
1
) ;
readingsEndUpdate ( $ shuttersDevHash , 0 ) ;
2018-09-13 08:11:10 +02:00
2018-09-07 14:10:46 +02:00
readingsBeginUpdate ( $ hash ) ;
2018-10-14 18:19:23 +02:00
readingsBulkUpdateIfChanged (
$ hash ,
$ shuttersDev . '_nextAstroTimeEvent' ,
(
$ shuttersSunriseUnixtime < $ shuttersSunsetUnixtime
? strftime ( "%e.%m.%Y - %H:%M" ,
localtime ( $ shuttersSunriseUnixtime ) )
: strftime (
"%e.%m.%Y - %H:%M" , localtime ( $ shuttersSunsetUnixtime )
)
)
) ;
readingsEndUpdate ( $ hash , 1 ) ;
RemoveInternalTimer ( $ shutters - > getInTimerFuncHash )
2018-10-17 09:50:11 +02:00
if ( defined ( $ shutters - > getInTimerFuncHash ) ) ;
2018-09-13 08:11:10 +02:00
2018-08-29 14:58:10 +02:00
## kleine Hilfe für InternalTimer damit ich alle benötigten Variablen an die Funktion übergeben kann welche von Internal Timer aufgerufen wird.
2018-10-14 18:19:23 +02:00
my % funcHash = (
hash = > $ hash ,
shuttersdevice = > $ shuttersDev ,
sunsettime = > $ shuttersSunsetUnixtime ,
sunrisetime = > $ shuttersSunriseUnixtime
) ;
## Ich brauche beim löschen des InternalTimer den Hash welchen ich mitgegeben habe,dieser muss gesichert werden
2018-10-17 09:50:11 +02:00
$ shutters - > setInTimerFuncHash ( \ % funcHash ) ;
2018-10-14 18:19:23 +02:00
InternalTimer ( $ shuttersSunsetUnixtime ,
'AutoShuttersControl::SunSetShuttersAfterTimerFn' , \ % funcHash )
if ( $ ascDev - > getAutoShuttersControlEvening eq 'on' ) ;
InternalTimer ( $ shuttersSunriseUnixtime ,
'AutoShuttersControl::SunRiseShuttersAfterTimerFn' , \ % funcHash )
if ( $ ascDev - > getAutoShuttersControlMorning eq 'on' ) ;
2018-11-08 08:32:47 +01:00
2018-11-07 08:22:11 +01:00
$ ascDev - > setStateReading ( 'created new drive timer' ) ;
2018-08-28 19:49:01 +02:00
}
2018-08-29 14:58:10 +02:00
## Funktion zum neu setzen der Timer und der Readings für Sunset/Rise
sub RenewSunRiseSetShuttersTimer ($) {
2018-10-14 18:19:23 +02:00
my $ hash = shift ;
foreach ( @ { $ hash - > { helper } { shuttersList } } ) {
2018-10-17 09:50:11 +02:00
$ shutters - > setShuttersDev ( $ _ ) ;
RemoveInternalTimer ( $ shutters - > getInTimerFuncHash ) ;
$ shutters - > setInTimerFuncHash ( undef ) ;
2018-10-14 18:19:23 +02:00
CreateSunRiseSetShuttersTimer ( $ hash , $ _ ) ;
2018-08-29 14:58:10 +02:00
}
}
2018-09-14 20:46:55 +02:00
## Funktion zum hardwareseitigen setzen des lock-out oder blocking beim Rolladen selbst
sub SetHardewareBlockForShutters ($$) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ cmd ) = @ _ ;
foreach ( @ { $ hash - > { helper } { shuttersList } } ) {
2018-11-14 15:26:32 +01:00
$ shutters - > setShuttersDev ( $ _ ) ;
if ( $ shutters - > getLockOut eq 'hard'
and $ shutters - > getLockOutCmd ne 'none' )
2018-10-14 18:19:23 +02:00
{
CommandSet ( undef , $ _ . ' inhibit ' . $ cmd )
2018-11-14 15:26:32 +01:00
if ( $ shutters - > getLockOutCmd eq 'inhibit' ) ;
2018-10-14 18:19:23 +02:00
CommandSet ( undef ,
$ _ . ' ' . ( $ cmd eq 'on' ? 'blocked' : 'unblocked' ) )
2018-11-14 15:26:32 +01:00
if ( $ shutters - > getLockOutCmd eq 'blocked' ) ;
2018-09-14 20:46:55 +02:00
}
}
}
2018-11-07 08:22:11 +01:00
## Funktion für das wiggle aller Shutters zusammen
sub wiggleAll ($) {
my $ hash = shift ;
foreach ( @ { $ hash - > { helper } { shuttersList } } ) {
2018-11-08 08:32:47 +01:00
wiggle ( $ hash , $ _ ) ;
2018-11-07 08:22:11 +01:00
}
}
sub wiggle ($$) {
my ( $ hash , $ shuttersDev ) = @ _ ;
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
$ shutters - > setNoOffset ( 1 ) ;
2018-11-08 08:32:47 +01:00
my % h = (
2018-11-07 08:22:11 +01:00
shuttersDev = > $ shutters - > getShuttersDev ,
posValue = > $ shutters - > getStatus ,
) ;
if ( $ shutters - > getShuttersPosCmdValueNegate ) {
if ( $ shutters - > getStatus >= $ shutters - > getOpenPos / 2 ) {
2018-11-12 12:56:18 +01:00
$ shutters - > setDriveCmd ( $ shutters - > getStatus + $ shutters - > getWiggleValue ) ;
2018-11-07 08:22:11 +01:00
}
2018-11-12 12:56:18 +01:00
else { $ shutters - > setDriveCmd ( $ shutters - > getStatus - $ shutters - > getWiggleValue ) ; }
2018-11-07 08:22:11 +01:00
}
else {
if ( $ shutters - > getStatus >= $ shutters - > getOpenPos / 2 ) {
2018-11-12 12:56:18 +01:00
$ shutters - > setDriveCmd ( $ shutters - > getStatus - $ shutters - > getWiggleValue ) ;
2018-11-07 08:22:11 +01:00
}
2018-11-12 12:56:18 +01:00
else { $ shutters - > setDriveCmd ( $ shutters - > getStatus + $ shutters - > getWiggleValue ) ; }
2018-11-07 08:22:11 +01:00
}
2018-11-08 08:32:47 +01:00
InternalTimer ( gettimeofday ( ) + 60 , 'AutoShuttersControl::SetCmdFn' , \ % h ) ;
2018-11-07 08:22:11 +01:00
}
####
2018-08-29 14:58:10 +02:00
## Funktion welche beim Ablaufen des Timers für Sunset aufgerufen werden soll
2018-08-28 19:49:01 +02:00
sub SunSetShuttersAfterTimerFn ($) {
2018-10-14 18:19:23 +02:00
my $ funcHash = shift ;
my $ hash = $ funcHash - > { hash } ;
my $ shuttersDev = $ funcHash - > { shuttersdevice } ;
2018-10-10 10:43:42 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-09-10 20:12:26 +02:00
my $ posValue ;
2018-10-14 18:19:23 +02:00
if ( CheckIfShuttersWindowRecOpen ( $ shuttersDev ) == 0
or $ shutters - > getVentilateOpen eq 'off' )
{
$ posValue = $ shutters - > getClosedPos ;
2018-09-10 20:12:26 +02:00
}
2018-10-14 18:19:23 +02:00
else { $ posValue = $ shutters - > getVentilatePos ; }
2018-10-27 13:36:11 +02:00
2018-10-28 18:12:40 +01:00
my $ homemode = $ shutters - > getRoommatesStatus ;
$ homemode = $ ascDev - > getResidentsStatus if ( $ homemode eq 'none' ) ;
2018-10-31 09:58:23 +01:00
if ( $ shutters - > getModeDown eq $ homemode
or $ homemode eq 'none'
or $ shutters - > getModeDown eq 'always' )
{
2018-10-30 19:10:50 +01:00
$ shutters - > setLastDrive ( 'night close' ) ;
ShuttersCommandSet ( $ hash , $ shuttersDev , $ posValue ) ;
}
2018-09-10 20:12:26 +02:00
2018-10-14 18:19:23 +02:00
CreateSunRiseSetShuttersTimer ( $ hash , $ shuttersDev ) ;
2018-08-28 19:49:01 +02:00
}
2018-08-29 14:58:10 +02:00
## Funktion welche beim Ablaufen des Timers für Sunrise aufgerufen werden soll
2018-08-28 19:49:01 +02:00
sub SunRiseShuttersAfterTimerFn ($) {
2018-10-14 18:19:23 +02:00
my $ funcHash = shift ;
my $ hash = $ funcHash - > { hash } ;
my $ shuttersDev = $ funcHash - > { shuttersdevice } ;
2018-10-10 10:43:42 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-10-14 18:19:23 +02:00
2018-10-28 18:12:40 +01:00
my $ homemode = $ shutters - > getRoommatesStatus ;
$ homemode = $ ascDev - > getResidentsStatus if ( $ homemode eq 'none' ) ;
if ( $ shutters - > getModeUp eq $ homemode
or $ homemode eq 'none'
2018-10-14 18:19:23 +02:00
or $ shutters - > getModeUp eq 'always' )
{
2018-10-30 19:10:50 +01:00
if (
2018-10-31 09:58:23 +01:00
(
$ shutters - > getRoommatesStatus eq 'home'
or $ shutters - > getRoommatesStatus eq 'awoken'
or $ shutters - > getRoommatesStatus eq 'absent'
or $ shutters - > getRoommatesStatus eq 'gone'
or $ shutters - > getRoommatesStatus eq 'none'
)
and $ ascDev - > getSelfDefense eq 'off'
or ( $ ascDev - > getSelfDefense eq 'on'
and CheckIfShuttersWindowRecOpen ( $ shuttersDev ) == 0 )
2018-10-30 19:10:50 +01:00
)
{
$ shutters - > setLastDrive ( 'day open' ) ;
ShuttersCommandSet ( $ hash , $ shuttersDev , $ shutters - > getOpenPos ) ;
}
2018-09-02 23:00:40 +02:00
}
2018-10-14 18:19:23 +02:00
CreateSunRiseSetShuttersTimer ( $ hash , $ shuttersDev ) ;
2018-08-28 19:49:01 +02:00
}
2018-10-08 03:59:51 +02:00
sub CreateNewNotifyDev ($) {
2018-10-14 18:19:23 +02:00
my $ hash = shift ;
my $ name = $ hash - > { NAME } ;
2018-10-08 03:59:51 +02:00
2018-10-14 18:19:23 +02:00
$ hash - > { NOTIFYDEV } = "global," . $ name ;
2018-10-08 03:59:51 +02:00
delete $ hash - > { monitoredDevs } ;
2018-10-14 18:38:44 +02:00
2018-10-14 18:19:23 +02:00
CommandDeleteReading ( undef , $ name . ' .monitoredDevs' ) ;
2018-10-17 15:58:05 +02:00
my $ shuttersList = '' ;
2018-10-14 18:19:23 +02:00
foreach ( @ { $ hash - > { helper } { shuttersList } } ) {
AddNotifyDev ( $ hash , AttrVal ( $ _ , 'ASC_Roommate_Device' , 'none' ) ,
$ _ , 'ASC_Roommate_Device' )
if ( AttrVal ( $ _ , 'ASC_Roommate_Device' , 'none' ) ne 'none' ) ;
AddNotifyDev ( $ hash , AttrVal ( $ _ , 'ASC_WindowRec' , 'none' ) ,
$ _ , 'ASC_WindowRec' )
if ( AttrVal ( $ _ , 'ASC_WindowRec' , 'none' ) ne 'none' ) ;
AddNotifyDev ( $ hash ,
AttrVal ( $ _ , 'ASC_Shading_Brightness_Sensor' , 'none' ) ,
$ _ , 'ASC_Shading_Brightness_Sensor' )
if (
AttrVal ( $ _ , 'ASC_Shading_Brightness_Sensor' , 'none' ) ne 'none' ) ;
2018-10-19 20:13:01 +02:00
$ shuttersList = $ shuttersList . ',' . $ _ ;
2018-10-08 03:59:51 +02:00
}
2018-10-14 18:19:23 +02:00
AddNotifyDev ( $ hash , AttrVal ( $ name , 'ASC_residentsDevice' , 'none' ) ,
$ name , 'ASC_residentsDevice' )
if ( AttrVal ( $ name , 'ASC_residentsDevice' , 'none' ) ne 'none' ) ;
2018-10-27 13:36:11 +02:00
AddNotifyDev ( $ hash , AttrVal ( $ name , 'ASC_rainSensorDevice' , 'none' ) ,
$ name , 'ASC_rainSensorDevice' )
if ( AttrVal ( $ name , 'ASC_rainSensorDevice' , 'none' ) ne 'none' ) ;
2018-11-14 03:41:38 +01:00
AddNotifyDev ( $ hash , AttrVal ( $ name , 'ASC_twilightDevice' , 'none' ) ,
2018-11-14 15:26:32 +01:00
$ name , 'ASC_twilightDevice' )
if ( AttrVal ( $ name , 'ASC_twilightDevice' , 'none' ) ne 'none' ) ;
2018-10-17 15:58:05 +02:00
$ hash - > { NOTIFYDEV } = $ hash - > { NOTIFYDEV } . $ shuttersList ;
2018-10-08 03:59:51 +02:00
}
2018-09-21 08:44:38 +02:00
sub GetShuttersInformation ($) {
2018-10-28 18:12:40 +01:00
my $ hash = shift ;
my $ ret = '<html><table><tr><td>' ;
2018-09-21 08:44:38 +02:00
$ ret . = '<table class="block wide">' ;
$ ret . = '<tr class="even">' ;
2018-10-09 18:05:55 +02:00
$ ret . = "<td><b>Shutters</b></td>" ;
2018-09-21 20:03:02 +02:00
$ ret . = "<td> </td>" ;
$ ret . = "<td><b>Next DriveUp</b></td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td><b>Next DriveDown</b></td>" ;
$ ret . = "<td> </td>" ;
2018-10-28 18:12:40 +01:00
$ ret . = "<td><b>ASC Up</b></td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td><b>ASC Down</b></td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td><b>ASC Mode Up</b></td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td><b>ASC Mode Down</b></td>" ;
$ ret . = "<td> </td>" ;
2018-09-21 20:03:02 +02:00
$ ret . = "<td><b>Partymode</b></td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td><b>Lock-Out</b></td>" ;
2018-10-28 18:12:40 +01:00
$ ret . = "<td> </td>" ;
$ ret . = "<td><b>Last Drive</b></td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td><b>Position</b></td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td><b>Last Position</b></td>" ;
2018-09-21 08:44:38 +02:00
$ ret . = '</tr>' ;
2018-09-21 22:12:24 +02:00
2018-10-28 18:12:40 +01:00
my $ linecount = 1 ;
foreach my $ shutter ( @ { $ hash - > { helper } { shuttersList } } ) {
$ shutters - > setShuttersDev ( $ shutter ) ;
if ( $ linecount % 2 == 0 ) { $ ret . = '<tr class="even">' ; }
else { $ ret . = '<tr class="odd">' ; }
$ ret . = "<td>$shutter</td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td>"
. strftime ( "%e.%m.%Y - %H:%M:%S" ,
localtime ( $ shutters - > getSunriseUnixTime ) )
. "</td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td>"
. strftime ( "%e.%m.%Y - %H:%M:%S" ,
localtime ( $ shutters - > getSunsetUnixTime ) )
. "</td>" ;
$ ret . = "<td> </td>" ;
2018-11-03 19:01:29 +01:00
$ ret . = "<td>" . $ shutters - > getUp . "</td>" ;
2018-10-28 18:12:40 +01:00
$ ret . = "<td> </td>" ;
2018-11-03 19:01:29 +01:00
$ ret . = "<td>" . $ shutters - > getDown . "</td>" ;
2018-10-28 18:12:40 +01:00
$ ret . = "<td> </td>" ;
$ ret . = "<td>" . $ shutters - > getModeUp . "</td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td>" . $ shutters - > getModeDown . "</td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td>" . $ shutters - > getPartyMode . "</td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td>" . $ shutters - > getLockOut . "</td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td>" . $ shutters - > getLastDrive . "</td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td>" . $ shutters - > getStatus . "</td>" ;
$ ret . = "<td> </td>" ;
$ ret . = "<td>" . $ shutters - > getLastPos . "</td>" ;
$ ret . = '</tr>' ;
$ linecount + + ;
2018-09-21 08:44:38 +02:00
}
$ ret . = '</table></td></tr>' ;
$ ret . = '</table></html>' ;
return $ ret ;
}
2018-10-08 03:59:51 +02:00
sub GetMonitoredDevs ($) {
2018-10-14 18:19:23 +02:00
my $ hash = shift ;
my $ notifydevs = eval {
decode_json ( ReadingsVal ( $ hash - > { NAME } , '.monitoredDevs' , 'none' ) ) ;
} ;
2018-10-08 03:59:51 +02:00
my $ ret = '<html><table><tr><td>' ;
$ ret . = '<table class="block wide">' ;
$ ret . = '<tr class="even">' ;
2018-10-09 18:05:55 +02:00
$ ret . = "<td><b>Shutters/ASC-Device</b></td>" ;
2018-10-08 03:59:51 +02:00
$ ret . = "<td> </td>" ;
2018-10-09 18:05:55 +02:00
$ ret . = "<td><b>NOTIFYDEV</b></td>" ;
2018-10-08 03:59:51 +02:00
$ ret . = "<td> </td>" ;
$ ret . = "<td><b>Attribut</b></td>" ;
$ ret . = "<td> </td>" ;
$ ret . = '</tr>' ;
2018-10-14 18:19:23 +02:00
if ( ref ( $ notifydevs ) eq "HASH" ) {
2018-10-08 03:59:51 +02:00
my $ linecount = 1 ;
2018-10-14 18:19:23 +02:00
foreach my $ notifydev ( sort keys ( % { $ notifydevs } ) ) {
if ( ref ( $ notifydevs - > { $ notifydev } ) eq "HASH" ) {
foreach
my $ shutters ( sort keys ( % { $ notifydevs - > { $ notifydev } } ) )
{
if ( $ linecount % 2 == 0 ) { $ ret . = '<tr class="even">' ; }
else { $ ret . = '<tr class="odd">' ; }
2018-10-08 03:59:51 +02:00
$ ret . = "<td>$shutters</td>" ;
$ ret . = "<td> </td>" ;
2018-10-09 18:05:55 +02:00
$ ret . = "<td>$notifydev</td>" ;
$ ret . = "<td> </td>" ;
2018-10-08 03:59:51 +02:00
$ ret . = "<td>$notifydevs->{$notifydev}{$shutters}</td>" ;
$ ret . = "<td> </td>" ;
$ ret . = '</tr>' ;
$ linecount + + ;
}
}
}
}
###### create Links
my $ aHref ;
2018-10-14 18:19:23 +02:00
# create define Link
2018-11-08 08:32:47 +01:00
# $aHref="<a href=\"".$::FW_httpheader->{host}."/fhem?cmd=set+".$::FW_CSRF."\">Create new NOTIFYDEV structure</a>";
2018-10-08 03:59:51 +02:00
# $aHref="<a href=\"/fhem?cmd=set+\">Create new NOTIFYDEV structure</a>";
# $aHref="<a href=\"".$headerHost[0]."/fhem?cmd=define+".makeDeviceName($dataset->{station}{name})."+Aqicn+".$dataset->{uid}.$FW_CSRF."\">Create Station Device</a>";
2018-10-14 18:19:23 +02:00
# $ret .= '<tr class="odd"> </tr>';
# $ret .= '<tr class="even"> </tr>';
# $ret .= "<td> </td>";
# $ret .= "<td> </td>";
# $ret .= "<td> </td>";
# $ret .= "<td> </td>";
# $ret .= "<td>".$aHref."</td>";
2018-10-08 03:59:51 +02:00
$ ret . = '</table></td></tr>' ;
$ ret . = '</table></html>' ;
return $ ret ;
}
2018-08-27 11:08:08 +02:00
#################################
## my little helper
#################################
2018-11-15 00:44:41 +01:00
sub AutoSearchTwilightDev ($) {
my $ hash = shift ;
my $ name = $ hash - > { NAME } ;
if ( devspec2array ( 'TYPE=(Astro|Twilight)' ) > 0 ) {
CommandAttr ( undef ,
$ name
. ' ASC_twilightDevice '
. ( devspec2array ( 'TYPE=(Astro|Twilight)' ) ) [ 0 ] )
if ( AttrVal ( $ name , 'ASC_twilightDevice' , 'none' ) eq 'none' ) ;
}
}
2018-08-29 14:58:10 +02:00
# Hilfsfunktion welche meinen ReadingString zum finden der getriggerten Devices und der Zurdnung was das Device überhaupt ist und zu welchen Rolladen es gehört aus liest und das Device extraiert
2018-09-30 21:05:30 +02:00
sub ExtractNotifyDevFromEvent ($$$) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ shuttersDev , $ shuttersAttr ) = @ _ ;
2018-09-30 21:05:30 +02:00
my % notifyDevs ;
2018-10-14 18:19:23 +02:00
while ( my $ notifyDev = each % { $ hash - > { monitoredDevs } } ) {
Log3 ( $ hash - > { NAME } , 4 ,
"AutoShuttersControl ($hash->{NAME}) - ExtractNotifyDevFromEvent - NotifyDev: "
. $ notifyDev ) ;
Log3 ( $ hash - > { NAME } , 5 ,
"AutoShuttersControl ($hash->{NAME}) - ExtractNotifyDevFromEvent - ShuttersDev: "
. $ shuttersDev ) ;
if ( defined ( $ hash - > { monitoredDevs } { $ notifyDev } { $ shuttersDev } )
and $ hash - > { monitoredDevs } { $ notifyDev } { $ shuttersDev } eq
$ shuttersAttr )
{
Log3 ( $ hash - > { NAME } , 4 ,
"AutoShuttersControl ($hash->{NAME}) - ExtractNotifyDevFromEvent - ShuttersDevHash: "
. $ hash - > { monitoredDevs } { $ notifyDev } { $ shuttersDev } ) ;
Log3 ( $ hash - > { NAME } , 5 ,
"AutoShuttersControl ($hash->{NAME}) - ExtractNotifyDevFromEvent - return ShuttersDev: "
. $ notifyDev ) ;
2018-09-30 21:05:30 +02:00
$ notifyDevs { $ notifyDev } = $ shuttersDev ;
2018-08-27 11:08:08 +02:00
}
}
2018-09-30 21:05:30 +02:00
return \ % notifyDevs ;
2018-08-16 10:37:09 +02:00
}
2018-08-31 09:32:16 +02:00
## Ist Tag oder Nacht für den entsprechende Rolladen
sub IsDay ($$) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ shuttersDev ) = @ _ ;
my $ name = $ hash - > { NAME } ;
return ( ShuttersSunrise ( $ hash , $ shuttersDev , 'unix' ) >
ShuttersSunset ( $ hash , $ shuttersDev , 'unix' ) ? 1 : 0 ) ;
2018-08-31 09:32:16 +02:00
}
sub ShuttersSunrise ($$$) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ shuttersDev , $ tm ) =
@ _ ; # Tm steht für Timemode und bedeutet Realzeit oder Unixzeit
my $ name = $ hash - > { NAME } ;
2018-09-13 08:11:10 +02:00
my $ autoAstroMode ;
2018-10-10 10:43:42 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-09-18 09:35:45 +02:00
2018-10-14 18:19:23 +02:00
if ( $ shutters - > getAutoAstroModeMorning ne 'none' ) {
$ autoAstroMode = $ shutters - > getAutoAstroModeMorning ;
$ autoAstroMode =
$ autoAstroMode . '=' . $ shutters - > getAutoAstroModeMorningHorizon
if ( $ autoAstroMode eq 'HORIZON' ) ;
}
else {
$ autoAstroMode = $ ascDev - > getAutoAstroModeMorning ;
$ autoAstroMode =
2018-11-03 19:01:29 +01:00
$ autoAstroMode . '=' . $ ascDev - > getAutoAstroModeMorningHorizon
2018-10-14 18:19:23 +02:00
if ( $ autoAstroMode eq 'HORIZON' ) ;
2018-09-13 15:21:29 +02:00
}
2018-10-14 18:19:23 +02:00
my $ oldFuncHash = $ shutters - > getInTimerFuncHash ;
2018-09-07 11:02:46 +02:00
my $ shuttersSunriseUnixtime ;
2018-08-28 19:49:01 +02:00
2018-10-14 18:19:23 +02:00
if ( $ tm eq 'unix' ) {
2018-11-03 19:01:29 +01:00
if ( $ shutters - > getUp eq 'astro' ) {
2018-10-14 18:19:23 +02:00
if ( ( IsWe ( ) or IsWeTomorrow ( ) )
2018-10-31 09:55:49 +01:00
and $ ascDev - > getSunriseTimeWeHoliday eq 'on' )
2018-10-14 18:19:23 +02:00
{
if ( not IsWeTomorrow ( ) ) {
2018-10-31 09:58:23 +01:00
if (
IsWe ( )
2018-10-31 09:55:49 +01:00
and int ( gettimeofday ( ) / 86400 ) == int (
(
computeAlignTime (
'24:00' ,
sunrise_abs (
2018-10-31 09:58:23 +01:00
$ autoAstroMode , 0 ,
2018-10-31 09:55:49 +01:00
$ shutters - > getTimeUpWeHoliday
)
) + 1
) / 86400
)
)
{
$ shuttersSunriseUnixtime = (
computeAlignTime (
'24:00' ,
sunrise_abs (
$ autoAstroMode , 0 ,
$ shutters - > getTimeUpWeHoliday
)
) + 1
) ;
}
elsif (
2018-10-14 18:19:23 +02:00
int ( gettimeofday ( ) / 86400 ) == int (
(
computeAlignTime (
'24:00' ,
sunrise_abs (
$ autoAstroMode ,
0 ,
$ shutters - > getTimeUpEarly ,
$ shutters - > getTimeUpLate
)
) + 1
) / 86400
)
)
{
$ shuttersSunriseUnixtime = (
computeAlignTime (
'24:00' ,
sunrise_abs (
$ autoAstroMode , 0 ,
$ shutters - > getTimeUpWeHoliday
)
) + 1
) ;
2018-09-24 15:29:39 +02:00
}
2018-10-14 18:19:23 +02:00
else {
$ shuttersSunriseUnixtime = (
computeAlignTime (
'24:00' ,
sunrise_abs (
$ autoAstroMode ,
0 ,
$ shutters - > getTimeUpEarly ,
$ shutters - > getTimeUpLate
)
) + 1
) ;
2018-09-24 15:29:39 +02:00
}
}
2018-10-14 18:19:23 +02:00
else {
$ shuttersSunriseUnixtime = (
computeAlignTime (
'24:00' ,
sunrise_abs (
$ autoAstroMode , 0 ,
$ shutters - > getTimeUpWeHoliday
)
) + 1
) ;
2018-09-24 15:29:39 +02:00
}
2018-09-18 09:35:45 +02:00
}
2018-10-14 18:19:23 +02:00
else {
$ shuttersSunriseUnixtime = (
computeAlignTime (
'24:00' ,
sunrise_abs (
$ autoAstroMode ,
0 ,
$ shutters - > getTimeUpEarly ,
$ shutters - > getTimeUpLate
)
) + 1
) ;
}
if ( defined ( $ oldFuncHash )
and ref ( $ oldFuncHash ) eq 'HASH'
and ( IsWe ( ) or IsWeTomorrow ( ) )
2018-10-31 09:55:49 +01:00
and $ ascDev - > getSunriseTimeWeHoliday eq 'on' )
2018-10-14 18:19:23 +02:00
{
if ( not IsWeTomorrow ( ) ) {
if (
int ( gettimeofday ( ) / 86400 ) == int (
(
computeAlignTime (
'24:00' ,
sunrise_abs (
$ autoAstroMode ,
0 ,
$ shutters - > getTimeUpEarly ,
$ shutters - > getTimeUpLate
)
) + 1
) / 86400
)
)
{
$ shuttersSunriseUnixtime =
( $ shuttersSunriseUnixtime + 86400 )
if ( $ shuttersSunriseUnixtime <
( $ oldFuncHash - > { sunrisetime } + 180 )
and $ oldFuncHash - > { sunrisetime } < gettimeofday ( ) ) ;
2018-09-27 10:19:41 +02:00
}
}
2018-09-07 11:02:46 +02:00
}
2018-10-14 18:19:23 +02:00
elsif ( defined ( $ oldFuncHash ) and ref ( $ oldFuncHash ) eq 'HASH' ) {
$ shuttersSunriseUnixtime = ( $ shuttersSunriseUnixtime + 86400 )
if ( $ shuttersSunriseUnixtime <
( $ oldFuncHash - > { sunrisetime } + 180 )
and $ oldFuncHash - > { sunrisetime } < gettimeofday ( ) ) ;
}
}
2018-11-03 19:01:29 +01:00
elsif ( $ shutters - > getUp eq 'time' ) {
2018-11-17 17:10:45 +01:00
if ( ( IsWe ( ) or IsWeTomorrow ( ) )
and $ ascDev - > getSunriseTimeWeHoliday eq 'on' )
{
if ( not IsWeTomorrow ( ) ) {
if (
IsWe ( )
and int ( gettimeofday ( ) / 86400 ) == int (
computeAlignTime (
'24:00' ,
$ shutters - > getTimeUpWeHoliday
)
) / 86400
)
{
$ shuttersSunriseUnixtime =
computeAlignTime (
'24:00' ,
$ shutters - > getTimeUpWeHoliday
) ;
}
elsif (
int ( gettimeofday ( ) / 86400 ) == int (
computeAlignTime (
'24:00' ,
$ shutters - > getTimeUpEarly
)
) / 86400
)
{
$ shuttersSunriseUnixtime =
computeAlignTime (
'24:00' ,
$ shutters - > getTimeUpWeHoliday
) ;
}
else {
$ shuttersSunriseUnixtime =
computeAlignTime (
'24:00' ,
2018-11-18 08:13:58 +01:00
$ shutters - > getTimeUpEarly
2018-11-17 17:10:45 +01:00
) ;
}
}
else {
$ shuttersSunriseUnixtime =
computeAlignTime (
'24:00' ,
$ shutters - > getTimeUpWeHoliday
) ;
}
}
else {
$ shuttersSunriseUnixtime =
computeAlignTime (
'24:00' ,
2018-11-18 08:13:58 +01:00
$ shutters - > getTimeUpEarly
2018-11-17 17:10:45 +01:00
) ;
}
2018-10-14 18:19:23 +02:00
}
2018-11-03 19:01:29 +01:00
elsif ( $ shutters - > getUp eq 'brightness' ) {
2018-10-14 18:19:23 +02:00
$ shuttersSunriseUnixtime =
2018-11-17 17:10:45 +01:00
computeAlignTime ( '24:00' , $ shutters - > getTimeUpLate ) ;
2018-09-07 11:02:46 +02:00
}
return $ shuttersSunriseUnixtime ;
2018-10-14 18:19:23 +02:00
}
elsif ( $ tm eq 'real' ) {
return sunrise_abs ( $ autoAstroMode , 0 , $ shutters - > getTimeUpEarly ,
$ shutters - > getTimeUpLate )
2018-11-03 19:01:29 +01:00
if ( $ shutters - > getUp eq 'astro' ) ;
return $ shutters - > getTimeUpEarly if ( $ shutters - > getUp eq 'time' ) ;
2018-08-31 09:32:16 +02:00
}
2018-08-28 19:49:01 +02:00
}
2018-09-04 22:53:48 +02:00
sub ShuttersSunset ($$$) {
2018-10-14 18:19:23 +02:00
my ( $ hash , $ shuttersDev , $ tm ) =
@ _ ; # Tm steht für Timemode und bedeutet Realzeit oder Unixzeit
my $ name = $ hash - > { NAME } ;
2018-09-13 08:11:10 +02:00
my $ autoAstroMode ;
2018-10-10 10:43:42 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-09-18 09:35:45 +02:00
2018-10-14 18:19:23 +02:00
if ( $ shutters - > getAutoAstroModeEvening ne 'none' ) {
$ autoAstroMode = $ shutters - > getAutoAstroModeEvening ;
$ autoAstroMode =
$ autoAstroMode . '=' . $ shutters - > getAutoAstroModeEveningHorizon
if ( $ autoAstroMode eq 'HORIZON' ) ;
2018-09-13 15:21:29 +02:00
}
2018-10-14 18:19:23 +02:00
else {
$ autoAstroMode = $ ascDev - > getAutoAstroModeEvening ;
$ autoAstroMode =
2018-11-03 19:01:29 +01:00
$ autoAstroMode . '=' . $ ascDev - > getAutoAstroModeEveningHorizon
2018-10-14 18:19:23 +02:00
if ( $ autoAstroMode eq 'HORIZON' ) ;
2018-09-13 15:21:29 +02:00
}
2018-10-14 18:19:23 +02:00
my $ oldFuncHash = $ shutters - > getInTimerFuncHash ;
2018-09-07 11:02:46 +02:00
my $ shuttersSunsetUnixtime ;
2018-08-31 09:32:16 +02:00
2018-10-14 18:19:23 +02:00
if ( $ tm eq 'unix' ) {
2018-11-03 19:01:29 +01:00
if ( $ shutters - > getDown eq 'astro' ) {
2018-10-14 18:19:23 +02:00
$ shuttersSunsetUnixtime = (
computeAlignTime (
'24:00' ,
sunset_abs (
$ autoAstroMode ,
0 ,
$ shutters - > getTimeDownEarly ,
$ shutters - > getTimeDownLate
)
) + 1
) ;
if ( defined ( $ oldFuncHash ) and ref ( $ oldFuncHash ) eq 'HASH' ) {
$ shuttersSunsetUnixtime = ( $ shuttersSunsetUnixtime + 86400 )
if ( $ shuttersSunsetUnixtime <
( $ oldFuncHash - > { sunsettime } + 180 )
and $ oldFuncHash - > { sunsettime } < gettimeofday ( ) ) ;
2018-09-07 11:02:46 +02:00
}
}
2018-11-03 19:01:29 +01:00
elsif ( $ shutters - > getDown eq 'time' ) {
2018-10-14 18:19:23 +02:00
$ shuttersSunsetUnixtime =
computeAlignTime ( '24:00' , $ shutters - > getTimeDownEarly ) ;
}
2018-11-03 19:01:29 +01:00
elsif ( $ shutters - > getDown eq 'brightness' ) {
2018-10-14 18:19:23 +02:00
$ shuttersSunsetUnixtime =
computeAlignTime ( '24:00' , $ shutters - > getTimeDownLate ) ;
}
2018-09-07 11:02:46 +02:00
return $ shuttersSunsetUnixtime ;
2018-10-14 18:19:23 +02:00
}
elsif ( $ tm eq 'real' ) {
return sunset_abs (
$ autoAstroMode , 0 ,
$ shutters - > getTimeDownEarly ,
$ shutters - > getTimeDownLate
2018-11-03 19:01:29 +01:00
) if ( $ shutters - > getDown eq 'astro' ) ;
2018-10-14 18:19:23 +02:00
return $ shutters - > getTimeDownEarly
2018-11-03 19:01:29 +01:00
if ( $ shutters - > getDown eq 'time' ) ;
2018-08-31 09:32:16 +02:00
}
}
2018-08-29 14:58:10 +02:00
## Kontrolliert ob das Fenster von einem bestimmten Rolladen offen ist
2018-08-28 19:49:01 +02:00
sub CheckIfShuttersWindowRecOpen ($) {
my $ shuttersDev = shift ;
2018-10-10 10:43:42 +02:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-08-28 19:49:01 +02:00
2018-10-14 18:19:23 +02:00
if ( $ shutters - > getWinStatus eq 'open' ) { return 2 ; }
elsif ( $ shutters - > getWinStatus eq 'tilted'
and $ shutters - > getSubTyp eq 'threestate' )
{
2018-08-28 19:49:01 +02:00
return 1 ;
}
2018-10-14 18:19:23 +02:00
elsif ( $ shutters - > getWinStatus eq 'closed' ) { return 0 ; }
2018-08-28 19:49:01 +02:00
}
2018-09-07 14:10:46 +02:00
sub makeReadingName ($) {
2018-10-14 18:19:23 +02:00
my ( $ name ) = @ _ ;
my % charHash = (
"ä" = > "ae" ,
"Ä" = > "Ae" ,
"ü" = > "ue" ,
"Ü" = > "Ue" ,
"ö" = > "oe" ,
"Ö" = > "Oe" ,
"ß" = > "ss"
) ;
my $ charHashkeys = join ( "|" , keys ( % charHash ) ) ;
$ name = "UNDEFINED" if ( ! defined ( $ name ) ) ;
return $ name if ( $ name =~ m/^\./ ) ;
2018-09-07 14:10:46 +02:00
$ name =~ s/($charHashkeys)/$charHash{$1}/gi ;
$ name =~ s/[^a-z0-9._\-\/]/_/gi ;
return $ name ;
}
2018-09-14 20:46:55 +02:00
sub TimeMin2Sec ($) {
my $ min = shift ;
my $ sec ;
2018-10-14 18:19:23 +02:00
$ sec = $ min * 60 ;
2018-09-14 20:46:55 +02:00
return $ sec ;
}
2018-09-18 09:35:45 +02:00
sub IsWe () {
2018-10-14 18:19:23 +02:00
my ( undef , undef , undef , undef , undef , undef , $ wday , undef , undef ) =
localtime ( gettimeofday ( ) ) ;
my $ we = ( ( $ wday == 0 || $ wday == 6 ) ? 1 : 0 ) ;
if ( ! $ we ) {
foreach my $ h2we ( split ( "," , AttrVal ( "global" , "holiday2we" , "" ) ) )
{
my ( $ a , $ b ) =
ReplaceEventMap ( $ h2we , [ $ h2we , Value ( $ h2we ) ] , 0 ) ;
$ we = 1 if ( $ b && $ b ne "none" ) ;
2018-09-18 09:35:45 +02:00
}
}
2018-10-14 18:19:23 +02:00
return $ we ;
2018-09-18 09:35:45 +02:00
}
sub IsWeTomorrow () {
2018-10-14 18:19:23 +02:00
my ( undef , undef , undef , undef , undef , undef , $ wday , undef , undef ) =
localtime ( gettimeofday ( ) ) ;
2018-10-16 10:30:10 +02:00
my $ we = (
( ( ( $ wday + 1 == 7 ? 0 : $ wday + 1 ) ) == 0 || ( $ wday + 1 ) == 6 )
2018-10-14 18:19:23 +02:00
? 1
2018-10-16 10:30:10 +02:00
: 0
) ;
2018-10-14 18:19:23 +02:00
if ( ! $ we ) {
foreach my $ h2we ( split ( "," , AttrVal ( "global" , "holiday2we" , "" ) ) )
{
my ( $ a , $ b ) = ReplaceEventMap ( $ h2we ,
[ $ h2we , ReadingsVal ( $ h2we , "tomorrow" , "none" ) ] , 0 ) ;
$ we = 1 if ( $ b && $ b ne "none" ) ;
2018-09-18 09:35:45 +02:00
}
}
2018-10-14 18:19:23 +02:00
return $ we ;
2018-09-18 09:35:45 +02:00
}
sub IsHoliday ($) {
2018-10-14 18:19:23 +02:00
my $ hash = shift ;
my $ name = $ hash - > { NAME } ;
2018-09-18 09:35:45 +02:00
2018-10-14 18:19:23 +02:00
return (
2018-11-12 09:09:30 +01:00
ReadingsVal (
AttrVal ( $ name , 'ASC_timeUpHolidayDevice' , 'none' ) ,
AttrVal ( $ name , 'ASC_timeUpHolidayReading' , 'state' ) ,
0
) == 1 ? 1 : 0
2018-10-14 18:19:23 +02:00
) ;
2018-09-18 09:35:45 +02:00
}
2018-10-30 08:18:09 +01:00
sub SetCmdFn ($) {
2018-10-30 19:10:50 +01:00
my $ h = shift ;
2018-10-30 08:18:09 +01:00
my $ shuttersDev = $ h - > { shuttersDev } ;
my $ posValue = $ h - > { posValue } ;
2018-10-30 19:10:50 +01:00
2018-10-30 08:18:09 +01:00
$ shutters - > setShuttersDev ( $ shuttersDev ) ;
2018-11-04 12:27:46 +01:00
if ( $ shutters - > getStatus != $ posValue ) {
$ shutters - > setLastPos ( $ shutters - > getStatus ) ;
$ shutters - > setLastDriveReading ;
2018-11-07 08:22:11 +01:00
$ ascDev - > setStateReading ;
2018-11-04 21:31:05 +01:00
}
else {
2018-11-04 12:27:46 +01:00
$ shutters - > setLastDrive (
ReadingsVal ( $ shuttersDev , 'ASC_ShuttersLastDrive' , 'none' ) ) ;
}
2018-10-30 08:18:09 +01:00
CommandSet ( undef ,
$ shuttersDev
. ':FILTER='
. $ shutters - > getPosCmd . '!='
. $ posValue . ' '
2018-11-07 08:22:11 +01:00
. $ shutters - > getPosSetCmd . ' '
2018-10-30 08:18:09 +01:00
. $ posValue ) ;
}
2018-10-28 18:12:40 +01:00
########## Begin der Klassendeklarierungen für OOP (Objektorientierte Programmierung) #########################
2018-10-10 10:43:42 +02:00
## Klasse Rolläden (Shutters) und die Subklassen Attr und Readings ##
## desweiteren wird noch die Klasse ASC_Roommate mit eingebunden
package ASC_Shutters ;
2018-10-14 18:19:23 +02:00
our @ ISA =
qw( ASC_Shutters::Readings ASC_Shutters::Attr ASC_Roommate ASC_Window ) ;
2018-10-08 21:05:47 +02:00
use strict ;
use warnings ;
2018-11-07 08:22:11 +01:00
use GPUtils qw( GP_Import ) ;
2018-10-14 18:19:23 +02:00
## Import der FHEM Funktionen
BEGIN {
GP_Import (
qw(
defs
ReadingsVal
readingsSingleUpdate
2018-10-30 08:18:09 +01:00
gettimeofday
InternalTimer )
2018-10-14 18:19:23 +02:00
) ;
}
2018-10-08 21:05:47 +02:00
sub new {
2018-10-14 18:19:23 +02:00
my $ class = shift ;
my $ self = {
shuttersDev = > undef ,
defaultarg = > undef ,
roommate = > undef ,
} ;
2018-10-08 21:05:47 +02:00
bless $ self , $ class ;
return $ self ;
}
2018-10-10 10:43:42 +02:00
sub setShuttersDev {
2018-10-14 18:19:23 +02:00
my ( $ self , $ shuttersDev ) = @ _ ;
2018-10-17 09:50:11 +02:00
2018-10-14 18:19:23 +02:00
$ self - > { shuttersDev } = $ shuttersDev if ( defined ( $ shuttersDev ) ) ;
2018-10-10 10:43:42 +02:00
return $ self - > { shuttersDev } ;
2018-10-08 21:05:47 +02:00
}
2018-10-27 13:36:11 +02:00
sub getShuttersDev {
my $ self = shift ;
return $ self - > { shuttersDev } ;
}
2018-11-07 08:22:11 +01:00
sub setNoOffset {
my ( $ self , $ noOffset ) = @ _ ;
$ self - > { $ self - > { shuttersDev } } { noOffset } = $ noOffset ;
return 0 ;
}
2018-10-14 18:19:23 +02:00
sub setDriveCmd {
my ( $ self , $ posValue ) = @ _ ;
2018-10-30 08:18:09 +01:00
my $ offSet = 0 ;
2018-11-15 15:01:34 +01:00
### antifreeze Routine
2018-11-16 10:44:54 +01:00
if ( $ shutters - > getFreezeStatus > 0 ) {
if ( $ shutters - > getFreezeStatus != 1 ) {
2018-11-15 21:51:02 +01:00
$ posValue = $ shutters - > getStatus ;
$ shutters - > setLastDrive ( 'no drive - antifreeze defense' ) ;
$ shutters - > setLastDriveReading ;
$ ascDev - > setStateReading ;
}
2018-11-16 10:44:54 +01:00
elsif ( $ posValue == $ shutters - > getClosedPos ) {
2018-11-15 21:51:02 +01:00
$ posValue = $ shutters - > getAntiFreezePos ;
$ shutters - > setLastDrive ( $ shutters - > getLastDrive . ' - antifreeze mode' ) ;
}
2018-11-15 15:01:34 +01:00
}
2018-10-30 19:10:50 +01:00
my % h = (
shuttersDev = > $ self - > { shuttersDev } ,
posValue = > $ posValue ,
) ;
2018-11-04 12:27:46 +01:00
2018-10-30 19:10:50 +01:00
$ offSet = $ shutters - > getOffset if ( $ shutters - > getOffset > 0 ) ;
2018-10-30 08:18:09 +01:00
$ offSet = $ ascDev - > getShuttersOffset if ( $ shutters - > getOffset == - 1 ) ;
2018-10-27 13:36:11 +02:00
2018-10-30 19:10:50 +01:00
InternalTimer ( gettimeofday ( ) + int ( rand ( $ offSet ) ) ,
'AutoShuttersControl::SetCmdFn' , \ % h )
2018-11-08 08:32:47 +01:00
if ( $ offSet > 0 and not $ shutters - > getNoOffset ) ;
AutoShuttersControl:: SetCmdFn ( \ % h )
if ( $ offSet == 0 or $ shutters - > getNoOffset ) ;
2018-11-07 08:22:11 +01:00
$ shutters - > setNoOffset ( 0 ) ;
2018-10-30 19:10:50 +01:00
return 0 ;
2018-10-14 18:19:23 +02:00
}
2018-10-08 21:05:47 +02:00
2018-10-28 18:12:40 +01:00
sub setSunsetUnixTime {
my ( $ self , $ unixtime ) = @ _ ;
$ self - > { $ self - > { shuttersDev } } { sunsettime } = $ unixtime ;
return 0 ;
}
sub setSunriseUnixTime {
my ( $ self , $ unixtime ) = @ _ ;
$ self - > { $ self - > { shuttersDev } } { sunrisetime } = $ unixtime ;
return 0 ;
}
2018-10-27 13:36:11 +02:00
sub setDelayCmd {
2018-10-14 18:19:23 +02:00
my ( $ self , $ posValue ) = @ _ ;
2018-10-27 13:36:11 +02:00
$ self - > { $ self - > { shuttersDev } } { delayCmd } = $ posValue ;
return 0 ;
}
sub setLastDrive {
my ( $ self , $ lastDrive ) = @ _ ;
$ self - > { $ self - > { shuttersDev } } { lastDrive } = $ lastDrive ;
return 0 ;
}
2018-11-07 08:22:11 +01:00
sub setPosSetCmd {
my ( $ self , $ posSetCmd ) = @ _ ;
2018-11-08 08:32:47 +01:00
2018-11-07 08:22:11 +01:00
$ self - > { $ self - > { shuttersDev } } { posSetCmd } = $ posSetCmd ;
return 0 ;
}
2018-10-27 13:36:11 +02:00
sub setLastDriveReading {
my $ self = shift ;
2018-10-14 18:19:23 +02:00
my $ shuttersDevHash = $ defs { $ self - > { shuttersDev } } ;
2018-10-27 13:36:11 +02:00
readingsSingleUpdate ( $ shuttersDevHash , 'ASC_ShuttersLastDrive' ,
2018-11-07 08:22:11 +01:00
$ shutters - > getLastDrive , 1 ) ;
2018-10-14 18:19:23 +02:00
return 0 ;
}
2018-10-19 20:13:01 +02:00
sub setLastPos
{ # letzte ermittelte Position bevor die Position des Rolladen über ASC geändert wurde
2018-10-14 18:19:23 +02:00
my ( $ self , $ position ) = @ _ ;
2018-10-17 09:50:11 +02:00
2018-10-17 15:58:05 +02:00
$ self - > { $ self - > { shuttersDev } } { lastPos } { VAL } = $ position
2018-10-17 09:50:11 +02:00
if ( defined ( $ position ) ) ;
2018-10-17 15:58:05 +02:00
$ self - > { $ self - > { shuttersDev } } { lastPos } { TIME } = int ( gettimeofday ( ) )
if ( defined ( $ self - > { $ self - > { shuttersDev } } { lastPos } ) ) ;
2018-10-14 18:19:23 +02:00
return 0 ;
}
2018-10-08 21:05:47 +02:00
2018-10-19 20:13:01 +02:00
sub setLastManPos
{ # letzte ermittelte Position bevor die Position des Rolladen manuell (nicht über ASC) geändert wurde
my ( $ self , $ position ) = @ _ ;
$ self - > { $ self - > { shuttersDev } } { lastManPos } { VAL } = $ position
if ( defined ( $ position ) ) ;
$ self - > { $ self - > { shuttersDev } } { lastManPos } { TIME } = int ( gettimeofday ( ) )
if ( defined ( $ self - > { $ self - > { shuttersDev } } { lastManPos } ) ) ;
return 0 ;
}
2018-10-14 18:19:23 +02:00
sub setDefault {
my ( $ self , $ defaultarg ) = @ _ ;
2018-10-17 09:50:11 +02:00
2018-10-14 18:19:23 +02:00
$ self - > { defaultarg } = $ defaultarg if ( defined ( $ defaultarg ) ) ;
2018-10-10 10:43:42 +02:00
return $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub setRoommate {
2018-10-14 18:19:23 +02:00
my ( $ self , $ roommate ) = @ _ ;
2018-10-17 09:50:11 +02:00
2018-10-14 18:19:23 +02:00
$ self - > { roommate } = $ roommate if ( defined ( $ roommate ) ) ;
2018-10-10 10:43:42 +02:00
return $ self - > { roommate } ;
2018-10-08 21:05:47 +02:00
}
2018-10-17 09:50:11 +02:00
sub setInTimerFuncHash {
my ( $ self , $ inTimerFuncHash ) = @ _ ;
$ self - > { $ self - > { shuttersDev } } { inTimerFuncHash } = $ inTimerFuncHash
if ( defined ( $ inTimerFuncHash ) ) ;
return 0 ;
}
2018-11-15 21:51:02 +01:00
sub getFreezeStatus {
2018-11-16 09:28:18 +01:00
use POSIX qw( strftime ) ;
2018-11-15 21:51:02 +01:00
my $ self = shift ;
2018-11-16 10:44:54 +01:00
my $ daytime = strftime ( "%P" , localtime ( ) ) ;
2018-11-15 21:51:02 +01:00
2018-11-16 10:44:54 +01:00
if ( $ shutters - > getAntiFreeze ne 'off'
and $ ascDev - > getOutTemp <= $ ascDev - > getFreezeTemp ) {
if ( $ shutters - > getAntiFreeze eq 'soft' ) {
return 1 ;
}
elsif ( $ shutters - > getAntiFreeze eq $ daytime
or $ shutters - > getAntiFreeze eq $ daytime )
{
return 2 ;
}
elsif ( $ shutters - > getAntiFreeze eq 'hard' ) {
return 3 ;
}
2018-11-15 21:51:02 +01:00
}
else { return 0 ; }
}
2018-11-07 08:22:11 +01:00
sub getShuttersPosCmdValueNegate {
my $ self = shift ;
2018-11-08 08:32:47 +01:00
2018-11-07 08:22:11 +01:00
return ( $ shutters - > getOpenPos < $ shutters - > getClosedPos ? 1 : 0 ) ;
}
sub getPosSetCmd {
my $ self = shift ;
2018-11-08 08:32:47 +01:00
return (
defined ( $ self - > { $ self - > { shuttersDev } } { posSetCmd } )
? $ self - > { $ self - > { shuttersDev } } { posSetCmd }
2018-11-12 09:09:30 +01:00
: $ shutters - > getPosCmd
) ;
2018-11-07 08:22:11 +01:00
}
sub getNoOffset {
my $ self = shift ;
return $ self - > { $ self - > { shuttersDev } } { noOffset } ;
}
2018-10-27 13:36:11 +02:00
sub getLastDrive {
my $ self = shift ;
2018-10-28 18:12:40 +01:00
$ self - > { $ self - > { shuttersDev } } { lastDrive } =
ReadingsVal ( $ self - > { shuttersDev } , 'ASC_ShuttersLastDrive' , 'none' )
if ( not defined ( $ self - > { $ self - > { shuttersDev } } { lastDrive } ) ) ;
2018-10-27 13:36:11 +02:00
return $ self - > { $ self - > { shuttersDev } } { lastDrive } ;
}
2018-10-19 20:13:01 +02:00
sub getLastPos
{ # letzte ermittelte Position bevor die Position des Rolladen über ASC geändert wurde
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-17 09:50:11 +02:00
return $ self - > { $ self - > { shuttersDev } } { lastPos } { VAL }
if ( defined ( $ self - > { $ self - > { shuttersDev } } { lastPos } )
and defined ( $ self - > { $ self - > { shuttersDev } } { lastPos } { VAL } ) ) ;
}
sub getLastPosTimestamp {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-17 09:50:11 +02:00
return $ self - > { $ self - > { shuttersDev } } { lastPos } { TIME }
if ( defined ( $ self - > { $ self - > { shuttersDev } } )
and defined ( $ self - > { $ self - > { shuttersDev } } { lastPos } )
and defined ( $ self - > { $ self - > { shuttersDev } } { lastPos } { TIME } ) ) ;
}
2018-10-19 20:13:01 +02:00
sub getLastManPos
{ # letzte ermittelte Position bevor die Position des Rolladen manuell (nicht über ASC) geändert wurde
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-19 20:13:01 +02:00
return $ self - > { $ self - > { shuttersDev } } { lastManPos } { VAL }
if ( defined ( $ self - > { $ self - > { shuttersDev } } { lastManPos } )
and defined ( $ self - > { $ self - > { shuttersDev } } { lastManPos } { VAL } ) ) ;
}
sub getLastManPosTimestamp {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-19 20:13:01 +02:00
return $ self - > { $ self - > { shuttersDev } } { lastManPos } { TIME }
if ( defined ( $ self - > { $ self - > { shuttersDev } } )
and defined ( $ self - > { $ self - > { shuttersDev } } { lastManPos } )
and defined ( $ self - > { $ self - > { shuttersDev } } { lastManPos } { TIME } ) ) ;
}
2018-10-17 09:50:11 +02:00
sub getInTimerFuncHash {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-17 09:50:11 +02:00
return $ self - > { $ self - > { shuttersDev } } { inTimerFuncHash } ;
2018-10-14 18:19:23 +02:00
}
2018-10-08 21:05:47 +02:00
2018-10-28 18:12:40 +01:00
sub getSunsetUnixTime {
my $ self = shift ;
return $ self - > { $ self - > { shuttersDev } } { sunsettime } ;
}
sub getSunriseUnixTime {
my $ self = shift ;
return $ self - > { $ self - > { shuttersDev } } { sunrisetime } ;
}
2018-10-14 18:19:23 +02:00
sub getRoommatesStatus {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
my $ loop = 0 ;
2018-10-01 08:43:59 +02:00
my @ roState ;
2018-10-14 18:19:23 +02:00
my % statePrio = (
'asleep' = > 1 ,
'gotosleep' = > 2 ,
'awoken' = > 3 ,
'home' = > 4 ,
'absent' = > 5 ,
'gone' = > 6 ,
'none' = > 7
) ;
my $ minPrio = 10 ;
foreach my $ ro ( split ( "," , $ shutters - > getRoommates ) ) {
2018-10-10 10:43:42 +02:00
$ shutters - > setRoommate ( $ ro ) ;
2018-11-03 19:01:29 +01:00
my $ currentPrio = $ statePrio { $ shutters - > _getRoommateStatus } ;
2018-10-14 18:19:23 +02:00
$ minPrio = $ currentPrio if ( $ minPrio > $ currentPrio ) ;
2018-10-01 08:43:59 +02:00
}
2018-10-17 09:50:11 +02:00
2018-10-14 18:19:23 +02:00
my % revStatePrio = reverse % statePrio ;
2018-10-10 10:43:42 +02:00
return $ revStatePrio { $ minPrio } ;
2018-10-01 08:43:59 +02:00
}
2018-10-10 10:43:42 +02:00
sub getRoommatesLastStatus {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
my $ loop = 0 ;
2018-10-01 08:43:59 +02:00
my @ roState ;
2018-10-14 18:19:23 +02:00
my % statePrio = (
'asleep' = > 1 ,
'gotosleep' = > 2 ,
'awoken' = > 3 ,
'home' = > 4 ,
'absent' = > 5 ,
'gone' = > 6 ,
'none' = > 7
) ;
my $ minPrio = 10 ;
foreach my $ ro ( split ( "," , $ shutters - > getRoommates ) ) {
2018-10-10 10:43:42 +02:00
$ shutters - > setRoommate ( $ ro ) ;
2018-11-03 19:01:29 +01:00
my $ currentPrio = $ statePrio { $ shutters - > _getRoommateLastStatus } ;
2018-10-14 18:19:23 +02:00
$ minPrio = $ currentPrio if ( $ minPrio > $ currentPrio ) ;
2018-10-01 08:43:59 +02:00
}
2018-10-14 18:19:23 +02:00
my % revStatePrio = reverse % statePrio ;
2018-10-10 10:43:42 +02:00
return $ revStatePrio { $ minPrio } ;
2018-10-08 21:05:47 +02:00
}
2018-10-09 18:05:55 +02:00
## Subklasse Attr von ASC_Shutters##
package ASC_Shutters::Attr ;
2018-10-08 21:05:47 +02:00
use strict ;
use warnings ;
2018-11-07 08:22:11 +01:00
use GPUtils qw( GP_Import ) ;
2018-10-08 21:05:47 +02:00
## Import der FHEM Funktionen
BEGIN {
2018-10-14 18:19:23 +02:00
GP_Import (
qw(
AttrVal )
) ;
}
2018-10-08 21:05:47 +02:00
2018-11-15 15:01:34 +01:00
sub getAntiFreezePos {
my $ self = shift ;
2018-11-18 08:13:58 +01:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Antifreeze_Pos' , 50 ) ;
2018-11-15 15:01:34 +01:00
}
2018-10-22 08:05:19 +02:00
sub getShuttersPlace {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-22 08:05:19 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_ShuttersPlace' , 'window' ) ;
2018-10-22 08:05:19 +02:00
}
2018-10-14 18:19:23 +02:00
sub getSelfDefenseExclude {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Self_Defense_Exclude' , 'off' ) ;
2018-10-14 18:19:23 +02:00
}
2018-10-08 21:05:47 +02:00
2018-11-12 12:56:18 +01:00
sub getWiggleValue {
my $ self = shift ;
return AttrVal ( $ self - > { shuttersDev } , 'ASC_WiggleValue' , 5 ) ;
}
2018-11-14 03:41:38 +01:00
sub getShadingPos {
my $ self = shift ;
my $ default = $ self - > { defaultarg } ;
$ default = 10 if ( not defined ( $ default ) ) ;
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Shading_Pos' , $ default ) ;
}
sub getShadingMode {
my $ self = shift ;
my $ default = $ self - > { defaultarg } ;
$ default = 'off' if ( not defined ( $ default ) ) ;
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Shading_Mode' , $ default ) ;
}
sub _getShadingBrightnessSensor {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Shading_Brightness_Sensor' ,
$ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-12 06:32:01 +02:00
sub getShadingBrightnessReading {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
my $ default = $ self - > { defaultarg } ;
2018-10-12 06:32:01 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'brightness' if ( not defined ( $ default ) ) ;
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Shading_Brightness_Reading' ,
$ default ) ;
2018-10-12 06:32:01 +02:00
}
2018-10-08 21:05:47 +02:00
2018-11-12 12:56:18 +01:00
sub getDirection {
my $ self = shift ;
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Shading_Direction' , - 1 ) ;
}
sub getShadingAngleLeft {
my $ self = shift ;
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Shading_Angle_Left' , - 1 ) ;
}
sub getShadingAngleRight {
my $ self = shift ;
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Shading_Angle_Right' , - 1 ) ;
}
2018-10-30 08:18:09 +01:00
sub getOffset {
my $ self = shift ;
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Drive_Offset' , 0 ) ;
}
2018-10-10 10:43:42 +02:00
sub getPosCmd {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-11-07 08:22:11 +01:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Pos_Reading' , 'pct' ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getOpenPos {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Open_Pos' , 0 ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getVentilatePos {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Ventilate_Pos' , 80 ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getClosedPos {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Closed_Pos' , 100 ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getVentilateOpen {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Ventilate_Window_Open' , 'off' ) ;
2018-10-08 21:05:47 +02:00
}
2018-11-15 15:01:34 +01:00
sub getComfortOpenPos {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-14 18:19:23 +02:00
2018-11-15 10:15:36 +01:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_ComfortOpen_Pos' , 50 ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getPartyMode {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-14 18:19:23 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Partymode' , 'off' ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getRoommates {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Roommate_Device' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getRoommatesReading {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'state' if ( not defined ( $ default ) ) ;
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Roommate_Reading' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getModeUp {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Mode_Up' , 'off' ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getModeDown {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Mode_Down' , 'off' ) ;
2018-10-01 08:43:59 +02:00
}
2018-10-10 10:43:42 +02:00
sub getLockOut {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-11-14 15:26:32 +01:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_LockOut' , 'off' ) ;
}
sub getLockOutCmd {
my $ self = shift ;
return AttrVal ( $ self - > { shuttersDev } , 'ASC_LockOut_Cmd' , 'none' ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getAntiFreeze {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Antifreeze' , 'off' ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getAutoAstroModeMorning {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_AutoAstroModeMorning' ,
$ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getAutoAstroModeEvening {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_AutoAstroModeEvening' ,
$ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getAutoAstroModeMorningHorizon {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_AutoAstroModeMorningHorizon' ,
0 ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getAutoAstroModeEveningHorizon {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_AutoAstroModeEveningHorizon' ,
0 ) ;
2018-10-08 21:05:47 +02:00
}
2018-11-03 19:01:29 +01:00
sub getUp {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Up' , 'astro' ) ;
2018-10-08 21:05:47 +02:00
}
2018-11-03 19:01:29 +01:00
sub getDown {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Down' , 'astro' ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getTimeUpEarly {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Time_Up_Early' , '04:30:00' ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getTimeUpLate {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Time_Up_Late' , '09:00:00' ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getTimeDownEarly {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Time_Down_Early' , '15:30:00' ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getTimeDownLate {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Time_Down_Late' , '22:00:00' ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getTimeUpWeHoliday {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_Time_Up_WE_Holiday' ,
'04:00:00' ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-16 10:30:10 +02:00
sub getBrightnessMinVal {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-16 10:30:10 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_BrightnessMinVal' , - 1 ) ;
2018-10-16 10:30:10 +02:00
}
sub getBrightnessMaxVal {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-16 10:30:10 +02:00
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_BrightnessMaxVal' , - 1 ) ;
2018-10-16 10:30:10 +02:00
}
2018-10-09 18:05:55 +02:00
## Subklasse Readings von ASC_Shutters ##
package ASC_Shutters::Readings ;
2018-10-08 21:05:47 +02:00
use strict ;
use warnings ;
2018-11-07 08:22:11 +01:00
use GPUtils qw( GP_Import ) ;
2018-10-08 21:05:47 +02:00
## Import der FHEM Funktionen
BEGIN {
2018-10-14 18:19:23 +02:00
GP_Import (
qw(
ReadingsVal )
) ;
}
2018-10-08 21:05:47 +02:00
2018-10-12 06:32:01 +02:00
sub getBrightness {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-10 10:43:42 +02:00
2018-11-14 03:41:38 +01:00
return ReadingsVal ( $ shutters - > _getShadingBrightnessSensor ,
2018-11-14 15:26:32 +01:00
$ shutters - > getShadingBrightnessReading , - 1 ) ;
2018-10-12 06:32:01 +02:00
}
2018-10-10 10:43:42 +02:00
sub getStatus {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
2018-10-10 10:43:42 +02:00
2018-10-27 13:36:11 +02:00
return ReadingsVal ( $ self - > { shuttersDev } , $ shutters - > getPosCmd , 0 ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getDelayCmd {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
return $ self - > { $ self - > { shuttersDev } } { delayCmd } ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
## Klasse Fenster (Window) und die Subklassen Attr und Readings ##
package ASC_Window ;
2018-10-14 18:19:23 +02:00
our @ ISA = qw( ASC_Window::Attr ASC_Window::Readings ) ;
2018-10-10 10:43:42 +02:00
## Subklasse Attr von Klasse ASC_Window ##
package ASC_Window::Attr ;
2018-10-08 21:05:47 +02:00
2018-10-10 10:43:42 +02:00
use strict ;
use warnings ;
2018-11-07 08:22:11 +01:00
use GPUtils qw( GP_Import ) ;
2018-10-10 10:43:42 +02:00
## Import der FHEM Funktionen
BEGIN {
2018-10-14 18:19:23 +02:00
GP_Import (
qw(
AttrVal )
) ;
}
2018-10-10 10:43:42 +02:00
sub getSubTyp {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
my $ default = $ self - > { defaultarg } ;
2018-10-10 10:43:42 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'twostate' if ( not defined ( $ default ) ) ;
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_WindowRec_subType' , $ default ) ;
2018-10-10 10:43:42 +02:00
}
2018-11-03 19:01:29 +01:00
sub _getWinDev {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
my $ default = $ self - > { defaultarg } ;
2018-10-10 10:43:42 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-27 13:36:11 +02:00
return AttrVal ( $ self - > { shuttersDev } , 'ASC_WindowRec' , $ default ) ;
2018-10-10 10:43:42 +02:00
}
## Subklasse Readings von Klasse ASC_Window ##
package ASC_Window::Readings ;
use strict ;
use warnings ;
2018-11-07 08:22:11 +01:00
use GPUtils qw( GP_Import ) ;
2018-10-10 10:43:42 +02:00
## Import der FHEM Funktionen
BEGIN {
2018-10-14 18:19:23 +02:00
GP_Import (
qw(
ReadingsVal )
) ;
}
2018-10-10 10:43:42 +02:00
sub getWinStatus {
2018-10-27 13:36:11 +02:00
my $ self = shift ;
my $ default = $ self - > { defaultarg } ;
2018-10-10 10:43:42 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'closed' if ( not defined ( $ default ) ) ;
2018-11-03 19:01:29 +01:00
return ReadingsVal ( $ shutters - > _getWinDev , 'state' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
## Klasse ASC_Roommate ##
package ASC_Roommate ;
use strict ;
use warnings ;
2018-11-07 08:22:11 +01:00
use GPUtils qw( GP_Import ) ;
2018-10-08 21:05:47 +02:00
## Import der FHEM Funktionen
BEGIN {
2018-10-14 18:19:23 +02:00
GP_Import (
qw(
ReadingsVal )
) ;
}
2018-10-08 21:05:47 +02:00
2018-11-03 19:01:29 +01:00
sub _getRoommateStatus {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ roommate = $ self - > { roommate } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-28 18:12:40 +01:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return ReadingsVal ( $ roommate , $ shutters - > getRoommatesReading , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-11-03 19:01:29 +01:00
sub _getRoommateLastStatus {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ roommate = $ self - > { roommate } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-28 18:12:40 +01:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return ReadingsVal ( $ roommate , 'lastState' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
## Klasse ASC_Dev plus Subklassen ASC_Attr_Dev und ASC_Readings_Dev##
package ASC_Dev ;
2018-10-14 18:19:23 +02:00
our @ ISA = qw( ASC_Dev::Readings ASC_Dev::Attr ) ;
2018-10-08 21:05:47 +02:00
use strict ;
use warnings ;
sub new {
2018-10-14 18:19:23 +02:00
my $ class = shift ;
my $ self = { name = > undef , } ;
2018-10-08 21:05:47 +02:00
bless $ self , $ class ;
return $ self ;
}
2018-10-10 10:43:42 +02:00
sub setName {
2018-10-14 18:19:23 +02:00
my ( $ self , $ name ) = @ _ ;
2018-10-17 09:50:11 +02:00
2018-10-14 18:19:23 +02:00
$ self - > { name } = $ name if ( defined ( $ name ) ) ;
2018-10-10 10:43:42 +02:00
return $ self - > { name } ;
}
sub setDefault {
2018-10-14 18:19:23 +02:00
my ( $ self , $ defaultarg ) = @ _ ;
2018-10-17 09:50:11 +02:00
2018-10-14 18:19:23 +02:00
$ self - > { defaultarg } = $ defaultarg if ( defined ( $ defaultarg ) ) ;
2018-10-10 10:43:42 +02:00
return $ self - > { defaultarg } ;
}
2018-10-09 18:05:55 +02:00
## Subklasse Readings ##
package ASC_Dev::Readings ;
2018-10-08 21:05:47 +02:00
use strict ;
use warnings ;
2018-11-07 08:22:11 +01:00
use GPUtils qw( GP_Import ) ;
2018-10-08 21:05:47 +02:00
## Import der FHEM Funktionen
BEGIN {
2018-10-14 18:19:23 +02:00
GP_Import (
qw(
2018-10-27 13:36:11 +02:00
readingsSingleUpdate
ReadingsVal
defs )
2018-10-14 18:19:23 +02:00
) ;
}
2018-10-08 21:05:47 +02:00
2018-10-27 13:36:11 +02:00
sub setDelayCmdReading {
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ hash = $ defs { $ name } ;
readingsSingleUpdate ( $ hash ,
$ shutters - > getShuttersDev . '_lastDelayPosValue' ,
$ shutters - > getDelayCmd , 1 ) ;
return 0 ;
}
2018-11-07 08:22:11 +01:00
sub setStateReading {
2018-11-08 08:32:47 +01:00
my $ self = shift ;
my $ value = shift ;
my $ name = $ self - > { name } ;
my $ hash = $ defs { $ name } ;
2018-11-07 08:22:11 +01:00
2018-11-08 08:32:47 +01:00
readingsSingleUpdate ( $ hash , 'state' ,
( defined ( $ value ) ? $ value : $ shutters - > getLastDrive ) , 1 ) ;
2018-11-07 08:22:11 +01:00
return 0 ;
}
2018-11-04 19:17:11 +01:00
sub setPosReading {
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ hash = $ defs { $ name } ;
readingsSingleUpdate ( $ hash , $ shutters - > getShuttersDev . '_PosValue' ,
$ shutters - > getStatus , 1 ) ;
return 0 ;
}
2018-10-27 13:36:11 +02:00
sub setLastPosReading {
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ hash = $ defs { $ name } ;
readingsSingleUpdate ( $ hash , $ shutters - > getShuttersDev . '_lastPosValue' ,
$ shutters - > getLastPos , 1 ) ;
return 0 ;
}
2018-11-03 19:01:29 +01:00
sub getPartyMode {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return ReadingsVal ( $ name , 'partyMode' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getLockOut {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return ReadingsVal ( $ name , 'lockOut' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getSunriseTimeWeHoliday {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return ReadingsVal ( $ name , 'sunriseTimeWeHoliday' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getMonitoredDevs {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
2018-10-08 21:05:47 +02:00
2018-10-14 18:19:23 +02:00
$ self - > { monitoredDevs } = ReadingsVal ( $ name , '.monitoredDevs' , 'none' ) ;
2018-10-08 21:05:47 +02:00
return $ self - > { monitoredDevs } ;
}
2018-10-10 10:43:42 +02:00
sub getOutTemp {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
2018-10-08 21:05:47 +02:00
2018-11-14 15:26:32 +01:00
return ReadingsVal ( $ ascDev - > _getTempSensor , $ ascDev - > getTempReading , - 100 ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getResidentsStatus {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
2018-10-09 18:05:55 +02:00
2018-11-03 19:01:29 +01:00
return ReadingsVal ( $ ascDev - > _getResidentsDev , $ ascDev - > getResidentsReading ,
2018-10-28 18:12:40 +01:00
'none' ) ;
2018-10-09 18:05:55 +02:00
}
2018-10-14 18:19:23 +02:00
sub getResidentsLastStatus {
my $ self = shift ;
2018-10-09 18:05:55 +02:00
2018-11-03 19:01:29 +01:00
return ReadingsVal ( $ ascDev - > _getResidentsDev , 'lastState' , 'none' ) ;
2018-10-09 18:05:55 +02:00
}
2018-10-14 18:19:23 +02:00
sub getSelfDefense {
my $ self = shift ;
my $ name = $ self - > { name } ;
return ReadingsVal ( $ name , 'selfDefense' , 'none' ) ;
}
2018-10-08 21:05:47 +02:00
2018-11-14 03:41:38 +01:00
sub getAzimuth {
my $ self = shift ;
2018-11-14 15:26:32 +01:00
my $ azimuth ;
2018-11-14 03:41:38 +01:00
2018-11-14 15:26:32 +01:00
$ azimuth = ReadingsVal ( $ ascDev - > _getTwilightDevice , 'azimuth' , - 1 ) if ( $ defs { $ ascDev - > _getTwilightDevice } - > { TYPE } eq 'Twilight' ) ;
$ azimuth = ReadingsVal ( $ ascDev - > _getTwilightDevice , 'SunAz' , - 1 ) if ( $ defs { $ ascDev - > _getTwilightDevice } - > { TYPE } eq 'Astro' ) ;
return $ azimuth ;
2018-11-14 03:41:38 +01:00
}
sub getElevation {
my $ self = shift ;
2018-11-14 15:26:32 +01:00
my $ elevation ;
2018-11-14 03:41:38 +01:00
2018-11-14 15:26:32 +01:00
$ elevation = ReadingsVal ( $ ascDev - > _getTwilightDevice , 'elevation' , - 1 ) if ( $ defs { $ ascDev - > _getTwilightDevice } - > { TYPE } eq 'Twilight' ) ;
$ elevation = ReadingsVal ( $ ascDev - > _getTwilightDevice , 'SunAlt' , - 1 ) if ( $ defs { $ ascDev - > _getTwilightDevice } - > { TYPE } eq 'Astro' ) ;
return $ elevation ;
2018-11-14 03:41:38 +01:00
}
2018-10-09 18:05:55 +02:00
## Subklasse Attr ##
package ASC_Dev::Attr ;
2018-10-08 21:05:47 +02:00
use strict ;
use warnings ;
2018-11-07 08:22:11 +01:00
use GPUtils qw( GP_Import ) ;
2018-10-08 21:05:47 +02:00
## Import der FHEM Funktionen
BEGIN {
2018-10-14 18:19:23 +02:00
GP_Import (
qw(
AttrVal )
) ;
}
2018-10-08 21:05:47 +02:00
2018-10-30 08:18:09 +01:00
sub getShuttersOffset {
2018-10-30 19:10:50 +01:00
my $ self = shift ;
my $ name = $ self - > { name } ;
2018-10-30 08:18:09 +01:00
return AttrVal ( $ name , 'ASC_shuttersDriveOffset' , 0 ) ;
}
2018-10-12 06:32:01 +02:00
sub getBrightnessMinVal {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-12 06:32:01 +02:00
2018-10-17 09:50:11 +02:00
$ default = 8000 if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_brightnessMinVal' , $ default ) ;
2018-10-12 06:32:01 +02:00
}
sub getBrightnessMaxVal {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 20000 if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_brightnessMaxVal' , $ default ) ;
2018-10-12 06:32:01 +02:00
}
2018-10-08 21:05:47 +02:00
2018-11-14 03:41:38 +01:00
sub _getTwilightDevice {
my $ self = shift ;
my $ name = $ self - > { name } ;
return AttrVal ( $ name , 'ASC_twilightDevice' , 'none' ) ;
}
2018-10-10 10:43:42 +02:00
sub getAutoAstroModeEvening {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_autoAstroModeEvening' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getAutoAstroModeEveningHorizon {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
2018-10-08 21:05:47 +02:00
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_autoAstroModeEveningHorizon' , 0 ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getAutoAstroModeMorning {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_autoAstroModeMorning' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getAutoAstroModeMorningHorizon {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
2018-10-08 21:05:47 +02:00
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_autoAstroModeMorningHorizon' , 0 ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getAutoShuttersControlMorning {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_autoShuttersControlMorning' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getAutoShuttersControlEvening {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_autoShuttersControlEvening' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getAutoShuttersControlComfort {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
2018-10-08 21:05:47 +02:00
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_autoShuttersControlComfort' , 'off' ) ;
2018-10-08 21:05:47 +02:00
}
2018-11-12 12:56:18 +01:00
sub getFreezeTemp {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-11-12 12:56:18 +01:00
return AttrVal ( $ name , 'ASC_freezeTemp' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-11-12 12:56:18 +01:00
sub _getTempSensor {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_temperatureSensor' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-10-10 10:43:42 +02:00
sub getTempReading {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-08 21:05:47 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_temperatureReading' , $ default ) ;
2018-10-08 21:05:47 +02:00
}
2018-08-15 10:27:53 +02:00
2018-11-03 19:01:29 +01:00
sub _getResidentsDev {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-09 18:05:55 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'none' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_residentsDevice' , $ default ) ;
2018-10-09 18:05:55 +02:00
}
2018-10-10 10:43:42 +02:00
sub getResidentsReading {
2018-10-14 18:19:23 +02:00
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
2018-10-09 18:05:55 +02:00
2018-10-17 09:50:11 +02:00
$ default = 'state' if ( not defined ( $ default ) ) ;
2018-10-14 18:19:23 +02:00
return AttrVal ( $ name , 'ASC_residentsDeviceReading' , $ default ) ;
2018-10-09 18:05:55 +02:00
}
2018-10-27 13:36:11 +02:00
sub getRainSensor {
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
$ default = 'none' if ( not defined ( $ default ) ) ;
return AttrVal ( $ name , 'ASC_rainSensorDevice' , $ default ) ;
}
sub getRainSensorReading {
my $ self = shift ;
my $ name = $ self - > { name } ;
my $ default = $ self - > { defaultarg } ;
$ default = 'state' if ( not defined ( $ default ) ) ;
return AttrVal ( $ name , 'ASC_rainSensorReading' , $ default ) ;
}
sub getRainSensorShuttersClosedPos {
my $ self = shift ;
my $ name = $ self - > { name } ;
return AttrVal ( $ name , 'ASC_rainSensorShuttersClosedPos' , 50 ) ;
}
2018-08-15 10:27:53 +02:00
1 ;
= pod
= item device
= item summary Modul
= item summary_DE Modul zur Automatischen Rolladensteuerung auf Basis bestimmter Ereignisse
= begin html
< a name = "AutoShuttersControl" > </a>
2018-11-09 08:48:48 +01:00
<h3> Automatic shutter control - ASC </h3>
2018-08-15 10:27:53 +02:00
<ul>
2018-11-09 08:48:48 +01:00
<u> <b> AutoShuttersControl in short ASC , controls automatically your shutters following defined rules . i . e . sunrise , sunset or any window event </b> </u>
2018-09-14 20:46:55 +02:00
<br>
2018-11-09 08:48:48 +01:00
This modul shall control all shutters which are supervised by this Modul following the configuration of attributes in the shutter device . With fitting configuration a shutter will drive up if a resident gets awake and the sun has risen already . It is also possible by tilting a window to bring a closed shutter into airing position .
2018-09-14 20:46:55 +02:00
<br> <br>
< a name = "AutoShuttersControlDefine" > </a>
<b> Define </b>
<ul> <br>
<code> define & lt ; name & gt ; AutoShuttersControl </code>
<br> <br>
Example:
<ul> <br>
2018-11-12 12:56:18 +01:00
<code> define myASControl AutoShuttersControl </code> <br>
2018-09-14 20:46:55 +02:00
</ul>
<br>
2018-11-12 12:56:18 +01:00
This command creates a AutoShuttersControl device named myASControl . <br>
2018-11-09 08:48:48 +01:00
After creating the device , all shutter devices which shall be controlled have to get set the attribut AutoShuttersControl with value 1 or 2 . <br>
Value 1 means "Inverse or shutter e.g.: shutter up 0,shutter down 100 and the command for percentual movement is position" , 2 = " Homematic Style e . g . : shutter up 100 , shutter down 0 and the command for percentual movement istpct . <br>
If the attribute is set , you may start automatic scan for your devices .
2018-09-14 20:46:55 +02:00
</ul>
<br> <br>
< a name = "AutoShuttersControlReadings" > </a>
<b> Readings </b>
<ul>
2018-11-09 08:48:48 +01:00
Im Modul Device
2018-09-14 20:46:55 +02:00
<ul>
2018-11-09 08:48:48 +01:00
<li> ... _nextAstroTimeEvent - time of the next astro event , sunrise , sunset or fixed time per shuttername </li>
<li> ... _PosValue - actual position of shutter </li>
<li> ... _lastPosValue - last position of shutter </li>
<li> ... _lastDelayPosValue - last drive command which is executed at the next permitted event ( example: delay because Partymode ) </li>
<li> partyMode - on /off activates the global partymode, all shutters with the attribute ASC_Partymode set to on will not be moved. The last command which had been send by a window event or resident state, will be send again if ASC-Device partyMode is set to off</ li >
<li> lockOut - on /off to activate the lock out mode for the selected shutter. (see description of attributes for die shutterdevices)</ li >
<li> room_ ... - list of all shutters found in respective rooms , e . g . : room_sleepingroom , terrasse </li>
<li> state - state of the devices active , enabled , disabled </li>
<li> sunriseTimeWeHoliday - on /off respects the attribute ASC_Time_Up_WE_Holiday </ li >
<li> userAttrList - list of user attributea which will be send to shutters </li>
2018-09-14 20:46:55 +02:00
</ul> <br>
2018-11-09 08:48:48 +01:00
Inside the shutter devices
2018-09-14 20:46:55 +02:00
<ul>
2018-11-09 08:48:48 +01:00
<li> ASC_Time_DriveUp - sunrise time for this shutter </li>
<li> ASC_Time_DriveDown - sunset time for this shutter </li>
<li> ASC_ShuttersLastDrive - last reason for the shutter to move </li>
2018-09-14 20:46:55 +02:00
</ul>
</ul>
<br> <br>
< a name = "AutoShuttersControlSet" > </a>
<b> Set </b>
<ul>
2018-11-09 08:48:48 +01:00
<li> partyMode - on /off activates the global party mode. see reading partyMode</ li >
<li> lockOut - on /off activates the global lock out mode. see reading lockOut</ li >
<li> renewSetSunriseSunsetTimer - refreshes the timer for sunset , sunrise and the internal timers . </li>
2018-11-12 12:56:18 +01:00
<li> scanForShutters - searches all FHEM devices with attribute "ASC" 1 /2</ li >
2018-11-09 08:48:48 +01:00
<li> sunriseTimeWeHoliday - on /off activates/ deactivates respecting attribute ASC_Time_Up_WE_Holiday </li>
2018-11-11 12:31:20 +01:00
<li> createNewNotifyDev - recreates the internal structure for NOTIFYDEV - attribute ASC_expert has value 1 . </li>
2018-11-09 08:48:48 +01:00
<li> selfDefense - on /off,activates/ deactivates the mode self defense . If the resident device says absent and selfDefense is active , each shutter for open windows will be closed . </li>
<li> wiggle - moves any shutter ( for deterrence purposes ) by 5 % up , and after 1 minute down again to last position . </li>
2018-09-14 20:46:55 +02:00
</ul>
<br> <br>
< a name = "AutoShuttersControlGet" > </a>
<b> Get </b>
<ul>
2018-11-09 08:48:48 +01:00
<li> showShuttersInformations - shows an overview of all times /timers</ li >
2018-11-11 12:31:20 +01:00
<li> showNotifyDevsInformations - shows an overview of all notify devices . Is used for control - attribute ASC_expert has value 1 </li>
2018-09-14 20:46:55 +02:00
</ul>
<br> <br>
< a name = "AutoShuttersControlAttributes" > </a>
<b> Attributes </b>
<ul>
2018-11-09 08:48:48 +01:00
In module device
2018-09-14 20:46:55 +02:00
<ul>
2018-11-12 12:56:18 +01:00
<li> ASC_freezeTemp - temperature which inhibits movement of shutter . The last drive command will be stored . </li>
2018-11-09 08:48:48 +01:00
<li> ASC_autoAstroModeEvening - actual REAL , CIVIL , NAUTIC , ASTRONOMIC </li>
<li> ASC_autoAstroModeEveningHorizon - heighth above horizon if HORIZON is selected at attribute ASC_autoAstroModeEvening . </li>
<li> ASC_autoAstroModeMorning - actual REAL , CIVIL , NAUTIC , ASTRONOMIC </li>
<li> ASC_autoAstroModeMorningHorizon - heighth above horizon if HORIZON is selected at attribute ASC_autoAstroModeMorning . </li>
2018-11-15 10:15:36 +01:00
<li> ASC_autoShuttersControlComfort - on /off turns on comfort function. Means a shutter with threestate sensor moves to a wide open position. The open position is set at shutter with the attribute ASC_ComfortOpen_Pos.</ li >
2018-11-09 08:48:48 +01:00
<li> ASC_autoShuttersControlEvening - on /off if the shutters shall be controlled by time in the evening.</ li >
<li> ASC_autoShuttersControlMorning - on /off if the shutters shall be controlled by time in the morning.</ li >
<li> ASC_temperatureReading - Reading for outside temperature . </li>
<li> ASC_temperatureSensor - Device for outside temperature . </li>
<li> ASC_timeUpHolidayDevice - Device for holiday detection or similar . </li>
<li> ASC_timeUpHolidayReading - corrsponding reading for ASC_timeUpHolidayDevice to detect holiday or similar / has to content 0 or 1.</ li >
<li> ASC_residentsDevice - devicename of the residents device </li>
<li> ASC_residentsDeviceReading - state of the residents device </li>
<li> ASC_brightnessMinVal - minimum brightness value to activate check of conditions </li>
<li> ASC_brightnessMaxVal - maximum brightness value to activate check of conditions </li>
<li> ASC_rainSensorDevice - device which triggers when it is raining </li>
<li> ASC_rainSensorReading - reading of rain sensor device </li>
<li> ASC_rainSensorShuttersClosedPos - position to be reached if it is raining . </li>
<li> ASC_shuttersDriveOffset - maximum delay time in seconds for drivetimes , 0 means no delay </li>
2018-11-15 10:15:36 +01:00
<li> ASC_twilightDevice - Device which provides information about the position of the sun , is used for shading , among other things </li>
2018-09-14 20:46:55 +02:00
</ul> <br>
2018-11-09 08:48:48 +01:00
In the shutter devices
2018-09-14 20:46:55 +02:00
<ul>
2018-11-09 08:48:48 +01:00
<li> AutoShuttersControl - 0 /1/ 2 1 = "Inverse or shutter e.g.: shutter upn 0,shutter down 100 and the command to travel is position" , 2 = " Homematic Style e . g . : shutter up 100 , shutter down 0 and the command to travel is pct </li>
2018-11-18 08:13:58 +01:00
<li> ASC_Antifreeze - soft /hard/o ff antifreeze if soft the shutters frive into the ASC_Antifreeze_Pos and if hard / am / pm is not driven or not driven within the appropriate time of day </li>
<li> ASC_Antifreeze_Pos - Position to be approached when the move command closes completely , but the frost protection is active </li>
2018-11-09 08:48:48 +01:00
<li> ASC_AutoAstroModeEvening - actual REAL , CIVIL , NAUTIC , ASTRONOMIC </li>
<li> ASC_AutoAstroModeEveningHorizon - heighth above horizon if HORIZON is selected at attribute ASC_autoAstroModeEvening . </li>
<li> ASC_AutoAstroModeMorning - actual REAL , CIVIL , NAUTIC , ASTRONOMIC </li>
<li> ASC_AutoAstroModeMorningHorizon - heighth above horizon if HORIZON is selected at attribute ASC_autoAstroModeMorning . </li>
2018-11-12 12:56:18 +01:00
<li> ASC_Closed_Pos - in 10 th steps from 0 to 100 , default value is pending on attribute ASC </li>
2018-11-09 08:48:48 +01:00
<li> ASC_Down - astro /time/ brightness with astro sunset will be calculated , with time the value of ASC_Time_Down_Early will be used and with brightness ASC_Time_Down_Early and ASC_Time_Down_Late has to be defined corectly . The timer uses ASC_Time_Down_Late time , during this time ASC_Time_Down_Early and ASC_Time_Down_Late are respected also , to control ASC_brightnessMinVal . If reached the shutter will travel down . </li>
<li> ASC_Mode_Down - always /home/ absent /off automatic is used: always/ home /absent/o ff ( if no roommate defined and absent is set no control will happen ) </li>
<li> ASC_Mode_Up - always /home/ absent /off automatic is used: always/ home /absent/o ff ( if no roommate defined and absent is set no control will happen ) </li>
<li> ASC_Drive_Offset - maximum random delay in seconds for calculating drivetimes , 0 means no delay , - 1 means the corresponding attribute of the ASC device shall be taken into account . </li>
2018-11-12 12:56:18 +01:00
<li> ASC_Open_Pos - in 10 th steps from 0 bis 100 , default value is pending from attribute ASC </li>
2018-11-09 08:48:48 +01:00
<li> ASC_Partymode - on /off turns the partymode on or off. In case of setting ASC-DEVICE to partyMode on, all drive commands of the shutters which have the attribute set to on, will be stored for later usage.</ li >
<li> ASC_Pos_Reading - name of the reading which represents the position of the shutter in percent , is used at unknown device types for set command . </li>
2018-11-15 10:15:36 +01:00
<li> ASC_ComfortOpen_Pos - in 10 th steps from 0 bis 100 , default value is pending from attribute ASC </li>
2018-11-09 08:48:48 +01:00
<li> ASC_Roommate_Reading - the reading of the roommate device which represents the state </li>
<li> ASC_Roommate_Device - comma seperated names of the roommate device /s representing the habitants of the room of the shutter. Senseless in in any rooms besides sleepingroom and childrens room.</ li >
<li> ASC_Time_Down_Early - Sunset earliest time to travel down </li>
<li> ASC_Time_Down_Late - Sunset latest time to travel down </li>
<li> ASC_Time_Up_Early - Sunrise earliest time to travel up </li>
<li> ASC_Time_Up_Late - Sunrise latest time to travel up </li>
<li> ASC_Time_Up_WE_Holiday - Sunrise earliest time to travel up at weekend and /or holiday (we2holiday is respected). Attention should not be bigger than ASC_Time_Up_Late otherwise ASC_Time_Up_Late will be used.</ li >
<li> ASC_Up - astro /time/ brightness with astro sunrise is calculated , with time the value of ASC_Time_Up_Early is used and with brightness ASC_Time_Up_Early and ASC_Time_Up_Late has to be set correctly . The Timer starts after ASC_Time_Up_Late , but during this time ASC_Time_Up_Early and ASC_Time_Up_Late are used , in combination with the attribute ASC_brightnessMinVal reached , if yes the shutter will travel down </li>
2018-11-12 12:56:18 +01:00
<li> ASC_Ventilate_Pos - in 10 th steps from 0 bis 100 , default value is pending from attribute ASC </li>
2018-11-09 08:48:48 +01:00
<li> ASC_Ventilate_Window_Open - drive to airing position if the window is tilted or opened and actual position is below airing position </li>
<li> ASC_WindowRec - name of the window sensor mounted to window </li>
<li> ASC_WindowRec_subType - type of the used window sensor: twostate ( optical oder magnetic ) or threestate ( rotating handle sensor ) </li>
2018-11-14 15:26:32 +01:00
<li> ASC_LockOut - soft /hard/o ff sets the lock out mode . With global activated lock out mode ( set ASC - Device lockOut soft ) and window sensor open , the shutter stays up . This is true only , if commands are given by ASC module . Is global set to hard , the shutter is blocked by hardware if possible . In this case a locally mounted switch can ' t be used either . </li>
<li> ASC_LockOut_Cmd - inhibit /blocked set command for the shutter-device for hardware interlock. Possible if "ASC_LockOut" is set to hard</ li >
2018-11-09 08:48:48 +01:00
<li> ASC_Self_Defense_Exclude - on /off to exclude this shutter from active Self Defense. Shutter will not be closed if window is open and residents are absent.</ li >
<li> ASC_Shading_Brightness_Sensor - Sensor device used for brightness . ATTENTION ! Is used also for ASC_Down - brightness </li>
<li> ASC_BrightnessMinVal - minimum brightness value to activate check of conditions / if the value -1 is not changed, the value of the module device is used.</ li >
<li> ASC_BrightnessMaxVal - maximum brightness value to activate check of conditions / if the value -1 is not changed, the value of the module device is used.</ li >
<li> ASC_ShuttersPlace - window /terrace, if this attribute is set to terrace and the residents device are in state "gone"and SelfDefence is active the shutter will be closed</ li >
2018-09-14 20:46:55 +02:00
</ul>
</ul>
2018-08-15 10:27:53 +02:00
</ul>
= end html
= begin html_DE
< a name = "AutoShuttersControl" > </a>
2018-11-12 12:56:18 +01:00
<h3> Automatische Rollladensteuerung - ASC </h3>
2018-08-15 10:27:53 +02:00
<ul>
2018-11-12 12:56:18 +01:00
<u> <b> AutoShuttersControl - oder kurz ASC - steuert automatisch Deine Rollläden nach bestimmten Vorgaben . Zum Beispiel Sonnenaufgang und Sonnenuntergang oder je nach Fenstervent </b> </u>
2018-08-15 10:27:53 +02:00
<br>
2018-11-12 12:56:18 +01:00
Dieses Modul soll alle vom Modul & uuml ; berwachten Rolll & auml ; den entsprechend der Konfiguration & uuml ; ber die Attribute im Rollladen Device steuern . Es wird bei entsprechender Konfiguration zum Beispiel die Rolll & auml ; den hochfahren , wenn ein Bewohner erwacht ist und draussen bereits die Sonne aufgegangen ist . Auch ist es m & ouml ; glich , dass der geschlossene Rollladen bei Ankippen eines Fensters in eine L & uuml ; ftungsposition f & auml ; hrt .
2018-09-05 15:50:14 +02:00
<br> <br>
< a name = "AutoShuttersControlDefine" > </a>
<b> Define </b>
<ul> <br>
<code> define & lt ; name & gt ; AutoShuttersControl </code>
<br> <br>
Example:
<ul> <br>
2018-11-12 12:56:18 +01:00
<code> define myASControl AutoShuttersControl </code> <br>
2018-09-05 15:50:14 +02:00
</ul>
<br>
2018-11-12 12:56:18 +01:00
Der Befehl erstellt ein AutoShuttersControl Device mit Namen myASControl . <br>
Nachdem das Device angelegt wurde , muss in allen Rolll & auml ; den Devices , welche gesteuert werden sollen , das Attribut ASC mit Wert 1 oder 2 gesetzt werden . <br>
Dabei bedeutet 1 = "Inverse oder Rollo - Bsp.: Rollo Oben 0,Rollo Unten 100 und der Befehl zum prozentualen Fahren ist position" , 2 = " Homematic Style - Bsp . : Rollo Oben 100 , Rollo Unten 0 und der Befehl zum prozentualen Fahren ist pct . <br>
Habt Ihr das Attribut gesetzt , k & ouml ; nnt Ihr den automatischen Scan nach den Devices anstossen .
2018-09-05 15:50:14 +02:00
</ul>
<br> <br>
< a name = "AutoShuttersControlReadings" > </a>
<b> Readings </b>
<ul>
Im Modul Device
<ul>
2018-11-12 12:56:18 +01:00
<li> ... _nextAstroTimeEvent - Uhrzeit des n & auml ; chsten Astro Events: Sonnenauf - oder Sonnenuntergang oder feste Zeit pro Rollonamen </li>
<li> ... _PosValue - aktuelle Position des Rollladen </li>
<li> ... _lastPosValue - letzte Position des Rollladen </li>
<li> ... _lastDelayPosValue - letzter abgesetzter Fahrbefehl , welcher beim n & auml ; chsten zul & auml ; ssigen Event ausgef & uuml ; hrt wird . </li>
<li> partyMode - on /off - aktiviert den globalen Partymodus: Alle Rollladen Devices, welche das Attribut ASC_Partymode auf on gestellt haben, werden nicht mehr gesteuert. Der letzte Schaltbefehl, der durch ein Fensterevent oder Bewohnerstatus an die Rollläden gesendet wurde, wird beim off setzen durch set ASC-Device partyMode off ausgeführt</ li >
2018-11-14 15:26:32 +01:00
<li> lockOut - on /off - für das Aktivieren des Aussperrschutzes gemäß des entsprechenden Attributs ASC_LockOut im jeweiligen Rollladen. (siehe Beschreibung bei den Attributen für die Rollladendevices)</ li >
2018-11-12 12:56:18 +01:00
<li> room_ ... - Auflistung aller Rolll & auml ; den , welche in den jeweiligen R & auml ; men gefunden wurde , Bsp . : room_Schlafzimmer , Terrasse </li>
<li> state - Status des Devices: active , enabled , disabled oder Info zur letzten Fahrt </li>
<li> sunriseTimeWeHoliday - on /off - wird das Rollladen Device Attribut ASC_Time_Up_WE_Holiday beachtet oder nicht</ li >
<li> userAttrList - Status der UserAttribute , welche an die Rolll & auml ; den gesendet werden </li>
2018-09-05 15:50:14 +02:00
</ul> <br>
2018-11-12 12:56:18 +01:00
In den Rolll & auml ; den Devices
2018-09-05 15:50:14 +02:00
<ul>
2018-11-12 12:56:18 +01:00
<li> ASC_Time_DriveUp - Sonnenaufgangszeit f & uuml ; r das Rollo </li>
2018-09-28 08:57:25 +02:00
<li> ASC_Time_DriveDown - Sonnenuntergangszeit f & uuml ; r das Rollo </li>
2018-11-12 12:56:18 +01:00
<li> ASC_ShuttersLastDrive - Grund des letzten Fahrens vom Rollladen </li>
2018-09-05 15:50:14 +02:00
</ul>
</ul>
<br> <br>
< a name = "AutoShuttersControlSet" > </a>
<b> Set </b>
<ul>
2018-11-12 12:56:18 +01:00
<li> partyMode - on /off - aktiviert den globalen Partymodus. Siehe Reading partyMode</ li >
<li> lockOut - on /off - aktiviert den globalen Aussperrschutz. Siehe Reading partyMode</ li >
<li> renewSetSunriseSunsetTimer - erneuert bei allen Rolll & auml ; den die Zeiten f & uuml ; r Sunset und Sunrise und setzt die internen Timer neu . </li>
<li> scanForShutters - sucht alle FHEM Devices mit dem Attribut "ASC" = 1 oder 2 </li>
<li> sunriseTimeWeHoliday - on /off - aktiviert/ deaktiviert die Beachtung des Rollladen Device Attributes ASC_Time_Up_WE_Holiday </li>
2018-11-11 12:31:20 +01:00
<li> createNewNotifyDev - Legt die interne Struktur f & uuml ; r NOTIFYDEV neu an - das Attribut ASC_expert muss 1 sein . </li>
2018-11-12 12:56:18 +01:00
<li> selfDefense - on /off - aktiviert/ deaktiviert den Selbstschutz , wenn das Residents Device absent meldet , selfDefense aktiv ist und ein Fenster im Haus noch offen steht , wird an diesem Fenster das Rollo runtergefahren </li>
2018-11-09 08:48:48 +01:00
<li> wiggle - bewegt einen Rollladen oder alle Rolll & auml ; den ( f & uuml ; r Abschreckungszwecke bei der Alarmierung ) um 5 % , und nach 1 Minute wieder zur & uuml ; ck zur Ursprungsposition </li>
2018-09-05 15:50:14 +02:00
</ul>
<br> <br>
< a name = "AutoShuttersControlGet" > </a>
<b> Get </b>
<ul>
2018-10-08 03:59:51 +02:00
<li> showShuttersInformations - zeigt eine & Uuml ; bersicht der Autofahrzeiten </li>
2018-11-12 12:56:18 +01:00
<li> showNotifyDevsInformations - zeigt eine & Uuml ; bersicht der abgelegten NOTIFYDEV Struktur . Dient zur Kontrolle - das Attribut ASC_expert muss 1 sein . </li>
2018-09-05 15:50:14 +02:00
</ul>
<br> <br>
< a name = "AutoShuttersControlAttributes" > </a>
<b> Attributes </b>
<ul>
Im Modul Device
<ul>
2018-11-12 12:56:18 +01:00
<li> ASC_freezeTemp - Temperatur , ab welcher der Frostschutz greifen soll und das Rollo nicht mehr f & auml ; hrt . Der letzte Fahrbefehl wird gespeichert . </li>
2018-10-14 18:19:23 +02:00
<li> ASC_autoAstroModeEvening - aktuell REAL , CIVIL , NAUTIC , ASTRONOMIC </li>
2018-09-28 08:57:25 +02:00
<li> ASC_autoAstroModeEveningHorizon - H & ouml ; he & uuml ; ber Horizont wenn beim Attribut ASC_autoAstroModeEvening HORIZON ausgew & auml ; hlt </li>
2018-10-14 18:19:23 +02:00
<li> ASC_autoAstroModeMorning - aktuell REAL , CIVIL , NAUTIC , ASTRONOMIC </li>
2018-09-28 08:57:25 +02:00
<li> ASC_autoAstroModeMorningHorizon - H & ouml ; he & uuml ; ber Horizont wenn beim Attribut ASC_autoAstroModeMorning HORIZON ausgew & auml ; hlt </li>
2018-11-15 10:15:36 +01:00
<li> ASC_autoShuttersControlComfort - on /off - schaltet die Komfortfunktion an. Bedeutet, dass ein Rollladen mit einem threestate Sensor am Fenster beim öffnen in eine Offenposition fährt, die beim Rollladen über das Attribut ASC_ComfortOpen_Pos eingestellt wird.</ li >
2018-11-12 12:56:18 +01:00
<li> ASC_autoShuttersControlEvening - on /off - ob Abends die Rollläden automatisch nach Zeit gesteuert werden sollen</ li >
<li> ASC_autoShuttersControlMorning - on /off - ob Morgens die Rollläden automatisch nach Zeit gesteuert werden sollen</ li >
2018-09-28 08:57:25 +02:00
<li> ASC_temperatureReading - Reading f & uuml ; r die Aussentemperatur </li>
<li> ASC_temperatureSensor - Device f & uuml ; r die Aussentemperatur </li>
2018-11-08 08:32:47 +01:00
<li> ASC_timeUpHolidayDevice - Device zur Urlaubserkennung oder Sonstiges / muss 0 oder 1 im Reading beinhalten.</ li >
<li> ASC_timeUpHolidayReading - passendes Reading zum ASC_timeUpHolidayDevice zur Urlaubserkennung oder Sonstiges / muss 0 oder 1 beinhalten.</ li >
2018-11-12 12:56:18 +01:00
<li> ASC_residentsDevice - Devicenamen des Residents Device der obersten Ebene </li>
2018-10-09 18:05:55 +02:00
<li> ASC_residentsDeviceReading - Status Reading vom Residents Device der obersten Ebene </li>
2018-11-12 12:56:18 +01:00
<li> ASC_brightnessMinVal - minimaler Lichtwert , bei dem Schaltbedingungen gepr & uuml ; ft werden sollen </li>
<li> ASC_brightnessMaxVal - maximaler Lichtwert , bei dem Schaltbedingungen gepr & uuml ; ft werden sollen </li>
<li> ASC_rainSensorDevice - Device , welches bei Regen getriggert werden soll </li>
2018-10-27 13:36:11 +02:00
<li> ASC_rainSensorReading - das ensprechende Reading zum Regendevice </li>
2018-11-12 12:56:18 +01:00
<li> ASC_rainSensorShuttersClosedPos - Position in pct , welche der Rollladen anfahren soll , wenn es Regnet </li>
<li> ASC_shuttersDriveOffset - maximal zuf & auml ; llige Verz & ouml ; gerung in Sekunden bei der Berechnung der Fahrzeiten , 0 bedeutet keine Verz & ouml ; gerung </li>
2018-11-15 10:15:36 +01:00
<li> ASC_twilightDevice - Device welches Informationen zum Sonnenstand liefert , wird unter anderem f & uuml ; r die Beschattung verwendet . </li>
2018-11-11 12:31:20 +01:00
<li> ASC_expert - ist der Wert 1 werden erweiterte Informationen bez & uuml ; glich des NotifyDevs unter set und get angezeigt </li>
2018-09-05 15:50:14 +02:00
</ul> <br>
2018-11-12 12:56:18 +01:00
In den Rolll & auml ; den Devices
2018-09-05 15:50:14 +02:00
<ul>
2018-11-12 12:56:18 +01:00
<li> ASC - 0 /1/ 2 1 = "Inverse oder Rollo - Bsp.: Rollo Oben 0, Rollo Unten 100 und der Befehl zum prozentualen Fahren ist position" , 2 = " Homematic Style - Bsp . : Rollo Oben 100 , Rollo Unten 0 und der Befehl zum prozentualen Fahren ist pct </li>
2018-11-18 08:13:58 +01:00
<li> ASC_Antifreeze - soft /am/ pm /hard/o ff - Frostschutz , wenn soft f & auml ; hrt der Rollladen in die ASC_Antifreeze_Pos und wenn hard /am/ pm wird gar nicht oder innerhalb der entsprechenden Tageszeit nicht gefahren </li>
<li> ASC_Antifreeze_Pos - Position die angefahren werden soll wenn der Fahrbefehl komplett schlie & szlig ; en lautet , aber der Frostschutz aktiv ist </li>
2018-10-14 18:19:23 +02:00
<li> ASC_AutoAstroModeEvening - aktuell REAL , CIVIL , NAUTIC , ASTRONOMIC </li>
2018-09-28 08:57:25 +02:00
<li> ASC_AutoAstroModeEveningHorizon - H & ouml ; he & uuml ; ber Horizont wenn beim Attribut ASC_autoAstroModeEvening HORIZON ausgew & auml ; hlt </li>
2018-10-14 18:19:23 +02:00
<li> ASC_AutoAstroModeMorning - aktuell REAL , CIVIL , NAUTIC , ASTRONOMIC </li>
2018-09-28 08:57:25 +02:00
<li> ASC_AutoAstroModeMorningHorizon - H & ouml ; he & uuml ; ber Horizont wenn beim Attribut ASC_autoAstroModeMorning HORIZON ausgew & auml ; hlt </li>
2018-11-12 12:56:18 +01:00
<li> ASC_Closed_Pos - in 10 Schritten von 0 bis 100 , Default ist abh & auml ; ngig vom Attribut ASC </li>
<li> ASC_Down - astro /time/ brightness - bei astro wird Sonnenuntergang berechnet , bei time wird der Wert aus ASC_Time_Down_Early als Fahrzeit verwendet und bei brightness muss ASC_Time_Down_Early und ASC_Time_Down_Late korrekt gesetzt werden . Der Timer l & auml ; uft dann nach ASC_Time_Down_Late Zeit , es wird aber in der Zeit zwischen ASC_Time_Down_Early und ASC_Time_Down_Late geschaut , ob die als Attribut im Moduldevice hinterlegte ASC_brightnessMinVal erreicht wurde . Wenn ja , wird der Rollladen runter gefahren </li>
<li> ASC_Mode_Down - always /home/ absent /off - Wann darf die Automatik steuern. immer, niemals, bei Abwesenheit des Roommate (ist kein Roommate und absent eingestellt, wird gar nicht gesteuert)</ li >
<li> ASC_Mode_Up - always /home/ absent /off - Wann darf die Automatik steuern. immer, niemals, bei Abwesenheit des Roommate (ist kein Roommate und absent eingestellt, wird gar nicht gesteuert)</ li >
<li> ASC_Drive_Offset - maximale zuf & auml ; llige Verz & ouml ; gerung in Sekunden bei der Berechnung der Fahrzeiten , 0 bedeutet keine Verz & ouml ; gerung , - 1 bedeutet , dass das gleichwertige Attribut aus dem ASC Device ausgewertet werden soll . </li>
<li> ASC_Open_Pos - in 10 Schritten von 0 bis 100 , Default ist abh & auml ; ngig vom Attribut ASC </li>
<li> ASC_Partymode - on /off - schaltet den Partymodus an oder aus. Wird am ASC Device set ASC-DEVICE partyMode on geschalten, werden alle Fahrbefehle an den Rollläden, welche das Attribut auf on haben, zwischengespeichert und später erst ausgeführt</ li >
<li> ASC_Pos_Reading - Name des Readings , welches die Position des Rollladen in Prozent an gibt ; wird bei unbekannten Device Typen auch als set Befehl zum fahren verwendet </li>
2018-11-15 10:15:36 +01:00
<li> ASC_ComfortOpen_Pos - in 10 Schritten von 0 bis 100 , Default ist abh & auml ; ngig vom Attribut ASC </li>
2018-11-12 12:56:18 +01:00
<li> ASC_Roommate_Reading - das Reading zum Roommate Device , welches den Status wieder gibt </li>
<li> ASC_Roommate_Device - mit Komma getrennte Namen des /der Roommate Device/s , welche den /die Bewohner des Raumes vom Rollladen wiedergibt. Es macht nur Sinn in Schlaf- oder Kinderzimmern</ li >
<li> ASC_Time_Down_Early - Sunset fr & uuml ; hste Zeit zum Runterfahren </li>
<li> ASC_Time_Down_Late - Sunset sp & auml ; teste Zeit zum Runterfahren </li>
<li> ASC_Time_Up_Early - Sunrise fr & uuml ; hste Zeit zum Hochfahren </li>
<li> ASC_Time_Up_Late - Sunrise sp & auml ; teste Zeit zum Hochfahren </li>
<li> ASC_Time_Up_WE_Holiday - Sunrise fr & uuml ; hste Zeit zum Hochfahren am Wochenende und /oder Urlaub (we2holiday wird beachtet). Achtung: Sollte nicht größer sein als ASC_Time_Up_Late, sonst wird ASC_Time_Up_Late verwendet</ li >
<li> ASC_Up - astro /time/ brightness - bei astro wird Sonnenaufgang berechnet , bei time wird der Wert aus ASC_Time_Up_Early als Fahrzeit verwendet und bei brightness muss ASC_Time_Up_Early und ASC_Time_Up_Late korrekt gesetzt werden . Der Timer l & auml ; uft dann nach ASC_Time_Up_Late Zeit , es wird aber in der Zeit zwischen ASC_Time_Up_Early und ASC_Time_Up_Late geschaut , ob die als Attribut im Moduldevice hinterlegte ASC_brightnessMinVal erreicht wurde . Wenn ja , wird der Rollladen runtergefahren </li>
<li> ASC_Ventilate_Pos - in 10 Schritten von 0 bis 100 , Default ist abh & auml ; ngig vom Attribut ASC </li>
<li> ASC_Ventilate_Window_Open - auf l & uuml ; ften , wenn das Fenster gekippt /geöffnet wird und aktuelle Position unterhalb der Lüften-Position ist</ li >
<li> ASC_WindowRec - Name des Fensterkontaktes , an dessen Fenster der Rollladen angebracht ist </li>
<li> ASC_WindowRec_subType - Typ des verwendeten Fensterkontaktes: twostate ( optisch oder magnetisch ) oder threestate ( Drehgriffkontakt ) </li>
2018-11-14 15:26:32 +01:00
<li> ASC_LockOut - soft /hard/o ff - stellt entsprechend den Aussperrschutz ein . Bei global aktivem Aussperrschutz ( set ASC - Device lockOut soft ) und einem Fensterkontakt open bleibt dann der Rollladen oben . Dies gilt nur bei Steuerbefehle über das ASC Modul . Stellt man global auf hard , wird bei entsprechender M & ouml ; glichkeit versucht den Rollladen hardwareseitig zu blockieren . Dann ist auch ein Fahren & uuml ; ber die Taster nicht mehr m & ouml ; glich . </li>
<li> ASC_LockOut_Cmd - inhibit /blocked - set Befehl für das Rollladen-Device zum Hardware sperren. Dieser Befehl wird gesetzt werden, wenn man "ASC_LockOut" auf hard setzt</ li >
2018-11-12 12:56:18 +01:00
<li> ASC_Self_Defense_Exclude - on /off - bei on Wert wird dieser Rollladen bei aktiven Self Defense und offenen Fenster nicht runter gefahren, wenn Residents absent ist.</ li >
<li> ASC_Shading_Brightness_Sensor - Sensor Device , welches f & uuml ; r die Lichtwerte verwendet wird . ACHTUNG ! Findet auch Verwendung bei ASC_Down - brightness </li>
<li> ASC_BrightnessMinVal - minimaler Lichtwert , bei dem Schaltbedingungen gepr & uuml ; ft werden sollen / wird der Wert von -1 nicht geändert, so wird automatisch der Wert aus dem Moduldevice genommen</ li >
<li> ASC_BrightnessMaxVal - maximaler Lichtwert , bei dem Schaltbedingungen gepr & uuml ; ft werden sollen / wird der Wert von -1 nicht geändert, so wird automatisch der Wert aus dem Moduldevice genommen</ li >
<li> ASC_ShuttersPlace - window /terrace - Wenn dieses Attribut auf terrace gesetzt ist, das Residence Device in den Status "done" geht und SelfDefence aktiv ist, wird das Rollo geschlossen</ li >
<li> ASC_WiggleValue - Wert um welchen sich die Position des Rollladens & auml ; ndern soll </li>
2018-09-05 15:50:14 +02:00
</ul>
</ul>
2018-08-15 10:27:53 +02:00
</ul>
= end html_DE
= cut