change code for versionflowset variable

This commit is contained in:
Marko Oldenburg 2019-06-20 11:22:10 +02:00
parent 9c0037d5db
commit abff40a4ec
2 changed files with 11 additions and 38 deletions

View File

@ -64,12 +64,10 @@ use strict;
use warnings;
use POSIX;
use FHEM::Meta;
use GPUtils qw(GP_Import);
use GPUtils qw(GP_Import GP_Export);
use HttpUtils;
use TcpServerUtils;
my $flowsetversion = '4.4.1';
my $missingModul = '';
eval "use Encode qw(encode encode_utf8);1" or $missingModul .= 'Encode ';
@ -176,22 +174,10 @@ BEGIN {
);
}
# _Export - Export references to main context using a different naming schema
sub _Export {
no strict qw/refs/; ## no critic
my $pkg = caller(0);
my $main = $pkg;
$main =~ s/^(?:.+::)?([^:]+)$/main::$1\_/g;
foreach (@_) {
*{ $main . $_ } = *{ $pkg . '::' . $_ };
}
}
#-- Export to main context with different name
_Export(
GP_Export(
qw(
Initialize
Flowsetversion
)
);
@ -249,7 +235,7 @@ sub Define($$) {
$hash->{BRIDGE} = 1;
$hash->{PORT} = $port;
$hash->{VERSION} = version->parse($VERSION)->normal;
$hash->{VERSIONFLOWSET} = $flowsetversion;
$hash->{VERSIONFLOWSET} = FHEM::Meta::Get( $hash, 'x_flowsetversion' );
CommandAttr( undef, $name . ' room AMAD' )
if ( AttrVal( $name, 'room', 'none' ) eq 'none' );
@ -906,7 +892,7 @@ sub ProcessRead($$) {
if ( $data =~ /currentFlowsetUpdate.xml/ ) {
$response =
qx(cat $fhempath/FHEM/lib/74_AMADautomagicFlowset_$flowsetversion.xml);
qx(cat $fhempath/FHEM/lib/74_AMADautomagicFlowset_$hash->{VERSIONFLOWSET}.xml);
$c = $hash->{CD};
print $c "HTTP/1.1 200 OK\r\n",
"Content-Type: text/plain\r\n",
@ -920,7 +906,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_$hash->{VERSIONFLOWSET}.prj.xml);
$c = $hash->{CD};
print $c "HTTP/1.1 200 OK\r\n",
"Content-Type: text/plain\r\n",
@ -1286,10 +1272,6 @@ sub ParseMsg($$) {
return ( $msg, $tail );
}
sub Flowsetversion() {
return $flowsetversion;
}
##### bleibt zu Anschauungszwecken erhalten
#sub Header2Hash($) {
#
@ -1479,6 +1461,7 @@ sub Flowsetversion() {
"release_status": "stable",
"license": "GPL_2",
"version": "v4.4.2",
"x_flowsetversion": "4.1.1",
"author": [
"Marko Oldenburg <leongaultier@gmail.com>"
],

View File

@ -52,9 +52,9 @@ use warnings;
use POSIX;
use FHEM::Meta;
use Data::Dumper; #only for Debugging
use GPUtils qw(GP_Import);
use GPUtils qw(GP_Import GP_Export);
require FHEM::73_AMADCommBridge;
require '73_AMADCommBridge.pm';
my $missingModul = '';
eval "use Encode qw(encode encode_utf8);1" or $missingModul .= 'Encode ';
@ -165,19 +165,8 @@ BEGIN {
);
}
# _Export - Export references to main context using a different naming schema
sub _Export {
no strict qw/refs/; ## no critic
my $pkg = caller(0);
my $main = $pkg;
$main =~ s/^(?:.+::)?([^:]+)$/main::$1\_/g;
foreach (@_) {
*{ $main . $_ } = *{ $pkg . '::' . $_ };
}
}
#-- Export to main context with different name
_Export(
GP_Export(
qw(
Initialize
)
@ -254,7 +243,6 @@ sub Define($$) {
$hash->{HOST} = $host;
$hash->{AMAD_ID} = $amad_id;
$hash->{VERSION} = version->parse($VERSION)->normal;
$hash->{VERSIONFLOWSET} = AMADCommBridge_Flowsetversion();
$hash->{NOTIFYDEV} = 'global,' . $name;
$hash->{MODEL} = $remoteServer;
@ -288,6 +276,8 @@ sub Define($$) {
}
$iodev = $hash->{IODev}->{NAME};
# $hash->{VERSIONFLOWSET} = FHEM::Meta::Get( $defs{$iodev}, 'x_flowsetversion' );
$hash->{VERSIONFLOWSET} = $defs{$iodev}->{VERSIONFLOWSET};
my $d = $modules{AMADDevice}{defptr}{$amad_id};