2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

74_AMADDevice: change DEF and add Attribut IODev, add Reading incommingSmsText

git-svn-id: https://svn.fhem.de/fhem/trunk@15752 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
LeonGaultier 2018-01-02 11:10:14 +00:00
parent 76f816e43c
commit 22388471aa
4 changed files with 840 additions and 816 deletions

View File

@ -1,5 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- change: 74_AMADDevice: change DEF and add Attribut IODev, add Reading
incommingSmsText
- change: 74_XiaomiFlowerSens: fix Problems with sshHost Methode - change: 74_XiaomiFlowerSens: fix Problems with sshHost Methode
- change: 73_GardenaSmartBridge/74_GardenaSmartDevice: add NotifyFn Support - change: 73_GardenaSmartBridge/74_GardenaSmartDevice: add NotifyFn Support
change AttrFn Routine change AttrFn Routine

View File

@ -74,8 +74,8 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode ";
eval "use JSON;1" or $missingModul .= "JSON "; eval "use JSON;1" or $missingModul .= "JSON ";
my $modulversion = "4.0.7"; my $modulversion = "4.0.8";
my $flowsetversion = "4.0.11"; my $flowsetversion = "4.0.12";
@ -788,7 +788,8 @@ sub AMADCommBridge_ResponseProcessing($$) {
return Log3 $bname, 3, "AMADCommBridge ($name) - AMADCommBridge: processing receive no reading values from Device: $fhemDevice" return Log3 $bname, 3, "AMADCommBridge ($name) - AMADCommBridge: processing receive no reading values from Device: $fhemDevice"
unless( (defined($decode_json->{payload}) and ($decode_json->{payload})) or (defined($decode_json->{firstrun}) and ($decode_json->{firstrun})) ); unless( (defined($decode_json->{payload}) and ($decode_json->{payload})) or (defined($decode_json->{firstrun}) and ($decode_json->{firstrun})) );
Log3 $bname, 4, "AMADCommBridge ($bname) - AMADCommBridge: processing receive reading values - Device: $fhemDevice Data: $decode_json->{payload}" unless( defined($decode_json->{payload}) and ($decode_json->{payload}) ); Log3 $bname, 4, "AMADCommBridge ($bname) - AMADCommBridge: processing receive reading values - Device: $fhemDevice Data: $decode_json->{payload}"
if( defined($decode_json->{payload}) and ($decode_json->{payload}) );
Dispatch($bhash,$json,undef); Dispatch($bhash,$json,undef);
Log3 $bname, 4, "AMADCommBridge ($bname) - call Dispatcher"; Log3 $bname, 4, "AMADCommBridge ($bname) - call Dispatcher";

View File

@ -59,7 +59,7 @@ eval "use JSON;1" or $missingModul .= "JSON ";
my $modulversion = "4.0.12"; my $modulversion = "4.0.12";
my $flowsetversion = "4.0.11"; my $flowsetversion = "4.0.12";
@ -120,6 +120,8 @@ sub AMADDevice_Initialize($) {
"setAPSSID ". "setAPSSID ".
"root:0,1 ". "root:0,1 ".
"disable:1 ". "disable:1 ".
"remoteServer:Automagic,Autoremote,TNES,other ".
"IODev ".
$readingFnAttributes; $readingFnAttributes;
foreach my $d(sort keys %{$modules{AMADDevice}{defptr}}) { foreach my $d(sort keys %{$modules{AMADDevice}{defptr}}) {
@ -134,27 +136,17 @@ sub AMADDevice_Define($$) {
my ( $hash, $def ) = @_; my ( $hash, $def ) = @_;
my @a = split( "[ \t]+", $def ); my @a = split( "[ \t]+", $def );
splice( @a, 1, 1 );
my $iodev;
my $i = 0;
return "too few parameters: define <name> AMADDevice <HOST-IP> <amad_id> <remoteServer>" if( @a != 5 );
foreach my $param ( @a ) {
if( $param =~ m/IODev=([^\s]*)/ ) {
$iodev = $1;
splice( @a, $i, 3 );
last;
}
$i++;
}
return "too few parameters: define <name> AMADDevice <HOST-IP> <amad_id>" if( @a != 3 );
return "Cannot define a AMAD device. Perl modul $missingModul is missing." if ( $missingModul ); return "Cannot define a AMAD device. Perl modul $missingModul is missing." if ( $missingModul );
my ($name,$host,$amad_id) = @a; my $name = $a[0];
my $host = $a[2];
my $amad_id = $a[3];
my $remoteServer = $a[4];
$hash->{DEF} = "$host $amad_id Automagic" if( $remoteServer ne 'Automagic' );
$hash->{HOST} = $host; $hash->{HOST} = $host;
$hash->{AMAD_ID} = $amad_id; $hash->{AMAD_ID} = $amad_id;
@ -168,14 +160,15 @@ sub AMADDevice_Define($$) {
CommandAttr(undef,"$name IODev $modules{AMADCommBridge}{defptr}{BRIDGE}->{NAME}") if(AttrVal($name,'IODev','none') eq 'none');
my $iodev = AttrVal($name,'IODev','none');
AssignIoPort($hash,$iodev) if( !$hash->{IODev} ); AssignIoPort($hash,$iodev) if( !$hash->{IODev} );
if(defined($hash->{IODev}->{NAME})) { if(defined($hash->{IODev}->{NAME})) {
Log3 $name, 3, "AMADDevice ($name) - I/O device is " . $hash->{IODev}->{NAME}; Log3 $name, 3, "AMADDevice ($name) - I/O device is " . $hash->{IODev}->{NAME};
} else { } else {
Log3 $name, 1, "AMADDevice ($name) - no I/O device"; Log3 $name, 1, "AMADDevice ($name) - no I/O device";
} }
@ -749,7 +742,7 @@ sub AMADDevice_Parse($$) {
} else { } else {
return "UNDEFINED $fhemDevice AMADDevice $decode_json->{firstrun}{'amaddevice_ip'} $decode_json->{amad}{'amad_id'} IODev=$name"; return "UNDEFINED $fhemDevice AMADDevice $decode_json->{firstrun}{'amaddevice_ip'} $decode_json->{amad}{'amad_id'} Automagic";
} }
} }