From 35a4f60a535c7cda4055f0dcc4ce4a1cda9f73b1 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sun, 2 Jan 2022 06:42:49 +0100 Subject: [PATCH 1/4] chnage require@ISA to use base --- controls_AutoShuttersControl.txt | 18 +++++++++--------- lib/FHEM/Automation/ShuttersControl/Dev.pm | 2 +- .../EventProcessingFunctions.pm | 4 +++- lib/FHEM/Automation/ShuttersControl/Helper.pm | 4 +++- .../ShuttersControl/Rainprotection.pm | 4 +++- .../Automation/ShuttersControl/Roommate.pm | 17 +++++++++++++++++ lib/FHEM/Automation/ShuttersControl/Shading.pm | 4 +++- .../Automation/ShuttersControl/Shutters.pm | 2 +- lib/FHEM/Automation/ShuttersControl/Window.pm | 2 +- 9 files changed, 41 insertions(+), 16 deletions(-) diff --git a/controls_AutoShuttersControl.txt b/controls_AutoShuttersControl.txt index 2d3b235..997435f 100644 --- a/controls_AutoShuttersControl.txt +++ b/controls_AutoShuttersControl.txt @@ -1,16 +1,16 @@ UPD 2022-01-01_20:15:38 115601 FHEM/73_AutoShuttersControl.pm -UPD 2022-01-01_20:15:38 75212 lib/FHEM/Automation/ShuttersControl.pm -UPD 2022-01-01_20:15:38 2693 lib/FHEM/Automation/ShuttersControl/Dev.pm -UPD 2022-01-01_20:15:38 2405 lib/FHEM/Automation/ShuttersControl/Roommate.pm -UPD 2022-01-01_20:15:38 32020 lib/FHEM/Automation/ShuttersControl/Shutters.pm -UPD 2022-01-01_20:15:38 25426 lib/FHEM/Automation/ShuttersControl/Shading.pm -UPD 2022-01-01_20:20:47 112096 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm -UPD 2022-01-01_20:15:38 40296 lib/FHEM/Automation/ShuttersControl/Helper.pm -UPD 2022-01-01_20:15:38 2211 lib/FHEM/Automation/ShuttersControl/Window.pm +UPD 2022-01-02_06:41:53 75212 lib/FHEM/Automation/ShuttersControl.pm +UPD 2022-01-02_06:39:39 2691 lib/FHEM/Automation/ShuttersControl/Dev.pm +UPD 2022-01-02_06:34:39 2677 lib/FHEM/Automation/ShuttersControl/Roommate.pm +UPD 2022-01-02_06:41:11 32018 lib/FHEM/Automation/ShuttersControl/Shutters.pm +UPD 2022-01-02_06:37:09 25452 lib/FHEM/Automation/ShuttersControl/Shading.pm +UPD 2022-01-02_06:36:31 112122 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm +UPD 2022-01-02_06:34:28 40322 lib/FHEM/Automation/ShuttersControl/Helper.pm +UPD 2022-01-02_06:41:32 2209 lib/FHEM/Automation/ShuttersControl/Window.pm UPD 2022-01-01_20:15:38 11706 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm UPD 2022-01-01_20:15:38 7265 lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm UPD 2022-01-01_20:15:38 52751 lib/FHEM/Automation/ShuttersControl/Shutters/Attr.pm UPD 2022-01-01_20:15:38 2799 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm UPD 2022-01-01_20:15:38 3887 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm UPD 2022-01-01_20:15:38 2200 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm -UPD 2022-01-01_20:15:38 7087 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +UPD 2022-01-02_06:36:44 7113 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm diff --git a/lib/FHEM/Automation/ShuttersControl/Dev.pm b/lib/FHEM/Automation/ShuttersControl/Dev.pm index 88f2b82..ced5bc4 100644 --- a/lib/FHEM/Automation/ShuttersControl/Dev.pm +++ b/lib/FHEM/Automation/ShuttersControl/Dev.pm @@ -43,7 +43,7 @@ package FHEM::Automation::ShuttersControl::Dev; use FHEM::Automation::ShuttersControl::Dev::Readings; use FHEM::Automation::ShuttersControl::Dev::Attr; -our @ISA = +use base qw(FHEM::Automation::ShuttersControl::Dev::Readings FHEM::Automation::ShuttersControl::Dev::Attr); use strict; diff --git a/lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm b/lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm index cd1625e..32eef96 100644 --- a/lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm +++ b/lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm @@ -52,7 +52,9 @@ use FHEM::Automation::ShuttersControl::Shading qw (:ALL); use FHEM::Automation::ShuttersControl::Rainprotection qw (:ALL); require Exporter; -our @ISA = qw(Exporter); +use base qw(Exporter); + +# our @ISA = qw(Exporter); our @EXPORT_OK = qw( EventProcessingPartyMode EventProcessingGeneral diff --git a/lib/FHEM/Automation/ShuttersControl/Helper.pm b/lib/FHEM/Automation/ShuttersControl/Helper.pm index bcbb9a7..6ca7c17 100644 --- a/lib/FHEM/Automation/ShuttersControl/Helper.pm +++ b/lib/FHEM/Automation/ShuttersControl/Helper.pm @@ -46,7 +46,9 @@ use POSIX qw(strftime); use utf8; require Exporter; -our @ISA = qw(Exporter); +use base qw(Exporter); + +# our @ISA = qw(Exporter); our @EXPORT_OK = qw( PositionValueWindowRec AutoSearchTwilightDev diff --git a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm index 0e16f28..e351dd8 100644 --- a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +++ b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm @@ -47,7 +47,9 @@ use utf8; use FHEM::Automation::ShuttersControl::Helper qw (:ALL); require Exporter; -our @ISA = qw(Exporter); +use base qw(Exporter); + +# our @ISA = qw(Exporter); our @EXPORT_OK = qw( RainProcessing ); diff --git a/lib/FHEM/Automation/ShuttersControl/Roommate.pm b/lib/FHEM/Automation/ShuttersControl/Roommate.pm index bde2368..2a99cb6 100644 --- a/lib/FHEM/Automation/ShuttersControl/Roommate.pm +++ b/lib/FHEM/Automation/ShuttersControl/Roommate.pm @@ -44,6 +44,23 @@ use strict; use warnings; use utf8; +require Exporter; +use base qw(Exporter); + +# our @ISA = qw(Exporter); +our @EXPORT_OK = qw( + getRoommateStatus + getRoommateLastStatus +); +our %EXPORT_TAGS = ( + ALL => [ + qw( + getRoommateStatus + getRoommateLastStatus + ) + ], +); + sub getRoommateStatus { my $self = shift; diff --git a/lib/FHEM/Automation/ShuttersControl/Shading.pm b/lib/FHEM/Automation/ShuttersControl/Shading.pm index f8718cf..2079187 100644 --- a/lib/FHEM/Automation/ShuttersControl/Shading.pm +++ b/lib/FHEM/Automation/ShuttersControl/Shading.pm @@ -48,7 +48,9 @@ use utf8; use FHEM::Automation::ShuttersControl::Helper qw (IsInTime); require Exporter; -our @ISA = qw(Exporter); +use base qw(Exporter); + +# our @ISA = qw(Exporter); our @EXPORT_OK = qw( CheckASC_ConditionsForShadingFn ShadingProcessing diff --git a/lib/FHEM/Automation/ShuttersControl/Shutters.pm b/lib/FHEM/Automation/ShuttersControl/Shutters.pm index c09db22..5d399cb 100644 --- a/lib/FHEM/Automation/ShuttersControl/Shutters.pm +++ b/lib/FHEM/Automation/ShuttersControl/Shutters.pm @@ -54,7 +54,7 @@ use FHEM::Automation::ShuttersControl::Shutters::Attr; use FHEM::Automation::ShuttersControl::Roommate; use FHEM::Automation::ShuttersControl::Window; -our @ISA = +use base qw(FHEM::Automation::ShuttersControl::Shutters::Readings FHEM::Automation::ShuttersControl::Shutters::Attr FHEM::Automation::ShuttersControl::Roommate FHEM::Automation::ShuttersControl::Window); sub new { diff --git a/lib/FHEM/Automation/ShuttersControl/Window.pm b/lib/FHEM/Automation/ShuttersControl/Window.pm index e13547a..595353b 100644 --- a/lib/FHEM/Automation/ShuttersControl/Window.pm +++ b/lib/FHEM/Automation/ShuttersControl/Window.pm @@ -47,7 +47,7 @@ use utf8; use FHEM::Automation::ShuttersControl::Window::Attr; use FHEM::Automation::ShuttersControl::Window::Readings; -our @ISA = +use base qw(FHEM::Automation::ShuttersControl::Window::Attr FHEM::Automation::ShuttersControl::Window::Readings); 1; -- 2.45.2 From 842e41e3dc64296abfe7a055b3b6fb0269842e1e Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sun, 2 Jan 2022 07:13:04 +0100 Subject: [PATCH 2/4] export object variable --- controls_AutoShuttersControl.txt | 6 +++--- lib/FHEM/Automation/ShuttersControl.pm | 10 ++++++---- lib/FHEM/Automation/ShuttersControl/Helper.pm | 2 ++ lib/FHEM/Automation/ShuttersControl/Shutters.pm | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/controls_AutoShuttersControl.txt b/controls_AutoShuttersControl.txt index 997435f..320620f 100644 --- a/controls_AutoShuttersControl.txt +++ b/controls_AutoShuttersControl.txt @@ -1,11 +1,11 @@ UPD 2022-01-01_20:15:38 115601 FHEM/73_AutoShuttersControl.pm -UPD 2022-01-02_06:41:53 75212 lib/FHEM/Automation/ShuttersControl.pm +UPD 2022-01-02_07:04:23 75300 lib/FHEM/Automation/ShuttersControl.pm UPD 2022-01-02_06:39:39 2691 lib/FHEM/Automation/ShuttersControl/Dev.pm UPD 2022-01-02_06:34:39 2677 lib/FHEM/Automation/ShuttersControl/Roommate.pm -UPD 2022-01-02_06:41:11 32018 lib/FHEM/Automation/ShuttersControl/Shutters.pm +UPD 2022-01-02_07:04:24 32028 lib/FHEM/Automation/ShuttersControl/Shutters.pm UPD 2022-01-02_06:37:09 25452 lib/FHEM/Automation/ShuttersControl/Shading.pm UPD 2022-01-02_06:36:31 112122 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm -UPD 2022-01-02_06:34:28 40322 lib/FHEM/Automation/ShuttersControl/Helper.pm +UPD 2022-01-02_07:04:20 40382 lib/FHEM/Automation/ShuttersControl/Helper.pm UPD 2022-01-02_06:41:32 2209 lib/FHEM/Automation/ShuttersControl/Window.pm UPD 2022-01-01_20:15:38 11706 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm UPD 2022-01-01_20:15:38 7265 lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm diff --git a/lib/FHEM/Automation/ShuttersControl.pm b/lib/FHEM/Automation/ShuttersControl.pm index 488dfca..a9bfd58 100644 --- a/lib/FHEM/Automation/ShuttersControl.pm +++ b/lib/FHEM/Automation/ShuttersControl.pm @@ -139,6 +139,12 @@ eval { ## Import der FHEM Funktionen #-- Run before package compilation BEGIN { + ## 2 Objekte werden erstellt + our $shutters = FHEM::Automation::ShuttersControl::Shutters->new(); + our $ascDev = FHEM::Automation::ShuttersControl::Dev->new(); + + use Exporter qw(import); + our @EXPORT_OK = qw / $shutters $ascDev /; # Import from main context GP_Import( @@ -269,10 +275,6 @@ my %posSetCmds = ( EnOcean => 'position', ); -## 2 Objekte werden erstellt -our $shutters = FHEM::Automation::ShuttersControl::Shutters->new(); -our $ascDev = FHEM::Automation::ShuttersControl::Dev->new(); - sub ascAPIget { my $getCommand = shift; my $shutterDev = shift; diff --git a/lib/FHEM/Automation/ShuttersControl/Helper.pm b/lib/FHEM/Automation/ShuttersControl/Helper.pm index 6ca7c17..f466885 100644 --- a/lib/FHEM/Automation/ShuttersControl/Helper.pm +++ b/lib/FHEM/Automation/ShuttersControl/Helper.pm @@ -88,6 +88,8 @@ our %EXPORT_TAGS = ( ], ); +use FHEM::Automation::ShuttersControl '$shutters $ascDev'; + use GPUtils qw(GP_Import); ## Import der FHEM Funktionen BEGIN { diff --git a/lib/FHEM/Automation/ShuttersControl/Shutters.pm b/lib/FHEM/Automation/ShuttersControl/Shutters.pm index 5d399cb..9a9c398 100644 --- a/lib/FHEM/Automation/ShuttersControl/Shutters.pm +++ b/lib/FHEM/Automation/ShuttersControl/Shutters.pm @@ -51,7 +51,7 @@ use utf8; use FHEM::Automation::ShuttersControl::Shutters::Readings; use FHEM::Automation::ShuttersControl::Shutters::Attr; -use FHEM::Automation::ShuttersControl::Roommate; +use FHEM::Automation::ShuttersControl::Roommate qw (:ALL); use FHEM::Automation::ShuttersControl::Window; use base -- 2.45.2 From 8109cd7ebe7715501490f5c875dd14f24b4f007b Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sun, 2 Jan 2022 07:49:03 +0100 Subject: [PATCH 3/4] change condition syntax of SetFn --- controls_AutoShuttersControl.txt | 4 +- lib/FHEM/Automation/ShuttersControl.pm | 633 +++++++++--------- lib/FHEM/Automation/ShuttersControl/Helper.pm | 2 - 3 files changed, 321 insertions(+), 318 deletions(-) diff --git a/controls_AutoShuttersControl.txt b/controls_AutoShuttersControl.txt index 320620f..dc61363 100644 --- a/controls_AutoShuttersControl.txt +++ b/controls_AutoShuttersControl.txt @@ -1,11 +1,11 @@ UPD 2022-01-01_20:15:38 115601 FHEM/73_AutoShuttersControl.pm -UPD 2022-01-02_07:04:23 75300 lib/FHEM/Automation/ShuttersControl.pm +UPD 2022-01-02_07:48:22 75806 lib/FHEM/Automation/ShuttersControl.pm UPD 2022-01-02_06:39:39 2691 lib/FHEM/Automation/ShuttersControl/Dev.pm UPD 2022-01-02_06:34:39 2677 lib/FHEM/Automation/ShuttersControl/Roommate.pm UPD 2022-01-02_07:04:24 32028 lib/FHEM/Automation/ShuttersControl/Shutters.pm UPD 2022-01-02_06:37:09 25452 lib/FHEM/Automation/ShuttersControl/Shading.pm UPD 2022-01-02_06:36:31 112122 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm -UPD 2022-01-02_07:04:20 40382 lib/FHEM/Automation/ShuttersControl/Helper.pm +UPD 2022-01-02_07:31:19 40322 lib/FHEM/Automation/ShuttersControl/Helper.pm UPD 2022-01-02_06:41:32 2209 lib/FHEM/Automation/ShuttersControl/Window.pm UPD 2022-01-01_20:15:38 11706 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm UPD 2022-01-01_20:15:38 7265 lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm diff --git a/lib/FHEM/Automation/ShuttersControl.pm b/lib/FHEM/Automation/ShuttersControl.pm index a9bfd58..432c7e2 100644 --- a/lib/FHEM/Automation/ShuttersControl.pm +++ b/lib/FHEM/Automation/ShuttersControl.pm @@ -72,6 +72,7 @@ use FHEM::Meta; use GPUtils qw(GP_Import GP_Export); use Data::Dumper; #only for Debugging use Date::Parse; +use experimental qw( switch ); use FHEM::Automation::ShuttersControl::Shutters; use FHEM::Automation::ShuttersControl::Dev; @@ -139,43 +140,25 @@ eval { ## Import der FHEM Funktionen #-- Run before package compilation BEGIN { - ## 2 Objekte werden erstellt - our $shutters = FHEM::Automation::ShuttersControl::Shutters->new(); - our $ascDev = FHEM::Automation::ShuttersControl::Dev->new(); - - use Exporter qw(import); - our @EXPORT_OK = qw / $shutters $ascDev /; - # Import from main context GP_Import( qw( - devspec2array - readingsSingleUpdate - readingsBulkUpdate - readingsBulkUpdateIfChanged - readingsBeginUpdate - readingsEndUpdate defs modules - Log3 - CommandAttr attr - CommandDeleteAttr - CommandDeleteReading - CommandSet readingFnAttributes - AttrVal - ReadingsVal - IsDisabled - deviceEvents - init_done - addToDevAttrList - addToAttrList - delFromDevAttrList - delFromAttrList - gettimeofday - InternalTimer - RemoveInternalTimer) + ::AttrVal + ::ReadingsVal + ::IsDisabled + ::deviceEvents + ::init_done + ::addToDevAttrList + ::addToAttrList + ::delFromDevAttrList + ::delFromAttrList + ::gettimeofday + ::InternalTimer + ::RemoveInternalTimer) ); #-- Export to main context with different name @@ -258,6 +241,10 @@ our %userAttrList = ( 'ASC_SlatPosCmd_SlatDevice' => '-', ); +## 2 Objekte werden erstellt +our $shutters = FHEM::Automation::ShuttersControl::Shutters->new(); +our $ascDev = FHEM::Automation::ShuttersControl::Dev->new(); + my %posSetCmds = ( ZWave => 'dim', Siro => 'pct', @@ -323,7 +310,7 @@ sub Define { use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' ); return 'only one AutoShuttersControl instance allowed' - if ( devspec2array('TYPE=AutoShuttersControl') > 1 ) + 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 ShuttersControl' if ( scalar( @{$aArg} ) != 2 ); @@ -338,24 +325,24 @@ sub Define { #$hash->{ascDev} = $ascDev; $ascDev->setName($name); - readingsSingleUpdate( + ::readingsSingleUpdate( $hash, 'state', 'please set attribute ASC with value 1 or 2 in all auto controlled shutter devices and then execute \'set DEVICENAME scanForShutters\'', 1 ); - 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, + ::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 . ' devStateIcon { ShuttersControl_DevStateIcon($name) }' ) - if ( AttrVal( $name, 'devStateIcon', 'none' ) eq 'none' ); + if ( ::AttrVal( $name, 'devStateIcon', 'none' ) eq 'none' ); - addToAttrList( 'ASC:0,1,2', 'AutoShuttersControl' ); + ::addToAttrList( 'ASC:0,1,2', 'AutoShuttersControl' ); - Log3( $name, 3, "AutoShuttersControl ($name) - defined" ); + ::Log3( $name, 3, "AutoShuttersControl ($name) - defined" ); $modules{AutoShuttersControl}{defptr}{ $hash->{MID} } = $hash; @@ -368,11 +355,11 @@ sub Undef { UserAttributs_Readings_ForShutters( $hash, 'del' ) ; # es sollen alle Attribute und Readings in den Rolläden Devices gelöscht werden welche vom Modul angelegt wurden - delFromAttrList('ASC:0,1,2'); + ::delFromAttrList('ASC:0,1,2'); delete( $modules{AutoShuttersControl}{defptr}{ $hash->{MID} } ); - Log3( $name, 3, "AutoShuttersControl ($name) - delete device $name" ); + ::Log3( $name, 3, "AutoShuttersControl ($name) - delete device $name" ); return; } @@ -400,10 +387,10 @@ sub Notify { my $name = $hash->{NAME}; my $devname = $dev->{NAME}; my $devtype = $dev->{TYPE}; - my $events = deviceEvents( $dev, 1 ); + my $events = ::deviceEvents( $dev, 1 ); return if ( !$events ); - Log3( $name, 4, + ::Log3( $name, 4, "AutoShuttersControl ($name) - Devname: " . $devname . " Name: " @@ -414,7 +401,7 @@ sub Notify { if ( ( grep m{^DEFINED.$name$}xms, - @{$events} && $devname eq 'global' && $init_done + @{$events} && $devname eq 'global' && $::init_done ) || ( grep m{^INITIALIZED$}xms, @@ -425,34 +412,36 @@ sub Notify { && $devname eq 'global' ) { - readingsSingleUpdate( $hash, 'partyMode', 'off', 0 ) + ::readingsSingleUpdate( $hash, 'partyMode', 'off', 0 ) if ( $ascDev->getPartyMode eq 'none' ); - readingsSingleUpdate( $hash, 'hardLockOut', 'off', 0 ) + ::readingsSingleUpdate( $hash, 'hardLockOut', 'off', 0 ) if ( $ascDev->getHardLockOut eq 'none' ); - readingsSingleUpdate( $hash, 'sunriseTimeWeHoliday', 'off', 0 ) + ::readingsSingleUpdate( $hash, 'sunriseTimeWeHoliday', 'off', 0 ) if ( $ascDev->getSunriseTimeWeHoliday eq 'none' ); - readingsSingleUpdate( $hash, 'selfDefense', 'off', 0 ) + ::readingsSingleUpdate( $hash, 'selfDefense', 'off', 0 ) if ( $ascDev->getSelfDefense eq 'none' ); - readingsSingleUpdate( $hash, 'controlShading', 'off', 0 ) + ::readingsSingleUpdate( $hash, 'controlShading', 'off', 0 ) if ( $ascDev->getAutoShuttersControlShading eq 'none' ); - readingsSingleUpdate( $hash, 'ascEnable', 'on', 0 ) + ::readingsSingleUpdate( $hash, 'ascEnable', 'on', 0 ) if ( $ascDev->getASCenable eq 'none' ); - CommandAttr( undef, + ::CommandAttr( undef, $name . ' devStateIcon { ShuttersControl_DevStateIcon($name) }' ) if ( - AttrVal( + ::AttrVal( $name, 'devStateIcon', '{ ShuttersControl_DevStateIcon($name) }' ) ne '{ ShuttersControl_DevStateIcon($name) }' ); - CommandDeleteAttr( undef, $name . ' event-on-change-reading' ) - if ( AttrVal( $name, 'event-on-change-reading', 'none' ) ne 'none' ); - CommandDeleteAttr( undef, $name . ' event-on-update-reading' ) - if ( AttrVal( $name, 'event-on-update-reading', 'none' ) ne 'none' ); + ::CommandDeleteAttr( undef, $name . ' event-on-change-reading' ) + if ( + ::AttrVal( $name, 'event-on-change-reading', 'none' ) ne 'none' ); + ::CommandDeleteAttr( undef, $name . ' event-on-update-reading' ) + if ( + ::AttrVal( $name, 'event-on-update-reading', 'none' ) ne '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) - if ( ReadingsVal( $name, 'userAttrList', 'none' ) ne 'none' ); + if ( ::ReadingsVal( $name, 'userAttrList', 'none' ) ne 'none' ); } return if ( ref( $hash->{helper}{shuttersList} ) ne 'ARRAY' @@ -465,22 +454,25 @@ sub Notify { if ( scalar( @{ $hash->{helper}{shuttersList} } ) > 0 ) { WriteReadingsShuttersList($hash); UserAttributs_Readings_ForShutters( $hash, 'add' ); - InternalTimer( - gettimeofday() + 3, + ::InternalTimer( + ::gettimeofday() + 3, 'FHEM::Automation::ShuttersControl::RenewSunRiseSetShuttersTimer', $hash ); - InternalTimer( - gettimeofday() + 5, + ::InternalTimer( + ::gettimeofday() + 5, 'FHEM::Automation::ShuttersControl::AutoSearchTwilightDev', $hash ); - InternalTimer( - gettimeofday() + 5, - sub() { CommandSet( undef, $name . ' controlShading on' ) }, + ::InternalTimer( + ::gettimeofday() + 5, + sub() { + ::CommandSet( undef, $name . ' controlShading on' ); + }, $hash ) - if ( ReadingsVal( $name, 'controlShading', 'off' ) ne 'off' ); + if ( + ::ReadingsVal( $name, 'controlShading', 'off' ) ne 'off' ); } } elsif ( grep m{^partyMode:.off$}xms, @{$events} ) { @@ -526,104 +518,109 @@ sub Set { my $cmd = shift @$aArg // return qq{"set $name" needs at least one argument}; - if ( lc $cmd eq 'renewalltimer' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) != 0 ); - RenewSunRiseSetShuttersTimer($hash); - } - elsif ( lc $cmd eq 'renewtimer' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); - CreateSunRiseSetShuttersTimer( $hash, $aArg->[0] ); - } - elsif ( lc $cmd eq 'scanforshutters' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) != 0 ); - ShuttersDeviceScan($hash); - } - elsif ( lc $cmd eq 'createnewnotifydev' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) != 0 ); - CreateNewNotifyDev($hash); - } - elsif ( lc $cmd eq 'partymode' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); - readingsSingleUpdate( $hash, $cmd, $aArg->[0], 1 ) - if ( $aArg->[0] ne ReadingsVal( $name, 'partyMode', 0 ) ); - } - elsif ( lc $cmd eq 'hardlockout' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); - readingsSingleUpdate( $hash, $cmd, $aArg->[0], 1 ); - HardewareBlockForShutters( $hash, $aArg->[0] ); - } - elsif ( lc $cmd eq 'sunrisetimeweholiday' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); - readingsSingleUpdate( $hash, $cmd, $aArg->[0], 1 ); - } - elsif ( lc $cmd eq 'controlshading' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); + given ($cmd) { + when ('renewalltimer') { + return "usage: $cmd" if ( scalar( @{$aArg} ) != 0 ); + RenewSunRiseSetShuttersTimer($hash); + } + when ('renewtimer') { + return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); + CreateSunRiseSetShuttersTimer( $hash, $aArg->[0] ); + } + when ('scanforshutters') { + return "usage: $cmd" if ( scalar( @{$aArg} ) != 0 ); + ShuttersDeviceScan($hash); + } + when ('createnewnotifydev') { + return "usage: $cmd" if ( scalar( @{$aArg} ) != 0 ); + CreateNewNotifyDev($hash); + } + when ('partymode') { + return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); + ::readingsSingleUpdate( $hash, $cmd, $aArg->[0], 1 ) + if ( $aArg->[0] ne ::ReadingsVal( $name, 'partyMode', 0 ) ); + } + when ('hardlockout') { + return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); + ::readingsSingleUpdate( $hash, $cmd, $aArg->[0], 1 ); + HardewareBlockForShutters( $hash, $aArg->[0] ); + } + when ('sunrisetimeweholiday') { + return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); + ::readingsSingleUpdate( $hash, $cmd, $aArg->[0], 1 ); + } + when ('controlshading') { + return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); - my $response = CheckASC_ConditionsForShadingFn( $hash, $aArg->[0] ); - readingsSingleUpdate( - $hash, $cmd, - ( - $aArg->[0] eq 'off' ? $aArg->[0] - : ( - $response eq 'none' ? $aArg->[0] - : $response - ) - ), - 1 - ); - } - elsif ( lc $cmd eq 'selfdefense' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); - readingsSingleUpdate( $hash, $cmd, $aArg->[0], 1 ); - } - elsif ( lc $cmd eq 'ascenable' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); - readingsSingleUpdate( $hash, $cmd, $aArg->[0], 1 ); - } - elsif ( lc $cmd eq 'advdrivedown' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) != 0 ); - EventProcessingAdvShuttersClose($hash); - } - elsif ( lc $cmd eq 'shutterascenabletoggle' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); - readingsSingleUpdate( - $defs{ $aArg->[0] }, - 'ASC_Enable', - ( - ReadingsVal( $aArg->[0], 'ASC_Enable', 'off' ) eq 'on' - ? 'off' - : 'on' - ), - 1 - ); - } - elsif ( lc $cmd eq 'wiggle' ) { - return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); + my $response = CheckASC_ConditionsForShadingFn( $hash, $aArg->[0] ); + ::readingsSingleUpdate( + $hash, $cmd, + ( + $aArg->[0] eq 'off' ? $aArg->[0] + : ( + $response eq 'none' ? $aArg->[0] + : $response + ) + ), + 1 + ); + } + when ('selfdefense') { + return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); + ::readingsSingleUpdate( $hash, $cmd, $aArg->[0], 1 ); + } + when ('ascenable') { + return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); + ::readingsSingleUpdate( $hash, $cmd, $aArg->[0], 1 ); + } + when ('advdrivedown') { + return "usage: $cmd" if ( scalar( @{$aArg} ) != 0 ); + EventProcessingAdvShuttersClose($hash); + } + when ('shutterascenabletoggle') { + return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); + ::readingsSingleUpdate( + $defs{ $aArg->[0] }, + 'ASC_Enable', + ( + ::ReadingsVal( $aArg->[0], 'ASC_Enable', 'off' ) eq 'on' + ? 'off' + : 'on' + ), + 1 + ); + } + when ('wiggle') { + return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); - ( - $aArg->[0] eq 'all' - ? wiggleAll($hash) - : wiggle( $hash, $aArg->[0] ) - ); - } - else { - my $list = 'scanForShutters:noArg'; - $list .= + ( + $aArg->[0] eq 'all' + ? wiggleAll($hash) + : wiggle( $hash, $aArg->[0] ) + ); + } + default { + my $list = 'scanForShutters:noArg'; + $list .= ' renewAllTimer:noArg advDriveDown:noArg partyMode:on,off hardLockOut:on,off sunriseTimeWeHoliday:on,off controlShading:on,off selfDefense:on,off ascEnable:on,off wiggle:all,' - . join( ',', @{ $hash->{helper}{shuttersList} } ) - . ' shutterASCenableToggle:' - . join( ',', @{ $hash->{helper}{shuttersList} } ) - . ' renewTimer:' - . join( ',', @{ $hash->{helper}{shuttersList} } ) - if ( ReadingsVal( $name, 'userAttrList', 'none' ) eq 'rolled out' - && defined( $hash->{helper}{shuttersList} ) - && scalar( @{ $hash->{helper}{shuttersList} } ) > 0 ); - $list .= ' createNewNotifyDev:noArg' - if ( ReadingsVal( $name, 'userAttrList', 'none' ) eq 'rolled out' - && AttrVal( $name, 'ASC_expert', 0 ) == 1 ); + . join( ',', @{ $hash->{helper}{shuttersList} } ) + . ' shutterASCenableToggle:' + . join( ',', @{ $hash->{helper}{shuttersList} } ) + . ' renewTimer:' + . join( ',', @{ $hash->{helper}{shuttersList} } ) + if ( + ::ReadingsVal( $name, 'userAttrList', 'none' ) eq 'rolled out' + && defined( $hash->{helper}{shuttersList} ) + && scalar( @{ $hash->{helper}{shuttersList} } ) > 0 ); + $list .= ' createNewNotifyDev:noArg' + if ( + ::ReadingsVal( $name, 'userAttrList', 'none' ) eq 'rolled out' + && ::AttrVal( $name, 'ASC_expert', 0 ) == 1 ); - return "Unknown argument $cmd,choose one of $list"; + return "Unknown argument $cmd,choose one of $list"; + } } + return; } @@ -643,8 +640,8 @@ sub Get { else { my $list = ""; $list .= " showNotifyDevsInformations:noArg" - if ( ReadingsVal( $name, 'userAttrList', 'none' ) eq 'rolled out' - && AttrVal( $name, 'ASC_expert', 0 ) == 1 ); + if ( ::ReadingsVal( $name, 'userAttrList', 'none' ) eq 'rolled out' + && ::AttrVal( $name, 'ASC_expert', 0 ) == 1 ); return "Unknown argument $cmd,choose one of $list"; } @@ -658,15 +655,15 @@ sub ShuttersDeviceScan { delete $hash->{helper}{shuttersList}; my @list; - @list = devspec2array('ASC=[1-2]'); + @list = ::devspec2array('ASC=[1-2]'); - CommandDeleteReading( undef, $name . ' .*_nextAstroTimeEvent' ); + ::CommandDeleteReading( undef, $name . ' .*_nextAstroTimeEvent' ); if ( scalar(@list) == 0 ) { - readingsBeginUpdate($hash); - readingsBulkUpdate( $hash, 'userAttrList', 'none' ); - readingsBulkUpdate( $hash, 'state', 'no shutters found' ); - readingsEndUpdate( $hash, 1 ); + ::readingsBeginUpdate($hash); + ::readingsBulkUpdate( $hash, 'userAttrList', 'none' ); + ::readingsBulkUpdate( $hash, 'state', 'no shutters found' ); + ::readingsEndUpdate( $hash, 1 ); return; } my $shuttersList = ''; @@ -681,25 +678,25 @@ sub ShuttersDeviceScan { #### vorher empfiehlt es sich die dort vergebenen Parameter aus zu lesen um sie dann hier wieder neu zu setzen. Dazu wird das shutters Objekt um einen Eintrag #### 'AttrUpdateChanges' erweitert if ( - ReadingsVal( + ::ReadingsVal( $shuttersDev, '.ASC_AttrUpdateChanges_' . $hash->{VERSION}, 0 ) == 0 ) { $shutters->setAttrUpdateChanges( 'ASC_ShuttersPlace', - AttrVal( $shuttersDev, 'ASC_ShuttersPlace', 'none' ) ); - delFromDevAttrList( $shuttersDev, 'ASC_ShuttersPlace' ); + ::AttrVal( $shuttersDev, 'ASC_ShuttersPlace', 'none' ) ); + ::delFromDevAttrList( $shuttersDev, 'ASC_ShuttersPlace' ); # $shutters->setAttrUpdateChanges( 'ASC_Down', -# AttrVal( $shuttersDev, 'ASC_Down', 'none' ) ); -# delFromDevAttrList( $shuttersDev, 'ASC_Down' ); +# ::AttrVal( $shuttersDev, 'ASC_Down', 'none' ) ); +# ::delFromDevAttrList( $shuttersDev, 'ASC_Down' ); # $shutters->setAttrUpdateChanges( 'ASC_Self_Defense_Mode', -# AttrVal( $shuttersDev, 'ASC_Self_Defense_Mode', 'none' ) ); -# delFromDevAttrList( $shuttersDev, 'ASC_Self_Defense_Mode' ); +# ::AttrVal( $shuttersDev, 'ASC_Self_Defense_Mode', 'none' ) ); +# ::delFromDevAttrList( $shuttersDev, 'ASC_Self_Defense_Mode' ); # $shutters->setAttrUpdateChanges( 'ASC_Self_Defense_Exclude', -# AttrVal( $shuttersDev, 'ASC_Self_Defense_Exclude', 'none' ) ); -# delFromDevAttrList( $shuttersDev, 'ASC_Self_Defense_Exclude' ); +# ::AttrVal( $shuttersDev, 'ASC_Self_Defense_Exclude', 'none' ) ); +# ::delFromDevAttrList( $shuttersDev, 'ASC_Self_Defense_Exclude' ); } #### @@ -720,8 +717,8 @@ sub ShuttersDeviceScan { # ( $shutters->getStatus != $shutters->getShadingPos ? 'in' : 'out' ) # ); $shutters->setPushBrightnessInArray( $shutters->getBrightness ); - readingsSingleUpdate( $defs{$shuttersDev}, 'ASC_Enable', 'on', 0 ) - if ( ReadingsVal( $shuttersDev, 'ASC_Enable', 'none' ) eq 'none' ); + ::readingsSingleUpdate( $defs{$shuttersDev}, 'ASC_Enable', 'on', 0 ) + if ( ::ReadingsVal( $shuttersDev, 'ASC_Enable', 'none' ) eq 'none' ); if ( $shutters->getIsDay ) { $shutters->setSunrise(1); @@ -745,7 +742,7 @@ sub ShuttersDeviceScan { $hash->{NOTIFYDEV} = $notifyDevString; } - readingsSingleUpdate( $hash, 'userAttrList', 'rolled out', 1 ); + ::readingsSingleUpdate( $hash, 'userAttrList', 'rolled out', 1 ); return; } @@ -756,20 +753,21 @@ sub WriteReadingsShuttersList { my $name = $hash->{NAME}; - CommandDeleteReading( undef, $name . ' room_.*' ); + ::CommandDeleteReading( undef, $name . ' room_.*' ); - readingsBeginUpdate($hash); + ::readingsBeginUpdate($hash); for my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) { - readingsBulkUpdate( + ::readingsBulkUpdate( $hash, 'room_' . ::makeReadingName( - AttrVal( $shuttersDev, 'room', 'unsorted' ) ), - ReadingsVal( + ::AttrVal( $shuttersDev, 'room', 'unsorted' ) + ), + ::ReadingsVal( $name, 'room_' . ::makeReadingName( - AttrVal( $shuttersDev, 'room', 'unsorted' ) + ::AttrVal( $shuttersDev, 'room', 'unsorted' ) ), '' ) @@ -777,36 +775,37 @@ sub WriteReadingsShuttersList { . $shuttersDev ) if ( - ReadingsVal( + ::ReadingsVal( $name, 'room_' . ::makeReadingName( - AttrVal( $shuttersDev, 'room', 'unsorted' ) + ::AttrVal( $shuttersDev, 'room', 'unsorted' ) ), 'none' ) ne 'none' ); - readingsBulkUpdate( + ::readingsBulkUpdate( $hash, 'room_' . ::makeReadingName( - AttrVal( $shuttersDev, 'room', 'unsorted' ) ), + ::AttrVal( $shuttersDev, 'room', 'unsorted' ) + ), $shuttersDev ) if ( - ReadingsVal( + ::ReadingsVal( $name, 'room_' . ::makeReadingName( - AttrVal( $shuttersDev, 'room', 'unsorted' ) + ::AttrVal( $shuttersDev, 'room', 'unsorted' ) ), 'none' ) eq 'none' ); } - readingsBulkUpdate( $hash, 'state', 'active' ); - readingsEndUpdate( $hash, 0 ); + ::readingsBulkUpdate( $hash, 'state', 'active' ); + ::readingsEndUpdate( $hash, 0 ); return; } @@ -819,7 +818,7 @@ sub UserAttributs_Readings_ForShutters { while ( my ( $attrib, $attribValue ) = each %{userAttrList} ) { for my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) { - addToDevAttrList( $shuttersDev, $attrib, 'AutoShuttersControl' ) + ::addToDevAttrList( $shuttersDev, $attrib, 'AutoShuttersControl' ) ; ## 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 ## Danach werden die Attribute die im userAttr stehen gesetzt und mit default Werten befüllt ## CommandAttr hat nicht funktioniert. Führte zu Problemen @@ -837,7 +836,7 @@ sub UserAttributs_Readings_ForShutters { } else { $attr{$shuttersDev}{ ( split( ':', $attrib ) )[0] } = - $attribValue->[ AttrVal( $shuttersDev, 'ASC', 2 ) ] + $attribValue->[ ::AttrVal( $shuttersDev, 'ASC', 2 ) ] if ( !defined( $attr{$shuttersDev}{ ( split( ':', $attrib ) )[0] } @@ -848,17 +847,17 @@ sub UserAttributs_Readings_ForShutters { ### associatedWith damit man sieht das der Rollladen mit einem ASC Device verbunden ist my $associatedString = - ReadingsVal( $shuttersDev, 'associatedWith', 'none' ); + ::ReadingsVal( $shuttersDev, 'associatedWith', 'none' ); if ( $associatedString ne 'none' ) { my %hash; %hash = map { ( $_ => 1 ) } split( ',', "$associatedString,$name" ); - readingsSingleUpdate( $defs{$shuttersDev}, + ::readingsSingleUpdate( $defs{$shuttersDev}, 'associatedWith', join( ',', sort keys %hash ), 0 ); } else { - readingsSingleUpdate( $defs{$shuttersDev}, + ::readingsSingleUpdate( $defs{$shuttersDev}, 'associatedWith', $name, 0 ); } ####################################### @@ -867,25 +866,25 @@ sub UserAttributs_Readings_ForShutters { elsif ( $cmd eq 'del' ) { $shutters->setShuttersDev($shuttersDev); - RemoveInternalTimer( $shutters->getInTimerFuncHash ); - CommandDeleteReading( undef, $shuttersDev . ' .?(ASC)_.*' ); - CommandDeleteAttr( undef, $shuttersDev . ' ASC' ); - delFromDevAttrList( $shuttersDev, $attrib ); + ::RemoveInternalTimer( $shutters->getInTimerFuncHash ); + ::CommandDeleteReading( undef, $shuttersDev . ' .?(ASC)_.*' ); + ::CommandDeleteAttr( undef, $shuttersDev . ' ASC' ); + ::delFromDevAttrList( $shuttersDev, $attrib ); ### associatedWith wird wieder entfernt my $associatedString = - ReadingsVal( $shuttersDev, 'associatedWith', 'none' ); + ::ReadingsVal( $shuttersDev, 'associatedWith', 'none' ); my %hash; %hash = map { ( $_ => 1 ) } grep { " $name " !~ m{ $shuttersDev }xms } split( ',', "$associatedString,$name" ); if ( keys %hash > 1 ) { - readingsSingleUpdate( $defs{$shuttersDev}, + ::readingsSingleUpdate( $defs{$shuttersDev}, 'associatedWith', join( ',', sort keys %hash ), 0 ); } else { - CommandDeleteReading( undef, + ::CommandDeleteReading( undef, $shuttersDev . ' associatedWith' ); } ################################### @@ -922,7 +921,7 @@ sub AddNotifyDev { $hash->{monitoredDevs}{$dev}{$shuttersDev} = $shuttersAttr; } - readingsSingleUpdate( $hash, '.monitoredDevs', + ::readingsSingleUpdate( $hash, '.monitoredDevs', eval { encode_json( $hash->{monitoredDevs} ) }, 0 ); return; @@ -940,7 +939,7 @@ sub DeleteNotifyDev { ExtractNotifyDevFromEvent( $hash, $shuttersDev, $shuttersAttr ); for my $notifyDev ( keys( %{$notifyDevs} ) ) { - Log3( $name, 4, + ::Log3( $name, 4, "AutoShuttersControl ($name) - DeleteNotifyDev - NotifyDev: " . $notifyDev ); delete $hash->{monitoredDevs}{$notifyDev}{$shuttersDev}; @@ -957,7 +956,7 @@ sub DeleteNotifyDev { $hash->{NOTIFYDEV} = join( ',', sort keys %hash ); } } - readingsSingleUpdate( $hash, '.monitoredDevs', + ::readingsSingleUpdate( $hash, '.monitoredDevs', eval { encode_json( $hash->{monitoredDevs} ) }, 0 ); return; @@ -1019,7 +1018,7 @@ sub ShuttersCommandSet { $shutters->setDelayCmd($posValue); $ascDev->setDelayCmdReading; $shutters->setNoDelay(0); - Log3( $name, 4, + ::Log3( $name, 4, "AutoShuttersControl ($name) - ShuttersCommandSet in Delay" ); ASC_Debug( 'FnShuttersCommandSet: ' @@ -1030,7 +1029,7 @@ sub ShuttersCommandSet { else { $shutters->setDriveCmd($posValue); $ascDev->setLastPosReading; - Log3( $name, 4, + ::Log3( $name, 4, "AutoShuttersControl ($name) - ShuttersCommandSet setDriveCmd wird aufgerufen" ); @@ -1046,18 +1045,20 @@ sub ShuttersCommandSet { ## Sub welche die InternalTimer nach entsprechenden Sunset oder Sunrise zusammen stellt sub CreateSunRiseSetShuttersTimer { my $hash = shift; - my $shuttersDev = shift // return Log3( $hash->{NAME}, 1, + my $shuttersDev = shift // return ::Log3( $hash->{NAME}, 1, "AutoShuttersControl ($hash->{NAME}) - Error in function CreateSunRiseSetShuttersTimer. No shuttersDev given" ); my $name = $hash->{NAME}; - my $shuttersDevHash = $defs{$shuttersDev} // return Log3( $hash->{NAME}, 1, + my $shuttersDevHash = $defs{$shuttersDev} // return ::Log3( + $hash->{NAME}, + 1, "AutoShuttersControl ($hash->{NAME}) - Error in function CreateSunRiseSetShuttersTimer. No shuttersDevHash found for device name $shuttersDev" ); my %funcHash; $shutters->setShuttersDev($shuttersDev); - return if ( IsDisabled($name) ); + return if ( ::IsDisabled($name) ); my $shuttersSunriseUnixtime = ShuttersSunrise( $shuttersDev, 'unix' ) + 1; my $shuttersSunsetUnixtime = ShuttersSunset( $shuttersDev, 'unix' ) + 1; @@ -1066,8 +1067,8 @@ sub CreateSunRiseSetShuttersTimer { $shutters->setSunsetUnixTime($shuttersSunsetUnixtime); ## In jedem Rolladen werden die errechneten Zeiten hinterlegt,es sei denn das autoShuttersControlEvening/Morning auf off steht - readingsBeginUpdate($shuttersDevHash); - readingsBulkUpdate( + ::readingsBeginUpdate($shuttersDevHash); + ::readingsBulkUpdate( $shuttersDevHash, 'ASC_Time_DriveDown', ( @@ -1081,7 +1082,7 @@ sub CreateSunRiseSetShuttersTimer { : 'AutoShuttersControl off' ) ); - readingsBulkUpdate( + ::readingsBulkUpdate( $shuttersDevHash, 'ASC_Time_DriveUp', ( @@ -1095,10 +1096,10 @@ sub CreateSunRiseSetShuttersTimer { : 'AutoShuttersControl off' ) ); - readingsEndUpdate( $shuttersDevHash, 0 ); + ::readingsEndUpdate( $shuttersDevHash, 0 ); - readingsBeginUpdate($hash); - readingsBulkUpdateIfChanged( + ::readingsBeginUpdate($hash); + ::readingsBulkUpdateIfChanged( $hash, $shuttersDev . '_nextAstroTimeEvent', ( @@ -1110,9 +1111,9 @@ sub CreateSunRiseSetShuttersTimer { ) ) ); - readingsEndUpdate( $hash, 1 ); + ::readingsEndUpdate( $hash, 1 ); - RemoveInternalTimer( $shutters->getInTimerFuncHash ) + ::RemoveInternalTimer( $shutters->getInTimerFuncHash ) if ( defined( $shutters->getInTimerFuncHash ) ); ## Setzt den Privacy Modus für die Sichtschutzfahrt auf den Status 0 @@ -1129,8 +1130,10 @@ sub CreateSunRiseSetShuttersTimer { PrivacyUpTime( $shuttersDevHash, $shuttersSunriseUnixtime ); } else { - CommandDeleteReading( undef, $shuttersDev . ' ASC_Time_PrivacyDriveUp' ) - if ( ReadingsVal( $shuttersDev, 'ASC_Time_PrivacyDriveUp', 'none' ) ne + ::CommandDeleteReading( undef, + $shuttersDev . ' ASC_Time_PrivacyDriveUp' ) + if ( + ::ReadingsVal( $shuttersDev, 'ASC_Time_PrivacyDriveUp', 'none' ) ne 'none' ); } @@ -1140,11 +1143,11 @@ sub CreateSunRiseSetShuttersTimer { PrivacyDownTime( $shuttersDevHash, $shuttersSunsetUnixtime ); } else { - CommandDeleteReading( undef, + ::CommandDeleteReading( undef, $shuttersDev . ' ASC_Time_PrivacyDriveDown' ) if ( - ReadingsVal( $shuttersDev, 'ASC_Time_PrivacyDriveDown', 'none' ) ne - 'none' ); + ::ReadingsVal( $shuttersDev, 'ASC_Time_PrivacyDriveDown', 'none' ) + ne 'none' ); } ## kleine Hilfe für InternalTimer damit ich alle benötigten Variablen an die Funktion übergeben kann welche von Internal Timer aufgerufen wird. @@ -1157,9 +1160,9 @@ sub CreateSunRiseSetShuttersTimer { ## Ich brauche beim löschen des InternalTimer den Hash welchen ich mitgegeben habe,dieser muss gesichert werden $shutters->setInTimerFuncHash( \%funcHash ); - InternalTimer( $shuttersSunsetUnixtime, \&SunSetShuttersAfterTimerFn, + ::InternalTimer( $shuttersSunsetUnixtime, \&SunSetShuttersAfterTimerFn, \%funcHash ); - InternalTimer( $shuttersSunriseUnixtime, \&SunRiseShuttersAfterTimerFn, + ::InternalTimer( $shuttersSunriseUnixtime, \&SunRiseShuttersAfterTimerFn, \%funcHash ); $ascDev->setStateReading('created new drive timer'); @@ -1176,7 +1179,7 @@ sub RenewSunRiseSetShuttersTimer { $shutters->setShuttersDev($shuttersDev); - RemoveInternalTimer( $shutters->getInTimerFuncHash ); + ::RemoveInternalTimer( $shutters->getInTimerFuncHash ); $shutters->setInTimerFuncHash(undef); CreateSunRiseSetShuttersTimer( $hash, $shuttersDev ); @@ -1185,8 +1188,8 @@ sub RenewSunRiseSetShuttersTimer { #### vorher empfiehlt es sich die dort vergebenen Parameter aus zu lesen um sie dann hier wieder neu zu setzen. Dazu wird das shutters Objekt um einen Eintrag #### 'AttrUpdateChanges' erweitert if ( - ( int( gettimeofday() ) - $::fhem_started ) < 60 - and ReadingsVal( + ( int( ::gettimeofday() ) - $::fhem_started ) < 60 + and ::ReadingsVal( $shuttersDev, '.ASC_AttrUpdateChanges_' . $hash->{VERSION}, 0 ) == 0 @@ -1209,63 +1212,65 @@ sub RenewSunRiseSetShuttersTimer { # $shutters->getAttrUpdateChanges('ASC_Self_Defense_Exclude') eq # 'on' ); - CommandDeleteReading( undef, + ::CommandDeleteReading( undef, $shuttersDev . ' .ASC_AttrUpdateChanges_.*' ) if ( - ReadingsVal( $shuttersDev, + ::ReadingsVal( $shuttersDev, '.ASC_AttrUpdateChanges_' . $hash->{VERSION}, 'none' ) eq 'none' ); - readingsSingleUpdate( $dhash, + ::readingsSingleUpdate( $dhash, '.ASC_AttrUpdateChanges_' . $hash->{VERSION}, 1, 0 ); } $attr{$shuttersDev}{ASC_BlockingTime_beforeNightClose} = - AttrVal( $shuttersDev, 'ASC_BlockingTime_beforNightClose', 'none' ) + ::AttrVal( $shuttersDev, 'ASC_BlockingTime_beforNightClose', 'none' ) if ( - AttrVal( $shuttersDev, 'ASC_BlockingTime_beforNightClose', 'none' ) - ne 'none' ); - delFromDevAttrList( $shuttersDev, 'ASC_BlockingTime_beforNightClose' ); + ::AttrVal( $shuttersDev, 'ASC_BlockingTime_beforNightClose', + 'none' ) ne 'none' + ); + ::delFromDevAttrList( $shuttersDev, + 'ASC_BlockingTime_beforNightClose' ); $attr{$shuttersDev}{ASC_BlockingTime_beforeDayOpen} = - AttrVal( $shuttersDev, 'ASC_BlockingTime_beforDayOpen', 'none' ) + ::AttrVal( $shuttersDev, 'ASC_BlockingTime_beforDayOpen', 'none' ) if ( - AttrVal( $shuttersDev, 'ASC_BlockingTime_beforDayOpen', 'none' ) ne - 'none' ); - delFromDevAttrList( $shuttersDev, 'ASC_BlockingTime_beforDayOpen' ); + ::AttrVal( $shuttersDev, 'ASC_BlockingTime_beforDayOpen', 'none' ) + ne 'none' ); + ::delFromDevAttrList( $shuttersDev, 'ASC_BlockingTime_beforDayOpen' ); # # $attr{$shuttersDev}{ASC_Shading_StateChange_SunnyCloudy} = -# AttrVal( $shuttersDev, 'ASC_Shading_StateChange_Sunny', 'none' ) . ':' -# . AttrVal( $shuttersDev, 'ASC_Shading_StateChange_Cloudy', 'none' ) +# ::AttrVal( $shuttersDev, 'ASC_Shading_StateChange_Sunny', 'none' ) . ':' +# . ::AttrVal( $shuttersDev, 'ASC_Shading_StateChange_Cloudy', 'none' ) # if ( -# AttrVal( $shuttersDev, 'ASC_Shading_StateChange_Sunny', 'none' ) ne 'none' -# && AttrVal( $shuttersDev, 'ASC_Shading_StateChange_Cloudy', 'none' ) ne +# ::AttrVal( $shuttersDev, 'ASC_Shading_StateChange_Sunny', 'none' ) ne 'none' +# && ::AttrVal( $shuttersDev, 'ASC_Shading_StateChange_Cloudy', 'none' ) ne # 'none' ); -# delFromDevAttrList( $shuttersDev, 'ASC_Shading_StateChange_Sunny' ); -# delFromDevAttrList( $shuttersDev, 'ASC_Shading_StateChange_Cloudy' ); +# ::delFromDevAttrList( $shuttersDev, 'ASC_Shading_StateChange_Sunny' ); +# ::delFromDevAttrList( $shuttersDev, 'ASC_Shading_StateChange_Cloudy' ); # # $attr{$shuttersDev}{ASC_Shading_InOutAzimuth} = -# ( AttrVal( $shuttersDev, 'ASC_Shading_Direction', 180 ) - -# AttrVal( $shuttersDev, 'ASC_Shading_Angle_Left', 85 ) ) +# ( ::AttrVal( $shuttersDev, 'ASC_Shading_Direction', 180 ) - +# ::AttrVal( $shuttersDev, 'ASC_Shading_Angle_Left', 85 ) ) # . ':' -# . ( AttrVal( $shuttersDev, 'ASC_Shading_Direction', 180 ) + -# AttrVal( $shuttersDev, 'ASC_Shading_Angle_Right', 85 ) ) -# if ( AttrVal( $shuttersDev, 'ASC_Shading_Direction', 'none' ) ne 'none' -# || AttrVal( $shuttersDev, 'ASC_Shading_Angle_Left', 'none' ) ne 'none' -# || AttrVal( $shuttersDev, 'ASC_Shading_Angle_Right', 'none' ) ne 'none' ); -# delFromDevAttrList( $shuttersDev, 'ASC_Shading_Direction' ); -# delFromDevAttrList( $shuttersDev, 'ASC_Shading_Angle_Left' ); -# delFromDevAttrList( $shuttersDev, 'ASC_Shading_Angle_Right' ); +# . ( ::AttrVal( $shuttersDev, 'ASC_Shading_Direction', 180 ) + +# ::AttrVal( $shuttersDev, 'ASC_Shading_Angle_Right', 85 ) ) +# if ( ::AttrVal( $shuttersDev, 'ASC_Shading_Direction', 'none' ) ne 'none' +# || ::AttrVal( $shuttersDev, 'ASC_Shading_Angle_Left', 'none' ) ne 'none' +# || ::AttrVal( $shuttersDev, 'ASC_Shading_Angle_Right', 'none' ) ne 'none' ); +# ::delFromDevAttrList( $shuttersDev, 'ASC_Shading_Direction' ); +# ::delFromDevAttrList( $shuttersDev, 'ASC_Shading_Angle_Left' ); +# ::delFromDevAttrList( $shuttersDev, 'ASC_Shading_Angle_Right' ); # # $attr{$shuttersDev}{ASC_PrivacyDownValue_beforeNightClose} = -# AttrVal( $shuttersDev, 'ASC_PrivacyDownTime_beforNightClose', 'none' ) +# ::AttrVal( $shuttersDev, 'ASC_PrivacyDownTime_beforNightClose', 'none' ) # if ( -# AttrVal( $shuttersDev, 'ASC_PrivacyDownTime_beforNightClose', 'none' ) ne +# ::AttrVal( $shuttersDev, 'ASC_PrivacyDownTime_beforNightClose', 'none' ) ne # 'none' ); -# delFromDevAttrList( $shuttersDev, 'ASC_PrivacyDownTime_beforNightClose' ); +# ::delFromDevAttrList( $shuttersDev, 'ASC_PrivacyDownTime_beforNightClose' ); # -# delFromDevAttrList( $shuttersDev, 'ASC_ExternalTriggerDevice' ); +# ::delFromDevAttrList( $shuttersDev, 'ASC_ExternalTriggerDevice' ); } return; @@ -1330,7 +1335,7 @@ sub wiggle { } } - InternalTimer( gettimeofday() + 60, \&_SetCmdFn, \%h ); + ::InternalTimer( ::gettimeofday() + 60, \&_SetCmdFn, \%h ); return; } @@ -1519,43 +1524,43 @@ sub CreateNewNotifyDev { $hash->{NOTIFYDEV} = "global," . $name; delete $hash->{monitoredDevs}; - CommandDeleteReading( undef, $name . ' .monitoredDevs' ); + ::CommandDeleteReading( undef, $name . ' .monitoredDevs' ); my $shuttersList = ''; for my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) { AddNotifyDev( $hash, - AttrVal( $shuttersDev, 'ASC_Roommate_Device', 'none' ), + ::AttrVal( $shuttersDev, 'ASC_Roommate_Device', 'none' ), $shuttersDev, 'ASC_Roommate_Device' ) - if ( - AttrVal( $shuttersDev, 'ASC_Roommate_Device', 'none' ) ne 'none' ); - AddNotifyDev( $hash, AttrVal( $shuttersDev, 'ASC_WindowRec', 'none' ), + if ( ::AttrVal( $shuttersDev, 'ASC_Roommate_Device', 'none' ) ne + 'none' ); + AddNotifyDev( $hash, ::AttrVal( $shuttersDev, 'ASC_WindowRec', 'none' ), $shuttersDev, 'ASC_WindowRec' ) - if ( AttrVal( $shuttersDev, 'ASC_WindowRec', 'none' ) ne 'none' ); + if ( ::AttrVal( $shuttersDev, 'ASC_WindowRec', 'none' ) ne 'none' ); AddNotifyDev( $hash, - AttrVal( $shuttersDev, 'ASC_BrightnessSensor', 'none' ), + ::AttrVal( $shuttersDev, 'ASC_BrightnessSensor', 'none' ), $shuttersDev, 'ASC_BrightnessSensor' ) - if ( - AttrVal( $shuttersDev, 'ASC_BrightnessSensor', 'none' ) ne 'none' ); + if ( ::AttrVal( $shuttersDev, 'ASC_BrightnessSensor', 'none' ) ne + 'none' ); AddNotifyDev( $hash, - AttrVal( $shuttersDev, 'ASC_ExternalTrigger', 'none' ), + ::AttrVal( $shuttersDev, 'ASC_ExternalTrigger', 'none' ), $shuttersDev, 'ASC_ExternalTrigger' ) - if ( - AttrVal( $shuttersDev, 'ASC_ExternalTrigger', 'none' ) ne 'none' ); + if ( ::AttrVal( $shuttersDev, 'ASC_ExternalTrigger', 'none' ) ne + 'none' ); $shuttersList = $shuttersList . ',' . $shuttersDev; } - AddNotifyDev( $hash, AttrVal( $name, 'ASC_residentsDev', 'none' ), + AddNotifyDev( $hash, ::AttrVal( $name, 'ASC_residentsDev', 'none' ), $name, 'ASC_residentsDev' ) - if ( AttrVal( $name, 'ASC_residentsDev', 'none' ) ne 'none' ); - AddNotifyDev( $hash, AttrVal( $name, 'ASC_rainSensor', 'none' ), + if ( ::AttrVal( $name, 'ASC_residentsDev', 'none' ) ne 'none' ); + AddNotifyDev( $hash, ::AttrVal( $name, 'ASC_rainSensor', 'none' ), $name, 'ASC_rainSensor' ) - if ( AttrVal( $name, 'ASC_rainSensor', 'none' ) ne 'none' ); - AddNotifyDev( $hash, AttrVal( $name, 'ASC_twilightDevice', 'none' ), + if ( ::AttrVal( $name, 'ASC_rainSensor', 'none' ) ne 'none' ); + AddNotifyDev( $hash, ::AttrVal( $name, 'ASC_twilightDevice', 'none' ), $name, 'ASC_twilightDevice' ) - if ( AttrVal( $name, 'ASC_twilightDevice', 'none' ) ne 'none' ); - AddNotifyDev( $hash, AttrVal( $name, 'ASC_windSensor', 'none' ), + if ( ::AttrVal( $name, 'ASC_twilightDevice', 'none' ) ne 'none' ); + AddNotifyDev( $hash, ::AttrVal( $name, 'ASC_windSensor', 'none' ), $name, 'ASC_windSensor' ) - if ( AttrVal( $name, 'ASC_windSensor', 'none' ) ne 'none' ); + if ( ::AttrVal( $name, 'ASC_windSensor', 'none' ) ne 'none' ); $hash->{NOTIFYDEV} = $hash->{NOTIFYDEV} . $shuttersList; @@ -1637,7 +1642,7 @@ sub ShuttersInformation { $ret .= "" . $shutters->getLockOut . ""; $ret .= " "; $ret .= "" - . ReadingsVal( $shuttersDev, 'ASC_ShuttersLastDrive', 'none' ) + . ::ReadingsVal( $shuttersDev, 'ASC_ShuttersLastDrive', 'none' ) . ""; $ret .= " "; $ret .= "" . $shutters->getStatus . ""; @@ -1662,7 +1667,7 @@ sub GetMonitoredDevs { my $hash = shift; my $notifydevs = eval { - decode_json( ReadingsVal( $hash->{NAME}, '.monitoredDevs', 'none' ) ); + decode_json( ::ReadingsVal( $hash->{NAME}, '.monitoredDevs', 'none' ) ); }; my $ret = '
'; $ret .= ''; @@ -1757,7 +1762,7 @@ sub _SetCmdFn { } else { $shutters->setLastDrive( - ReadingsVal( $shuttersDev, 'ASC_ShuttersLastDrive', 'none' ) ); + ::ReadingsVal( $shuttersDev, 'ASC_ShuttersLastDrive', 'none' ) ); ASC_Debug( 'FnSetCmdFn: ' . $shuttersDev . ' - Abbruch aktuelle Position ist gleich der Zielposition ' @@ -1845,17 +1850,17 @@ sub _SetCmdFn { ::AnalyzeCommandChain( $h, $commandTemplate ); } else { - CommandSet( undef, + ::CommandSet( undef, $shuttersDev . ':FILTER=' . $shutters->getPosCmd . '!=' . $posValue . ' ' . $driveCommand ); - InternalTimer( - gettimeofday() + 3, + ::InternalTimer( + ::gettimeofday() + 3, sub() { - CommandSet( + ::CommandSet( undef, ( $shutters->getSlatDevice ne 'none' @@ -1887,7 +1892,7 @@ sub _setShuttersLastDriveDelayed { my $shuttersDevHash = $h->{devHash}; my $lastDrive = $h->{lastDrive}; - readingsSingleUpdate( $shuttersDevHash, 'ASC_ShuttersLastDrive', + ::readingsSingleUpdate( $shuttersDevHash, 'ASC_ShuttersLastDrive', $lastDrive, 1 ); return; @@ -1895,7 +1900,7 @@ sub _setShuttersLastDriveDelayed { sub ASC_Debug { return - if ( !AttrVal( $ascDev->getName, 'ASC_debug', 0 ) ); + if ( !::AttrVal( $ascDev->getName, 'ASC_debug', 0 ) ); my $debugMsg = shift; my $debugTimestamp = strftime( "%Y.%m.%d %T", localtime(time) ); @@ -1916,7 +1921,7 @@ sub PrivacyUpTime { my $privacyUpUnixtime; if ( ( $shuttersSunriseUnixtime - $shutters->getPrivacyUpTime ) > - ( gettimeofday() + 1 ) + ( ::gettimeofday() + 1 ) || $shutters->getPrivacyUpStatus == 2 ) { $privacyUpUnixtime = @@ -1925,7 +1930,7 @@ sub PrivacyUpTime { $privacyUpUnixtime += 86400 if ( $shutters->getPrivacyUpStatus == 2 ); - readingsSingleUpdate( $shuttersDevHash, 'ASC_Time_PrivacyDriveUp', + ::readingsSingleUpdate( $shuttersDevHash, 'ASC_Time_PrivacyDriveUp', strftime( "%d.%m.%Y - %H:%M", localtime($privacyUpUnixtime) ), 1 ); ## Setzt den PrivacyUp Modus für die Sichtschutzfahrt auf den Status 1 ## und gibt die Unixtime für die nächste Fahrt korrekt zurück @@ -1935,7 +1940,7 @@ sub PrivacyUpTime { } } else { - readingsSingleUpdate( + ::readingsSingleUpdate( $shuttersDevHash, 'ASC_Time_PrivacyDriveUp', strftime( @@ -1959,7 +1964,7 @@ sub PrivacyDownTime { my $privacyDownUnixtime; if ( ( $shuttersSunsetUnixtime - $shutters->getPrivacyDownTime ) > - ( gettimeofday() + 1 ) + ( ::gettimeofday() + 1 ) || $shutters->getPrivacyDownStatus == 2 ) { $privacyDownUnixtime = @@ -1968,7 +1973,7 @@ sub PrivacyDownTime { $privacyDownUnixtime += 86400 if ( $shutters->getPrivacyDownStatus == 2 ); - readingsSingleUpdate( $shuttersDevHash, 'ASC_Time_PrivacyDriveDown', + ::readingsSingleUpdate( $shuttersDevHash, 'ASC_Time_PrivacyDriveDown', strftime( "%d.%m.%Y - %H:%M", localtime($privacyDownUnixtime) ), 1 ); ## Setzt den PrivacyDown Modus für die Sichtschutzfahrt auf den Status 1 @@ -1979,7 +1984,7 @@ sub PrivacyDownTime { } } else { - readingsSingleUpdate( + ::readingsSingleUpdate( $shuttersDevHash, 'ASC_Time_PrivacyDriveDown', strftime( @@ -2004,55 +2009,55 @@ sub DevStateIcon { return if ( !$hash ); my $name = $hash->{NAME}; - if ( ReadingsVal( $name, 'state', undef ) eq 'created new drive timer' ) { + if ( ::ReadingsVal( $name, 'state', undef ) eq 'created new drive timer' ) { return '.*:clock'; } - elsif ( ReadingsVal( $name, 'state', undef ) eq 'selfDefense terrace' ) { + elsif ( ::ReadingsVal( $name, 'state', undef ) eq 'selfDefense terrace' ) { return '.*:fts_door_tilt'; } - elsif ( ReadingsVal( $name, 'state', undef ) =~ m{.*asleep$}xms ) { + elsif ( ::ReadingsVal( $name, 'state', undef ) =~ m{.*asleep$}xms ) { return '.*:scene_sleeping'; } - elsif ( ReadingsVal( $name, 'state', undef ) =~ + elsif ( ::ReadingsVal( $name, 'state', undef ) =~ m{^roommate(.come)?.(awoken|home)$}xms ) { return '.*:user_available'; } - elsif ( ReadingsVal( $name, 'state', undef ) =~ + elsif ( ::ReadingsVal( $name, 'state', undef ) =~ m{^residents.(home|awoken)$}xms ) { return '.*:status_available'; } - elsif ( ReadingsVal( $name, 'state', undef ) eq 'manual' ) { + elsif ( ::ReadingsVal( $name, 'state', undef ) eq 'manual' ) { return '.*:fts_shutter_manual'; } - elsif ( ReadingsVal( $name, 'state', undef ) eq 'selfDefense inactive' ) { + elsif ( ::ReadingsVal( $name, 'state', undef ) eq 'selfDefense inactive' ) { return '.*:status_open'; } elsif ( - ReadingsVal( $name, 'state', undef ) =~ m{^selfDefense.*.active$}xms ) + ::ReadingsVal( $name, 'state', undef ) =~ m{^selfDefense.*.active$}xms ) { return '.*:status_locked'; } - elsif ( ReadingsVal( $name, 'state', undef ) eq 'day open' ) { + elsif ( ::ReadingsVal( $name, 'state', undef ) eq 'day open' ) { return '.*:scene_day'; } - elsif ( ReadingsVal( $name, 'state', undef ) eq 'night close' ) { + elsif ( ::ReadingsVal( $name, 'state', undef ) eq 'night close' ) { return '.*:scene_night'; } - elsif ( ReadingsVal( $name, 'state', undef ) eq 'shading in' ) { + elsif ( ::ReadingsVal( $name, 'state', undef ) eq 'shading in' ) { return '.*:fts_shutter_shadding_run'; } - elsif ( ReadingsVal( $name, 'state', undef ) eq 'shading out' ) { + elsif ( ::ReadingsVal( $name, 'state', undef ) eq 'shading out' ) { return '.*:fts_shutter_shadding_stop'; } - elsif ( ReadingsVal( $name, 'state', undef ) eq 'active' ) { + elsif ( ::ReadingsVal( $name, 'state', undef ) eq 'active' ) { return '.*:hourglass'; } - elsif ( ReadingsVal( $name, 'state', undef ) =~ m{.*privacy.*}xms ) { + elsif ( ::ReadingsVal( $name, 'state', undef ) =~ m{.*privacy.*}xms ) { return '.*:fts_shutter_50'; } - elsif ( ReadingsVal( $name, 'state', undef ) eq 'adv delay close' ) { + elsif ( ::ReadingsVal( $name, 'state', undef ) eq 'adv delay close' ) { return '.*:christmas_tree'; } @@ -2065,7 +2070,7 @@ sub RemoveShuttersTimer { for my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) { $shutters->setShuttersDev($shuttersDev); - RemoveInternalTimer( $shutters->getInTimerFuncHash ); + ::RemoveInternalTimer( $shutters->getInTimerFuncHash ); $shutters->setInTimerFuncHash(undef); } diff --git a/lib/FHEM/Automation/ShuttersControl/Helper.pm b/lib/FHEM/Automation/ShuttersControl/Helper.pm index f466885..6ca7c17 100644 --- a/lib/FHEM/Automation/ShuttersControl/Helper.pm +++ b/lib/FHEM/Automation/ShuttersControl/Helper.pm @@ -88,8 +88,6 @@ our %EXPORT_TAGS = ( ], ); -use FHEM::Automation::ShuttersControl '$shutters $ascDev'; - use GPUtils qw(GP_Import); ## Import der FHEM Funktionen BEGIN { -- 2.45.2 From 79d369b9f53d53d6f4e435ee53e7e434fc4f75ad Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sun, 2 Jan 2022 07:55:00 +0100 Subject: [PATCH 4/4] little bugfix --- controls_AutoShuttersControl.txt | 2 +- lib/FHEM/Automation/ShuttersControl.pm | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/controls_AutoShuttersControl.txt b/controls_AutoShuttersControl.txt index dc61363..1eccf1b 100644 --- a/controls_AutoShuttersControl.txt +++ b/controls_AutoShuttersControl.txt @@ -1,5 +1,5 @@ UPD 2022-01-01_20:15:38 115601 FHEM/73_AutoShuttersControl.pm -UPD 2022-01-02_07:48:22 75806 lib/FHEM/Automation/ShuttersControl.pm +UPD 2022-01-02_07:52:37 75828 lib/FHEM/Automation/ShuttersControl.pm UPD 2022-01-02_06:39:39 2691 lib/FHEM/Automation/ShuttersControl/Dev.pm UPD 2022-01-02_06:34:39 2677 lib/FHEM/Automation/ShuttersControl/Roommate.pm UPD 2022-01-02_07:04:24 32028 lib/FHEM/Automation/ShuttersControl/Shutters.pm diff --git a/lib/FHEM/Automation/ShuttersControl.pm b/lib/FHEM/Automation/ShuttersControl.pm index 432c7e2..3fe509c 100644 --- a/lib/FHEM/Automation/ShuttersControl.pm +++ b/lib/FHEM/Automation/ShuttersControl.pm @@ -518,6 +518,8 @@ sub Set { my $cmd = shift @$aArg // return qq{"set $name" needs at least one argument}; + $cmd = lc($cmd); + given ($cmd) { when ('renewalltimer') { return "usage: $cmd" if ( scalar( @{$aArg} ) != 0 ); -- 2.45.2