diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index 48966ac..d6158c9 100755 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -64,12 +64,11 @@ use strict; use warnings; use POSIX; use FHEM::Meta; -use GPUtils qw(GP_Import) - ; # wird für den Import der FHEM Funktionen aus der fhem.pl benötigt +use GPUtils qw(GP_Import); use HttpUtils; use TcpServerUtils; -our $MODULVERSION = '4.4.2'; -our $FLOWSETVERSION = '4.4.1'; + +my $flowsetversion = '4.4.1'; my $missingModul = ''; eval "use Encode qw(encode encode_utf8);1" or $missingModul .= 'Encode '; @@ -192,6 +191,7 @@ sub _Export { _Export( qw( Initialize + Flowsetversion ) ); @@ -220,13 +220,6 @@ sub Initialize($) { . 'fhemServerIP ' . $readingFnAttributes; - foreach my $d ( sort keys %{ $modules{AMADCommBridge}{defptr} } ) { - - my $hash = $modules{AMADCommBridge}{defptr}{$d}; - $hash->{VERSIONMODUL} = $MODULVERSION; - $hash->{VERSIONFLOWSET} = $FLOWSETVERSION; - } - return FHEM::Meta::InitMod( __FILE__, $hash ); } @@ -237,6 +230,8 @@ sub Define($$) { my @a = split( '[ \t][ \t]*', $def ); return $@ unless ( FHEM::Meta::SetInternals($hash) ); + use version 0.44; our $VERSION = FHEM::Meta::Get( $hash, 'version' ); + return 'too few parameters: define AMADCommBridge ' if ( @a < 2 and @a > 3 ); return @@ -253,8 +248,8 @@ sub Define($$) { $hash->{BRIDGE} = 1; $hash->{PORT} = $port; - $hash->{VERSIONMODUL} = $MODULVERSION; - $hash->{VERSIONFLOWSET} = $FLOWSETVERSION; + $hash->{VERSION} = version->parse($VERSION)->normal; + $hash->{VERSIONFLOWSET} = $flowsetversion; CommandAttr( undef, $name . ' room AMAD' ) if ( AttrVal( $name, 'room', 'none' ) eq 'none' ); @@ -911,7 +906,7 @@ sub ProcessRead($$) { if ( $data =~ /currentFlowsetUpdate.xml/ ) { $response = -qx(cat $fhempath/FHEM/lib/74_AMADautomagicFlowset_$FLOWSETVERSION.xml); +qx(cat $fhempath/FHEM/lib/74_AMADautomagicFlowset_$flowsetversion.xml); $c = $hash->{CD}; print $c "HTTP/1.1 200 OK\r\n", "Content-Type: text/plain\r\n", @@ -925,7 +920,7 @@ qx(cat $fhempath/FHEM/lib/74_AMADautomagicFlowset_$FLOWSETVERSION.xml); elsif ( $data =~ /currentTaskersetUpdate.prj.xml/ ) { $response = - qx(cat $fhempath/FHEM/lib/74_AMADtaskerset_$FLOWSETVERSION.prj.xml); + qx(cat $fhempath/FHEM/lib/74_AMADtaskerset_$flowsetversion.prj.xml); $c = $hash->{CD}; print $c "HTTP/1.1 200 OK\r\n", "Content-Type: text/plain\r\n", @@ -1291,6 +1286,10 @@ sub ParseMsg($$) { return ( $msg, $tail ); } +sub Flowsetversion() { + return $flowsetversion; +} + ##### bleibt zu Anschauungszwecken erhalten #sub Header2Hash($) { # @@ -1479,6 +1478,7 @@ sub ParseMsg($$) { ], "release_status": "stable", "license": "GPL_2", + "version": "v4.4.2", "author": [ "Marko Oldenburg " ], diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index 2d507ef..d3917e4 100755 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -51,12 +51,10 @@ use strict; use warnings; use POSIX; use FHEM::Meta; - use Data::Dumper; #only for Debugging -use GPUtils qw(GP_Import) - ; # wird für den Import der FHEM Funktionen aus der fhem.pl benötigt -our $MODULVERSION = '4.4.2'; -our $FLOWSETVERSION = '4.4.1'; +use GPUtils qw(GP_Import); + +require FHEM::73_AMADCommBridge; my $missingModul = ''; eval "use Encode qw(encode encode_utf8);1" or $missingModul .= 'Encode '; @@ -154,6 +152,7 @@ BEGIN { ReadingsVal IsDisabled deviceEvents + AMADCommBridge_Flowsetversion init_done gettimeofday getUniqueId @@ -227,13 +226,6 @@ sub Initialize($) { . 'setTakePictureCamera:Back,Front ' . $readingFnAttributes; - foreach my $d ( sort keys %{ $modules{AMADDevice}{defptr} } ) { - - my $hash = $modules{AMADDevice}{defptr}{$d}; - $hash->{VERSIONMODUL} = $MODULVERSION; - $hash->{VERSIONFLOWSET} = $FLOWSETVERSION; - } - return FHEM::Meta::InitMod( __FILE__, $hash ); } @@ -243,6 +235,8 @@ sub Define($$) { my @a = split( '[ \t]+', $def ); return $@ unless ( FHEM::Meta::SetInternals($hash) ); + use version 0.44; our $VERSION = FHEM::Meta::Get( $hash, 'version' ); + return 'too few parameters: define AMADDevice ' if ( @a != 5 ); @@ -259,8 +253,8 @@ sub Define($$) { $hash->{HOST} = $host; $hash->{AMAD_ID} = $amad_id; - $hash->{VERSIONMODUL} = $MODULVERSION; - $hash->{VERSIONFLOWSET} = $FLOWSETVERSION; + $hash->{VERSION} = version->parse($VERSION)->normal; + $hash->{VERSIONFLOWSET} = AMADCommBridge_Flowsetversion(); $hash->{NOTIFYDEV} = 'global,' . $name; $hash->{MODEL} = $remoteServer; @@ -1695,6 +1689,7 @@ sub CreateChangeBtDeviceValue($$) { ], "release_status": "stable", "license": "GPL_2", + "version": "v4.4.2", "author": [ "Marko Oldenburg " ],