From fa4e67fcf0512085c67e533c2f0509a1197774f9 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Wed, 16 Sep 2015 13:34:48 +0200 Subject: [PATCH 01/25] =?UTF-8?q?erste=20Ans=C3=A4tze=20f=C3=BCr=20bidirek?= =?UTF-8?q?tionale=20Kommunikation=20mittels=20tcpServerUtils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 58 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index 3daccb6..569cdfb 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -33,8 +33,9 @@ use warnings; use Time::HiRes qw(gettimeofday); use HttpUtils; +use TcpServerUtils; -my $version = "0.6.2"; +my $version = "0.7.0"; @@ -77,6 +78,10 @@ my ( $hash, $def ) = @_; my $host = $a[2]; my $port = 8090; my $interval = 180; + + # Interner Server fuer bidirektionale Kommunikation + my $sport = 8090; + $hash->{HOST} = $host; $hash->{PORT} = $port; @@ -86,12 +91,19 @@ my ( $hash, $def ) = @_; $hash->{helper}{setCmdErrorCounter} = 0; Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{HOST} and interval $hash->{INTERVAL} (sec)"; + + # Oeffnen des TCP Servers + my $ret = TcpServer_Open($hash, $sport, $global); + if($ret && !$init_done) { + Log3 $name, 1, "$ret. Exiting."; + exit(1); + } + AMAD_GetUpdateLocal( $hash ); InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ); - # $hash->{STATE} = "initialized"; # direktes setzen von STATE ist absolete readingsSingleUpdate ( $hash, "state", "initialized", 1 ); readingsSingleUpdate ( $hash, "deviceState", "online", 1 ); @@ -100,11 +112,9 @@ my ( $hash, $def ) = @_; sub AMAD_Undef($$) { -my ( $hash, $arg ) = @_; - + my ( $hash, $arg ) = @_; RemoveInternalTimer( $hash ); - - return undef; + return TcpServer_Close($hash); } sub AMAD_Attr(@) { @@ -117,11 +127,9 @@ my ( $cmd, $name, $attrName, $attrVal ) = @_; if( $attrVal eq "0" ) { RemoveInternalTimer( $hash ); InternalTimer( gettimeofday()+2, "AMAD_GetUpdateTimer", $hash, 0 ) if( ReadingsVal( $hash->{NAME}, "state", 0 ) eq "disabled" ); - # $hash->{STATE}='active'; # direktes STATE setzen ist absolete readingsSingleUpdate ( $hash, "state", "active", 1 ); Log3 $name, 3, "AMAD ($name) - enabled"; } else { - # $hash->{STATE} = 'disabled'; readingsSingleUpdate ( $hash, "state", "disabled", 1 ); RemoveInternalTimer( $hash ); Log3 $name, 3, "AMAD ($name) - disabled"; @@ -130,7 +138,6 @@ my ( $cmd, $name, $attrName, $attrVal ) = @_; elsif( $cmd eq "del" ) { RemoveInternalTimer( $hash ); InternalTimer( gettimeofday()+2, "AMAD_GetUpdateTimer", $hash, 0 ) if( ReadingsVal( $hash->{NAME}, "state", 0 ) eq "disabled" ); - # $hash->{STATE}='active'; readingsSingleUpdate ( $hash, "state", "active", 1 ); Log3 $name, 3, "AMAD ($name) - enabled"; @@ -313,7 +320,6 @@ sub AMAD_RetrieveAutomagicInfoFinished($$$) { Log3 $name, 5, "AMAD ($name) - CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; readingsBulkUpdate( $hash, "deviceState", "offline" ); - # $hash->{STATE} = "AMAD Flows inactive, device set offline"; # STATE direkt setzen ist absolete readingsBulkUpdate ( $hash, "state", "AMAD Flows inactive, device set offline"); } elsif( $hash->{helper}{infoErrorCounter} > 9 && $hash->{helper}{setCmdErrorCounter} > 4 ) { @@ -322,7 +328,6 @@ sub AMAD_RetrieveAutomagicInfoFinished($$$) { Log3 $name, 4, "AMAD ($name) - UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; $attr{$name}{disable} = 1; - # $hash->{STATE} = "Unknown Error, device disabled"; readingsBulkUpdate ( $hash, "state", "Unknown Error, device disabled"); $hash->{helper}{infoErrorCounter} = 0; @@ -346,7 +351,6 @@ sub AMAD_RetrieveAutomagicInfoFinished($$$) { Log3 $name, 4, "AMAD ($name) - To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; readingsBulkUpdate( $hash, "deviceState", "offline" ); - # $hash->{STATE} = "To many Errors, device set offline"; # STATE direkt setzen ist absolete readingsBulkUpdate ( $hash, "state", "To many Errors, device set offline"); $hash->{helper}{infoErrorCounter} = 0; } @@ -356,7 +360,6 @@ sub AMAD_RetrieveAutomagicInfoFinished($$$) { if( defined( $err ) ) { if( $err ne "" ) { readingsBeginUpdate( $hash ); - # $hash->{STATE} = $err if( $hash->{STATE} ne "initialized" ); readingsBulkUpdate ( $hash, "state", "$err") if( ReadingsVal( $name, "state", 1 ) ne "initialized" ); $hash->{helper}{infoErrorCounter} = ( $hash->{helper}{infoErrorCounter} + 1 ); @@ -380,7 +383,6 @@ sub AMAD_RetrieveAutomagicInfoFinished($$$) { if( $data eq "" and exists( $param->{code} ) ) { readingsBeginUpdate( $hash ); - # $hash->{STATE} = $param->{code} if( $hash->{STATE} ne "initialized" ); # direktes setzen von STATE ist absolete readingsBulkUpdate ( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state", 1 ) ne "initialized" ); $hash->{helper}{infoErrorCounter} = ( $hash->{helper}{infoErrorCounter} + 1 ); @@ -399,7 +401,6 @@ sub AMAD_RetrieveAutomagicInfoFinished($$$) { } if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { - #$hash->{STATE} = $param->{code} if( $hash->{STATE} ne "initialized" ); ## STATE direkt ist absolete readingsBeginUpdate( $hash ); readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state" ,0) ne "initialized" ); $hash->{helper}{infoErrorCounter} = ( $hash->{helper}{infoErrorCounter} + 1 ); @@ -427,7 +428,6 @@ sub AMAD_RetrieveAutomagicInfoFinished($$$) { $hash->{helper}{infoErrorCounter} = 0; ### Begin Response Processing - # $hash->{STATE} = "active" if( $hash->{STATE} eq "initialized" || $hash->{STATE} ne "active" ); ## STATE direkt setzen ist absolete readingsSingleUpdate( $hash, "state", "active", 1) if( ReadingsVal( $name, "state", 0 ) ne "initialized" or ReadingsVal( $name, "state", 0 ) ne "active" ); my @valuestring = split( '@@@@', $data ); @@ -454,11 +454,26 @@ sub AMAD_RetrieveAutomagicInfoFinished($$$) { $hash->{helper}{infoErrorCounter} = 0; ### End Response Processing - #$hash->{STATE} = "active" if( $hash->{STATE} eq "initialized" ); ## STATE direkt setzen ist absolete readingsBulkUpdate( $hash, "state", "active" ) if( ReadingsVal( $name, "state", 0 ) eq "initialized" ); readingsEndUpdate( $hash, 1 ); return undef; +} + +sub AMAD_Read($) { + + my ($hash) = @_; + + my $name = $hash->{NAME}; + + if($hash->{SERVERSOCKET}) { # Accept and create a child + my $chash = TcpServer_Accept($hash, "http"); + return if(!$chash); + } + + + + } sub AMAD_HTTP_POST($$) { @@ -466,10 +481,8 @@ sub AMAD_HTTP_POST($$) { my ( $hash, $url ) = @_; my $name = $hash->{NAME}; - #my $state = $hash->{STATE}; my $state = ReadingsVal( $name, "state", 0 ); - #$hash->{STATE} = "Send HTTP POST"; readingsSingleUpdate( $hash, "state", "Send HTTP POST", 1 ); HttpUtils_NonblockingGet( @@ -484,7 +497,6 @@ sub AMAD_HTTP_POST($$) { ); Log3 $name, 4, "AMAD ($name) - Send HTTP POST with URL $url"; - #$hash->{STATE} = $state; readingsSingleUpdate( $hash, "state", $state, 1 ); return undef; @@ -507,7 +519,6 @@ sub AMAD_HTTP_POSTerrorHandling($$$) { Log3 $name, 5, "AMAD ($name) - CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; readingsBulkUpdate( $hash, "deviceState", "offline" ); - #$hash->{STATE} = "AMAD Flows inactive, device set offline"; # STATE direkt setzen ist absolete readingsBulkUpdate( $hash, "state", "AMAD Flows inactive, device set offline" ); } elsif( $hash->{helper}{infoErrorCounter} > 9 && $hash->{helper}{setCmdErrorCounter} > 4 ) { @@ -516,7 +527,6 @@ sub AMAD_HTTP_POSTerrorHandling($$$) { Log3 $name, 4, "AMAD ($name) - UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; $attr{$name}{disable} = 1; - #$hash->{STATE} = "Unknown Error, device disabled"; readingsBulkUpdate( $hash, "state", "Unknown Error, device disabled" ); $hash->{helper}{infoErrorCounter} = 0; $hash->{helper}{setCmdErrorCounter} = 0; @@ -539,7 +549,6 @@ sub AMAD_HTTP_POSTerrorHandling($$$) { Log3 $name, 4, "AMAD ($name) - To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; readingsBulkUpdate( $hash, "deviceState", "offline" ); - #$hash->{STATE} = "To many Errors, device set offline"; ## STATE direkt setzen ist absolete readingsBulkUpdate( $hash, "state", "To many Errors, device set offline" ); $hash->{helper}{setCmdErrorCounter} = 0; } @@ -549,7 +558,6 @@ sub AMAD_HTTP_POSTerrorHandling($$$) { if( defined( $err ) ) { if( $err ne "" ) { readingsBeginUpdate( $hash ); - #$hash->{STATE} = $err if( $hash->{STATE} ne "initialized" ); ## STATE direkt setzen ist absolete readingsBulkUpdate( $hash, "state", $err ) if( ReadingsVal( $name, "state", 0 ) ne "initialized" ); $hash->{helper}{setCmdErrorCounter} = ($hash->{helper}{setCmdErrorCounter} + 1); @@ -573,7 +581,6 @@ sub AMAD_HTTP_POSTerrorHandling($$$) { if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { readingsBeginUpdate( $hash ); - #$hash->{STATE} = $param->{code} if( $hash->{STATE} ne "initialized" ); ## STATE direkt setzen ist absolete readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $hash, "state", 0 ) ne "initialized" ); $hash->{helper}{setCmdErrorCounter} = ( $hash->{helper}{setCmdErrorCounter} + 1 ); @@ -589,7 +596,6 @@ sub AMAD_HTTP_POSTerrorHandling($$$) { if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { readingsBeginUpdate( $hash ); - #$hash->{STATE} = $param->{code} if( $hash->{STATE} ne "initialized" ); ## STATE direkt setzen ist absolete readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state", 0 ) ne "initialized" ); $hash->{helper}{setCmdErrorCounter} = ( $hash->{helper}{setCmdErrorCounter} + 1 ); From 5147f82e5a71c63d3b553c97d05fee4eaae649ef Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Wed, 16 Sep 2015 21:27:33 +0200 Subject: [PATCH 02/25] =?UTF-8?q?noch=20Probleme=20mit=20weiteren=20Port?= =?UTF-8?q?=20=C3=B6ffnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index 569cdfb..2c7cbf7 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.0"; +my $version = "0.7.1"; @@ -79,9 +79,6 @@ my ( $hash, $def ) = @_; my $port = 8090; my $interval = 180; - # Interner Server fuer bidirektionale Kommunikation - my $sport = 8090; - $hash->{HOST} = $host; $hash->{PORT} = $port; @@ -93,11 +90,14 @@ my ( $hash, $def ) = @_; Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{HOST} and interval $hash->{INTERVAL} (sec)"; # Oeffnen des TCP Servers - my $ret = TcpServer_Open($hash, $sport, $global); + my $ret = TcpServer_Open( $hash, "8090", "global" ); + if($ret && !$init_done) { Log3 $name, 1, "$ret. Exiting."; exit(1); } + Log3 $name, 1, "$ret. Wird geöffnet."; + return $ret; AMAD_GetUpdateLocal( $hash ); @@ -468,11 +468,14 @@ sub AMAD_Read($) { if($hash->{SERVERSOCKET}) { # Accept and create a child my $chash = TcpServer_Accept($hash, "http"); - return if(!$chash); + $chash->{CD}->blocking(0); + return; } - + my $buf; + my $ret = sysread($hash->{CD}, $buf, 256); + Log3 $name, 3, "AMAD ($name) - Recieve String $buf"; } From 271071e5417c6734d2ae9805ca0b9ff7e7a7f711 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 17 Sep 2015 21:07:14 +0200 Subject: [PATCH 03/25] fehlerhaftes define --- 74_AMAD.pm | 90 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 32 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index 2c7cbf7..e2d87fe 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.1"; +my $version = "0.7.0"; @@ -47,7 +47,7 @@ sub AMAD_Initialize($) { $hash->{DefFn} = "AMAD_Define"; $hash->{UndefFn} = "AMAD_Undef"; $hash->{AttrFn} = "AMAD_Attr"; - $hash->{ReadFn} = "AMAD_Read"; + $hash->{ReadFn} = "AMAD_CommBridge_Read"; $hash->{AttrList} = "setOpenApp ". "setFullscreen:0,1 ". "setScreenOrientation:0,1 ". @@ -68,7 +68,21 @@ sub AMAD_Initialize($) { sub AMAD_Define($$) { -my ( $hash, $def ) = @_; + my ( $hash, $def ) = @_; + + #if( !$defs{AMADCommBridge} ) { # Anlegen einer Masterinstanz für die bidirektionale Kommunikation + + #my $bridgeDevice = "AMADCommBridge"; + #CommandDefine( undef, "$bridgeDevice AMAD 127.0.0.1" ); + #$defs{AMADCommBridge}{FAKEDEVICE} = 1; + #$defs{AMADCommBridge}{TEMPORARY} = 1; + #$defs{AMADCommBridge}{alias} = "AMAD Communication Bridge"; + #$defs{AMADCommBridge}{room} = 'hidden'; + + #Log3 $hash->{NAME}, 3, "AMAD ( $hash->{NAME} ) - AMADCommBridge fertig angelegt"; + #} + + my @a = split( "[ \t][ \t]*", $def ); return "too few parameters: define AMAD " if ( @a != 3 ); @@ -88,33 +102,25 @@ my ( $hash, $def ) = @_; $hash->{helper}{setCmdErrorCounter} = 0; Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{HOST} and interval $hash->{INTERVAL} (sec)"; - - # Oeffnen des TCP Servers - my $ret = TcpServer_Open( $hash, "8090", "global" ); - - if($ret && !$init_done) { - Log3 $name, 1, "$ret. Exiting."; - exit(1); - } - Log3 $name, 1, "$ret. Wird geöffnet."; - return $ret; - - AMAD_GetUpdateLocal( $hash ); - - InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ); - readingsSingleUpdate ( $hash, "state", "initialized", 1 ); - readingsSingleUpdate ( $hash, "deviceState", "online", 1 ); - - return undef; + + AMAD_GetUpdateLocal( $hash ); #if( $name ne "AMADCommBridge" ); + InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ); #if( $name ne "AMADCommBridge" ); + #AMAD_CommBridge_Open( $hash ) if( $hash eq "AMADCommBridge" ); + + readingsSingleUpdate ( $hash, "state", "initialized", 1 ); #if( $name ne "AMADCommBridge" ); + readingsSingleUpdate ( $hash, "deviceState", "online", 1 ); #if( $name ne "AMADCommBridge" ); } sub AMAD_Undef($$) { my ( $hash, $arg ) = @_; + RemoveInternalTimer( $hash ); - return TcpServer_Close($hash); + + my $ret = TcpServer_Close( $hash ) if( $hash eq "AMADCommBridge" ); + return $ret if( $hash eq "AMADCommBridge" ); } sub AMAD_Attr(@) { @@ -202,7 +208,7 @@ sub AMAD_GetUpdateLocal($) { my ( $hash ) = @_; my $name = $hash->{NAME}; - AMAD_RetrieveAutomagicInfo( $hash ) if( ReadingsVal( $name, "deviceState", "online" ) eq "online" && ReadingsVal( $hash->{NAME}, "state", 0 ) ne "initialized" && AttrVal( $name, "disable", 0 ) ne "1" ); ### deviceState muß von Hand online/offline gesetzt werden z.B. ueber RESIDENZ Modul + AMAD_RetrieveAutomagicInfo( $hash ) if( $name ne "AMADCommBridge" && ReadingsVal( $name, "deviceState", "online" ) eq "online" && ReadingsVal( $hash->{NAME}, "state", 0 ) ne "initialized" && AttrVal( $name, "disable", 0 ) ne "1" ); ### deviceState muß von Hand online/offline gesetzt werden z.B. ueber RESIDENZ Modul return 1; } @@ -212,7 +218,7 @@ sub AMAD_GetUpdateTimer($) { my ( $hash ) = @_; my $name = $hash->{NAME}; - AMAD_RetrieveAutomagicInfo( $hash ) if( ReadingsVal( $name, "deviceState", "online" ) eq "online" && AttrVal( $name, "disable", 0 ) ne "1" ); ### deviceState muß von Hand online/offline gesetzt werden z.B. ueber RESIDENZ Modul + AMAD_RetrieveAutomagicInfo( $hash ) if( $name ne "AMADCommBridge" && ReadingsVal( $name, "deviceState", "online" ) eq "online" && AttrVal( $name, "disable", 0 ) ne "1" ); ### deviceState muss von Hand online/offline gesetzt werden z.B. ueber RESIDENZ Modul InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 1 ); Log3 $name, 4, "AMAD ($name) - Call AMAD_GetUpdateTimer"; @@ -220,6 +226,22 @@ sub AMAD_GetUpdateTimer($) { return 1; } +sub AMAD_CommBridge_Open($) { + + my ( $hash ) = @_; + my $name = $hash->{NAME}; + + # Oeffnen des TCP Servers + my $ret = TcpServer_Open( $hash, "8090", "global" ); + + if( $ret && !$init_done ) { + Log3 $name, 1, "$ret. Exiting."; + exit(1); + } + Log3 $name, 1, "$ret. Wird geöffnet."; + return $ret; +} + sub AMAD_Set($$@) { my ( $hash, $name, $cmd, @val ) = @_; @@ -460,22 +482,26 @@ sub AMAD_RetrieveAutomagicInfoFinished($$$) { return undef; } -sub AMAD_Read($) { +sub AMAD_CommBridge_Read($$) { - my ($hash) = @_; - + my ( $hash, $reread ) = @_; my $name = $hash->{NAME}; if($hash->{SERVERSOCKET}) { # Accept and create a child - my $chash = TcpServer_Accept($hash, "http"); - $chash->{CD}->blocking(0); + my $nhash = TcpServer_Accept( $hash, "AMAD" ); + return if( !$nhash ); + $nhash->{CD}->blocking(0); return; } - my $buf; - my $ret = sysread($hash->{CD}, $buf, 256); + my $c = $hash->{CD}; - Log3 $name, 3, "AMAD ($name) - Recieve String $buf"; + if( !$reread ) { + my $buf; + my $ret = sysread( $c, $buf, 1024); + + Log3 $name, 3, "AMAD ($name) - Recieve String $buf"; + } } From 42dc1eccc80cd5aa563dcb90ac56bbdda8ef316a Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 17 Sep 2015 21:19:55 +0200 Subject: [PATCH 04/25] korrektes define --- 74_AMAD.pm | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index e2d87fe..fa25baf 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -69,7 +69,8 @@ sub AMAD_Initialize($) { sub AMAD_Define($$) { my ( $hash, $def ) = @_; - + + #if( !$defs{AMADCommBridge} ) { # Anlegen einer Masterinstanz für die bidirektionale Kommunikation #my $bridgeDevice = "AMADCommBridge"; @@ -81,6 +82,70 @@ sub AMAD_Define($$) { #Log3 $hash->{NAME}, 3, "AMAD ( $hash->{NAME} ) - AMADCommBridge fertig angelegt"; #} + + + my @a = split( "[ \t][ \t]*", $def ); + + return "too few parameters: define AMAD " if ( @a != 3 ); + + + my $name = $a[0]; + my $host = $a[2]; + my $port = 8090; + my $interval = 180; + + $hash->{HOST} = $host; + $hash->{PORT} = $port; + $hash->{INTERVAL} = $interval; + $hash->{VERSION} = $version; + $hash->{helper}{infoErrorCounter} = 0; + $hash->{helper}{setCmdErrorCounter} = 0; + + Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)"; + + AMAD_GetUpdateLocal( $hash ); + + InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ); + #AMAD_CommBridge_Open( $hash ) if( $hash eq "AMADCommBridge" ); + readingsSingleUpdate ( $hash, "state", "initialized", 1 ); + readingsSingleUpdate ( $hash, "deviceState", "online", 1 ); + + return undef; +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +my ( $hash, $def ) = @_; + + my @a = split( "[ \t][ \t]*", $def ); @@ -107,7 +172,7 @@ sub AMAD_Define($$) { AMAD_GetUpdateLocal( $hash ); #if( $name ne "AMADCommBridge" ); InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ); #if( $name ne "AMADCommBridge" ); - #AMAD_CommBridge_Open( $hash ) if( $hash eq "AMADCommBridge" ); + readingsSingleUpdate ( $hash, "state", "initialized", 1 ); #if( $name ne "AMADCommBridge" ); readingsSingleUpdate ( $hash, "deviceState", "online", 1 ); #if( $name ne "AMADCommBridge" ); From dde2b5c37ddbf6a923c7aa8ce842905bca019af9 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 18 Sep 2015 08:41:06 +0200 Subject: [PATCH 05/25] tests mit verschiedenen Codeteilen --- 74_AMAD.pm | 182 +++++++++++++++++------------------------------------ 1 file changed, 58 insertions(+), 124 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index fa25baf..7d3cc56 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -48,6 +48,7 @@ sub AMAD_Initialize($) { $hash->{UndefFn} = "AMAD_Undef"; $hash->{AttrFn} = "AMAD_Attr"; $hash->{ReadFn} = "AMAD_CommBridge_Read"; + $hash->{AttrList} = "setOpenApp ". "setFullscreen:0,1 ". "setScreenOrientation:0,1 ". @@ -59,7 +60,6 @@ sub AMAD_Initialize($) { "disable:1 "; $hash->{AttrList} .= $readingFnAttributes; - foreach my $d(sort keys %defs) { next if($defs{$d}{TYPE} ne "AMAD"); $defs{$d}->{VERSION} = $version; @@ -69,21 +69,6 @@ sub AMAD_Initialize($) { sub AMAD_Define($$) { my ( $hash, $def ) = @_; - - - #if( !$defs{AMADCommBridge} ) { # Anlegen einer Masterinstanz für die bidirektionale Kommunikation - - #my $bridgeDevice = "AMADCommBridge"; - #CommandDefine( undef, "$bridgeDevice AMAD 127.0.0.1" ); - #$defs{AMADCommBridge}{FAKEDEVICE} = 1; - #$defs{AMADCommBridge}{TEMPORARY} = 1; - #$defs{AMADCommBridge}{alias} = "AMAD Communication Bridge"; - #$defs{AMADCommBridge}{room} = 'hidden'; - - #Log3 $hash->{NAME}, 3, "AMAD ( $hash->{NAME} ) - AMADCommBridge fertig angelegt"; - #} - - my @a = split( "[ \t][ \t]*", $def ); return "too few parameters: define AMAD " if ( @a != 3 ); @@ -96,88 +81,34 @@ sub AMAD_Define($$) { $hash->{HOST} = $host; $hash->{PORT} = $port; - $hash->{INTERVAL} = $interval; + $hash->{INTERVAL} = $interval if( $name ne "AMADCommBridge" ); $hash->{VERSION} = $version; - $hash->{helper}{infoErrorCounter} = 0; - $hash->{helper}{setCmdErrorCounter} = 0; + $hash->{helper}{infoErrorCounter} = 0 if( $name ne "AMADCommBridge" ); + $hash->{helper}{setCmdErrorCounter} = 0 if( $name ne "AMADCommBridge" ); - Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)"; + Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)" if( $name ne "AMADCommBridge" ); - AMAD_GetUpdateLocal( $hash ); - - InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ); - #AMAD_CommBridge_Open( $hash ) if( $hash eq "AMADCommBridge" ); + AMAD_GetUpdateLocal( $hash ) if( $name ne "AMADCommBridge" ); + InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ) if( $name ne "AMADCommBridge" ); + readingsSingleUpdate ( $hash, "state", "initialized", 1 ); readingsSingleUpdate ( $hash, "deviceState", "online", 1 ); + + + if( !$defs{AMADCommBridge} ) { # Anlegen einer Masterinstanz für die bidirektionale Kommunikation + + my $bridgeDevice = "AMADCommBridge"; + CommandDefine( undef, "$bridgeDevice AMAD 127.0.0.1" ); + $defs{AMADCommBridge}{TEMPORARY} = 1; + CommandAttr(undef,"$bridgeDevice room hidden"); + + AMAD_CommBridge_Open( $hash ); + } + return undef; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -my ( $hash, $def ) = @_; - - - - - my @a = split( "[ \t][ \t]*", $def ); - - return "too few parameters: define AMAD " if ( @a != 3 ); - - - my $name = $a[0]; - my $host = $a[2]; - my $port = 8090; - my $interval = 180; - - - $hash->{HOST} = $host; - $hash->{PORT} = $port; - $hash->{INTERVAL} = $interval; - $hash->{VERSION} = $version; - $hash->{helper}{infoErrorCounter} = 0; - $hash->{helper}{setCmdErrorCounter} = 0; - - Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{HOST} and interval $hash->{INTERVAL} (sec)"; - - - - AMAD_GetUpdateLocal( $hash ); #if( $name ne "AMADCommBridge" ); - InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ); #if( $name ne "AMADCommBridge" ); - - - readingsSingleUpdate ( $hash, "state", "initialized", 1 ); #if( $name ne "AMADCommBridge" ); - readingsSingleUpdate ( $hash, "deviceState", "online", 1 ); #if( $name ne "AMADCommBridge" ); -} - sub AMAD_Undef($$) { my ( $hash, $arg ) = @_; @@ -273,7 +204,7 @@ sub AMAD_GetUpdateLocal($) { my ( $hash ) = @_; my $name = $hash->{NAME}; - AMAD_RetrieveAutomagicInfo( $hash ) if( $name ne "AMADCommBridge" && ReadingsVal( $name, "deviceState", "online" ) eq "online" && ReadingsVal( $hash->{NAME}, "state", 0 ) ne "initialized" && AttrVal( $name, "disable", 0 ) ne "1" ); ### deviceState muß von Hand online/offline gesetzt werden z.B. ueber RESIDENZ Modul + AMAD_RetrieveAutomagicInfo( $hash ) if( ReadingsVal( $name, "deviceState", "online" ) eq "online" && ReadingsVal( $hash->{NAME}, "state", 0 ) ne "initialized" && AttrVal( $name, "disable", 0 ) ne "1" ); ### deviceState muß von Hand online/offline gesetzt werden z.B. ueber RESIDENZ Modul return 1; } @@ -283,7 +214,7 @@ sub AMAD_GetUpdateTimer($) { my ( $hash ) = @_; my $name = $hash->{NAME}; - AMAD_RetrieveAutomagicInfo( $hash ) if( $name ne "AMADCommBridge" && ReadingsVal( $name, "deviceState", "online" ) eq "online" && AttrVal( $name, "disable", 0 ) ne "1" ); ### deviceState muss von Hand online/offline gesetzt werden z.B. ueber RESIDENZ Modul + AMAD_RetrieveAutomagicInfo( $hash ) if( ReadingsVal( $name, "deviceState", "online" ) eq "online" && AttrVal( $name, "disable", 0 ) ne "1" ); ### deviceState muss von Hand online/offline gesetzt werden z.B. ueber RESIDENZ Modul InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 1 ); Log3 $name, 4, "AMAD ($name) - Call AMAD_GetUpdateTimer"; @@ -310,40 +241,42 @@ sub AMAD_CommBridge_Open($) { sub AMAD_Set($$@) { my ( $hash, $name, $cmd, @val ) = @_; - my $apps = AttrVal( $name, "setOpenApp", "none" ); - - my $list = ""; - $list .= "screenMsg "; - $list .= "ttsMsg "; - $list .= "volume:slider,0,1,15 "; - $list .= "deviceState:online,offline "; - $list .= "mediaPlayer:play,stop,next,back " if( AttrVal( $name, "fhemServerIP", "none" ) ne "none" ); - $list .= "screenBrightness:slider,0,1,255 " if( AttrVal( $name, "setScreenBrightness", "1" ) eq "1" ); - $list .= "screen:on,off "; - $list .= "screenOrientation:auto,landscape,portrait " if( AttrVal( $name, "setScreenOrientation", "1" ) eq "1" ); - $list .= "screenFullscreen:on,off " if( AttrVal( $name, "setFullscreen", "1" ) eq "1" ); - $list .= "openURL "; - $list .= "openApp:$apps " if( AttrVal( $name, "setOpenApp", "none" ) ne "none" ); - $list .= "nextAlarmTime:time "; - $list .= "statusRequest:noArg "; - $list .= "system:reboot " if( AttrVal( $name, "root", "1" ) eq "1" ); + if( $name ne "AMADCommBridge" ) { + my $apps = AttrVal( $name, "setOpenApp", "none" ); + + my $list = ""; + + $list .= "screenMsg "; + $list .= "ttsMsg "; + $list .= "volume:slider,0,1,15 "; + $list .= "deviceState:online,offline "; + $list .= "mediaPlayer:play,stop,next,back " if( AttrVal( $name, "fhemServerIP", "none" ) ne "none" ); + $list .= "screenBrightness:slider,0,1,255 " if( AttrVal( $name, "setScreenBrightness", "1" ) eq "1" ); + $list .= "screen:on,off "; + $list .= "screenOrientation:auto,landscape,portrait " if( AttrVal( $name, "setScreenOrientation", "1" ) eq "1" ); + $list .= "screenFullscreen:on,off " if( AttrVal( $name, "setFullscreen", "1" ) eq "1" ); + $list .= "openURL "; + $list .= "openApp:$apps " if( AttrVal( $name, "setOpenApp", "none" ) ne "none" ); + $list .= "nextAlarmTime:time "; + $list .= "statusRequest:noArg "; + $list .= "system:reboot " if( AttrVal( $name, "root", "1" ) eq "1" ); - if (lc $cmd eq 'screenmsg' - || lc $cmd eq 'ttsmsg' - || lc $cmd eq 'volume' - || lc $cmd eq 'mediaplayer' - || lc $cmd eq 'devicestate' - || lc $cmd eq 'screenbrightness' - || lc $cmd eq 'screenorientation' - || lc $cmd eq 'screenfullscreen' - || lc $cmd eq 'screen' - || lc $cmd eq 'openurl' - || lc $cmd eq 'openapp' - || lc $cmd eq 'nextalarmtime' - || lc $cmd eq 'system' - || lc $cmd eq 'statusrequest') { + if (lc $cmd eq 'screenmsg' + || lc $cmd eq 'ttsmsg' + || lc $cmd eq 'volume' + || lc $cmd eq 'mediaplayer' + || lc $cmd eq 'devicestate' + || lc $cmd eq 'screenbrightness' + || lc $cmd eq 'screenorientation' + || lc $cmd eq 'screenfullscreen' + || lc $cmd eq 'screen' + || lc $cmd eq 'openurl' + || lc $cmd eq 'openapp' + || lc $cmd eq 'nextalarmtime' + || lc $cmd eq 'system' + || lc $cmd eq 'statusrequest') { Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val); @@ -354,9 +287,10 @@ sub AMAD_Set($$@) { return "Cannot set command, FHEM Device is offline" if( ReadingsVal( $name, "deviceState", "online" ) eq "offline" ); return AMAD_SelectSetCmd( $hash, $cmd, @val ) if( @val ) || ( lc $cmd eq 'statusrequest' ); - } + } - return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; + return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; + } } sub AMAD_RetrieveAutomagicInfo($) { From a1a1feb2d43e7d1d5af6dfa3fc7aeaebf0837d65 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 29 Sep 2015 10:53:31 +0200 Subject: [PATCH 06/25] einbindung AMADCommBridge Kommunikation mit setzen von Readings im AMADCommBridge Device --- 74_AMAD.pm | 561 +++++++++++++++++++++++++++++------------------------ 1 file changed, 308 insertions(+), 253 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index 7d3cc56..f49dfc3 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.0"; +my $version = "0.7.1"; @@ -69,10 +69,10 @@ sub AMAD_Initialize($) { sub AMAD_Define($$) { my ( $hash, $def ) = @_; + my @a = split( "[ \t][ \t]*", $def ); - return "too few parameters: define AMAD " if ( @a != 3 ); - + return "too few parameters: define AMAD " if( @a != 3 && $a[0] ne "AMADCommBridge" ); my $name = $a[0]; my $host = $a[2]; @@ -81,42 +81,54 @@ sub AMAD_Define($$) { $hash->{HOST} = $host; $hash->{PORT} = $port; - $hash->{INTERVAL} = $interval if( $name ne "AMADCommBridge" ); + $hash->{INTERVAL} = $interval if( $hash->{HOST} ); $hash->{VERSION} = $version; - $hash->{helper}{infoErrorCounter} = 0 if( $name ne "AMADCommBridge" ); - $hash->{helper}{setCmdErrorCounter} = 0 if( $name ne "AMADCommBridge" ); + $hash->{helper}{infoErrorCounter} = 0 if( $hash->{HOST} ); + $hash->{helper}{setCmdErrorCounter} = 0 if( $hash->{HOST} ); + + if( !$hash->{HOST} ) { + return "there is already a amad bridge" if( $modules{AMAD}{defptr}{BRIDGE} ); - Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)" if( $name ne "AMADCommBridge" ); - - AMAD_GetUpdateLocal( $hash ) if( $name ne "AMADCommBridge" ); - InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ) if( $name ne "AMADCommBridge" ); - - readingsSingleUpdate ( $hash, "state", "initialized", 1 ); - readingsSingleUpdate ( $hash, "deviceState", "online", 1 ); - - - if( !$defs{AMADCommBridge} ) { # Anlegen einer Masterinstanz für die bidirektionale Kommunikation - - my $bridgeDevice = "AMADCommBridge"; - CommandDefine( undef, "$bridgeDevice AMAD 127.0.0.1" ); - $defs{AMADCommBridge}{TEMPORARY} = 1; - CommandAttr(undef,"$bridgeDevice room hidden"); - + $hash->{BRIDGE} = 1; + $hash->{TEMPORARY} = 1; + $modules{AMAD}{defptr}{BRIDGE} = $hash; + $attr{$name}{room} = "hidden"; + Log3 $name, 3, "AMAD ($name) - defined Bridge with Socketport $hash->{PORT}"; AMAD_CommBridge_Open( $hash ); - } - - return undef; + } else { + if( !$modules{AMAD}{defptr}{BRIDGE} ) { + CommandDefine( undef, "AMADCommBridge AMAD" ); + } + + Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)"; + + readingsSingleUpdate ( $hash, "state", "initialized", 1 ) if( $hash->{HOST} ); + readingsSingleUpdate ( $hash, "deviceState", "online", 1 ) if( $hash->{HOST} ); + + InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ) if( $hash->{HOST} ); + + #$modules{AMAD}{defptr}{$hash->$hash->{HOST}}; + + return undef; + } } sub AMAD_Undef($$) { my ( $hash, $arg ) = @_; - RemoveInternalTimer( $hash ); + if( $hash->{BRIDGE} ) { + delete $modules{AMAD}{defptr}{BRIDGE}; - my $ret = TcpServer_Close( $hash ) if( $hash eq "AMADCommBridge" ); - return $ret if( $hash eq "AMADCommBridge" ); + } else { + delete $modules{AMAD}{defptr}{$hash->{HOST}}; + + RemoveInternalTimer( $hash ); + + my $ret = TcpServer_Close( $hash ); + return $ret; + } } sub AMAD_Attr(@) { @@ -222,77 +234,6 @@ sub AMAD_GetUpdateTimer($) { return 1; } -sub AMAD_CommBridge_Open($) { - - my ( $hash ) = @_; - my $name = $hash->{NAME}; - - # Oeffnen des TCP Servers - my $ret = TcpServer_Open( $hash, "8090", "global" ); - - if( $ret && !$init_done ) { - Log3 $name, 1, "$ret. Exiting."; - exit(1); - } - Log3 $name, 1, "$ret. Wird geöffnet."; - return $ret; -} - -sub AMAD_Set($$@) { - - my ( $hash, $name, $cmd, @val ) = @_; - - if( $name ne "AMADCommBridge" ) { - my $apps = AttrVal( $name, "setOpenApp", "none" ); - - my $list = ""; - - $list .= "screenMsg "; - $list .= "ttsMsg "; - $list .= "volume:slider,0,1,15 "; - $list .= "deviceState:online,offline "; - $list .= "mediaPlayer:play,stop,next,back " if( AttrVal( $name, "fhemServerIP", "none" ) ne "none" ); - $list .= "screenBrightness:slider,0,1,255 " if( AttrVal( $name, "setScreenBrightness", "1" ) eq "1" ); - $list .= "screen:on,off "; - $list .= "screenOrientation:auto,landscape,portrait " if( AttrVal( $name, "setScreenOrientation", "1" ) eq "1" ); - $list .= "screenFullscreen:on,off " if( AttrVal( $name, "setFullscreen", "1" ) eq "1" ); - $list .= "openURL "; - $list .= "openApp:$apps " if( AttrVal( $name, "setOpenApp", "none" ) ne "none" ); - $list .= "nextAlarmTime:time "; - $list .= "statusRequest:noArg "; - $list .= "system:reboot " if( AttrVal( $name, "root", "1" ) eq "1" ); - - - if (lc $cmd eq 'screenmsg' - || lc $cmd eq 'ttsmsg' - || lc $cmd eq 'volume' - || lc $cmd eq 'mediaplayer' - || lc $cmd eq 'devicestate' - || lc $cmd eq 'screenbrightness' - || lc $cmd eq 'screenorientation' - || lc $cmd eq 'screenfullscreen' - || lc $cmd eq 'screen' - || lc $cmd eq 'openurl' - || lc $cmd eq 'openapp' - || lc $cmd eq 'nextalarmtime' - || lc $cmd eq 'system' - || lc $cmd eq 'statusrequest') { - - Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val); - - return "set command only works if state not equal initialized, please wait for next interval run" if( ReadingsVal( $hash->{NAME}, "state", 0 ) eq "initialized"); - return "Cannot set command, FHEM Device is disabled" if( AttrVal( $name, "disable", "0" ) eq "1" ); - - return AMAD_SelectSetCmd( $hash, $cmd, @val ) if( @val ) && ( ReadingsVal( $name, "deviceState", "online" ) eq "offline" ) && ( lc $cmd eq 'devicestate' ); - return "Cannot set command, FHEM Device is offline" if( ReadingsVal( $name, "deviceState", "online" ) eq "offline" ); - - return AMAD_SelectSetCmd( $hash, $cmd, @val ) if( @val ) || ( lc $cmd eq 'statusrequest' ); - } - - return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; - } -} - sub AMAD_RetrieveAutomagicInfo($) { my ($hash) = @_; @@ -306,7 +247,7 @@ sub AMAD_RetrieveAutomagicInfo($) { HttpUtils_NonblockingGet( { url => $url, - timeout => 5, + timeout => 10, hash => $hash, method => "GET", header => "fhemIP: $fhemip\r\nfhemDevice: $name", @@ -481,170 +422,59 @@ sub AMAD_RetrieveAutomagicInfoFinished($$$) { return undef; } -sub AMAD_CommBridge_Read($$) { - - my ( $hash, $reread ) = @_; - my $name = $hash->{NAME}; +sub AMAD_Set($$@) { - if($hash->{SERVERSOCKET}) { # Accept and create a child - my $nhash = TcpServer_Accept( $hash, "AMAD" ); - return if( !$nhash ); - $nhash->{CD}->blocking(0); - return; - } + my ( $hash, $name, $cmd, @val ) = @_; - my $c = $hash->{CD}; + if( $name ne "AMADCommBridge" ) { + my $apps = AttrVal( $name, "setOpenApp", "none" ); + + my $list = ""; - if( !$reread ) { - my $buf; - my $ret = sysread( $c, $buf, 1024); - - Log3 $name, 3, "AMAD ($name) - Recieve String $buf"; - } + $list .= "screenMsg "; + $list .= "ttsMsg "; + $list .= "volume:slider,0,1,15 "; + $list .= "deviceState:online,offline "; + $list .= "mediaPlayer:play,stop,next,back " if( AttrVal( $name, "fhemServerIP", "none" ) ne "none" ); + $list .= "screenBrightness:slider,0,1,255 " if( AttrVal( $name, "setScreenBrightness", "1" ) eq "1" ); + $list .= "screen:on,off "; + $list .= "screenOrientation:auto,landscape,portrait " if( AttrVal( $name, "setScreenOrientation", "1" ) eq "1" ); + $list .= "screenFullscreen:on,off " if( AttrVal( $name, "setFullscreen", "1" ) eq "1" ); + $list .= "openURL "; + $list .= "openApp:$apps " if( AttrVal( $name, "setOpenApp", "none" ) ne "none" ); + $list .= "nextAlarmTime:time "; + $list .= "statusRequest:noArg "; + $list .= "system:reboot " if( AttrVal( $name, "root", "1" ) eq "1" ); -} -sub AMAD_HTTP_POST($$) { + if (lc $cmd eq 'screenmsg' + || lc $cmd eq 'ttsmsg' + || lc $cmd eq 'volume' + || lc $cmd eq 'mediaplayer' + || lc $cmd eq 'devicestate' + || lc $cmd eq 'screenbrightness' + || lc $cmd eq 'screenorientation' + || lc $cmd eq 'screenfullscreen' + || lc $cmd eq 'screen' + || lc $cmd eq 'openurl' + || lc $cmd eq 'openapp' + || lc $cmd eq 'nextalarmtime' + || lc $cmd eq 'system' + || lc $cmd eq 'statusrequest') { - my ( $hash, $url ) = @_; - my $name = $hash->{NAME}; - - my $state = ReadingsVal( $name, "state", 0 ); - - readingsSingleUpdate( $hash, "state", "Send HTTP POST", 1 ); - - HttpUtils_NonblockingGet( - { - url => $url, - timeout => 5, - hash => $hash, - method => "POST", - doTrigger => 1, - callback => \&AMAD_HTTP_POSTerrorHandling, - } - ); - Log3 $name, 4, "AMAD ($name) - Send HTTP POST with URL $url"; - - readingsSingleUpdate( $hash, "state", $state, 1 ); - - return undef; -} - -sub AMAD_HTTP_POSTerrorHandling($$$) { - - my ( $param, $err, $data ) = @_; - my $hash = $param->{hash}; - my $name = $hash->{NAME}; - - - ### Begin Error Handling - if( $hash->{helper}{setCmdErrorCounter} > 2 ) { - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "lastSetCommandState", "statusRequest_error" ); - - if( ReadingsVal( $name, "flow_Informations", "active" ) eq "inactive" && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { - readingsBulkUpdate( $hash, "lastSetCommandError", "AMAD flows on your device inactive, please check your device" ); - Log3 $name, 5, "AMAD ($name) - CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; - - readingsBulkUpdate( $hash, "deviceState", "offline" ); - readingsBulkUpdate( $hash, "state", "AMAD Flows inactive, device set offline" ); - } - elsif( $hash->{helper}{infoErrorCounter} > 9 && $hash->{helper}{setCmdErrorCounter} > 4 ) { - readingsBulkUpdate($hash, "lastSetCommandError", "unknown error, please contact the developer" ); - - Log3 $name, 4, "AMAD ($name) - UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; - - $attr{$name}{disable} = 1; - readingsBulkUpdate( $hash, "state", "Unknown Error, device disabled" ); - $hash->{helper}{infoErrorCounter} = 0; - $hash->{helper}{setCmdErrorCounter} = 0; - - return; - } - elsif( ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { - readingsBulkUpdate( $hash, "lastSetCommandError", "setCommands flow on your device is inactive, will try to reactivate" ); - - Log3 $name, 4, "AMAD ($name) - Flow SetCommands on your Device is inactive, will try to reactivate"; - } - elsif( $hash->{helper}{setCmdErrorCounter} > 4 && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "active" ){ - readingsBulkUpdate( $hash, "lastSetCommandError", "check automagicApp on your device" ); - - Log3 $name, 4, "AMAD ($name) - Please check the AutomagicAPP on your Device"; - } - elsif( $hash->{helper}{setCmdErrorCounter} > 9 ) { - readingsBulkUpdate( $hash, "lastSetCommandError", "to many errors, check your network or device configuration" ); - - Log3 $name, 4, "AMAD ($name) - To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; - - readingsBulkUpdate( $hash, "deviceState", "offline" ); - readingsBulkUpdate( $hash, "state", "To many Errors, device set offline" ); - $hash->{helper}{setCmdErrorCounter} = 0; - } - readingsEndUpdate( $hash, 1 ); - } - - if( defined( $err ) ) { - if( $err ne "" ) { - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "state", $err ) if( ReadingsVal( $name, "state", 0 ) ne "initialized" ); - $hash->{helper}{setCmdErrorCounter} = ($hash->{helper}{setCmdErrorCounter} + 1); + Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val); - readingsBulkUpdate( $hash, "lastSetCommandState", "cmd_error" ); + return "set command only works if state not equal initialized, please wait for next interval run" if( ReadingsVal( $hash->{NAME}, "state", 0 ) eq "initialized"); + return "Cannot set command, FHEM Device is disabled" if( AttrVal( $name, "disable", "0" ) eq "1" ); + + return AMAD_SelectSetCmd( $hash, $cmd, @val ) if( @val ) && ( ReadingsVal( $name, "deviceState", "online" ) eq "offline" ) && ( lc $cmd eq 'devicestate' ); + return "Cannot set command, FHEM Device is offline" if( ReadingsVal( $name, "deviceState", "online" ) eq "offline" ); - if( $err =~ /timed out/ ) { - readingsBulkUpdate( $hash, "lastSetCommandError", "connect to your device is timed out. check network" ); - } - elsif( $err =~ /Keine Route zum Zielrechner/ ) { - readingsBulkUpdate( $hash, "lastSetCommandError", "no route to target. bad network configuration or network is down" ); - } else { - readingsBulkUpdate( $hash, "lastSetCommandError", "$err" ); - } - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 5, "AMAD ($name) - AMAD_HTTP_POST: error while POST Command: $err"; - - return; + return AMAD_SelectSetCmd( $hash, $cmd, @val ) if( @val ) || ( lc $cmd eq 'statusrequest' ); } - } - - if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $hash, "state", 0 ) ne "initialized" ); - - $hash->{helper}{setCmdErrorCounter} = ( $hash->{helper}{setCmdErrorCounter} + 1 ); - readingsBulkUpdate($hash, "lastSetCommandState", "cmd_error" ); - readingsBulkUpdate($hash, "lastSetCommandError", "http Error ".$param->{code} ); - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 5, "AMAD ($name) - AMAD_HTTP_POST: received http code ".$param->{code}; - - return; + return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; } - - if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state", 0 ) ne "initialized" ); - - $hash->{helper}{setCmdErrorCounter} = ( $hash->{helper}{setCmdErrorCounter} + 1 ); - - readingsBulkUpdate( $hash, "lastSetCommandState", "cmd_error" ); - - if( $param->{code} eq 404 ) { - readingsBulkUpdate( $hash, "lastSetCommandError", "setCommands flow is inactive on your device!" ); - } else { - readingsBulkUpdate( $hash, "lastSetCommandError", "http error ".$param->{code} ); - } - - return; - } - - ### End Error Handling - - readingsSingleUpdate( $hash, "lastSetCommandState", "cmd_done", 1 ); - $hash->{helper}{setCmdErrorCounter} = 0; - - return undef; } sub AMAD_SelectSetCmd($$@) { @@ -793,6 +623,231 @@ sub AMAD_SelectSetCmd($$@) { return undef; } +sub AMAD_HTTP_POST($$) { + + my ( $hash, $url ) = @_; + my $name = $hash->{NAME}; + + my $state = ReadingsVal( $name, "state", 0 ); + + readingsSingleUpdate( $hash, "state", "Send HTTP POST", 1 ); + + HttpUtils_NonblockingGet( + { + url => $url, + timeout => 60, + hash => $hash, + method => "POST", + doTrigger => 1, + callback => \&AMAD_HTTP_POSTerrorHandling, + } + ); + Log3 $name, 4, "AMAD ($name) - Send HTTP POST with URL $url"; + + readingsSingleUpdate( $hash, "state", $state, 1 ); + + return undef; +} + +sub AMAD_HTTP_POSTerrorHandling($$$) { + + my ( $param, $err, $data ) = @_; + my $hash = $param->{hash}; + my $name = $hash->{NAME}; + + + ### Begin Error Handling + if( $hash->{helper}{setCmdErrorCounter} > 2 ) { + readingsBeginUpdate( $hash ); + readingsBulkUpdate( $hash, "lastSetCommandState", "statusRequest_error" ); + + if( ReadingsVal( $name, "flow_Informations", "active" ) eq "inactive" && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { + readingsBulkUpdate( $hash, "lastSetCommandError", "AMAD flows on your device inactive, please check your device" ); + Log3 $name, 5, "AMAD ($name) - CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; + + readingsBulkUpdate( $hash, "deviceState", "offline" ); + readingsBulkUpdate( $hash, "state", "AMAD Flows inactive, device set offline" ); + } + elsif( $hash->{helper}{infoErrorCounter} > 9 && $hash->{helper}{setCmdErrorCounter} > 4 ) { + readingsBulkUpdate($hash, "lastSetCommandError", "unknown error, please contact the developer" ); + + Log3 $name, 4, "AMAD ($name) - UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; + + $attr{$name}{disable} = 1; + readingsBulkUpdate( $hash, "state", "Unknown Error, device disabled" ); + $hash->{helper}{infoErrorCounter} = 0; + $hash->{helper}{setCmdErrorCounter} = 0; + + return; + } + elsif( ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { + readingsBulkUpdate( $hash, "lastSetCommandError", "setCommands flow on your device is inactive, will try to reactivate" ); + + Log3 $name, 4, "AMAD ($name) - Flow SetCommands on your Device is inactive, will try to reactivate"; + } + elsif( $hash->{helper}{setCmdErrorCounter} > 4 && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "active" ){ + readingsBulkUpdate( $hash, "lastSetCommandError", "check automagicApp on your device" ); + + Log3 $name, 4, "AMAD ($name) - Please check the AutomagicAPP on your Device"; + } + elsif( $hash->{helper}{setCmdErrorCounter} > 9 ) { + readingsBulkUpdate( $hash, "lastSetCommandError", "to many errors, check your network or device configuration" ); + + Log3 $name, 4, "AMAD ($name) - To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; + + readingsBulkUpdate( $hash, "deviceState", "offline" ); + readingsBulkUpdate( $hash, "state", "To many Errors, device set offline" ); + $hash->{helper}{setCmdErrorCounter} = 0; + } + readingsEndUpdate( $hash, 1 ); + } + + if( defined( $err ) ) { + if( $err ne "" ) { + readingsBeginUpdate( $hash ); + readingsBulkUpdate( $hash, "state", $err ) if( ReadingsVal( $name, "state", 0 ) ne "initialized" ); + $hash->{helper}{setCmdErrorCounter} = ($hash->{helper}{setCmdErrorCounter} + 1); + + readingsBulkUpdate( $hash, "lastSetCommandState", "cmd_error" ); + + if( $err =~ /timed out/ ) { + readingsBulkUpdate( $hash, "lastSetCommandError", "connect to your device is timed out. check network" ); + } + elsif( $err =~ /Keine Route zum Zielrechner/ ) { + readingsBulkUpdate( $hash, "lastSetCommandError", "no route to target. bad network configuration or network is down" ); + } else { + readingsBulkUpdate( $hash, "lastSetCommandError", "$err" ); + } + readingsEndUpdate( $hash, 1 ); + + Log3 $name, 5, "AMAD ($name) - AMAD_HTTP_POST: error while POST Command: $err"; + + return; + } + } + + if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { + readingsBeginUpdate( $hash ); + readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $hash, "state", 0 ) ne "initialized" ); + + $hash->{helper}{setCmdErrorCounter} = ( $hash->{helper}{setCmdErrorCounter} + 1 ); + + readingsBulkUpdate($hash, "lastSetCommandState", "cmd_error" ); + readingsBulkUpdate($hash, "lastSetCommandError", "http Error ".$param->{code} ); + readingsEndUpdate( $hash, 1 ); + + Log3 $name, 5, "AMAD ($name) - AMAD_HTTP_POST: received http code ".$param->{code}; + + return; + } + + if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { + readingsBeginUpdate( $hash ); + readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state", 0 ) ne "initialized" ); + + $hash->{helper}{setCmdErrorCounter} = ( $hash->{helper}{setCmdErrorCounter} + 1 ); + + readingsBulkUpdate( $hash, "lastSetCommandState", "cmd_error" ); + + if( $param->{code} eq 404 ) { + readingsBulkUpdate( $hash, "lastSetCommandError", "setCommands flow is inactive on your device!" ); + } else { + readingsBulkUpdate( $hash, "lastSetCommandError", "http error ".$param->{code} ); + } + + return; + } + + ### End Error Handling + + readingsSingleUpdate( $hash, "lastSetCommandState", "cmd_done", 1 ); + $hash->{helper}{setCmdErrorCounter} = 0; + + return undef; +} + +sub AMAD_CommBridge_Open($) { + + my ( $hash ) = @_; + my $name = $hash->{NAME}; + + # Oeffnen des TCP Sockets + my $ret = TcpServer_Open( $hash, "8090", "global" ); + + if( $ret && !$init_done ) { + Log3 $name, 3, "$ret. Exiting."; + exit(1); + } + + readingsSingleUpdate ( $hash, "state", "opened", 1 ); + Log3 $name, 5, "Socket wird geöffnet."; + + return $ret; +} + +sub AMAD_CommBridge_Read($) { + + my ( $hash ) = @_; + my $name = $hash->{NAME}; + #my $chash = $modules{AMAD}{defptr}{}; + my $brihash = $modules{AMAD}{defptr}{BRIDGE}; + + # Received chars stored in $c + if( $hash->{SERVERSOCKET} ) { # Accept and create a child + TcpServer_Accept( $hash, "AMAD" ); + # my $chash = TcpServer_Accept( $hash, "AMAD" ); # Wird zum schließen der Verbindung benötigt, siehe unten + return; + } + + # Read 1024 byte of data + my $buf; + my $ret = sysread($hash->{CD}, $buf, 1024); + + # When there is an error in connection return + if( !defined($ret ) || $ret <= 0 ) { + CommandDelete( undef, $hash->{NAME} ); + return; + } + + my $response = "header lines: \r\nAMADCommBridge recive Data complete\r\nPlease see next\r\n\r\nrunnin\r\n"; + + my $c = $hash->{CD}; + print $c "HTTP/1.1 200 OK\r\n", + "Content-Type: text/plain\r\n", + "Content-Length: ".length($response)."\r\n\r\n", + $response; + + + ## hier den close Client einbauen auf hash vom Accept $chash siehe oben + ## close($hash->{CD}) + + + + + ### + ## Consume Content + ### + + my @data = split( '\R\R', $buf ); + if ( $data[0] =~ /FHEMCMD: setreading\b/ ) { + + Log3 $name, 3, "setreading ist gleich $data[1]"; + return; + #return AMAD_RetrieveAutomagicInfoFinished( "test", "err", $data[1] ); + } + + elsif ( $data[0] =~ /FHEMCMD: set\b/ ) { + readingsBeginUpdate( $brihash ); + readingsBulkUpdate ( $brihash, "lastCmd", $data[1] ); + + @data = split( '\n', $data[0] ); + $data[2] =~ s/FHEMDEVICE: //; + + readingsBulkUpdate ( $brihash, "lastCmdDevice", $data[2] ); + readingsEndUpdate( $brihash, 1 ); + } +} + 1; From dc15053fba48d1ce4101a673664181c9e8851ad4 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 1 Oct 2015 21:01:21 +0200 Subject: [PATCH 07/25] =?UTF-8?q?AMAD=20Bridge=20nun=20vollst=C3=A4ndig=20?= =?UTF-8?q?integriert,=202=20Funkrionen=20innerhalb=20des=20Information=20?= =?UTF-8?q?und=20setCommands=20Flows=20wurden=20bereits=20auf=20die=20Brid?= =?UTF-8?q?ge=20Kommunikation=20umgestellt.=20Bsp,=20setzen=20der=20Music?= =?UTF-8?q?=20Metachanged=20Readings=20Album,Artist=20und=20so.=20Ausserde?= =?UTF-8?q?m=20wird=20das=20anfordern=20eines=20statusRequest=20nach=20erf?= =?UTF-8?q?olreichen=20setCommand=20nun=20=C3=BCber=20das=20Bridge=20Devic?= =?UTF-8?q?e=20durchgef=C3=BChrt.=20ES=20IST=20ZWINGEND=20NOTWENDIG=20DAS?= =?UTF-8?q?=20DAS=20ATTRIBUT=20fhemServerIP=20GESETZT=20WIRD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 82 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index f49dfc3..7be9db6 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.1"; +my $version = "0.7.2"; @@ -513,9 +513,6 @@ sub AMAD_SelectSetCmd($$@) { my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setVolume?volume=$vol"; readingsSingleUpdate( $hash, $cmd, $vol, 1 ); - - Log3 $name, 4, "AMAD ($name) - Starte Update GetUpdateLocal"; - AMAD_GetUpdateLocal( $hash ); return AMAD_HTTP_POST( $hash, $url ); } @@ -540,9 +537,6 @@ sub AMAD_SelectSetCmd($$@) { my $bri = join( " ", @data ); my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setBrightness?brightness=$bri"; - - Log3 $name, 4, "AMAD ($name) - Starte Update GetUpdateLocal"; - AMAD_GetUpdateLocal( $hash ); return AMAD_HTTP_POST( $hash,$url ); } @@ -552,9 +546,6 @@ sub AMAD_SelectSetCmd($$@) { my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenOnOff?screen=$mod"; - Log3 $name, 4, "AMAD ($name) - Starte Update GetUpdateLocal"; - AMAD_GetUpdateLocal( $hash ); - return AMAD_HTTP_POST( $hash,$url ); } @@ -562,9 +553,6 @@ sub AMAD_SelectSetCmd($$@) { my $mod = join( " ", @data ); my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenOrientation?orientation=$mod"; - - Log3 $name, 4, "AMAD ($name) - Starte Update GetUpdateLocal"; - AMAD_GetUpdateLocal( $hash ); return AMAD_HTTP_POST( $hash,$url ); } @@ -592,9 +580,6 @@ sub AMAD_SelectSetCmd($$@) { my @alarm = split( ":", $alarmTime ); my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setAlarm?hour=".$alarm[0]."&minute=".$alarm[1]; - - Log3 $name, 4, "AMAD ($name) - Starte Update GetUpdateLocal"; - AMAD_GetUpdateLocal( $hash ); return AMAD_HTTP_POST( $hash, $url ); } @@ -789,13 +774,12 @@ sub AMAD_CommBridge_Read($) { my ( $hash ) = @_; my $name = $hash->{NAME}; - #my $chash = $modules{AMAD}{defptr}{}; my $brihash = $modules{AMAD}{defptr}{BRIDGE}; - # Received chars stored in $c + if( $hash->{SERVERSOCKET} ) { # Accept and create a child TcpServer_Accept( $hash, "AMAD" ); - # my $chash = TcpServer_Accept( $hash, "AMAD" ); # Wird zum schließen der Verbindung benötigt, siehe unten + return; } @@ -809,7 +793,7 @@ sub AMAD_CommBridge_Read($) { return; } - my $response = "header lines: \r\nAMADCommBridge recive Data complete\r\nPlease see next\r\n\r\nrunnin\r\n"; + my $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM will process\r\n now\r\n"; my $c = $hash->{CD}; print $c "HTTP/1.1 200 OK\r\n", @@ -822,30 +806,62 @@ sub AMAD_CommBridge_Read($) { ## close($hash->{CD}) - - + ### ## Consume Content ### my @data = split( '\R\R', $buf ); + if ( $data[0] =~ /FHEMCMD: setreading\b/ ) { + my $tv = $data[1]; + + @data = split( '\R', $data[0] ); + $data[2] =~ s/FHEMDEVICE: //; + my $chash = $defs{$data[2]}; + ### Begin Response Processing + + my @valuestring = split( '@@@@', $tv ); + my %buffer; + + foreach( @valuestring ) { + my @values = split( '@@' , $_ ); + $buffer{$values[0]} = $values[1]; + } + + my $t; + my $v; + while( ( $t, $v ) = each %buffer ) { + $v =~ s/null//g; + + readingsBeginUpdate( $chash ); + readingsBulkUpdate( $chash, $t, $v ) if( defined( $v ) ); + } + + readingsBulkUpdate( $chash, "lastStatusRequestState", "statusRequest_done" ); + readingsEndUpdate( $chash, 1 ); + ### End Response Processing - Log3 $name, 3, "setreading ist gleich $data[1]"; return; - #return AMAD_RetrieveAutomagicInfoFinished( "test", "err", $data[1] ); } elsif ( $data[0] =~ /FHEMCMD: set\b/ ) { - readingsBeginUpdate( $brihash ); - readingsBulkUpdate ( $brihash, "lastCmd", $data[1] ); - - @data = split( '\n', $data[0] ); - $data[2] =~ s/FHEMDEVICE: //; - - readingsBulkUpdate ( $brihash, "lastCmdDevice", $data[2] ); - readingsEndUpdate( $brihash, 1 ); - } + my $fhemCmd = $data[1]; + + fhem ("$fhemCmd") if( AttrVal( "AMADCommBridge", "Expert", "0" ) eq "1" ); + readingsSingleUpdate( $brihash, "receiveFhemCommand", $fhemCmd, 1 ); + + return; + } + + elsif ( $data[0] =~ /FHEMCMD: statusrequest\b/ ) { + + @data = split( '\R', $data[0] ); + $data[2] =~ s/FHEMDEVICE: //; + my $chash = $defs{$data[2]}; + + return AMAD_GetUpdateLocal( $chash ); + } } From 548f420c3d9b259f14d295268f254775ef605fbe Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 1 Oct 2015 21:12:01 +0200 Subject: [PATCH 08/25] =?UTF-8?q?Flows=20f=C3=BCr=20die=20aktuelle=20Devel?= =?UTF-8?q?=20Version=200.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMADautomagicFlows0.6.0.xml | 902 --------------------------------- 1 file changed, 902 deletions(-) delete mode 100644 74_AMADautomagicFlows0.6.0.xml diff --git a/74_AMADautomagicFlows0.6.0.xml b/74_AMADautomagicFlows0.6.0.xml deleted file mode 100644 index 0dfa0f2..0000000 --- a/74_AMADautomagicFlows0.6.0.xml +++ /dev/null @@ -1,902 +0,0 @@ - - - - false - com.android.music.metachanged - true - com.android.music.metachanged - - - - - - - - global_artist = getString("artist"); -global_track = getString("track"); -global_album = getString("album"); - false - - - false - HTTP Request: /fhem-amad/deviceInfo/ - true - /fhem-amad/deviceInfo/ - 8090 - true - - - false - HTTP Request: /fhem-amad/setCommands/* - true - /fhem-amad/setCommands/* - 8090 - true - - - true - Akku Ladestand: grösser als 0% - 0 - HIGHER_THAN - - - false - App Task läuft: App3 (neuster) - - true - - - false - App Task läuft: App4 (neuster) - - true - - - false - App Task läuft: App5 (neuster) - - true - - - false - App Task läuft: gplay (neuster) - com.google.android.music - true - - - false - App Task läuft: tuneinradio (neuster) - tunein.player - true - - - false - Benachrichtigung in Statusbar angezeigt: Automagic - ch.gridvision.ppam.androidautomagic - TEXT - CONTAINS_TEXT - - false - false - - - true - Bluetooth eingeschaltet - - - true - Bluetooth Gerät verbunden: Beliebiges Geräte - true - - - - - true - Display automatisch drehen eingeschaltet - - - true - Display eingeschaltet - - - true - Display Orientierung: Portrait - true - - - false - Expression: App3 - param_app == "" - - - false - Expression: App4 - param_app == "" - - - false - Expression: App5 - param_app == "" - - - true - Expression: global_fhemdevice == "null" - global_fhemdevice == "null" - - - true - Expression: global_fhemip == "null" - global_fhemip == "null" - - - false - Expression: gplay - param_app == "gplay" - - - false - Expression: mediaPlayer" - request_path == "/fhem-amad/setCommands/mediaPlayer" - - - false - Expression: openApp" - request_path == "/fhem-amad/setCommands/openApp" - - - false - Expression: openURL" - request_path == "/fhem-amad/setCommands/openURL" - - - true - Expression: param_button == "back" - param_button == "back" - - - true - Expression: param_button == "next" - param_button == "next" - - - true - Expression: param_button == "play" - param_button == "play" - - - true - Expression: param_button == "stop" - param_button == "stop" - - - true - Expression: param_fullscreen == "off" - param_fullscreen == "off" - - - true - Expression: param_fullscreen == "on" - param_fullscreen == "on" - - - true - Expression: param_orientation == "auto" - param_orientation == "auto" - - - true - Expression: param_orientation == "landscape" - param_orientation == "landscape" - - - true - Expression: param_orientation == "portrait" - param_orientation == "portrait" - - - true - Expression: param_screen=="off" - param_screen=="off" - - - true - Expression: param_screen=="on" - param_screen=="on" - - - false - Expression: Reboot - param_syscmd == "reboot" - - - false - Expression: screenMsg" - request_path == "/fhem-amad/setCommands/screenMsg" - - - false - Expression: setAlarm" - request_path == "/fhem-amad/setCommands/setAlarm" - - - false - Expression: setBrightness" - request_path == "/fhem-amad/setCommands/setBrightness" - - - false - Expression: setScreenFullscreen" - request_path == "/fhem-amad/setCommands/setScreenFullscreen" - - - false - Expression: setScreenOnOff" - request_path == "/fhem-amad/setCommands/setScreenOnOff" - - - false - Expression: setScreenOrientation" - request_path == "/fhem-amad/setCommands/setScreenOrientation" - - - false - Expression: setVolume" - request_path == "/fhem-amad/setCommands/setVolume" - - - false - Expression: System Command" - request_path == "/fhem-amad/setCommands/systemcommand" - - - true - Expression: trigger == "com.android.music.metachanged" - trigger == "com.android.music.metachanged" - - - true - Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" - trigger == "HTTP Request: /fhem-amad/setCommands/*" - - - false - Expression: ttsMsg" - request_path == "/fhem-amad/setCommands/ttsMsg" - - - false - Expression: tuneinradio - param_app == "tuneinradio" - - - true - Flow Aktiv: Informations - Informations - - - true - Flow Aktiv: SetCommands - SetCommands - - - true - Musik Aktiv - - - true - WLAN Verbunden: Alle SSIDs - true - - - - false - App Starten: App3 - - - - - false - App Starten: App4 - - - - - false - App Starten: App5 - - - - - false - App Starten: PlayMusic - com.google.android.music - - - - false - App Starten: tuneinradio - tunein.player - - - - true - Audio Player steuern: Medienknopf Play (Google Play Musik) - true - LAUNCH - KEYCODE_MEDIA_PLAY - true - com.google.android.music - com.google.android.music.playback.MediaButtonIntentReceiver - Google Play Musik - - - true - Audio Player steuern: Medienknopf Stopp (Google Play Musik) - true - LAUNCH - KEYCODE_MEDIA_STOP - true - com.google.android.music - com.google.android.music.playback.MediaButtonIntentReceiver - Google Play Musik - - - true - Audio Player steuern: Medienknopf Weiter (Google Play Musik) - true - LAUNCH - KEYCODE_MEDIA_NEXT - true - com.google.android.music - com.google.android.music.playback.MediaButtonIntentReceiver - Google Play Musik - - - true - Audio Player steuern: Medienknopf Zurück (Google Play Musik) - true - LAUNCH - KEYCODE_MEDIA_PREVIOUS - true - com.google.android.music - com.google.android.music.playback.MediaButtonIntentReceiver - Google Play Musik - - - true - Benachrichtigung auf Bildschirm: {param_message} (lange) - true - {param_message} - - 200 - 250 - false - 1.0 - true - false - TOP_LEFT - 0 - 0 - - - true - Display automatisch drehen ein-/ausschalten: Aus - false - - - true - Display automatisch drehen ein-/ausschalten: Ein - true - - - true - Gerät sperren - - - true - HTTP Request: GET http://{global_fhemip}:8085/fhem?cmd=sleep%202%3Bset%20{global_fhemdevice}%20statusRequest speichern in response - http://{global_fhemip}:8085/fhem?cmd=sleep%202%3Bset%20{global_fhemdevice}%20statusRequest - true - false - - GET - X_WWW_FORM_URLENCODED - text/plain - - Lastname=XYZ,Firstname=ABC - 60000 - false - - true - response - /storage/emulated/0/Download/file.bin - - - false - HTTP Response Information - powerLevel@@{battery_percentage}@@@@powerPlugged@@{battery_plugged}@@@@volumeMusikBluetooth@@{volumeMusikBluetooth}@@@@volumeMusikSpeaker@@{volumeMusikSpeaker}@@@@screenBrightness@@{screenBrightness}@@@@nextAlarmTime@@{next_alarmtime}@@@@nextAlarmDay@@{next_alarmday}@@@@screen@@{screen_state}@@@@automagicState@@{notification_text}@@@@screenOrientation@@{screen_orientation}@@@@currentMusicTrack@@{global_track}@@@@currentMusicAlbum@@{global_album}@@@@currentMusicArtist@@{global_artist}@@@@bluetooth@@{bluetooth_state}@@@@connectedBTdevices@@{connected_devices_names}@@@@flow_SetCommands@@{setCommandFlow_state} - true - text/plain - - - false - HTTP Response SetCommand - flow_informations@@{informationFlow_state}@@@@ - true - text/plain - - - false - Initialisiere Variable Nächster Alarm: next_alarm - next_alarm - - - false - Initialisiere Variable Systemeinstellung: screenBrightness - SYSTEM - screen_brightness - screenBrightness - - - false - Initialisiere Variable Systemeinstellung: volumeMusikBluetooth - SYSTEM - volume_music_bt_a2dp - volumeMusikBluetooth - - - false - Initialisiere Variable Systemeinstellung: volumeMusikSpeaker - SYSTEM - volume_music_speaker - volumeMusikSpeaker - - - false - Lautstärken setzen - false - global_volume_alarm - false - global_volume_dtmf - true - param_volume - false - global_volume_notification - false - global_volume_ring - false - global_volume_system - false - global_volume_voice_call - false - global_ringer_mode - false - global_interruptions_mode - - - true - Neustart - - - - true - Pause: 2s (Gerät wach halten) - 2s - true - - - true - Schalte Display ein: Hell für 120s - true - 120s - true - - - true - Script: bluetooth_state = "off" - - - - true - Script: bluetooth_state = "on" - - - - true - Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; - - - - true - Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} - - - - true - Script: informationFlow_state = "aktiv" - - - - true - Script: informationFlow_state = "inaktiv" - - - - true - Script: next_alarmday = "{next_alarm,dateformat,c}" - - - - true - Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" - - - - true - Script: notification_text = "no supported from your device" - - - - true - Script: screen_orientation = "auto" - - - - true - Script: screen_orientation = "landscape" - - - - true - Script: screen_orientation = "portrait" - - - - true - Script: screen_state = "off" - - - - true - Script: screen_state = "on" - - - - true - Script: setCommandFlow_state = "aktiv" - - - - true - Script: setCommandFlow_state = "inaktiv" - - - - true - Setze Alarm: um {param_hour}:{param_minute} - - {param_hour} - {param_minute} - - - true - Setze Display Orientierung: Auf Default zurücksetzen - UNSPECIFIED - false - - - true - Setze Display Orientierung: Landscape - LANDSCAPE - false - - - true - Setze Display Orientierung: Portrait - PORTRAIT - false - - - true - Setze Flow Status: Aktivieren Informations - true - Informations - - - - true - Setze Flow Status: Aktivieren SetCommands - true - SetCommands - - - - true - Setze Systemeinstellung: System screen_brightness auf {param_brightness} - SYSTEM - screen_brightness - {param_brightness} - true - - - true - Setze Vollbild Modus: Auf Default zurücksetzen - UNSPECIFIED - false - - - true - Setze Vollbild Modus: Navigation nicht anzeigen - HIDE_NAVIGATION - false - - - true - Sprachausgabe: {param_message} - MUSIC - {param_message} - de_DE - true - 1.0 - true - 1.0 - true - false - false - false - TRANSIENT - - - true - URL in Browser öffnen: {param_url} (mit Chrome) - {param_url} - true - com.android.chrome - com.google.android.apps.chrome.Main - Chrome - - - Informations - FHEM Info / Steuerung über AMAD Modul v0.6 - true - SKIP - 120 - - com.android.music.metachanged - HTTP Request: /fhem-amad/deviceInfo/ - - Script: notification_text = "no supported from your device" - Script: screen_orientation = "auto" - Display automatisch drehen eingeschaltet - Script: screen_orientation = "portrait" - Display Orientierung: Portrait - Script: screen_orientation = "landscape" - Bluetooth eingeschaltet - Script: bluetooth_state = "on" - Bluetooth Gerät verbunden: Beliebiges Geräte - Script: bluetooth_state = "off" - Script: screen_state = "off" - Script: screen_state = "on" - Display eingeschaltet - Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" - Initialisiere Variable Nächster Alarm: next_alarm - Script: next_alarmday = "{next_alarm,dateformat,c}" - Initialisiere Variable Systemeinstellung: screenBrightness - Initialisiere Variable Systemeinstellung: volumeMusikSpeaker - Initialisiere Variable Systemeinstellung: volumeMusikBluetooth - Expression: global_fhemip == "null" - Expression: global_fhemdevice == "null" - Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} - Flow Aktiv: SetCommands - Script: setCommandFlow_state = "aktiv" - Script: setCommandFlow_state = "inaktiv" - Setze Flow Status: Aktivieren SetCommands - Benachrichtigung in Statusbar angezeigt: Automagic - HTTP Response Information - Akku Ladestand: grösser als 0% - Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; - Musik Aktiv - Pause: 2s (Gerät wach halten) - Expression: trigger == "com.android.music.metachanged" - WLAN Verbunden: Alle SSIDs - HTTP Request: GET http://{global_fhemip}:8085/fhem?cmd=sleep%202%3Bset%20{global_fhemdevice}%20statusRequest speichern in response - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SetCommands - FHEM Info / Steuerung über AMAD Modul v0.6 - true - QUEUE - 120 - - HTTP Request: /fhem-amad/deviceInfo/ - HTTP Request: /fhem-amad/setCommands/* - - Expression: param_screen=="on" - Sprachausgabe: {param_message} - Expression: ttsMsg" - Expression: setBrightness" - Expression: setAlarm" - Expression: screenMsg" - Expression: openURL" - Setze Alarm: um {param_hour}:{param_minute} - URL in Browser öffnen: {param_url} (mit Chrome) - Benachrichtigung auf Bildschirm: {param_message} (lange) - Schalte Display ein: Hell für 120s - Expression: setScreenFullscreen" - Expression: param_orientation == "auto" - Setze Display Orientierung: Portrait - Setze Display Orientierung: Landscape - Expression: param_orientation == "landscape" - Expression: param_orientation == "portrait" - Expression: param_fullscreen == "off" - Setze Vollbild Modus: Navigation nicht anzeigen - Expression: param_fullscreen == "on" - Setze Vollbild Modus: Auf Default zurücksetzen - Audio Player steuern: Medienknopf Zurück (Google Play Musik) - Expression: param_button == "back" - Display automatisch drehen ein-/ausschalten: Aus - Expression: param_button == "next" - Setze Display Orientierung: Auf Default zurücksetzen - Display automatisch drehen ein-/ausschalten: Ein - Audio Player steuern: Medienknopf Play (Google Play Musik) - Expression: param_button == "play" - Expression: mediaPlayer" - Audio Player steuern: Medienknopf Weiter (Google Play Musik) - Audio Player steuern: Medienknopf Stopp (Google Play Musik) - Expression: param_button == "stop" - Expression: param_screen=="off" - Gerät sperren - Expression: setScreenOnOff" - Expression: setVolume" - Lautstärken setzen - App Task läuft: App5 (neuster) - Expression: App5 - Expression: App4 - App Task läuft: App3 (neuster) - Expression: App3 - App Starten: App3 - App Starten: App4 - App Task läuft: App4 (neuster) - Expression: tuneinradio - App Task läuft: tuneinradio (neuster) - App Starten: tuneinradio - App Starten: App5 - App Task läuft: gplay (neuster) - Expression: gplay - App Starten: PlayMusic - Expression: openApp" - Expression: System Command" - Expression: setScreenOrientation" - Expression: Reboot - Neustart - Setze Systemeinstellung: System screen_brightness auf {param_brightness} - Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" - Setze Flow Status: Aktivieren Informations - Script: informationFlow_state = "inaktiv" - Script: informationFlow_state = "aktiv" - Flow Aktiv: Informations - HTTP Response SetCommand - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From fa2b42af6b38d0f89189b99e57a67bd36fe41404 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 2 Oct 2015 06:16:54 +0200 Subject: [PATCH 09/25] =?UTF-8?q?Flows=20f=C3=BCr=20die=20aktuelle=20Devel?= =?UTF-8?q?=20Version=200.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMADautomagicFlows0.7_DEVEL.xml | 915 +++++++++++++++++++++++++++++ 1 file changed, 915 insertions(+) create mode 100644 74_AMADautomagicFlows0.7_DEVEL.xml diff --git a/74_AMADautomagicFlows0.7_DEVEL.xml b/74_AMADautomagicFlows0.7_DEVEL.xml new file mode 100644 index 0000000..5ec87ec --- /dev/null +++ b/74_AMADautomagicFlows0.7_DEVEL.xml @@ -0,0 +1,915 @@ + + + + false + com.android.music.metachanged + true + com.android.music.metachanged + + + + + + + + global_artist = getString("artist"); +global_track = getString("track"); +global_album = getString("album"); + false + + + false + HTTP Request: /fhem-amad/deviceInfo/ + true + /fhem-amad/deviceInfo/ + 8090 + true + + + false + HTTP Request: /fhem-amad/setCommands/* + true + /fhem-amad/setCommands/* + 8090 + true + + + true + Akku Ladestand: grösser als 0% + 0 + HIGHER_THAN + + + false + App Task läuft: App3 (neuster) + + true + + + false + App Task läuft: App4 (neuster) + + true + + + false + App Task läuft: App5 (neuster) + + true + + + false + App Task läuft: gplay (neuster) + com.google.android.music + true + + + false + App Task läuft: tuneinradio (neuster) + tunein.player + true + + + false + Benachrichtigung in Statusbar angezeigt: Automagic + ch.gridvision.ppam.androidautomagic + TEXT + CONTAINS_TEXT + + false + false + + + true + Bluetooth eingeschaltet + + + true + Bluetooth Gerät verbunden: Beliebiges Geräte + true + + + + + true + Display automatisch drehen eingeschaltet + + + true + Display eingeschaltet + + + true + Display Orientierung: Portrait + true + + + false + Expression: App3 + param_app == "" + + + false + Expression: App4 + param_app == "" + + + false + Expression: App5 + param_app == "" + + + false + Expression: gplay + param_app == "gplay" + + + false + Expression: mediaPlayer" + request_path == "/fhem-amad/setCommands/mediaPlayer" + + + false + Expression: openApp" + request_path == "/fhem-amad/setCommands/openApp" + + + false + Expression: openURL" + request_path == "/fhem-amad/setCommands/openURL" + + + true + Expression: param_button == "back" + param_button == "back" + + + true + Expression: param_button == "next" + param_button == "next" + + + true + Expression: param_button == "play" + param_button == "play" + + + true + Expression: param_button == "stop" + param_button == "stop" + + + true + Expression: param_fullscreen == "off" + param_fullscreen == "off" + + + true + Expression: param_fullscreen == "on" + param_fullscreen == "on" + + + true + Expression: param_orientation == "auto" + param_orientation == "auto" + + + true + Expression: param_orientation == "landscape" + param_orientation == "landscape" + + + true + Expression: param_orientation == "portrait" + param_orientation == "portrait" + + + true + Expression: param_screen=="off" + param_screen=="off" + + + true + Expression: param_screen=="on" + param_screen=="on" + + + false + Expression: Reboot + param_syscmd == "reboot" + + + false + Expression: screenMsg" + request_path == "/fhem-amad/setCommands/screenMsg" + + + false + Expression: setAlarm" + request_path == "/fhem-amad/setCommands/setAlarm" + + + false + Expression: setBrightness" + request_path == "/fhem-amad/setCommands/setBrightness" + + + false + Expression: setScreenFullscreen" + request_path == "/fhem-amad/setCommands/setScreenFullscreen" + + + false + Expression: setScreenOnOff" + request_path == "/fhem-amad/setCommands/setScreenOnOff" + + + false + Expression: setScreenOrientation" + request_path == "/fhem-amad/setCommands/setScreenOrientation" + + + false + Expression: setVolume" + request_path == "/fhem-amad/setCommands/setVolume" + + + false + Expression: System Command" + request_path == "/fhem-amad/setCommands/systemcommand" + + + true + Expression: trigger == "com.android.music.metachanged" + trigger == "com.android.music.metachanged" + + + true + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + trigger == "HTTP Request: /fhem-amad/setCommands/*" + + + false + Expression: ttsMsg" + request_path == "/fhem-amad/setCommands/ttsMsg" + + + false + Expression: tuneinradio + param_app == "tuneinradio" + + + true + Flow Aktiv: Informations + Informations + + + true + Flow Aktiv: SetCommands + SetCommands + + + true + Musik Aktiv + + + true + WLAN Verbunden: Alle SSIDs + true + + + + false + App Starten: App3 + + + + + false + App Starten: App4 + + + + + false + App Starten: App5 + + + + + false + App Starten: PlayMusic + com.google.android.music + + + + false + App Starten: tuneinradio + tunein.player + + + + true + Audio Player steuern: Medienknopf Play (Google Play Musik) + true + LAUNCH + KEYCODE_MEDIA_PLAY + true + com.google.android.music + com.google.android.music.playback.MediaButtonIntentReceiver + Google Play Musik + + + true + Audio Player steuern: Medienknopf Stopp (Google Play Musik) + true + LAUNCH + KEYCODE_MEDIA_STOP + true + com.google.android.music + com.google.android.music.playback.MediaButtonIntentReceiver + Google Play Musik + + + true + Audio Player steuern: Medienknopf Weiter (Google Play Musik) + true + LAUNCH + KEYCODE_MEDIA_NEXT + true + com.google.android.music + com.google.android.music.playback.MediaButtonIntentReceiver + Google Play Musik + + + true + Audio Player steuern: Medienknopf Zurück (Google Play Musik) + true + LAUNCH + KEYCODE_MEDIA_PREVIOUS + true + com.google.android.music + com.google.android.music.playback.MediaButtonIntentReceiver + Google Play Musik + + + true + Benachrichtigung auf Bildschirm: {param_message} (lange) + true + {param_message} + + 200 + 250 + false + 1.0 + true + false + TOP_LEFT + 0 + 0 + + + true + Display automatisch drehen ein-/ausschalten: Aus + false + + + true + Display automatisch drehen ein-/ausschalten: Ein + true + + + true + Gerät sperren + + + false + HTTP Response Information + powerLevel@@{battery_percentage}@@@@powerPlugged@@{battery_plugged}@@@@volumeMusikBluetooth@@{volumeMusikBluetooth}@@@@volumeMusikSpeaker@@{volumeMusikSpeaker}@@@@screenBrightness@@{screenBrightness}@@@@nextAlarmTime@@{next_alarmtime}@@@@nextAlarmDay@@{next_alarmday}@@@@screen@@{screen_state}@@@@automagicState@@{notification_text}@@@@screenOrientation@@{screen_orientation}@@@@currentMusicTrack@@{global_track}@@@@currentMusicAlbum@@{global_album}@@@@currentMusicArtist@@{global_artist}@@@@bluetooth@@{bluetooth_state}@@@@connectedBTdevices@@{connected_devices_names}@@@@flow_SetCommands@@{setCommandFlow_state} + true + text/plain + + + false + HTTP Response SetCommand + flow_informations@@{informationFlow_state}@@@@ + true + text/plain + + + false + Initialisiere Variable Nächster Alarm: next_alarm + next_alarm + + + false + Initialisiere Variable Systemeinstellung: screenBrightness + SYSTEM + screen_brightness + screenBrightness + + + false + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth + SYSTEM + volume_music_bt_a2dp + volumeMusikBluetooth + + + false + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker + SYSTEM + volume_music_speaker + volumeMusikSpeaker + + + false + Lautstärken setzen + false + global_volume_alarm + false + global_volume_dtmf + true + param_volume + false + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + true + Neustart + + + + true + Pause: 2s (Gerät wach halten) + 2s + true + + + false + Reading Music Metachanged + http://{global_fhemip}:8090 + false + false + + POST + GENERAL_TEXT + text/plain + currentMusicTrack@@{global_track}@@@@currentMusicAlbum@@{global_album}@@@@currentMusicArtist@@{global_artist}@@@@ + @@@@readingsNameXYZ@@readingsValueABC + 5000 + true + FHEMDEVICE: {global_fhemdevice} +FHEMCMD: setreading + true + response + /storage/emulated/0/Download/file.bin + + + true + Schalte Display ein: Hell für 120s + true + 120s + true + + + true + Script: bluetooth_state = "off" + + + + true + Script: bluetooth_state = "on" + + + + true + Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; + + + + true + Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} + + + + true + Script: informationFlow_state = "aktiv" + + + + true + Script: informationFlow_state = "inaktiv" + + + + true + Script: next_alarmday = "{next_alarm,dateformat,c}" + + + + true + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + + + + true + Script: notification_text = "no supported from your device" + + + + true + Script: screen_orientation = "auto" + + + + true + Script: screen_orientation = "landscape" + + + + true + Script: screen_orientation = "portrait" + + + + true + Script: screen_state = "off" + + + + true + Script: screen_state = "on" + + + + true + Script: setCommandFlow_state = "aktiv" + + + + true + Script: setCommandFlow_state = "inaktiv" + + + + true + Setze Alarm: um {param_hour}:{param_minute} + + {param_hour} + {param_minute} + + + true + Setze Display Orientierung: Auf Default zurücksetzen + UNSPECIFIED + false + + + true + Setze Display Orientierung: Landscape + LANDSCAPE + false + + + true + Setze Display Orientierung: Portrait + PORTRAIT + false + + + true + Setze Flow Status: Aktivieren Informations + true + Informations + + + + true + Setze Flow Status: Aktivieren SetCommands + true + SetCommands + + + + true + Setze Systemeinstellung: System screen_brightness auf {param_brightness} + SYSTEM + screen_brightness + {param_brightness} + true + + + true + Setze Vollbild Modus: Auf Default zurücksetzen + UNSPECIFIED + false + + + true + Setze Vollbild Modus: Navigation nicht anzeigen + HIDE_NAVIGATION + false + + + true + Sprachausgabe: {param_message} + MUSIC + {param_message} + de_DE + true + 1.0 + true + 1.0 + true + false + false + true + TRANSIENT + + + false + StatusRequest + http://{global_fhemip}:8090 + false + false + + POST + GENERAL_TEXT + text/plain + + @@@@readingsNameXYZ@@readingsValueABC + 5000 + true + FHEMDEVICE: {global_fhemdevice} +FHEMCMD: statusrequest + true + response + /storage/emulated/0/Download/file.bin + + + true + URL in Browser öffnen: {param_url} (mit Chrome) + {param_url} + true + com.android.chrome + com.google.android.apps.chrome.Main + Chrome + + + Informations + FHEM Info / Steuerung über AMAD Modul v0.7 Develop + true + QUEUE + 120 + Script: notification_text = "no supported from your device" + Script: screen_orientation = "auto" + Display automatisch drehen eingeschaltet + Script: screen_orientation = "portrait" + Display Orientierung: Portrait + Script: screen_orientation = "landscape" + Bluetooth eingeschaltet + Script: bluetooth_state = "on" + Bluetooth Gerät verbunden: Beliebiges Geräte + Script: bluetooth_state = "off" + Script: screen_state = "off" + Script: screen_state = "on" + Display eingeschaltet + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + Initialisiere Variable Nächster Alarm: next_alarm + Script: next_alarmday = "{next_alarm,dateformat,c}" + Initialisiere Variable Systemeinstellung: screenBrightness + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth + Flow Aktiv: SetCommands + Script: setCommandFlow_state = "aktiv" + Script: setCommandFlow_state = "inaktiv" + Setze Flow Status: Aktivieren SetCommands + Benachrichtigung in Statusbar angezeigt: Automagic + Akku Ladestand: grösser als 0% + Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; + Musik Aktiv + Pause: 2s (Gerät wach halten) + Expression: trigger == "com.android.music.metachanged" + Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} + HTTP Response Information + WLAN Verbunden: Alle SSIDs + Reading Music Metachanged + + HTTP Request: /fhem-amad/deviceInfo/ + com.android.music.metachanged + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SetCommands + FHEM Info / Steuerung über AMAD Modul v0.7 Develop + true + QUEUE + 120 + + HTTP Request: /fhem-amad/deviceInfo/ + HTTP Request: /fhem-amad/setCommands/* + + Expression: param_screen=="on" + Expression: setBrightness" + Expression: setAlarm" + Expression: screenMsg" + Expression: openURL" + URL in Browser öffnen: {param_url} (mit Chrome) + Benachrichtigung auf Bildschirm: {param_message} (lange) + Expression: setScreenFullscreen" + Expression: param_orientation == "auto" + Setze Display Orientierung: Portrait + Setze Display Orientierung: Landscape + Expression: param_orientation == "landscape" + Expression: param_orientation == "portrait" + Expression: param_fullscreen == "off" + Setze Vollbild Modus: Navigation nicht anzeigen + Expression: param_fullscreen == "on" + Setze Vollbild Modus: Auf Default zurücksetzen + Audio Player steuern: Medienknopf Zurück (Google Play Musik) + Expression: param_button == "back" + Expression: param_button == "next" + Setze Display Orientierung: Auf Default zurücksetzen + Audio Player steuern: Medienknopf Play (Google Play Musik) + Expression: param_button == "play" + Expression: mediaPlayer" + Audio Player steuern: Medienknopf Weiter (Google Play Musik) + Expression: param_button == "stop" + Expression: param_screen=="off" + Gerät sperren + Expression: setScreenOnOff" + Expression: setVolume" + App Task läuft: App5 (neuster) + Expression: App5 + Expression: App4 + App Task läuft: App3 (neuster) + Expression: App3 + App Starten: App3 + App Starten: App4 + App Task läuft: App4 (neuster) + Expression: tuneinradio + App Task läuft: tuneinradio (neuster) + App Starten: tuneinradio + App Starten: App5 + App Task läuft: gplay (neuster) + Expression: gplay + App Starten: PlayMusic + Expression: openApp" + Expression: System Command" + Expression: setScreenOrientation" + Expression: Reboot + Neustart + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + Setze Flow Status: Aktivieren Informations + Script: informationFlow_state = "inaktiv" + Script: informationFlow_state = "aktiv" + Flow Aktiv: Informations + Sprachausgabe: {param_message} + Expression: ttsMsg" + Lautstärken setzen + StatusRequest + Setze Systemeinstellung: System screen_brightness auf {param_brightness} + Schalte Display ein: Hell für 120s + Display automatisch drehen ein-/ausschalten: Aus + Display automatisch drehen ein-/ausschalten: Ein + Setze Alarm: um {param_hour}:{param_minute} + HTTP Response SetCommand + Audio Player steuern: Medienknopf Stopp (Google Play Musik) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 8ad6dbccfd5ef702945a1d6a7f05caedb8966f43 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 2 Oct 2015 11:19:04 +0200 Subject: [PATCH 10/25] =?UTF-8?q?fhemServerIP=20als=20Reading=20in=20der?= =?UTF-8?q?=20Bridge,=20muss=20zwingend=20eingetragen=20werden.=20expertMo?= =?UTF-8?q?de=20ebenfalls=20in=20der=20Bridge=20f=C3=BCr=20direkte=20Befeh?= =?UTF-8?q?lsabsetzung=20von=20FHEM=20Befehlen=20=C3=BCber=20die=20Bridge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index 7be9db6..bb127af 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.2"; +my $version = "0.7.3"; @@ -53,7 +53,6 @@ sub AMAD_Initialize($) { "setFullscreen:0,1 ". "setScreenOrientation:0,1 ". "setScreenBrightness:0,1 ". - "fhemServerIP ". "root:0,1 ". "interval ". "port ". @@ -90,9 +89,9 @@ sub AMAD_Define($$) { return "there is already a amad bridge" if( $modules{AMAD}{defptr}{BRIDGE} ); $hash->{BRIDGE} = 1; - $hash->{TEMPORARY} = 1; + #$hash->{TEMPORARY} = 1; $modules{AMAD}{defptr}{BRIDGE} = $hash; - $attr{$name}{room} = "hidden"; + $attr{$name}{room} = "AMAD"; Log3 $name, 3, "AMAD ($name) - defined Bridge with Socketport $hash->{PORT}"; AMAD_CommBridge_Open( $hash ); @@ -240,7 +239,7 @@ sub AMAD_RetrieveAutomagicInfo($) { my $name = $hash->{NAME}; my $host = $hash->{HOST}; my $port = $hash->{PORT}; - my $fhemip = AttrVal( $name, "fhemServerIP", "none" ); + my $fhemip = ReadingsVal( "AMADCommBridge", "fhemServerIP", "none" ); my $url = "http://" . $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Path muß so im Automagic als http request Trigger drin stehen @@ -435,7 +434,7 @@ sub AMAD_Set($$@) { $list .= "ttsMsg "; $list .= "volume:slider,0,1,15 "; $list .= "deviceState:online,offline "; - $list .= "mediaPlayer:play,stop,next,back " if( AttrVal( $name, "fhemServerIP", "none" ) ne "none" ); + $list .= "mediaPlayer:play,stop,next,back " if( ReadingsVal( "AMADCommBridge", "fhemServerIP", "none" ) ne "none"); $list .= "screenBrightness:slider,0,1,255 " if( AttrVal( $name, "setScreenBrightness", "1" ) eq "1" ); $list .= "screen:on,off "; $list .= "screenOrientation:auto,landscape,portrait " if( AttrVal( $name, "setScreenOrientation", "1" ) eq "1" ); @@ -446,8 +445,7 @@ sub AMAD_Set($$@) { $list .= "statusRequest:noArg "; $list .= "system:reboot " if( AttrVal( $name, "root", "1" ) eq "1" ); - - if (lc $cmd eq 'screenmsg' + if( lc $cmd eq 'screenmsg' || lc $cmd eq 'ttsmsg' || lc $cmd eq 'volume' || lc $cmd eq 'mediaplayer' @@ -460,7 +458,7 @@ sub AMAD_Set($$@) { || lc $cmd eq 'openapp' || lc $cmd eq 'nextalarmtime' || lc $cmd eq 'system' - || lc $cmd eq 'statusrequest') { + || lc $cmd eq 'statusrequest' ) { Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val); @@ -475,6 +473,25 @@ sub AMAD_Set($$@) { return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; } + + elsif( $name eq "AMADCommBridge" ) { + + my $list = ""; + + ## set Befehle für die AMAD_CommBridge + $list .= "expertMode:0,1 " if( $modules{AMAD}{defptr}{BRIDGE} ); + $list .= "fhemServerIP " if( $modules{AMAD}{defptr}{BRIDGE} ); + + if( lc $cmd eq 'expertmode' + || lc $cmd eq 'fhemserverip' ) { + + readingsSingleUpdate( $hash, $cmd, $val[0], 0 ); + + return; + } + + return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; + } } sub AMAD_SelectSetCmd($$@) { @@ -848,7 +865,7 @@ sub AMAD_CommBridge_Read($) { elsif ( $data[0] =~ /FHEMCMD: set\b/ ) { my $fhemCmd = $data[1]; - fhem ("$fhemCmd") if( AttrVal( "AMADCommBridge", "Expert", "0" ) eq "1" ); + fhem ("$fhemCmd") if( ReadingsVal( "AMADCommBridge", "expertMode", 0 ) ne "0" ); readingsSingleUpdate( $brihash, "receiveFhemCommand", $fhemCmd, 1 ); return; From 66440d28cd764804ec9fe8a744d291ba5b7f1bb4 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 8 Oct 2015 12:20:53 +0200 Subject: [PATCH 11/25] =?UTF-8?q?Bliuetooth=20aktivieren=20eingebaut,=20no?= =?UTF-8?q?tifysndFile=20Sound=20eingebaut,=20Abfrage=20ob=20App=20noch=20?= =?UTF-8?q?l=C3=A4uft=20eingebaut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index bb127af..5b8c7cc 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.3"; +my $version = "0.7.4"; @@ -50,6 +50,7 @@ sub AMAD_Initialize($) { $hash->{ReadFn} = "AMAD_CommBridge_Read"; $hash->{AttrList} = "setOpenApp ". + "getActiveTask ". "setFullscreen:0,1 ". "setScreenOrientation:0,1 ". "setScreenBrightness:0,1 ". @@ -86,10 +87,9 @@ sub AMAD_Define($$) { $hash->{helper}{setCmdErrorCounter} = 0 if( $hash->{HOST} ); if( !$hash->{HOST} ) { - return "there is already a amad bridge" if( $modules{AMAD}{defptr}{BRIDGE} ); + return "there is already a AMAD Bridge" if( $modules{AMAD}{defptr}{BRIDGE} ); $hash->{BRIDGE} = 1; - #$hash->{TEMPORARY} = 1; $modules{AMAD}{defptr}{BRIDGE} = $hash; $attr{$name}{room} = "AMAD"; Log3 $name, 3, "AMAD ($name) - defined Bridge with Socketport $hash->{PORT}"; @@ -100,8 +100,9 @@ sub AMAD_Define($$) { CommandDefine( undef, "AMADCommBridge AMAD" ); } - Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)"; - + Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)"; + + $attr{$name}{room} = "AMAD"; readingsSingleUpdate ( $hash, "state", "initialized", 1 ) if( $hash->{HOST} ); readingsSingleUpdate ( $hash, "deviceState", "online", 1 ) if( $hash->{HOST} ); @@ -240,6 +241,8 @@ sub AMAD_RetrieveAutomagicInfo($) { my $host = $hash->{HOST}; my $port = $hash->{PORT}; my $fhemip = ReadingsVal( "AMADCommBridge", "fhemServerIP", "none" ); + my $activetask = AttrVal( $name, "getActiveTask", "none" ); + my $url = "http://" . $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Path muß so im Automagic als http request Trigger drin stehen @@ -249,7 +252,7 @@ sub AMAD_RetrieveAutomagicInfo($) { timeout => 10, hash => $hash, method => "GET", - header => "fhemIP: $fhemip\r\nfhemDevice: $name", + header => "fhemIP: $fhemip\r\nfhemDevice: $name\r\nactiveTask: $activetask", doTrigger => 1, callback => \&AMAD_RetrieveAutomagicInfoFinished, } @@ -427,9 +430,9 @@ sub AMAD_Set($$@) { if( $name ne "AMADCommBridge" ) { my $apps = AttrVal( $name, "setOpenApp", "none" ); + my $activetask = AttrVal( $name, "setActiveTask", "none" ); my $list = ""; - $list .= "screenMsg "; $list .= "ttsMsg "; $list .= "volume:slider,0,1,15 "; @@ -444,6 +447,8 @@ sub AMAD_Set($$@) { $list .= "nextAlarmTime:time "; $list .= "statusRequest:noArg "; $list .= "system:reboot " if( AttrVal( $name, "root", "1" ) eq "1" ); + $list .= "bluetooth:on,off "; + $list .= "notifySndFile "; if( lc $cmd eq 'screenmsg' || lc $cmd eq 'ttsmsg' @@ -457,7 +462,9 @@ sub AMAD_Set($$@) { || lc $cmd eq 'openurl' || lc $cmd eq 'openapp' || lc $cmd eq 'nextalarmtime' + || lc $cmd eq 'bluetooth' || lc $cmd eq 'system' + || lc $cmd eq 'notifysndfile' || lc $cmd eq 'statusrequest' ) { Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val); @@ -621,6 +628,22 @@ sub AMAD_SelectSetCmd($$@) { return AMAD_HTTP_POST( $hash,$url ); } + + elsif( lc $cmd eq 'bluetooth' ) { + my $mod = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setbluetooth?bluetooth=$mod"; + + return AMAD_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'notifysndfile' ) { + my $notify = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/playnotifysnd?notifyfile=$notify"; + + return AMAD_HTTP_POST( $hash,$url ); + } return undef; } @@ -865,7 +888,7 @@ sub AMAD_CommBridge_Read($) { elsif ( $data[0] =~ /FHEMCMD: set\b/ ) { my $fhemCmd = $data[1]; - fhem ("$fhemCmd") if( ReadingsVal( "AMADCommBridge", "expertMode", 0 ) ne "0" ); + fhem ("$fhemCmd") if( ReadingsVal( "AMADCommBridge", "expertMode", 0 ) eq "1" ); readingsSingleUpdate( $brihash, "receiveFhemCommand", $fhemCmd, 1 ); return; @@ -1216,4 +1239,4 @@ sub AMAD_CommBridge_Read($) { =end html_DE -=cut \ No newline at end of file +=cut From 523b7211c07e82ad638d3178587d316e20463592 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 8 Oct 2015 14:25:32 +0200 Subject: [PATCH 12/25] =?UTF-8?q?sauberes=20l=C3=B6schen=20der=20Instanzen?= =?UTF-8?q?=20geht=20nun?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index 5b8c7cc..a72693f 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -79,14 +79,14 @@ sub AMAD_Define($$) { my $port = 8090; my $interval = 180; - $hash->{HOST} = $host; + $hash->{HOST} = $host if( $host ); $hash->{PORT} = $port; $hash->{INTERVAL} = $interval if( $hash->{HOST} ); $hash->{VERSION} = $version; $hash->{helper}{infoErrorCounter} = 0 if( $hash->{HOST} ); $hash->{helper}{setCmdErrorCounter} = 0 if( $hash->{HOST} ); - if( !$hash->{HOST} ) { + if( ! $hash->{HOST} ) { return "there is already a AMAD Bridge" if( $modules{AMAD}{defptr}{BRIDGE} ); $hash->{BRIDGE} = 1; @@ -96,8 +96,10 @@ sub AMAD_Define($$) { AMAD_CommBridge_Open( $hash ); } else { - if( !$modules{AMAD}{defptr}{BRIDGE} ) { + if( ! $modules{AMAD}{defptr}{BRIDGE} ) { CommandDefine( undef, "AMADCommBridge AMAD" ); + Log3 $name, 3, "AMAD ($name) - there is already a AMAD Bridge"; + } Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)"; @@ -108,7 +110,7 @@ sub AMAD_Define($$) { InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ) if( $hash->{HOST} ); - #$modules{AMAD}{defptr}{$hash->$hash->{HOST}}; + $modules{AMAD}{defptr}{$hash->{HOST}}; return undef; } @@ -120,14 +122,15 @@ sub AMAD_Undef($$) { if( $hash->{BRIDGE} ) { delete $modules{AMAD}{defptr}{BRIDGE}; + + my $ret = TcpServer_Close( $hash ); + return $ret; } else { delete $modules{AMAD}{defptr}{$hash->{HOST}}; RemoveInternalTimer( $hash ); - my $ret = TcpServer_Close( $hash ); - return $ret; } } From 75837cf440853b0e03c7c562c524f7de0f5943bd Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 8 Oct 2015 14:34:01 +0200 Subject: [PATCH 13/25] =?UTF-8?q?Code=20ges=C3=A4ubert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index a72693f..e3d30bb 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -97,9 +97,7 @@ sub AMAD_Define($$) { } else { if( ! $modules{AMAD}{defptr}{BRIDGE} ) { - CommandDefine( undef, "AMADCommBridge AMAD" ); - Log3 $name, 3, "AMAD ($name) - there is already a AMAD Bridge"; - + CommandDefine( undef, "AMADCommBridge AMAD" ); } Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)"; From 3ac6de31f6d603e2c8751208f9a14e839c4e39a9 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 8 Oct 2015 16:21:32 +0200 Subject: [PATCH 14/25] =?UTF-8?q?Code=20f=C3=BCr=20Versionsnummer=20im=20I?= =?UTF-8?q?nitilize=20umgeschrieben=20auf=20{AMAD}{defptr}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index e3d30bb..eb675b5 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.4"; +my $version = "0.7.5"; @@ -60,10 +60,12 @@ sub AMAD_Initialize($) { "disable:1 "; $hash->{AttrList} .= $readingFnAttributes; - foreach my $d(sort keys %defs) { - next if($defs{$d}{TYPE} ne "AMAD"); - $defs{$d}->{VERSION} = $version; + foreach my $d(sort keys %{$modules{AMAD}{defptr}}) { + my $hash = $modules{AMAD}{defptr}{$d}; + $hash->{VERSION} = $version; } + + } sub AMAD_Define($$) { @@ -107,8 +109,8 @@ sub AMAD_Define($$) { readingsSingleUpdate ( $hash, "deviceState", "online", 1 ) if( $hash->{HOST} ); InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ) if( $hash->{HOST} ); - - $modules{AMAD}{defptr}{$hash->{HOST}}; + + $modules{AMAD}{defptr}{$hash->{HOST}} = $hash; return undef; } From c866c56b829b652b37583dcb60ae9a6eb8e3ff8a Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 9 Oct 2015 13:18:20 +0200 Subject: [PATCH 15/25] =?UTF-8?q?Automatisches=20l=C3=B6schen=20der=20Brid?= =?UTF-8?q?ge=20einbearbeitet=20wenn=20das=20letzte=20AMAD=20Host=20Device?= =?UTF-8?q?=20gel=C3=B6scht=20wurde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index eb675b5..b665408 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.5"; +my $version = "0.7.6"; @@ -98,7 +98,7 @@ sub AMAD_Define($$) { AMAD_CommBridge_Open( $hash ); } else { - if( ! $modules{AMAD}{defptr}{BRIDGE} ) { + if( ! $modules{AMAD}{defptr}{BRIDGE} && $init_done ) { CommandDefine( undef, "AMADCommBridge AMAD" ); } @@ -122,15 +122,20 @@ sub AMAD_Undef($$) { if( $hash->{BRIDGE} ) { delete $modules{AMAD}{defptr}{BRIDGE}; - my $ret = TcpServer_Close( $hash ); return $ret; } else { delete $modules{AMAD}{defptr}{$hash->{HOST}}; - RemoveInternalTimer( $hash ); - + + foreach my $d(sort keys %{$modules{AMAD}{defptr}}) { + my $hash = $modules{AMAD}{defptr}{$d}; + my $host = $hash->{HOST}; + + return if( $host ); + CommandDelete( undef, "AMADCommBridge" ); + } } } @@ -1242,4 +1247,4 @@ sub AMAD_CommBridge_Read($) { =end html_DE -=cut +=cut \ No newline at end of file From d22776c2c36b0a2a1098c088bf5c870bf72c16c3 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sat, 10 Oct 2015 21:15:20 +0200 Subject: [PATCH 16/25] erste Vorabversion zum testen. Neue Funktionen, AMADCommBridge, Bluetooth ein aus, play notification sound, check aktiv task --- 74_AMAD.pm | 21 +- ...EVEL.xml => 74_AMADautomagicFlows0.7.7.xml | 573 +++++++++++------- 2 files changed, 370 insertions(+), 224 deletions(-) rename 74_AMADautomagicFlows0.7_DEVEL.xml => 74_AMADautomagicFlows0.7.7.xml (62%) diff --git a/74_AMAD.pm b/74_AMAD.pm index b665408..5aee395 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.6"; +my $version = "0.7.7"; @@ -50,10 +50,11 @@ sub AMAD_Initialize($) { $hash->{ReadFn} = "AMAD_CommBridge_Read"; $hash->{AttrList} = "setOpenApp ". - "getActiveTask ". + "checkActiveTask ". "setFullscreen:0,1 ". "setScreenOrientation:0,1 ". "setScreenBrightness:0,1 ". + #"setBluetoothDevice ". "root:0,1 ". "interval ". "port ". @@ -249,7 +250,7 @@ sub AMAD_RetrieveAutomagicInfo($) { my $host = $hash->{HOST}; my $port = $hash->{PORT}; my $fhemip = ReadingsVal( "AMADCommBridge", "fhemServerIP", "none" ); - my $activetask = AttrVal( $name, "getActiveTask", "none" ); + my $activetask = AttrVal( $name, "checkActiveTask", "none" ); my $url = "http://" . $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Path muß so im Automagic als http request Trigger drin stehen @@ -438,6 +439,7 @@ sub AMAD_Set($$@) { if( $name ne "AMADCommBridge" ) { my $apps = AttrVal( $name, "setOpenApp", "none" ); + my $btdev = AttrVal( $name, "setBluetoothDevice", "none" ); my $activetask = AttrVal( $name, "setActiveTask", "none" ); my $list = ""; @@ -457,6 +459,7 @@ sub AMAD_Set($$@) { $list .= "system:reboot " if( AttrVal( $name, "root", "1" ) eq "1" ); $list .= "bluetooth:on,off "; $list .= "notifySndFile "; + #$list .= "changetoBTDevice:$btdev " if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); if( lc $cmd eq 'screenmsg' || lc $cmd eq 'ttsmsg' @@ -473,6 +476,7 @@ sub AMAD_Set($$@) { || lc $cmd eq 'bluetooth' || lc $cmd eq 'system' || lc $cmd eq 'notifysndfile' + || lc $cmd eq 'changetobtdevice' || lc $cmd eq 'statusrequest' ) { Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val); @@ -652,6 +656,15 @@ sub AMAD_SelectSetCmd($$@) { return AMAD_HTTP_POST( $hash,$url ); } + + elsif( lc $cmd eq 'changetobtdevice' ) { + my $btdevice = join( " ", @data ); + my @btmac = split( "|", $btdevice ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setbtdevice?btdevicemac=".$btmac[1]; + + return AMAD_HTTP_POST( $hash,$url ); + } return undef; } @@ -1087,7 +1100,7 @@ sub AMAD_CommBridge_Read($) {
Dieses Modul liefert, in Verbindung mit der Android APP Automagic, diverse Informationen von Android Geräten. Die AndroidAPP Automagic (welche nicht von mir stammt und 2.90Euro kostet) funktioniert wie Tasker, ist aber bei weitem User freundlicher. - Im Auslieferiungszustand werden folgende Zustände dargestellt: + Im Auslieferungszustand werden folgende Zustände dargestellt:
  • Zustand von Automagic auf dem Gerät
  • Bluetooth An/Aus
  • diff --git a/74_AMADautomagicFlows0.7_DEVEL.xml b/74_AMADautomagicFlows0.7.7.xml similarity index 62% rename from 74_AMADautomagicFlows0.7_DEVEL.xml rename to 74_AMADautomagicFlows0.7.7.xml index 5ec87ec..c3fa999 100644 --- a/74_AMADautomagicFlows0.7_DEVEL.xml +++ b/74_AMADautomagicFlows0.7.7.xml @@ -69,6 +69,12 @@ global_album = getString("album"); tunein.player true + + true + App Task läuft: {header_activetask} (neuster) + {header_activetask} + true + false Benachrichtigung in Statusbar angezeigt: Automagic @@ -128,6 +134,11 @@ global_album = getString("album"); Expression: mediaPlayer" request_path == "/fhem-amad/setCommands/mediaPlayer" + + false + Expression: notifysnd" + request_path == "/fhem-amad/setCommands/playnotifysnd" + false Expression: openApp" @@ -138,6 +149,16 @@ global_album = getString("album"); Expression: openURL" request_path == "/fhem-amad/setCommands/openURL" + + true + Expression: param_bluetooth == "off" + param_bluetooth == "off" + + + true + Expression: param_bluetooth == "on" + param_bluetooth == "on" + true Expression: param_button == "back" @@ -208,11 +229,21 @@ global_album = getString("album"); Expression: setAlarm" request_path == "/fhem-amad/setCommands/setAlarm" + + false + Expression: setBluetooth" + request_path == "/fhem-amad/setCommands/setbluetooth" + false Expression: setBrightness" request_path == "/fhem-amad/setCommands/setBrightness" + + false + Expression: setBTDevice" + request_path == "/fhem-amad/setCommands/setbtdevice" + false Expression: setScreenFullscreen" @@ -243,6 +274,11 @@ global_album = getString("album"); Expression: trigger == "com.android.music.metachanged" trigger == "com.android.music.metachanged" + + true + Expression: trigger == "Globale Variable: global_own_reading" + trigger == "Globale Variable: global_own_reading" + true Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" @@ -368,6 +404,24 @@ global_album = getString("album"); 0 0 + + true + Bluetooth ein-/ausschalten: Aus + false + + + true + Bluetooth ein-/ausschalten: Ein + true + + + true + Bluetooth Gerät verbinden/trennen: Verbinden Headset {param_btdevicemac} + HEADSET + {param_btdevicemac} + + true + true Display automatisch drehen ein-/ausschalten: Aus @@ -385,7 +439,7 @@ global_album = getString("album"); false HTTP Response Information - powerLevel@@{battery_percentage}@@@@powerPlugged@@{battery_plugged}@@@@volumeMusikBluetooth@@{volumeMusikBluetooth}@@@@volumeMusikSpeaker@@{volumeMusikSpeaker}@@@@screenBrightness@@{screenBrightness}@@@@nextAlarmTime@@{next_alarmtime}@@@@nextAlarmDay@@{next_alarmday}@@@@screen@@{screen_state}@@@@automagicState@@{notification_text}@@@@screenOrientation@@{screen_orientation}@@@@currentMusicTrack@@{global_track}@@@@currentMusicAlbum@@{global_album}@@@@currentMusicArtist@@{global_artist}@@@@bluetooth@@{bluetooth_state}@@@@connectedBTdevices@@{connected_devices_names}@@@@flow_SetCommands@@{setCommandFlow_state} + powerLevel@@{battery_percentage}@@@@powerPlugged@@{battery_plugged}@@@@volumeMusikBluetooth@@{volumeMusikBluetooth}@@@@volumeMusikSpeaker@@{volumeMusikSpeaker}@@@@screenBrightness@@{screenBrightness}@@@@nextAlarmTime@@{next_alarmtime}@@@@nextAlarmDay@@{next_alarmday}@@@@screen@@{screen_state}@@@@automagicState@@{notification_text}@@@@screenOrientation@@{screen_orientation}@@@@currentMusicTrack@@{global_track}@@@@currentMusicAlbum@@{global_album}@@@@currentMusicArtist@@{global_artist}@@@@bluetooth@@{bluetooth_state}@@@@connectedBTdevices@@{connected_devices_names}@@@@connectedBTdevicesMAC@@{connected_devices_addresses}@@@@flow_SetCommands@@{setCommandFlow_state}@@@@checkActiveTask@@{runTask} true text/plain @@ -449,6 +503,26 @@ global_album = getString("album"); Neustart + + false + Own Reading + http://{global_fhemip}:8090 + false + false + + POST + GENERAL_TEXT + text/plain + {substring(getValue("global_own_reading",""),14)}@@{replaceAll(getValue("global_{substring(getValue('global_own_reading',''),14)}","nicht gefunden"),"\\s","%20")}@@@@ + @@@@readingsNameXYZ@@readingsValueABC + 5000 + true + FHEMDEVICE: {global_fhemdevice} +FHEMCMD: setreading + true + response + /storage/emulated/0/Download/file.bin + true Pause: 2s (Gerät wach halten) @@ -530,6 +604,16 @@ global_fhemdevice = {header_fhemdevice} Script: notification_text = "no supported from your device" + + true + Script: runTask = "0" + + + + true + Script: runTask = "1" + + true Script: screen_orientation = "auto" @@ -624,6 +708,18 @@ global_fhemdevice = {header_fhemdevice} HIDE_NAVIGATION false + + true + Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung + FILE + Lautlos + /storage/emulated/0/Notifications/{param_notifyfile} + NOTIFICATION + false + true + true + TRANSIENT + true Sprachausgabe: {param_message} @@ -671,100 +767,114 @@ FHEMCMD: statusrequest Informations - FHEM Info / Steuerung über AMAD Modul v0.7 Develop + FHEM Info / Steuerung über AMAD Modul v0.7.7 true QUEUE 120 - Script: notification_text = "no supported from your device" - Script: screen_orientation = "auto" - Display automatisch drehen eingeschaltet - Script: screen_orientation = "portrait" - Display Orientierung: Portrait - Script: screen_orientation = "landscape" - Bluetooth eingeschaltet - Script: bluetooth_state = "on" - Bluetooth Gerät verbunden: Beliebiges Geräte - Script: bluetooth_state = "off" - Script: screen_state = "off" - Script: screen_state = "on" - Display eingeschaltet - Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" - Initialisiere Variable Nächster Alarm: next_alarm - Script: next_alarmday = "{next_alarm,dateformat,c}" - Initialisiere Variable Systemeinstellung: screenBrightness - Initialisiere Variable Systemeinstellung: volumeMusikSpeaker - Initialisiere Variable Systemeinstellung: volumeMusikBluetooth - Flow Aktiv: SetCommands - Script: setCommandFlow_state = "aktiv" - Script: setCommandFlow_state = "inaktiv" - Setze Flow Status: Aktivieren SetCommands - Benachrichtigung in Statusbar angezeigt: Automagic - Akku Ladestand: grösser als 0% - Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; - Musik Aktiv - Pause: 2s (Gerät wach halten) - Expression: trigger == "com.android.music.metachanged" - Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} - HTTP Response Information - WLAN Verbunden: Alle SSIDs - Reading Music Metachanged - + HTTP Request: /fhem-amad/deviceInfo/ com.android.music.metachanged - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Script: notification_text = "no supported from your device" + Script: screen_orientation = "auto" + Display automatisch drehen eingeschaltet + Script: screen_orientation = "portrait" + Display Orientierung: Portrait + Script: screen_orientation = "landscape" + Bluetooth eingeschaltet + Script: bluetooth_state = "off" + Script: screen_state = "off" + Script: screen_state = "on" + Display eingeschaltet + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + Initialisiere Variable Nächster Alarm: next_alarm + Script: next_alarmday = "{next_alarm,dateformat,c}" + Initialisiere Variable Systemeinstellung: screenBrightness + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth + Flow Aktiv: SetCommands + Script: setCommandFlow_state = "aktiv" + Setze Flow Status: Aktivieren SetCommands + Benachrichtigung in Statusbar angezeigt: Automagic + Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; + Musik Aktiv + Pause: 2s (Gerät wach halten) + Expression: trigger == "com.android.music.metachanged" + Expression: trigger == "Globale Variable: global_own_reading" + WLAN Verbunden: Alle SSIDs + WLAN Verbunden: Alle SSIDs + Script: bluetooth_state = "on" + Bluetooth Gerät verbunden: Beliebiges Geräte + Akku Ladestand: grösser als 0% + Script: setCommandFlow_state = "inaktiv" + Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} + App Task läuft: {header_activetask} (neuster) + Script: runTask = "0" + Script: runTask = "1" + Reading Music Metachanged + Own Reading + HTTP Response Information + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SetCommands - FHEM Info / Steuerung über AMAD Modul v0.7 Develop + FHEM Info / Steuerung über AMAD Modul v0.7.7 true QUEUE 120 @@ -776,140 +886,163 @@ FHEMCMD: statusrequest Expression: setBrightness" Expression: setAlarm" Expression: screenMsg" - Expression: openURL" - URL in Browser öffnen: {param_url} (mit Chrome) - Benachrichtigung auf Bildschirm: {param_message} (lange) - Expression: setScreenFullscreen" - Expression: param_orientation == "auto" - Setze Display Orientierung: Portrait - Setze Display Orientierung: Landscape - Expression: param_orientation == "landscape" - Expression: param_orientation == "portrait" - Expression: param_fullscreen == "off" - Setze Vollbild Modus: Navigation nicht anzeigen - Expression: param_fullscreen == "on" - Setze Vollbild Modus: Auf Default zurücksetzen - Audio Player steuern: Medienknopf Zurück (Google Play Musik) - Expression: param_button == "back" - Expression: param_button == "next" - Setze Display Orientierung: Auf Default zurücksetzen - Audio Player steuern: Medienknopf Play (Google Play Musik) - Expression: param_button == "play" - Expression: mediaPlayer" - Audio Player steuern: Medienknopf Weiter (Google Play Musik) - Expression: param_button == "stop" - Expression: param_screen=="off" - Gerät sperren - Expression: setScreenOnOff" - Expression: setVolume" - App Task läuft: App5 (neuster) - Expression: App5 - Expression: App4 - App Task läuft: App3 (neuster) - Expression: App3 - App Starten: App3 - App Starten: App4 - App Task läuft: App4 (neuster) - Expression: tuneinradio - App Task läuft: tuneinradio (neuster) - App Starten: tuneinradio - App Starten: App5 - App Task läuft: gplay (neuster) - Expression: gplay - App Starten: PlayMusic - Expression: openApp" - Expression: System Command" - Expression: setScreenOrientation" - Expression: Reboot - Neustart - Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" - Setze Flow Status: Aktivieren Informations - Script: informationFlow_state = "inaktiv" - Script: informationFlow_state = "aktiv" - Flow Aktiv: Informations - Sprachausgabe: {param_message} - Expression: ttsMsg" - Lautstärken setzen - StatusRequest - Setze Systemeinstellung: System screen_brightness auf {param_brightness} - Schalte Display ein: Hell für 120s - Display automatisch drehen ein-/ausschalten: Aus - Display automatisch drehen ein-/ausschalten: Ein - Setze Alarm: um {param_hour}:{param_minute} - HTTP Response SetCommand - Audio Player steuern: Medienknopf Stopp (Google Play Musik) - - - - - - - - - - - - - - + URL in Browser öffnen: {param_url} (mit Chrome) + Benachrichtigung auf Bildschirm: {param_message} (lange) + Expression: setScreenFullscreen" + Expression: param_orientation == "auto" + Setze Display Orientierung: Portrait + Setze Display Orientierung: Landscape + Expression: param_orientation == "landscape" + Expression: param_orientation == "portrait" + Setze Vollbild Modus: Navigation nicht anzeigen + Setze Vollbild Modus: Auf Default zurücksetzen + Audio Player steuern: Medienknopf Zurück (Google Play Musik) + Expression: param_button == "back" + Expression: param_button == "next" + Setze Display Orientierung: Auf Default zurücksetzen + Audio Player steuern: Medienknopf Play (Google Play Musik) + Expression: param_button == "play" + Expression: mediaPlayer" + Audio Player steuern: Medienknopf Weiter (Google Play Musik) + Expression: param_button == "stop" + Expression: param_screen=="off" + Gerät sperren + Expression: setScreenOnOff" + App Task läuft: App5 (neuster) + Expression: App5 + Expression: App4 + App Task läuft: App3 (neuster) + Expression: App3 + App Starten: App3 + App Starten: App4 + App Task läuft: App4 (neuster) + Expression: tuneinradio + App Task läuft: tuneinradio (neuster) + App Starten: tuneinradio + App Starten: App5 + App Task läuft: gplay (neuster) + Expression: gplay + App Starten: PlayMusic + Expression: openApp" + Expression: System Command" + Neustart + Setze Flow Status: Aktivieren Informations + Script: informationFlow_state = "inaktiv" + Script: informationFlow_state = "aktiv" + Flow Aktiv: Informations + Expression: ttsMsg" + Lautstärken setzen + Setze Systemeinstellung: System screen_brightness auf {param_brightness} + Schalte Display ein: Hell für 120s + Display automatisch drehen ein-/ausschalten: Aus + Display automatisch drehen ein-/ausschalten: Ein + Setze Alarm: um {param_hour}:{param_minute} + HTTP Response SetCommand + Audio Player steuern: Medienknopf Stopp (Google Play Musik) + Expression: setScreenOrientation" + Expression: param_fullscreen == "off" + Expression: param_fullscreen == "on" + Expression: setBluetooth" + Expression: param_bluetooth == "on" + Expression: param_bluetooth == "off" + Bluetooth ein-/ausschalten: Ein + Bluetooth ein-/ausschalten: Aus + Expression: openURL" + Expression: Reboot + Expression: setVolume" + Sprachausgabe: {param_message} + Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung + StatusRequest + Expression: notifysnd" + Bluetooth Gerät verbinden/trennen: Verbinden Headset {param_btdevicemac} + Expression: setBTDevice" + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + Bluetooth Gerät verbunden: Beliebiges Geräte + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 942bc9b998fb507741b67ac5d0b3649153554f13 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 13 Oct 2015 22:28:42 +0200 Subject: [PATCH 17/25] =?UTF-8?q?Bluetooth=20toggle=20hinzugef=C3=BCgt,=20?= =?UTF-8?q?ausserdem=20gibt=20es=20nun=20Beispiel=20Flows=20f=C3=BCr=20Own?= =?UTF-8?q?Readings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 18 +- ....7.7.xml => 74_AMADautomagicFlows0.7.8.xml | 317 ++++++++++++++---- 2 files changed, 270 insertions(+), 65 deletions(-) rename 74_AMADautomagicFlows0.7.7.xml => 74_AMADautomagicFlows0.7.8.xml (78%) diff --git a/74_AMAD.pm b/74_AMAD.pm index 5aee395..dce13ec 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.7"; +my $version = "0.7.8"; @@ -54,7 +54,7 @@ sub AMAD_Initialize($) { "setFullscreen:0,1 ". "setScreenOrientation:0,1 ". "setScreenBrightness:0,1 ". - #"setBluetoothDevice ". + "setBluetoothDevice ". "root:0,1 ". "interval ". "port ". @@ -459,7 +459,7 @@ sub AMAD_Set($$@) { $list .= "system:reboot " if( AttrVal( $name, "root", "1" ) eq "1" ); $list .= "bluetooth:on,off "; $list .= "notifySndFile "; - #$list .= "changetoBTDevice:$btdev " if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); + $list .= "changetoBTDevice:$btdev " if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); if( lc $cmd eq 'screenmsg' || lc $cmd eq 'ttsmsg' @@ -658,11 +658,15 @@ sub AMAD_SelectSetCmd($$@) { } elsif( lc $cmd eq 'changetobtdevice' ) { - my $btdevice = join( " ", @data ); - my @btmac = split( "|", $btdevice ); + my $swToBtDevice = join( " ", @data ); + my @swToBtMac = split( /\|/, $swToBtDevice ); + my $btDevices = AttrVal( $name, "setBluetoothDevice", "none" ) if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); + my @btDevice = split( ',', $btDevices ); + my @btDeviceOne = split( /\|/, $btDevice[0] ); + my @btDeviceTwo = split( /\|/, $btDevice[1] ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setbtdevice?swToBtDeviceMac=".$swToBtMac[1]."&btDeviceOne=".$btDeviceOne[1]."&btDeviceTwo=".$btDeviceTwo[1]; - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setbtdevice?btdevicemac=".$btmac[1]; - return AMAD_HTTP_POST( $hash,$url ); } diff --git a/74_AMADautomagicFlows0.7.7.xml b/74_AMADautomagicFlows0.7.8.xml similarity index 78% rename from 74_AMADautomagicFlows0.7.7.xml rename to 74_AMADautomagicFlows0.7.8.xml index c3fa999..0e4f662 100644 --- a/74_AMADautomagicFlows0.7.7.xml +++ b/74_AMADautomagicFlows0.7.8.xml @@ -17,6 +17,24 @@ global_track = getString("track"); global_album = getString("album"); false + + true + Display Status: Aus + false + false + + + true + Display Status: Ein + false + true + + + true + Globale Variable: global_touched + false + global_touched + false HTTP Request: /fhem-amad/deviceInfo/ @@ -33,6 +51,26 @@ global_album = getString("album"); 8090 true + + true + Periodischer Timer: alle 4m + false + 240000 + true + false + false + Mon + Tue + Wed + Thu + Fri + Sat + Sun + 8 + 0 + 17 + 0 + true Akku Ladestand: grösser als 0% @@ -96,6 +134,20 @@ global_album = getString("album"); + + true + Bluetooth Gerät verbunden: {param_btdeviceone} + false + {param_btdeviceone} + + + + true + Bluetooth Gerät verbunden: {param_btdevicetwo} + false + {param_btdevicetwo} + + true Display automatisch drehen eingeschaltet @@ -124,6 +176,16 @@ global_album = getString("album"); Expression: App5 param_app == "" + + true + Expression: global_touched=="ja" + global_touched=="ja" + + + true + Expression: global_touched=="wait" + global_touched=="wait" + false Expression: gplay @@ -416,9 +478,25 @@ global_album = getString("album"); true - Bluetooth Gerät verbinden/trennen: Verbinden Headset {param_btdevicemac} - HEADSET - {param_btdevicemac} + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} + A2DP + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} + A2DP + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} + A2DP + {param_swtobtdevicemac} true @@ -476,6 +554,16 @@ global_album = getString("album"); volume_music_speaker volumeMusikSpeaker + + true + Kommandozeilenbefehl als Root ausführen: getevent -c 1 in + getevent -c 1 + + + stdout + stderr + exit_code + false Lautstärken setzen @@ -523,6 +611,18 @@ FHEMCMD: setreading response /storage/emulated/0/Download/file.bin + + true + Pause: 10s (Schlafmodus zulassen) + 10s + false + + + true + Pause: 15s (Gerät wach halten) + 15s + true + true Pause: 2s (Gerät wach halten) @@ -573,12 +673,42 @@ FHEMCMD: setreading global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; + + true + Script: global_display="an";global_own_reading="{getDate()}_display" + + + + true + Script: global_display="aus";global_own_reading="{getDate()}_display" + + true Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} + + true + Script: global_touch="ja";global_own_reading="{getDate()}_touch";global_touched="ja" + + + + true + Script: global_touch="nein";global_own_reading="{getDate()}_touch" + + + + true + Script: global_touched="ja" + + + + true + Script: global_touched="wait" + + true Script: informationFlow_state = "aktiv" @@ -767,7 +897,7 @@ FHEMCMD: statusrequest Informations - FHEM Info / Steuerung über AMAD Modul v0.7.7 + FHEM Info / Steuerung über AMAD Modul v0.7.8 true QUEUE 120 @@ -872,9 +1002,68 @@ FHEMCMD: statusrequest + + Meldung Display An + AMAD FHEM / OwnReadings Examples + false + PARALLEL + + Display Status: Ein + + Script: global_display="an";global_own_reading="{getDate()}_display" + + + + Meldung Display Aus + AMAD FHEM / OwnReadings Examples + false + PARALLEL + + Display Status: Aus + + Script: global_display="aus";global_own_reading="{getDate()}_display" + + + + Meldung kein Touch + AMAD FHEM / OwnReadings Examples + false + STOP + + Globale Variable: global_touched + + Pause: 15s (Gerät wach halten) + Script: global_touched="wait" + Expression: global_touched=="ja" + Expression: global_touched=="wait" + Script: global_touch="nein";global_own_reading="{getDate()}_touch" + + + + + + + + Meldung Touch + AMAD FHEM / OwnReadings Examples + false + STOP + + Periodischer Timer: alle 4m + + Kommandozeilenbefehl als Root ausführen: getevent -c 1 in + Script: global_touched="ja" + Script: global_touch="ja";global_own_reading="{getDate()}_touch";global_touched="ja" + Pause: 10s (Schlafmodus zulassen) + + + + + + SetCommands - FHEM Info / Steuerung über AMAD Modul v0.7.7 + FHEM Info / Steuerung über AMAD Modul v0.7.8 true QUEUE 120 @@ -943,22 +1132,26 @@ FHEMCMD: statusrequest Expression: param_fullscreen == "off" Expression: param_fullscreen == "on" Expression: setBluetooth" - Expression: param_bluetooth == "on" - Expression: param_bluetooth == "off" - Bluetooth ein-/ausschalten: Ein - Bluetooth ein-/ausschalten: Aus - Expression: openURL" - Expression: Reboot - Expression: setVolume" - Sprachausgabe: {param_message} - Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung - StatusRequest - Expression: notifysnd" - Bluetooth Gerät verbinden/trennen: Verbinden Headset {param_btdevicemac} - Expression: setBTDevice" - Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" - Bluetooth Gerät verbunden: Beliebiges Geräte - + Expression: openURL" + Expression: Reboot + Expression: setVolume" + Sprachausgabe: {param_message} + Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung + StatusRequest + Expression: notifysnd" + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + Expression: param_bluetooth == "off" + Bluetooth ein-/ausschalten: Aus + Expression: param_bluetooth == "on" + Bluetooth ein-/ausschalten: Ein + Expression: setBTDevice" + Bluetooth eingeschaltet + Bluetooth Gerät verbunden: {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} + Bluetooth Gerät verbunden: {param_btdevicetwo} + @@ -997,52 +1190,60 @@ FHEMCMD: statusrequest - + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From b95fc5d8a463d03fa5cc8b6b4d0c4cd965554d9b Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 15 Oct 2015 06:10:00 +0200 Subject: [PATCH 18/25] =?UTF-8?q?l=C3=B6schen=20der=20Benachrichtigungen?= =?UTF-8?q?=20in=20der=20Statusbar=20hinzugef=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 55 +- ....7.8.xml => 74_AMADautomagicFlows0.7.9.xml | 548 +++++++++++------- 2 files changed, 380 insertions(+), 223 deletions(-) rename 74_AMADautomagicFlows0.7.8.xml => 74_AMADautomagicFlows0.7.9.xml (72%) diff --git a/74_AMAD.pm b/74_AMAD.pm index dce13ec..5e1532b 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.8"; +my $version = "0.7.9"; @@ -459,6 +459,7 @@ sub AMAD_Set($$@) { $list .= "system:reboot " if( AttrVal( $name, "root", "1" ) eq "1" ); $list .= "bluetooth:on,off "; $list .= "notifySndFile "; + $list .= "clearNotificationBar:All,Automagic "; $list .= "changetoBTDevice:$btdev " if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); if( lc $cmd eq 'screenmsg' @@ -477,6 +478,7 @@ sub AMAD_Set($$@) { || lc $cmd eq 'system' || lc $cmd eq 'notifysndfile' || lc $cmd eq 'changetobtdevice' + || lc $cmd eq 'clearnotificationbar' || lc $cmd eq 'statusrequest' ) { Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val); @@ -669,6 +671,14 @@ sub AMAD_SelectSetCmd($$@) { return AMAD_HTTP_POST( $hash,$url ); } + + elsif( lc $cmd eq 'clearnotificationbar' ) { + my $appname = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/clearnotificationbar?app=$appname"; + + return AMAD_HTTP_POST( $hash,$url ); + } return undef; } @@ -1108,7 +1118,8 @@ sub AMAD_CommBridge_Read($) {
    • Zustand von Automagic auf dem Gerät
    • Bluetooth An/Aus
    • -
    • verbundene Bluetoothgeräte
    • +
    • Zustand einer definierten App (läuft aktiv im Vordergrund oder nicht?)
    • +
    • verbundene Bluetoothgeräte, inklusive deren MAC Adresse
    • aktuell abgespieltes Musikalbum des verwendeten Mediaplayers
    • aktuell abgespielter Musikinterpret des verwendeten Mediaplayers
    • aktuell abgespielter Musiktitel des verwendeten Mediaplayers
    • @@ -1131,9 +1142,12 @@ sub AMAD_CommBridge_Read($) {

      Das Modul gibt Dir auch die Möglichkeit Deine Androidgeräte zu steuern. So können folgende Aktionen durchgeführt werden.
        +
      • Bluetooth Ein/Aus schalten
      • +
      • zu einem bestimmten Bluetoothgerät wechseln/verbinden
      • Status des Gerätes (Online,Offline)
      • Mediaplayer steuern (Play, Stop, nächster Titel, vorheriger Titel)
      • nächste Alarmzeit setzen
      • +
      • ein Benachrichtigungston abspielen (Notificationsound)
      • eine App auf dem Gerät öffnen
      • eine URL im Browser öffnen
      • Bildschirm An/Aus machen
      • @@ -1168,20 +1182,34 @@ sub AMAD_CommBridge_Read($) { define WandTabletWohnzimmer AMAD 192.168.0.23

      - Diese Anweisung erstellt ein neues AMAD-Device. Der Parameter <IP-ADRESSE< legt die IP Adresse des Android Gerätes fest.
      + Diese Anweisung erstellt ein neues AMAD-Device im Raum AMAD.Der Parameter <IP-ADRESSE< legt die IP Adresse des Android Gerätes fest.
      Das Standard Abfrageinterval ist 180 Sekunden und kann über das Attribut intervall geändert werden. Wer den Port ändern möchte, kann dies über das Attribut port tun. Ihr solltet aber wissen was Ihr tut, da dieser Port im HTTP Response Trigger der beiden Flows eingestellt ist. Demzufolge muß dieser dort auch verädert werden.


    Fertig! Nach anlegen der Geräteinstanz sollten nach spätestens 3 Minuten bereits die ersten Readings reinkommen. +


    + + AMAD Communication Bridge +
      + Beim ersten anlegen einer AMAD Deviceinstanz wird automatisch ein Gerät Namens AMADCommBridge im Raum AMAD angelegt. BITTE NIEMALS DEN NAMEN DER BRIDGE ÄNDERN!!! + Alle anderen Eigenschaften können geändert werden. Dieses Gerät diehnt zur Kommunikation + vom Androidgerät zu FHEM ohne das zuvor eine Anfrage von FHEM aus ging. Damit das Androidgerät die IP von FHEM kennt, muss diese sofort nach dem anlegen der Bridge + über den set Befehl in ein entsprechendes Reading in die Bridge geschrieben werden. DAS IST SUPER WICHTIG UND FÜR DIE FUNKTION DER BRIDGE NOTWENDIG.
      + Bitte führt hierzu folgenden Befehl aus. set AMADCommBridge fhemServerIP <FHEM-IP>.
      + Als zweites Reading könnt Ihr expertModesetzen. Mit diesem Reading wird eine unmittelbare Komminikation mit FHEM erreicht ohne die Einschränkung über ein + Notify gehen zu müssen und nur reine set Befehle ausführen zu können. +


    Readings
    • automagicState - Statusmeldungen von der AutomagicApp
    • bluetooth on/off - ist auf dem Gerät Bluetooth an oder aus
    • -
    • connectedBTdevices - eine Lieste der verbundenen Gerät
    • +
    • checkActiveTask - Zustand einer zuvor definierten APP. 0=nicht aktiv oder nicht aktiv im Vordergrund, 1=aktiv im Vordergrund, siehe Hinweis unten
    • +
    • connectedBTdevices - eine Liste der verbundenen Gerät
    • +
    • connectedBTdevicesMAC - eine Liste der MAC Adressen aller verbundender BT Geräte
    • currentMusicAlbum - aktuell abgespieltes Musikalbum des verwendeten Mediaplayers
    • currentMusicArtist - aktuell abgespielter Musikinterpret des verwendeten Mediaplayers
    • currentMusicTrack - aktuell abgespielter Musiktitel des verwendeten Mediaplayers
    • @@ -1204,17 +1232,22 @@ sub AMAD_CommBridge_Read($) {
    • volume - Lautstärkewert welcher über "set volume" gesetzt wurde.
    • volumeMusikBluetooth - Media Lautstärke von angeschlossenden Bluetooth Lautsprechern
    • volumeMusikSpeaker - Media Lautstärke der internen Lautsprecher
    • -
      - Die Readings volumeMusikBluetooth und volumeMusikSpeaker spiegeln die jeweilige Medialautstärke der angeschlossenden Bluetoothlautsprechern oder der internen Lautsprecher wieder.
      +

      + Die Readings volumeMusikBluetooth und volumeMusikSpeaker spiegeln die jeweilige Medialautstärke der angeschlossenden Bluetoothlautsprecher oder der internen Lautsprecher wieder. Sofern man die jeweiligen Lautstärken ausschließlich über den Set Befehl setzt, wird eine der beiden immer mit dem "volume" Reading über ein stimmen.

      + Beim Reading checkActivTask muß zuvor der Packagename der zu prüfenden App als Attribut checkActiveTask angegeben werden. Beispiel: attr Nexus10Wohnzimmer + checkActiveTask com.android.chrome für den Chrome Browser. +



    Set
      +
    • bluetooth - Schaltet Bluetooth on/off
    • deviceState - setzt den Device Status Online/Offline. Siehe Readings
    • mediaPlayer - steuert den Standard Mediaplayer. play, stop, Titel zürück, Titel vor.
    • nextAlarmTime - setzt die Alarmzeit. Geht aber nur innerhalb der nächsten 24Std.
    • +
    • notifySndFile - spielt die angegebende Mediadatei auf dem Androidgerät ab. Die aufzurufende Mediadatei muß sich im Ordner /storage/emulated/0/Notifications/ befinden.
    • openURL - öffnet eine URL im Standardbrowser
    • screen - setzt den Bildschirm on/off mit Sperre, in den Automagic Einstellungen muss "Admin Funktion" gesetzt werden sonst funktioniert "Screen off" nicht.
    • screenMsg - versendet eine Bildschirmnachricht
    • @@ -1225,6 +1258,8 @@ sub AMAD_CommBridge_Read($) {
      Set abhängig von gesetzten Attributen
        +
      • +
      • changetoBtDevice - wechselt zu einem anderen Bluetooth Gerät. Attribut setBluetoothDevice muß gesetzt sein. Siehe Hinweis unten!
      • mediaPlayer - steuert den Standard Mediaplayer. play, stop, Titel zürück, Titel vor. Attribut fhemServerIP
      • openApp - öffnet eine ausgewählte App. Attribut setOpenApp
      • screenBrightness - setzt die Bildschirmhelligkeit, von 0-255 Attribut setScreenBrightness
      • @@ -1233,10 +1268,14 @@ sub AMAD_CommBridge_Read($) {
      • screenFullscreen - Schaltet den Vollbildmodus on/off. Attribut setFullscreen
      • screenOrientation - Schaltet die Bildschirmausrichtung Auto/Landscape/Portait. Attribut setScreenOrientation
      • system - setzt Systembefehle ab (nur bei gerootetet Geräen). Reboot Attribut root, in den Automagic Einstellungen muss "Root Funktion" gesetzt werden
      • +
        Um openApp verwenden zu können, muss als Attribut ein, oder durch Komma getrennt, mehrere App Namen gesetzt werden. Der App Name ist frei wählbar und nur zur Wiedererkennung notwendig. Der selbe App Name muß im Flow SetCommands auf der linken Seite unterhalb der Raute Expression:"openApp" in einen der 5 Stränge (eine App pro Strang) in beide Rauten eingetragen werden. Danach wird - in das - Viereck die App ausgewält welche durch den Attribut App Namen gestartet werden soll. + in das Viereck die App ausgewält welche durch den Attribut App Namen gestartet werden soll.

        + Um zwischen Bluetoothgeräten wechseln zu können, muß das Attribut setBluetoothDevice mit folgender Syntax gesetzt werden. attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC Es muss + zwingend darauf geachtet werden das beim BTdeviceName kein Leerzeichen vorhanden ist. Am besten zusammen oder mit Unterstrich. Achtet bei der MAC darauf das Ihr wirklich nach jeder zweiten Zahl auch + einen : drin habt
        + Beispiel: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76


      diff --git a/74_AMADautomagicFlows0.7.8.xml b/74_AMADautomagicFlows0.7.9.xml similarity index 72% rename from 74_AMADautomagicFlows0.7.8.xml rename to 74_AMADautomagicFlows0.7.9.xml index 0e4f662..c48b08a 100644 --- a/74_AMADautomagicFlows0.7.8.xml +++ b/74_AMADautomagicFlows0.7.9.xml @@ -161,6 +161,11 @@ global_album = getString("album"); Display Orientierung: Portrait true + + false + Expression: All + param_app == "All" + false Expression: App3 @@ -176,6 +181,16 @@ global_album = getString("album"); Expression: App5 param_app == "" + + false + Expression: Automagic + param_app == "Automagic" + + + false + Expression: Clear Automagic Meldungen" + request_path == "/fhem-amad/setCommands/clearnotificationbar" + true Expression: global_touched=="ja" @@ -466,6 +481,28 @@ global_album = getString("album"); 0 0 + + true + Benachrichtigung aus Statusbar entfernen: Alle + false + true + 1 + true + + true + + + + true + Benachrichtigung aus Statusbar entfernen: Alle (Automagic) + true + true + 1 + false + + true + + true Bluetooth ein-/ausschalten: Aus @@ -492,6 +529,54 @@ global_album = getString("album"); false + + true + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} + INPUT_DEVICE + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} + INPUT_DEVICE + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} + HEADSET + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} + HEADSET + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} + PAN + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} + PAN + {param_btdevicetwo} + + false + true Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} @@ -629,6 +714,12 @@ FHEMCMD: setreading 2s true + + true + Pause: 3s (Gerät wach halten) + 3s + true + false Reading Music Metachanged @@ -897,7 +988,7 @@ FHEMCMD: statusrequest Informations - FHEM Info / Steuerung über AMAD Modul v0.7.8 + FHEM Info / Steuerung über AMAD Modul v0.7.9 true QUEUE 120 @@ -925,82 +1016,82 @@ FHEMCMD: statusrequest Flow Aktiv: SetCommands Script: setCommandFlow_state = "aktiv" Setze Flow Status: Aktivieren SetCommands - Benachrichtigung in Statusbar angezeigt: Automagic - Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; - Musik Aktiv - Pause: 2s (Gerät wach halten) - Expression: trigger == "com.android.music.metachanged" - Expression: trigger == "Globale Variable: global_own_reading" - WLAN Verbunden: Alle SSIDs - WLAN Verbunden: Alle SSIDs - Script: bluetooth_state = "on" - Bluetooth Gerät verbunden: Beliebiges Geräte - Akku Ladestand: grösser als 0% - Script: setCommandFlow_state = "inaktiv" - Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} - App Task läuft: {header_activetask} (neuster) - Script: runTask = "0" - Script: runTask = "1" - Reading Music Metachanged - Own Reading - HTTP Response Information - - - + Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; + Musik Aktiv + Pause: 2s (Gerät wach halten) + Expression: trigger == "com.android.music.metachanged" + Expression: trigger == "Globale Variable: global_own_reading" + WLAN Verbunden: Alle SSIDs + WLAN Verbunden: Alle SSIDs + Script: bluetooth_state = "on" + Bluetooth Gerät verbunden: Beliebiges Geräte + Akku Ladestand: grösser als 0% + Script: setCommandFlow_state = "inaktiv" + Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} + App Task läuft: {header_activetask} (neuster) + Script: runTask = "0" + Script: runTask = "1" + Reading Music Metachanged + Own Reading + HTTP Response Information + Benachrichtigung in Statusbar angezeigt: Automagic + + + - + - - + + - - - - + + + + - + - - - - + + + + - - - - - - - + + + + + + + + - - - + - + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + Meldung Display An @@ -1063,7 +1154,7 @@ FHEMCMD: statusrequest SetCommands - FHEM Info / Steuerung über AMAD Modul v0.7.8 + FHEM Info / Steuerung über AMAD Modul v0.7.9 true QUEUE 120 @@ -1089,161 +1180,188 @@ FHEMCMD: statusrequest Expression: param_button == "back" Expression: param_button == "next" Setze Display Orientierung: Auf Default zurücksetzen - Audio Player steuern: Medienknopf Play (Google Play Musik) - Expression: param_button == "play" - Expression: mediaPlayer" - Audio Player steuern: Medienknopf Weiter (Google Play Musik) - Expression: param_button == "stop" - Expression: param_screen=="off" - Gerät sperren - Expression: setScreenOnOff" - App Task läuft: App5 (neuster) - Expression: App5 - Expression: App4 - App Task läuft: App3 (neuster) - Expression: App3 - App Starten: App3 - App Starten: App4 - App Task läuft: App4 (neuster) - Expression: tuneinradio - App Task läuft: tuneinradio (neuster) - App Starten: tuneinradio - App Starten: App5 - App Task läuft: gplay (neuster) - Expression: gplay - App Starten: PlayMusic - Expression: openApp" - Expression: System Command" - Neustart - Setze Flow Status: Aktivieren Informations - Script: informationFlow_state = "inaktiv" - Script: informationFlow_state = "aktiv" - Flow Aktiv: Informations - Expression: ttsMsg" - Lautstärken setzen - Setze Systemeinstellung: System screen_brightness auf {param_brightness} - Schalte Display ein: Hell für 120s - Display automatisch drehen ein-/ausschalten: Aus - Display automatisch drehen ein-/ausschalten: Ein - Setze Alarm: um {param_hour}:{param_minute} - HTTP Response SetCommand - Audio Player steuern: Medienknopf Stopp (Google Play Musik) - Expression: setScreenOrientation" - Expression: param_fullscreen == "off" - Expression: param_fullscreen == "on" - Expression: setBluetooth" - Expression: openURL" - Expression: Reboot - Expression: setVolume" - Sprachausgabe: {param_message} - Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung - StatusRequest - Expression: notifysnd" - Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" - Expression: param_bluetooth == "off" - Bluetooth ein-/ausschalten: Aus - Expression: param_bluetooth == "on" - Bluetooth ein-/ausschalten: Ein - Expression: setBTDevice" - Bluetooth eingeschaltet - Bluetooth Gerät verbunden: {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} - Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} - Bluetooth Gerät verbunden: {param_btdevicetwo} - - - - + Expression: param_button == "play" + Expression: mediaPlayer" + Audio Player steuern: Medienknopf Weiter (Google Play Musik) + Expression: param_button == "stop" + Expression: param_screen=="off" + Gerät sperren + Expression: setScreenOnOff" + App Task läuft: App5 (neuster) + Expression: App5 + Expression: App4 + App Task läuft: App3 (neuster) + Expression: App3 + App Starten: App3 + App Starten: App4 + App Task läuft: App4 (neuster) + Expression: tuneinradio + App Task läuft: tuneinradio (neuster) + App Starten: tuneinradio + App Starten: App5 + App Task läuft: gplay (neuster) + Expression: gplay + App Starten: PlayMusic + Expression: System Command" + Neustart + Setze Flow Status: Aktivieren Informations + Script: informationFlow_state = "inaktiv" + Script: informationFlow_state = "aktiv" + Flow Aktiv: Informations + Expression: ttsMsg" + Lautstärken setzen + Setze Systemeinstellung: System screen_brightness auf {param_brightness} + Schalte Display ein: Hell für 120s + Display automatisch drehen ein-/ausschalten: Aus + Display automatisch drehen ein-/ausschalten: Ein + Setze Alarm: um {param_hour}:{param_minute} + Audio Player steuern: Medienknopf Stopp (Google Play Musik) + Expression: setScreenOrientation" + Expression: param_fullscreen == "off" + Expression: param_fullscreen == "on" + Expression: setBluetooth" + Expression: openURL" + Expression: setVolume" + Sprachausgabe: {param_message} + Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung + StatusRequest + Expression: param_bluetooth == "off" + Bluetooth ein-/ausschalten: Aus + Expression: param_bluetooth == "on" + Bluetooth ein-/ausschalten: Ein + Expression: setBTDevice" + Bluetooth eingeschaltet + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} + HTTP Response SetCommand + Bluetooth Gerät verbunden: {param_btdeviceone} + Bluetooth Gerät verbunden: {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} + Pause: 3s (Gerät wach halten) + Expression: notifysnd" + Audio Player steuern: Medienknopf Play (Google Play Musik) + Expression: openApp" + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + Expression: Reboot + Benachrichtigung aus Statusbar entfernen: Alle + Expression: All + Benachrichtigung aus Statusbar entfernen: Alle (Automagic) + Expression: Automagic + Expression: Clear Automagic Meldungen" + + + + - - + + - - + + - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 24c6ee95f6439691ff91bc8b16e4f74d6132a74b Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 15 Oct 2015 06:11:53 +0200 Subject: [PATCH 19/25] Readme angepasst --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 92b1188..361c974 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,15 @@ -

      AMAD - Automagic Android Device

      +

      AMAD

        AMAD - Automagic Android Device +
        Dieses Modul liefert, in Verbindung mit der Android APP Automagic, diverse Informationen von Android Geräten. Die AndroidAPP Automagic (welche nicht von mir stammt und 2.90Euro kostet) funktioniert wie Tasker, ist aber bei weitem User freundlicher. - Im Auslieferiungszustand werden folgende Zustände dargestellt: + Im Auslieferungszustand werden folgende Zustände dargestellt:
        • Zustand von Automagic auf dem Gerät
        • Bluetooth An/Aus
        • -
        • verbundene Bluetoothgeräte
        • +
        • Zustand einer definierten App (läuft aktiv im Vordergrund oder nicht?)
        • +
        • verbundene Bluetoothgeräte, inklusive deren MAC Adresse
        • aktuell abgespieltes Musikalbum des verwendeten Mediaplayers
        • aktuell abgespielter Musikinterpret des verwendeten Mediaplayers
        • aktuell abgespielter Musiktitel des verwendeten Mediaplayers
        • @@ -16,7 +18,7 @@
        • nächste Alarmzeit
        • Batteriestatus in %
        • Ladestatus - Netztei angeschlossen / nicht angeschlossen
        • -
        • Bildschirnstatus An/Aus
        • +
        • Bildschirmstatus An/Aus
        • Bildschirmhelligkeit
        • Vollbildmodus An/Aus
        • Bildschirmausrichtung Auto/Landscape/Portrait
        • @@ -30,9 +32,12 @@

          Das Modul gibt Dir auch die Möglichkeit Deine Androidgeräte zu steuern. So können folgende Aktionen durchgeführt werden.
            +
          • Bluetooth Ein/Aus schalten
          • +
          • zu einem bestimmten Bluetoothgerät wechseln/verbinden
          • Status des Gerätes (Online,Offline)
          • Mediaplayer steuern (Play, Stop, nächster Titel, vorheriger Titel)
          • nächste Alarmzeit setzen
          • +
          • ein Benachrichtigungston abspielen (Notificationsound)
          • eine App auf dem Gerät öffnen
          • eine URL im Browser öffnen
          • Bildschirm An/Aus machen
          • @@ -52,7 +57,7 @@ Wie genau verwendet man nun AMAD?
            • installiert Euch die App "Automagic Premium" aus dem App Store oder die Testversion von hier
            • -
            • installiert das Flowset 74_AMADautomagicFlows$VERSION.xml aus dem Ordner $INSTALLFHEM/lib/ auf Eurem Androidgerät und aktiviert erstmal nur den "Informations" Flow.
            • +
            • installiert das Flowset 74_AMADautomagicFlows$VERSION.xml aus dem Ordner $INSTALLFHEM/FHEM/lib/ auf Eurem Androidgerät und aktiviert erstmal nur den "Informations" Flow.

            Nun müsst Ihr nur noch ein Device in FHEM anlegen. @@ -67,20 +72,34 @@ define WandTabletWohnzimmer AMAD 192.168.0.23

          - Diese Anweisung erstellt ein neues AMAD-Device. Der Parameter <IP-ADRESSE< legt die IP Adresse des Android Gerätes fest.
          + Diese Anweisung erstellt ein neues AMAD-Device im Raum AMAD.Der Parameter <IP-ADRESSE< legt die IP Adresse des Android Gerätes fest.
          Das Standard Abfrageinterval ist 180 Sekunden und kann über das Attribut intervall geändert werden. Wer den Port ändern möchte, kann dies über das Attribut port tun. Ihr solltet aber wissen was Ihr tut, da dieser Port im HTTP Response Trigger der beiden Flows eingestellt ist. Demzufolge muß dieser dort - auch verändert werden.
          + auch verädert werden.


        Fertig! Nach anlegen der Geräteinstanz sollten nach spätestens 3 Minuten bereits die ersten Readings reinkommen. +


        + + AMAD Communication Bridge +
          + Beim ersten anlegen einer AMAD Deviceinstanz wird automatisch ein Gerät Namens AMADCommBridge im Raum AMAD angelegt. BITTE NIEMALS DEN NAMEN DER BRIDGE ÄNDERN!!! + Alle anderen Eigenschaften können geändert werden. Dieses Gerät diehnt zur Kommunikation + vom Androidgerät zu FHEM ohne das zuvor eine Anfrage von FHEM aus ging. Damit das Androidgerät die IP von FHEM kennt, muss diese sofort nach dem anlegen der Bridge + über den set Befehl in ein entsprechendes Reading in die Bridge geschrieben werden. DAS IST SUPER WICHTIG UND FÜR DIE FUNKTION DER BRIDGE NOTWENDIG.
          + Bitte führt hierzu folgenden Befehl aus. set AMADCommBridge fhemServerIP <FHEM-IP>.
          + Als zweites Reading könnt Ihr expertModesetzen. Mit diesem Reading wird eine unmittelbare Komminikation mit FHEM erreicht ohne die Einschränkung über ein + Notify gehen zu müssen und nur reine set Befehle ausführen zu können. +


        Readings
        • automagicState - Statusmeldungen von der AutomagicApp
        • bluetooth on/off - ist auf dem Gerät Bluetooth an oder aus
        • -
        • connectedBTdevices - eine Lieste der verbundenen Gerät
        • +
        • checkActiveTask - Zustand einer zuvor definierten APP. 0=nicht aktiv oder nicht aktiv im Vordergrund, 1=aktiv im Vordergrund, siehe Hinweis unten
        • +
        • connectedBTdevices - eine Liste der verbundenen Gerät
        • +
        • connectedBTdevicesMAC - eine Liste der MAC Adressen aller verbundender BT Geräte
        • currentMusicAlbum - aktuell abgespieltes Musikalbum des verwendeten Mediaplayers
        • currentMusicArtist - aktuell abgespielter Musikinterpret des verwendeten Mediaplayers
        • currentMusicTrack - aktuell abgespielter Musiktitel des verwendeten Mediaplayers
        • @@ -95,7 +114,7 @@
        • nextAlarmDay - aktiver Alarmtag
        • nextAlarmTime - aktive Alarmzeit
        • powerLevel - Status der Batterie in %
        • -
        • powerPlugged - Netzteil angeschlossen? 0=NEIN, 2=JA
        • +
        • powerPlugged - Netzteil angeschlossen? 0=NEIN, 1|2=JA
        • screen - Bildschirm An oderAus
        • screenBrightness - Bildschirmhelligkeit von 0-255
        • screenFullscreen - Vollbildmodus (On,Off)
        • @@ -103,17 +122,22 @@
        • volume - Lautstärkewert welcher über "set volume" gesetzt wurde.
        • volumeMusikBluetooth - Media Lautstärke von angeschlossenden Bluetooth Lautsprechern
        • volumeMusikSpeaker - Media Lautstärke der internen Lautsprecher
        • -
          - Die Readings volumeMusikBluetooth und volumeMusikSpeaker spiegeln die jeweilige Medialautstärke der angeschlossenden Bluetoothlautsprechern oder der internen Lautsprecher wieder.
          +

          + Die Readings volumeMusikBluetooth und volumeMusikSpeaker spiegeln die jeweilige Medialautstärke der angeschlossenden Bluetoothlautsprecher oder der internen Lautsprecher wieder. Sofern man die jeweiligen Lautstärken ausschließlich über den Set Befehl setzt, wird eine der beiden immer mit dem "volume" Reading über ein stimmen.

          + Beim Reading checkActivTask muß zuvor der Packagename der zu prüfenden App als Attribut checkActiveTask angegeben werden. Beispiel: attr Nexus10Wohnzimmer + checkActiveTask com.android.chrome für den Chrome Browser. +



        Set
          +
        • bluetooth - Schaltet Bluetooth on/off
        • deviceState - setzt den Device Status Online/Offline. Siehe Readings
        • mediaPlayer - steuert den Standard Mediaplayer. play, stop, Titel zürück, Titel vor.
        • nextAlarmTime - setzt die Alarmzeit. Geht aber nur innerhalb der nächsten 24Std.
        • +
        • notifySndFile - spielt die angegebende Mediadatei auf dem Androidgerät ab. Die aufzurufende Mediadatei muß sich im Ordner /storage/emulated/0/Notifications/ befinden.
        • openURL - öffnet eine URL im Standardbrowser
        • screen - setzt den Bildschirm on/off mit Sperre, in den Automagic Einstellungen muss "Admin Funktion" gesetzt werden sonst funktioniert "Screen off" nicht.
        • screenMsg - versendet eine Bildschirmnachricht
        • @@ -124,6 +148,8 @@
          Set abhängig von gesetzten Attributen
            +
          • +
          • changetoBtDevice - wechselt zu einem anderen Bluetooth Gerät. Attribut setBluetoothDevice muß gesetzt sein. Siehe Hinweis unten!
          • mediaPlayer - steuert den Standard Mediaplayer. play, stop, Titel zürück, Titel vor. Attribut fhemServerIP
          • openApp - öffnet eine ausgewählte App. Attribut setOpenApp
          • screenBrightness - setzt die Bildschirmhelligkeit, von 0-255 Attribut setScreenBrightness
          • @@ -132,16 +158,20 @@
          • screenFullscreen - Schaltet den Vollbildmodus on/off. Attribut setFullscreen
          • screenOrientation - Schaltet die Bildschirmausrichtung Auto/Landscape/Portait. Attribut setScreenOrientation
          • system - setzt Systembefehle ab (nur bei gerootetet Geräen). Reboot Attribut root, in den Automagic Einstellungen muss "Root Funktion" gesetzt werden
          • +
            Um openApp verwenden zu können, muss als Attribut ein, oder durch Komma getrennt, mehrere App Namen gesetzt werden. Der App Name ist frei wählbar und nur zur Wiedererkennung notwendig. Der selbe App Name muß im Flow SetCommands auf der linken Seite unterhalb der Raute Expression:"openApp" in einen der 5 Stränge (eine App pro Strang) in beide Rauten eingetragen werden. Danach wird - in das - Viereck die App ausgewält welche durch den Attribut App Namen gestartet werden soll. + in das Viereck die App ausgewält welche durch den Attribut App Namen gestartet werden soll.

            + Um zwischen Bluetoothgeräten wechseln zu können, muß das Attribut setBluetoothDevice mit folgender Syntax gesetzt werden. attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC Es muss + zwingend darauf geachtet werden das beim BTdeviceName kein Leerzeichen vorhanden ist. Am besten zusammen oder mit Unterstrich. Achtet bei der MAC darauf das Ihr wirklich nach jeder zweiten Zahl auch + einen : drin habt
            + Beispiel: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76


          - STATE + state
            -
          • initialized - Ist der Status kurz nach einem define..
          • +
          • initialized - Ist der Status kurz nach einem define.
          • active - die Geräteinstanz ist im aktiven Status.
          • disabled - die Geräteinstanz wurde über das Attribut disable deaktiviert
          From dc1ba7f38bb2587350145159e1f6174861aa4ad8 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 16 Oct 2015 06:03:53 +0200 Subject: [PATCH 20/25] =?UTF-8?q?trigger=20f=C3=BCr=20OwnReadings=20im=20I?= =?UTF-8?q?nformationflow=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMADautomagicFlows0.7.9.xml | 195 +++++++++++++++++---------------- 1 file changed, 101 insertions(+), 94 deletions(-) diff --git a/74_AMADautomagicFlows0.7.9.xml b/74_AMADautomagicFlows0.7.9.xml index c48b08a..7e5566d 100644 --- a/74_AMADautomagicFlows0.7.9.xml +++ b/74_AMADautomagicFlows0.7.9.xml @@ -29,6 +29,12 @@ global_album = getString("album"); false true + + true + Globale Variable: global_own_reading + true + global_own_reading + true Globale Variable: global_touched @@ -992,106 +998,107 @@ FHEMCMD: statusrequest true QUEUE 120 - + Script: notification_text = "no supported from your device" + Script: screen_orientation = "auto" + Display automatisch drehen eingeschaltet + Script: screen_orientation = "portrait" + Display Orientierung: Portrait + Script: screen_orientation = "landscape" + Bluetooth eingeschaltet + Script: bluetooth_state = "off" + Script: screen_state = "off" + Script: screen_state = "on" + Display eingeschaltet + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + Initialisiere Variable Nächster Alarm: next_alarm + Script: next_alarmday = "{next_alarm,dateformat,c}" + Initialisiere Variable Systemeinstellung: screenBrightness + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth + Flow Aktiv: SetCommands + Script: setCommandFlow_state = "aktiv" + Setze Flow Status: Aktivieren SetCommands + Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; + Musik Aktiv + Pause: 2s (Gerät wach halten) + Expression: trigger == "com.android.music.metachanged" + Expression: trigger == "Globale Variable: global_own_reading" + WLAN Verbunden: Alle SSIDs + WLAN Verbunden: Alle SSIDs + Script: bluetooth_state = "on" + Bluetooth Gerät verbunden: Beliebiges Geräte + Akku Ladestand: grösser als 0% + Script: setCommandFlow_state = "inaktiv" + Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} + App Task läuft: {header_activetask} (neuster) + Script: runTask = "0" + Script: runTask = "1" + Reading Music Metachanged + Own Reading + HTTP Response Information + Benachrichtigung in Statusbar angezeigt: Automagic + HTTP Request: /fhem-amad/deviceInfo/ com.android.music.metachanged + Globale Variable: global_own_reading - Script: notification_text = "no supported from your device" - Script: screen_orientation = "auto" - Display automatisch drehen eingeschaltet - Script: screen_orientation = "portrait" - Display Orientierung: Portrait - Script: screen_orientation = "landscape" - Bluetooth eingeschaltet - Script: bluetooth_state = "off" - Script: screen_state = "off" - Script: screen_state = "on" - Display eingeschaltet - Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" - Initialisiere Variable Nächster Alarm: next_alarm - Script: next_alarmday = "{next_alarm,dateformat,c}" - Initialisiere Variable Systemeinstellung: screenBrightness - Initialisiere Variable Systemeinstellung: volumeMusikSpeaker - Initialisiere Variable Systemeinstellung: volumeMusikBluetooth - Flow Aktiv: SetCommands - Script: setCommandFlow_state = "aktiv" - Setze Flow Status: Aktivieren SetCommands - Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; - Musik Aktiv - Pause: 2s (Gerät wach halten) - Expression: trigger == "com.android.music.metachanged" - Expression: trigger == "Globale Variable: global_own_reading" - WLAN Verbunden: Alle SSIDs - WLAN Verbunden: Alle SSIDs - Script: bluetooth_state = "on" - Bluetooth Gerät verbunden: Beliebiges Geräte - Akku Ladestand: grösser als 0% - Script: setCommandFlow_state = "inaktiv" - Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} - App Task läuft: {header_activetask} (neuster) - Script: runTask = "0" - Script: runTask = "1" - Reading Music Metachanged - Own Reading - HTTP Response Information - Benachrichtigung in Statusbar angezeigt: Automagic - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + Meldung Display An From 9dd938d84f4ccc90dca1b59793b7c12f1bcb9e39 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 16 Oct 2015 12:51:11 +0200 Subject: [PATCH 21/25] Dokumentation angepasst --- 74_AMAD.pm | 42 ++++++++++++++++++++++++++++++++++++++---- README.md | 42 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 76 insertions(+), 8 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index 5e1532b..2894497 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -1205,7 +1205,7 @@ sub AMAD_CommBridge_Read($) { Readings
            -
          • automagicState - Statusmeldungen von der AutomagicApp
          • +
          • automagicState - Statusmeldungen von der AutomagicApp (Voraussetzung Android >4.3). Wer ein Android >4.3 hat und im Reading steht "wird nicht unterstützt", muß in den Androideinstellungen unter Ton und Benachrichtigungen -> Benachrichtigungszugriff ein Haken setzen für Automagic
          • bluetooth on/off - ist auf dem Gerät Bluetooth an oder aus
          • checkActiveTask - Zustand einer zuvor definierten APP. 0=nicht aktiv oder nicht aktiv im Vordergrund, 1=aktiv im Vordergrund, siehe Hinweis unten
          • connectedBTdevices - eine Liste der verbundenen Gerät
          • @@ -1232,18 +1232,51 @@ sub AMAD_CommBridge_Read($) {
          • volume - Lautstärkewert welcher über "set volume" gesetzt wurde.
          • volumeMusikBluetooth - Media Lautstärke von angeschlossenden Bluetooth Lautsprechern
          • volumeMusikSpeaker - Media Lautstärke der internen Lautsprecher
          • -

            +
            Die Readings volumeMusikBluetooth und volumeMusikSpeaker spiegeln die jeweilige Medialautstärke der angeschlossenden Bluetoothlautsprecher oder der internen Lautsprecher wieder. Sofern man die jeweiligen Lautstärken ausschließlich über den Set Befehl setzt, wird eine der beiden immer mit dem "volume" Reading über ein stimmen.

            Beim Reading checkActivTask muß zuvor der Packagename der zu prüfenden App als Attribut checkActiveTask angegeben werden. Beispiel: attr Nexus10Wohnzimmer checkActiveTask com.android.chrome für den Chrome Browser.

          + Eigene Readings im AMAD-Device erstellen +
            + Es ist möglich, aus beliebigen eigenen Automagic-Flows eigene Readings im AMAD-Device zu erstellen und zu füllen. Die Übertragung zum FHEM AMAD-Device erfolgt umgehend über die AMADCommBridge - daher sollte auf eine zu häufige Aktualisierung verzichtet werden. Die Vorgehensweise in Automagic hierfür ist folgende: +
              +
              +
            • zunächst erstellt man sich, soweit nicht bereits geschehen, einen Automagic-Flow der die Information, die in ein Reading übernommen werden soll zur Verfügung stellt
            • +
            • diese Information speichert man nun mittels Automagic Action Script in eine globale Variable namens global_reading_ (beim auf Groß- und Kleinschreibung achten):
            • +
              + + Beispiel: Das Reading Touch soll den Wert "ja" erhalten + Action Script: global_reading_Touch="ja" + +

              +
            • abschließend muss noch die Übertragung des Wertes initiiert werden. Dies erfolgt, indem der Wert der Variable global_own_reading auf den Wert _ gesetzt wird (auch hier auf Groß- und Kleinschreibung achten):
            • +
              + + Beispiel: Das Reading Touch soll übertragen werden
              + Action Script: global_own_reading="{getDate()}_Touch"
              + Hinweis: man kann auch beide Aktionen in ein Script packen: +
                + global_reading_Touch="ja";global_own_reading="{getDate()}_Touch" +
              +
              +
              +
            • Möchte man nun als nächstes z.B. eine sofortige Benachrichtigung, wenn das Display des Tablets an- oder ausgeschaltet wird, könnte man sich Flows bauen, welche beim De-/Aktivieren des Display ausgeführt werden:
            • +
              + + Action Script beim Aktivieren des Displays: global_reading_Display="an";global_own_reading="{getDate()}_Display" + Action Script beim Deaktivieren des Displays: global_reading_Display="aus";global_own_reading="{getDate()}_Display" + +
            +


          Set
          • bluetooth - Schaltet Bluetooth on/off
          • +
          • clearNotificationBar - (All,Automagic) löscht alle Meldungen oder nur die Automagic Meldungen in der Statusleiste
          • deviceState - setzt den Device Status Online/Offline. Siehe Readings
          • mediaPlayer - steuert den Standard Mediaplayer. play, stop, Titel zürück, Titel vor.
          • nextAlarmTime - setzt die Alarmzeit. Geht aber nur innerhalb der nächsten 24Std.
          • @@ -1258,7 +1291,6 @@ sub AMAD_CommBridge_Read($) {
            Set abhängig von gesetzten Attributen
              -
            • changetoBtDevice - wechselt zu einem anderen Bluetooth Gerät. Attribut setBluetoothDevice muß gesetzt sein. Siehe Hinweis unten!
            • mediaPlayer - steuert den Standard Mediaplayer. play, stop, Titel zürück, Titel vor. Attribut fhemServerIP
            • openApp - öffnet eine ausgewählte App. Attribut setOpenApp
            • @@ -1299,7 +1331,9 @@ sub AMAD_CommBridge_Read($) { Der größte Dank geht an meinen Mentor Andre (justme1968), er hat mir mit hilfreichen Tips geholfen Perlcode zu verstehen und Spaß am programmieren zu haben.
              Auch möchte ich mich bei Jens bedanken (jensb) welcher mir ebenfalls mit hilfreichen Tips bei meinen aller ersten Gehversuchen beim Perlcode schreiben unterstützt hat.
              So und nun noch ein besonderer Dank an pah (Prof. Dr. Peter Henning ), ohne seine Aussage "Keine Ahnung hatten wir alle mal, das ist keine Ausrede" hätte ich bestimmt nicht angefangen Interesse an - Modulentwicklung zu zeigen :-) + Modulentwicklung zu zeigen :-)
              + Danke an Jürgen(ujaudio) der sich um die Übersetzung der Commandref ins Englische gekümmert hat und hoffentlich weiter kümmern wird :-)
              + Danke auch an Ronny(RoBra81) für seine tollte Idee und Umsetzung von eigenen AMAD Readings aus externen Flows.
            =end html_DE diff --git a/README.md b/README.md index 361c974..fc99d51 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Readings
              -
            • automagicState - Statusmeldungen von der AutomagicApp
            • +
            • automagicState - Statusmeldungen von der AutomagicApp (Voraussetzung Android >4.3). Wer ein Android >4.3 hat und im Reading steht "wird nicht unterstützt", muß in den Androideinstellungen unter Ton und Benachrichtigungen -> Benachrichtigungszugriff ein Haken setzen für Automagic
            • bluetooth on/off - ist auf dem Gerät Bluetooth an oder aus
            • checkActiveTask - Zustand einer zuvor definierten APP. 0=nicht aktiv oder nicht aktiv im Vordergrund, 1=aktiv im Vordergrund, siehe Hinweis unten
            • connectedBTdevices - eine Liste der verbundenen Gerät
            • @@ -122,18 +122,51 @@
            • volume - Lautstärkewert welcher über "set volume" gesetzt wurde.
            • volumeMusikBluetooth - Media Lautstärke von angeschlossenden Bluetooth Lautsprechern
            • volumeMusikSpeaker - Media Lautstärke der internen Lautsprecher
            • -

              +
              Die Readings volumeMusikBluetooth und volumeMusikSpeaker spiegeln die jeweilige Medialautstärke der angeschlossenden Bluetoothlautsprecher oder der internen Lautsprecher wieder. Sofern man die jeweiligen Lautstärken ausschließlich über den Set Befehl setzt, wird eine der beiden immer mit dem "volume" Reading über ein stimmen.

              Beim Reading checkActivTask muß zuvor der Packagename der zu prüfenden App als Attribut checkActiveTask angegeben werden. Beispiel: attr Nexus10Wohnzimmer checkActiveTask com.android.chrome für den Chrome Browser.

            + Eigene Readings im AMAD-Device erstellen +
              + Es ist möglich, aus beliebigen eigenen Automagic-Flows eigene Readings im AMAD-Device zu erstellen und zu füllen. Die Übertragung zum FHEM AMAD-Device erfolgt umgehend über die AMADCommBridge - daher sollte auf eine zu häufige Aktualisierung verzichtet werden. Die Vorgehensweise in Automagic hierfür ist folgende: +
                +
                +
              • zunächst erstellt man sich, soweit nicht bereits geschehen, einen Automagic-Flow der die Information, die in ein Reading übernommen werden soll zur Verfügung stellt
              • +
              • diese Information speichert man nun mittels Automagic Action Script in eine globale Variable namens global_reading_ (beim auf Groß- und Kleinschreibung achten):
              • +
                + + Beispiel: Das Reading Touch soll den Wert "ja" erhalten + Action Script: global_reading_Touch="ja" + +

                +
              • abschließend muss noch die Übertragung des Wertes initiiert werden. Dies erfolgt, indem der Wert der Variable global_own_reading auf den Wert _ gesetzt wird (auch hier auf Groß- und Kleinschreibung achten):
              • +
                + + Beispiel: Das Reading Touch soll übertragen werden
                + Action Script: global_own_reading="{getDate()}_Touch"
                + Hinweis: man kann auch beide Aktionen in ein Script packen: +
                  + global_reading_Touch="ja";global_own_reading="{getDate()}_Touch" +
                +
                +
                +
              • Möchte man nun als nächstes z.B. eine sofortige Benachrichtigung, wenn das Display des Tablets an- oder ausgeschaltet wird, könnte man sich Flows bauen, welche beim De-/Aktivieren des Display ausgeführt werden:
              • +
                + + Action Script beim Aktivieren des Displays: global_reading_Display="an";global_own_reading="{getDate()}_Display" + Action Script beim Deaktivieren des Displays: global_reading_Display="aus";global_own_reading="{getDate()}_Display" + +
              +


            Set
            • bluetooth - Schaltet Bluetooth on/off
            • +
            • clearNotificationBar - (All,Automagic) löscht alle Meldungen oder nur die Automagic Meldungen in der Statusleiste
            • deviceState - setzt den Device Status Online/Offline. Siehe Readings
            • mediaPlayer - steuert den Standard Mediaplayer. play, stop, Titel zürück, Titel vor.
            • nextAlarmTime - setzt die Alarmzeit. Geht aber nur innerhalb der nächsten 24Std.
            • @@ -148,7 +181,6 @@
              Set abhängig von gesetzten Attributen
                -
              • changetoBtDevice - wechselt zu einem anderen Bluetooth Gerät. Attribut setBluetoothDevice muß gesetzt sein. Siehe Hinweis unten!
              • mediaPlayer - steuert den Standard Mediaplayer. play, stop, Titel zürück, Titel vor. Attribut fhemServerIP
              • openApp - öffnet eine ausgewählte App. Attribut setOpenApp
              • @@ -189,5 +221,7 @@ Der größte Dank geht an meinen Mentor Andre (justme1968), er hat mir mit hilfreichen Tips geholfen Perlcode zu verstehen und Spaß am programmieren zu haben.
                Auch möchte ich mich bei Jens bedanken (jensb) welcher mir ebenfalls mit hilfreichen Tips bei meinen aller ersten Gehversuchen beim Perlcode schreiben unterstützt hat.
                So und nun noch ein besonderer Dank an pah (Prof. Dr. Peter Henning ), ohne seine Aussage "Keine Ahnung hatten wir alle mal, das ist keine Ausrede" hätte ich bestimmt nicht angefangen Interesse an - Modulentwicklung zu zeigen :-) + Modulentwicklung zu zeigen :-)
                + Danke an Jürgen(ujaudio) der sich um die Übersetzung der Commandref ins Englische gekümmert hat und hoffentlich weiter kümmern wird :-)
                + Danke auch an Ronny(RoBra81) für seine tollte Idee und Umsetzung von eigenen AMAD Readings aus externen Flows.
              \ No newline at end of file From 540d44fa668c40de2e096944f1432831fc343044 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Wed, 21 Oct 2015 15:49:57 +0200 Subject: [PATCH 22/25] =?UTF-8?q?Commandref=20im=20Modul=20angepasst.=20En?= =?UTF-8?q?glische=20=C3=9Cbersetzung=20eingepflegt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 68 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index 2894497..b89fcde 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.9"; +my $version = "0.7.10"; @@ -65,8 +65,6 @@ sub AMAD_Initialize($) { my $hash = $modules{AMAD}{defptr}{$d}; $hash->{VERSION} = $version; } - - } sub AMAD_Define($$) { @@ -979,9 +977,12 @@ sub AMAD_CommBridge_Read($) {

              With this module it is also possible to control an Android device as follows.
                -
              • State of the device (nnline, offline)
              • +
              • Switch Bluetooth on/off
              • +
              • Set or change the connection to a specific Bluetooth device
              • +
              • State of the device (online, offline)
              • Media Player control ( play / stop / next track / previous track)
              • Set next alarm time
              • +
              • Play a notification sound
              • Open an app on the device
              • Open a URL in the browser on the device
              • Set Screen on/off
              • @@ -1024,14 +1025,25 @@ sub AMAD_CommBridge_Read($) {


              Done! After connecting the device instance should already come in the first Readings within 3 minutes. +


              + + AMAD Communication Bridge +
                + When you define the first AMAD device instance another device named AMADCommBridge will also be defined. Its room attribute is AMAD.YOU SHOULD NEVER CHANGE THIS NAME. Feel free to change all other properties. You need this device for the communication fom the Andoid unit to FHEM without having received any query from FHEM. The Android unit must know the IP address of FHEM, so you must enter the set command for the corresponding reading immediately after the definition of the bridge. This is extremly important to get the functionality working properly! + The command is + set AMADCommBridge fhemServerIP . + There is another reading expertMode which allows a direct communication with FHEM without haviung to use a notify or being limited to set commands. +


              Readings
              • automagic state - status messages from the AutomagicApp
              • bluetooth on / off - is Bluetooth switched on or off on the device
              • +
              • checkActiveTask - state of an app being defined before, 1=activ in the foreground, see the hint further down
              • connectedBTdevices - a list of the connected devices
              • -
              • current Music Album - currently abgespieltes Music Album of the media player used
              • +
              • connectedBTdevicesMAC – list f the MAC addresses of all connected BT devices
              • +
              • current Music Album - currently played music album of the media player used
              • current music artist - currently played music artist of the media player used
              • current Music Track - currently played music title of the media player used
              • deviceState - State of the Android device, must itself be set with setreading e.g. about the attendance check. When offline is set, the interval is set off for information retrieval.
              • @@ -1054,7 +1066,43 @@ sub AMAD_CommBridge_Read($) {
              • volume music speaker - Media volume of the internal speakers

              • The Readings volume Music Bluetooth and music speaker volume reflect the respective media volume of the closed border is Bluetooth speakers or the internal speaker again. - Unless one the respective volumes relies exclusively on the Set command, one of the two will always agree with the "volume" Reading a. + Unless one the respective volumes relies exclusively on the Set command, one of the two will always agree with the "volume" Reading a.

                + Before using the Reading checkActivTask you must set the nme of the package name of te app to be checked innthe attribute checkActiveTask. Eample: + attr Nexus10Wohnzimmer checkActiveTask com.android.chrome for the Chrome browser. +


              + Define user specific Readings in the AMAD device +
                + You can specify your own reaqdings in the AMAD device and use them in combination with your Automagic flow. The transmission takes place immediately by means of the AMADCommBridge - so you should not update it too often. This is how you can do it: +
                  +
                  +
                • first you need to define an Automagic flow for the information for the reading
                • +
                • diese Information speichert man nun mittels Automagic Action Script in eine globale Variable namens global_reading_ (beim auf Groß- und Kleinschreibung achten):
                • +
                  + + this information needs to be stored with the help of an Automagic action in a global variable (case sensitiv!). Example: + The Reading Touch should get the value "yes" + Action Script: global_reading_Touch="yes" + +

                  +
                • abschließend muss noch die Übertragung des Wertes initiiert werden. Dies erfolgt, indem der Wert der Variable global_own_reading auf den Wert _ gesetzt wird (auch hier auf Groß- und Kleinschreibung achten):
                • +
                  + + Finally you need to trigger the transmission of the value. This is dne by setting the the value of the variable global_own_reading to _ gesetzt wird (again: case sensitiv!): + Example: The Reading Touch should be transfered
                  + Action Script: global_own_reading="{getDate()}_Touch"
                  + Hint: you can put both actions in one script: +
                    + global_reading_Touch="ja";global_own_reading="{getDate()}_Touch" +
                  +
                  +
                  +
                • Asume you want to get an immediate information when the display of your tablet has been switched on or off then you can define the following flows: +
                  + + Action Script when the display is activated: global_reading_Display="on";global_own_reading="{getDate()}_Display" + Action Script when the display is deactivated: global_reading_Display="off";global_own_reading="{getDate()}_Display"
                • + +


              @@ -1063,6 +1111,7 @@ sub AMAD_CommBridge_Read($) {
            • Device State - sets the Device Status Online / Offline. See Readings
            • Media Player - controls the default media player. Play, Stop, Back Route title, ahead of title.
            • NextAlarm time - sets the alarm time. only within the next 24hrs.
            • +
            • notifySndFile - plays the specified media file on the Android device. The file to be played must be in the folder /storage/emulated/0/Notifications/.
            • openURL - opens a URL in your default browser
            • screen - are sets the screen on / off with barrier in the car Magic settings must "Admin Function" set will not work "Screen off".
            • screenMsg - sends a message screen
            • @@ -1073,6 +1122,7 @@ sub AMAD_CommBridge_Read($) {
              Set depending on set attributes
                +
              • changetoBtDevice - changes to another Bluetooth device. The attribute setBluetoothDevice must be set. See hint below!
              • mediaPlayer - controls the default media player. Play, Stop, Back Route title, ahead of title. Attribute fhemServerIP
              • openapp - opens a selected app. Attribute setOpenApp
              • screen Brightness - sets the screen brightness, 0-255 Attribute setScreenBrightness
              • @@ -1080,7 +1130,11 @@ sub AMAD_CommBridge_Read($) {
              • screen fullscreen - Switches to full screen mode on / off. Attribute SetFullscreen
              • screenOrientation - Switches the screen orientation Auto / Landscape / Portrait. Attribute setScreenOrientation
              • system - set system commands from (only rooted devices). Reboot Attribut root, in the Auto Magic Settings "root function" must be set
              • - In order to use openApp you need an attribute where separated by a comma, several app names are set in order to use openapp. The app name is arbitrary and only required for recognition. The same app name must be used in the flow in SetCommands on the left below the hash expression: "openapp" be in one of the 5 paths (one app per path) entered in both diamonds. Thereafter, in the quadrangle selected the app which app through the attribute names should be started. + In order to use openApp you need an attribute where separated by a comma, several app names are set in order to use openapp. The app name is arbitrary and only required for recognition. The same app name must be used in the flow in SetCommands on the left below the hash expression: "openapp" be in one of the 5 paths (one app per path) entered in both diamonds. Thereafter, in the quadrangle selected the app which app through the attribute names should be started.

                + To switch between different Bluetooth devices, you need set the attribute setBluetoothDevice accordingly. + attr BTdeviceName1|MAC,BTDeviceName2|MAC + There may never be a sapce in BTdeviceName. There must also be the colon(:) in the MAC address after every second sign! + Example: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76


              From 9ebae0828a10f3f458f3b0eb4334e784ce373ae9 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Wed, 28 Oct 2015 06:33:33 +0100 Subject: [PATCH 23/25] =?UTF-8?q?Verbesserung=20des=20BT=20wechsels,=20erh?= =?UTF-8?q?=C3=B6hung=20des=20httprequest=20timeouts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index b89fcde..29e9cf0 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.10"; +my $version = "0.7.11"; @@ -256,7 +256,7 @@ sub AMAD_RetrieveAutomagicInfo($) { HttpUtils_NonblockingGet( { url => $url, - timeout => 10, + timeout => 60, hash => $hash, method => "GET", header => "fhemIP: $fhemip\r\nfhemDevice: $name\r\nactiveTask: $activetask", From e5d334af1d784b8b37ff49f792956c2676010085 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 29 Oct 2015 09:04:32 +0100 Subject: [PATCH 24/25] =?UTF-8?q?fertige=20Flows=20und=20Update=20des=20Mo?= =?UTF-8?q?dules=20f=C3=BCr=20Version=200.8.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 2 +- 74_AMADautomagicFlows0.7.9.xml | 1374 -------------------------------- 2 files changed, 1 insertion(+), 1375 deletions(-) delete mode 100644 74_AMADautomagicFlows0.7.9.xml diff --git a/74_AMAD.pm b/74_AMAD.pm index 29e9cf0..73041d2 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.7.11"; +my $version = "0.8.0"; diff --git a/74_AMADautomagicFlows0.7.9.xml b/74_AMADautomagicFlows0.7.9.xml deleted file mode 100644 index 7e5566d..0000000 --- a/74_AMADautomagicFlows0.7.9.xml +++ /dev/null @@ -1,1374 +0,0 @@ - - - - false - com.android.music.metachanged - true - com.android.music.metachanged - - - - - - - - global_artist = getString("artist"); -global_track = getString("track"); -global_album = getString("album"); - false - - - true - Display Status: Aus - false - false - - - true - Display Status: Ein - false - true - - - true - Globale Variable: global_own_reading - true - global_own_reading - - - true - Globale Variable: global_touched - false - global_touched - - - false - HTTP Request: /fhem-amad/deviceInfo/ - true - /fhem-amad/deviceInfo/ - 8090 - true - - - false - HTTP Request: /fhem-amad/setCommands/* - true - /fhem-amad/setCommands/* - 8090 - true - - - true - Periodischer Timer: alle 4m - false - 240000 - true - false - false - Mon - Tue - Wed - Thu - Fri - Sat - Sun - 8 - 0 - 17 - 0 - - - true - Akku Ladestand: grösser als 0% - 0 - HIGHER_THAN - - - false - App Task läuft: App3 (neuster) - - true - - - false - App Task läuft: App4 (neuster) - - true - - - false - App Task läuft: App5 (neuster) - - true - - - false - App Task läuft: gplay (neuster) - com.google.android.music - true - - - false - App Task läuft: tuneinradio (neuster) - tunein.player - true - - - true - App Task läuft: {header_activetask} (neuster) - {header_activetask} - true - - - false - Benachrichtigung in Statusbar angezeigt: Automagic - ch.gridvision.ppam.androidautomagic - TEXT - CONTAINS_TEXT - - false - false - - - true - Bluetooth eingeschaltet - - - true - Bluetooth Gerät verbunden: Beliebiges Geräte - true - - - - - true - Bluetooth Gerät verbunden: {param_btdeviceone} - false - {param_btdeviceone} - - - - true - Bluetooth Gerät verbunden: {param_btdevicetwo} - false - {param_btdevicetwo} - - - - true - Display automatisch drehen eingeschaltet - - - true - Display eingeschaltet - - - true - Display Orientierung: Portrait - true - - - false - Expression: All - param_app == "All" - - - false - Expression: App3 - param_app == "" - - - false - Expression: App4 - param_app == "" - - - false - Expression: App5 - param_app == "" - - - false - Expression: Automagic - param_app == "Automagic" - - - false - Expression: Clear Automagic Meldungen" - request_path == "/fhem-amad/setCommands/clearnotificationbar" - - - true - Expression: global_touched=="ja" - global_touched=="ja" - - - true - Expression: global_touched=="wait" - global_touched=="wait" - - - false - Expression: gplay - param_app == "gplay" - - - false - Expression: mediaPlayer" - request_path == "/fhem-amad/setCommands/mediaPlayer" - - - false - Expression: notifysnd" - request_path == "/fhem-amad/setCommands/playnotifysnd" - - - false - Expression: openApp" - request_path == "/fhem-amad/setCommands/openApp" - - - false - Expression: openURL" - request_path == "/fhem-amad/setCommands/openURL" - - - true - Expression: param_bluetooth == "off" - param_bluetooth == "off" - - - true - Expression: param_bluetooth == "on" - param_bluetooth == "on" - - - true - Expression: param_button == "back" - param_button == "back" - - - true - Expression: param_button == "next" - param_button == "next" - - - true - Expression: param_button == "play" - param_button == "play" - - - true - Expression: param_button == "stop" - param_button == "stop" - - - true - Expression: param_fullscreen == "off" - param_fullscreen == "off" - - - true - Expression: param_fullscreen == "on" - param_fullscreen == "on" - - - true - Expression: param_orientation == "auto" - param_orientation == "auto" - - - true - Expression: param_orientation == "landscape" - param_orientation == "landscape" - - - true - Expression: param_orientation == "portrait" - param_orientation == "portrait" - - - true - Expression: param_screen=="off" - param_screen=="off" - - - true - Expression: param_screen=="on" - param_screen=="on" - - - false - Expression: Reboot - param_syscmd == "reboot" - - - false - Expression: screenMsg" - request_path == "/fhem-amad/setCommands/screenMsg" - - - false - Expression: setAlarm" - request_path == "/fhem-amad/setCommands/setAlarm" - - - false - Expression: setBluetooth" - request_path == "/fhem-amad/setCommands/setbluetooth" - - - false - Expression: setBrightness" - request_path == "/fhem-amad/setCommands/setBrightness" - - - false - Expression: setBTDevice" - request_path == "/fhem-amad/setCommands/setbtdevice" - - - false - Expression: setScreenFullscreen" - request_path == "/fhem-amad/setCommands/setScreenFullscreen" - - - false - Expression: setScreenOnOff" - request_path == "/fhem-amad/setCommands/setScreenOnOff" - - - false - Expression: setScreenOrientation" - request_path == "/fhem-amad/setCommands/setScreenOrientation" - - - false - Expression: setVolume" - request_path == "/fhem-amad/setCommands/setVolume" - - - false - Expression: System Command" - request_path == "/fhem-amad/setCommands/systemcommand" - - - true - Expression: trigger == "com.android.music.metachanged" - trigger == "com.android.music.metachanged" - - - true - Expression: trigger == "Globale Variable: global_own_reading" - trigger == "Globale Variable: global_own_reading" - - - true - Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" - trigger == "HTTP Request: /fhem-amad/setCommands/*" - - - false - Expression: ttsMsg" - request_path == "/fhem-amad/setCommands/ttsMsg" - - - false - Expression: tuneinradio - param_app == "tuneinradio" - - - true - Flow Aktiv: Informations - Informations - - - true - Flow Aktiv: SetCommands - SetCommands - - - true - Musik Aktiv - - - true - WLAN Verbunden: Alle SSIDs - true - - - - false - App Starten: App3 - - - - - false - App Starten: App4 - - - - - false - App Starten: App5 - - - - - false - App Starten: PlayMusic - com.google.android.music - - - - false - App Starten: tuneinradio - tunein.player - - - - true - Audio Player steuern: Medienknopf Play (Google Play Musik) - true - LAUNCH - KEYCODE_MEDIA_PLAY - true - com.google.android.music - com.google.android.music.playback.MediaButtonIntentReceiver - Google Play Musik - - - true - Audio Player steuern: Medienknopf Stopp (Google Play Musik) - true - LAUNCH - KEYCODE_MEDIA_STOP - true - com.google.android.music - com.google.android.music.playback.MediaButtonIntentReceiver - Google Play Musik - - - true - Audio Player steuern: Medienknopf Weiter (Google Play Musik) - true - LAUNCH - KEYCODE_MEDIA_NEXT - true - com.google.android.music - com.google.android.music.playback.MediaButtonIntentReceiver - Google Play Musik - - - true - Audio Player steuern: Medienknopf Zurück (Google Play Musik) - true - LAUNCH - KEYCODE_MEDIA_PREVIOUS - true - com.google.android.music - com.google.android.music.playback.MediaButtonIntentReceiver - Google Play Musik - - - true - Benachrichtigung auf Bildschirm: {param_message} (lange) - true - {param_message} - - 200 - 250 - false - 1.0 - true - false - TOP_LEFT - 0 - 0 - - - true - Benachrichtigung aus Statusbar entfernen: Alle - false - true - 1 - true - - true - - - - true - Benachrichtigung aus Statusbar entfernen: Alle (Automagic) - true - true - 1 - false - - true - - - - true - Bluetooth ein-/ausschalten: Aus - false - - - true - Bluetooth ein-/ausschalten: Ein - true - - - true - Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} - A2DP - {param_btdeviceone} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} - A2DP - {param_btdevicetwo} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} - INPUT_DEVICE - {param_btdeviceone} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} - INPUT_DEVICE - {param_btdevicetwo} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} - HEADSET - {param_btdeviceone} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} - HEADSET - {param_btdevicetwo} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} - PAN - {param_btdeviceone} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} - PAN - {param_btdevicetwo} - - false - - - true - Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} - A2DP - {param_swtobtdevicemac} - - true - - - true - Display automatisch drehen ein-/ausschalten: Aus - false - - - true - Display automatisch drehen ein-/ausschalten: Ein - true - - - true - Gerät sperren - - - false - HTTP Response Information - powerLevel@@{battery_percentage}@@@@powerPlugged@@{battery_plugged}@@@@volumeMusikBluetooth@@{volumeMusikBluetooth}@@@@volumeMusikSpeaker@@{volumeMusikSpeaker}@@@@screenBrightness@@{screenBrightness}@@@@nextAlarmTime@@{next_alarmtime}@@@@nextAlarmDay@@{next_alarmday}@@@@screen@@{screen_state}@@@@automagicState@@{notification_text}@@@@screenOrientation@@{screen_orientation}@@@@currentMusicTrack@@{global_track}@@@@currentMusicAlbum@@{global_album}@@@@currentMusicArtist@@{global_artist}@@@@bluetooth@@{bluetooth_state}@@@@connectedBTdevices@@{connected_devices_names}@@@@connectedBTdevicesMAC@@{connected_devices_addresses}@@@@flow_SetCommands@@{setCommandFlow_state}@@@@checkActiveTask@@{runTask} - true - text/plain - - - false - HTTP Response SetCommand - flow_informations@@{informationFlow_state}@@@@ - true - text/plain - - - false - Initialisiere Variable Nächster Alarm: next_alarm - next_alarm - - - false - Initialisiere Variable Systemeinstellung: screenBrightness - SYSTEM - screen_brightness - screenBrightness - - - false - Initialisiere Variable Systemeinstellung: volumeMusikBluetooth - SYSTEM - volume_music_bt_a2dp - volumeMusikBluetooth - - - false - Initialisiere Variable Systemeinstellung: volumeMusikSpeaker - SYSTEM - volume_music_speaker - volumeMusikSpeaker - - - true - Kommandozeilenbefehl als Root ausführen: getevent -c 1 in - getevent -c 1 - - - stdout - stderr - exit_code - - - false - Lautstärken setzen - false - global_volume_alarm - false - global_volume_dtmf - true - param_volume - false - global_volume_notification - false - global_volume_ring - false - global_volume_system - false - global_volume_voice_call - false - global_ringer_mode - false - global_interruptions_mode - - - true - Neustart - - - - false - Own Reading - http://{global_fhemip}:8090 - false - false - - POST - GENERAL_TEXT - text/plain - {substring(getValue("global_own_reading",""),14)}@@{replaceAll(getValue("global_{substring(getValue('global_own_reading',''),14)}","nicht gefunden"),"\\s","%20")}@@@@ - @@@@readingsNameXYZ@@readingsValueABC - 5000 - true - FHEMDEVICE: {global_fhemdevice} -FHEMCMD: setreading - true - response - /storage/emulated/0/Download/file.bin - - - true - Pause: 10s (Schlafmodus zulassen) - 10s - false - - - true - Pause: 15s (Gerät wach halten) - 15s - true - - - true - Pause: 2s (Gerät wach halten) - 2s - true - - - true - Pause: 3s (Gerät wach halten) - 3s - true - - - false - Reading Music Metachanged - http://{global_fhemip}:8090 - false - false - - POST - GENERAL_TEXT - text/plain - currentMusicTrack@@{global_track}@@@@currentMusicAlbum@@{global_album}@@@@currentMusicArtist@@{global_artist}@@@@ - @@@@readingsNameXYZ@@readingsValueABC - 5000 - true - FHEMDEVICE: {global_fhemdevice} -FHEMCMD: setreading - true - response - /storage/emulated/0/Download/file.bin - - - true - Schalte Display ein: Hell für 120s - true - 120s - true - - - true - Script: bluetooth_state = "off" - - - - true - Script: bluetooth_state = "on" - - - - true - Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; - - - - true - Script: global_display="an";global_own_reading="{getDate()}_display" - - - - true - Script: global_display="aus";global_own_reading="{getDate()}_display" - - - - true - Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} - - - - true - Script: global_touch="ja";global_own_reading="{getDate()}_touch";global_touched="ja" - - - - true - Script: global_touch="nein";global_own_reading="{getDate()}_touch" - - - - true - Script: global_touched="ja" - - - - true - Script: global_touched="wait" - - - - true - Script: informationFlow_state = "aktiv" - - - - true - Script: informationFlow_state = "inaktiv" - - - - true - Script: next_alarmday = "{next_alarm,dateformat,c}" - - - - true - Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" - - - - true - Script: notification_text = "no supported from your device" - - - - true - Script: runTask = "0" - - - - true - Script: runTask = "1" - - - - true - Script: screen_orientation = "auto" - - - - true - Script: screen_orientation = "landscape" - - - - true - Script: screen_orientation = "portrait" - - - - true - Script: screen_state = "off" - - - - true - Script: screen_state = "on" - - - - true - Script: setCommandFlow_state = "aktiv" - - - - true - Script: setCommandFlow_state = "inaktiv" - - - - true - Setze Alarm: um {param_hour}:{param_minute} - - {param_hour} - {param_minute} - - - true - Setze Display Orientierung: Auf Default zurücksetzen - UNSPECIFIED - false - - - true - Setze Display Orientierung: Landscape - LANDSCAPE - false - - - true - Setze Display Orientierung: Portrait - PORTRAIT - false - - - true - Setze Flow Status: Aktivieren Informations - true - Informations - - - - true - Setze Flow Status: Aktivieren SetCommands - true - SetCommands - - - - true - Setze Systemeinstellung: System screen_brightness auf {param_brightness} - SYSTEM - screen_brightness - {param_brightness} - true - - - true - Setze Vollbild Modus: Auf Default zurücksetzen - UNSPECIFIED - false - - - true - Setze Vollbild Modus: Navigation nicht anzeigen - HIDE_NAVIGATION - false - - - true - Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung - FILE - Lautlos - /storage/emulated/0/Notifications/{param_notifyfile} - NOTIFICATION - false - true - true - TRANSIENT - - - true - Sprachausgabe: {param_message} - MUSIC - {param_message} - de_DE - true - 1.0 - true - 1.0 - true - false - false - true - TRANSIENT - - - false - StatusRequest - http://{global_fhemip}:8090 - false - false - - POST - GENERAL_TEXT - text/plain - - @@@@readingsNameXYZ@@readingsValueABC - 5000 - true - FHEMDEVICE: {global_fhemdevice} -FHEMCMD: statusrequest - true - response - /storage/emulated/0/Download/file.bin - - - true - URL in Browser öffnen: {param_url} (mit Chrome) - {param_url} - true - com.android.chrome - com.google.android.apps.chrome.Main - Chrome - - - Informations - FHEM Info / Steuerung über AMAD Modul v0.7.9 - true - QUEUE - 120 - Script: notification_text = "no supported from your device" - Script: screen_orientation = "auto" - Display automatisch drehen eingeschaltet - Script: screen_orientation = "portrait" - Display Orientierung: Portrait - Script: screen_orientation = "landscape" - Bluetooth eingeschaltet - Script: bluetooth_state = "off" - Script: screen_state = "off" - Script: screen_state = "on" - Display eingeschaltet - Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" - Initialisiere Variable Nächster Alarm: next_alarm - Script: next_alarmday = "{next_alarm,dateformat,c}" - Initialisiere Variable Systemeinstellung: screenBrightness - Initialisiere Variable Systemeinstellung: volumeMusikSpeaker - Initialisiere Variable Systemeinstellung: volumeMusikBluetooth - Flow Aktiv: SetCommands - Script: setCommandFlow_state = "aktiv" - Setze Flow Status: Aktivieren SetCommands - Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; - Musik Aktiv - Pause: 2s (Gerät wach halten) - Expression: trigger == "com.android.music.metachanged" - Expression: trigger == "Globale Variable: global_own_reading" - WLAN Verbunden: Alle SSIDs - WLAN Verbunden: Alle SSIDs - Script: bluetooth_state = "on" - Bluetooth Gerät verbunden: Beliebiges Geräte - Akku Ladestand: grösser als 0% - Script: setCommandFlow_state = "inaktiv" - Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} - App Task läuft: {header_activetask} (neuster) - Script: runTask = "0" - Script: runTask = "1" - Reading Music Metachanged - Own Reading - HTTP Response Information - Benachrichtigung in Statusbar angezeigt: Automagic - - HTTP Request: /fhem-amad/deviceInfo/ - com.android.music.metachanged - Globale Variable: global_own_reading - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Meldung Display An - AMAD FHEM / OwnReadings Examples - false - PARALLEL - - Display Status: Ein - - Script: global_display="an";global_own_reading="{getDate()}_display" - - - - Meldung Display Aus - AMAD FHEM / OwnReadings Examples - false - PARALLEL - - Display Status: Aus - - Script: global_display="aus";global_own_reading="{getDate()}_display" - - - - Meldung kein Touch - AMAD FHEM / OwnReadings Examples - false - STOP - - Globale Variable: global_touched - - Pause: 15s (Gerät wach halten) - Script: global_touched="wait" - Expression: global_touched=="ja" - Expression: global_touched=="wait" - Script: global_touch="nein";global_own_reading="{getDate()}_touch" - - - - - - - - Meldung Touch - AMAD FHEM / OwnReadings Examples - false - STOP - - Periodischer Timer: alle 4m - - Kommandozeilenbefehl als Root ausführen: getevent -c 1 in - Script: global_touched="ja" - Script: global_touch="ja";global_own_reading="{getDate()}_touch";global_touched="ja" - Pause: 10s (Schlafmodus zulassen) - - - - - - - - SetCommands - FHEM Info / Steuerung über AMAD Modul v0.7.9 - true - QUEUE - 120 - - HTTP Request: /fhem-amad/deviceInfo/ - HTTP Request: /fhem-amad/setCommands/* - - Expression: param_screen=="on" - Expression: setBrightness" - Expression: setAlarm" - Expression: screenMsg" - URL in Browser öffnen: {param_url} (mit Chrome) - Benachrichtigung auf Bildschirm: {param_message} (lange) - Expression: setScreenFullscreen" - Expression: param_orientation == "auto" - Setze Display Orientierung: Portrait - Setze Display Orientierung: Landscape - Expression: param_orientation == "landscape" - Expression: param_orientation == "portrait" - Setze Vollbild Modus: Navigation nicht anzeigen - Setze Vollbild Modus: Auf Default zurücksetzen - Audio Player steuern: Medienknopf Zurück (Google Play Musik) - Expression: param_button == "back" - Expression: param_button == "next" - Setze Display Orientierung: Auf Default zurücksetzen - Expression: param_button == "play" - Expression: mediaPlayer" - Audio Player steuern: Medienknopf Weiter (Google Play Musik) - Expression: param_button == "stop" - Expression: param_screen=="off" - Gerät sperren - Expression: setScreenOnOff" - App Task läuft: App5 (neuster) - Expression: App5 - Expression: App4 - App Task läuft: App3 (neuster) - Expression: App3 - App Starten: App3 - App Starten: App4 - App Task läuft: App4 (neuster) - Expression: tuneinradio - App Task läuft: tuneinradio (neuster) - App Starten: tuneinradio - App Starten: App5 - App Task läuft: gplay (neuster) - Expression: gplay - App Starten: PlayMusic - Expression: System Command" - Neustart - Setze Flow Status: Aktivieren Informations - Script: informationFlow_state = "inaktiv" - Script: informationFlow_state = "aktiv" - Flow Aktiv: Informations - Expression: ttsMsg" - Lautstärken setzen - Setze Systemeinstellung: System screen_brightness auf {param_brightness} - Schalte Display ein: Hell für 120s - Display automatisch drehen ein-/ausschalten: Aus - Display automatisch drehen ein-/ausschalten: Ein - Setze Alarm: um {param_hour}:{param_minute} - Audio Player steuern: Medienknopf Stopp (Google Play Musik) - Expression: setScreenOrientation" - Expression: param_fullscreen == "off" - Expression: param_fullscreen == "on" - Expression: setBluetooth" - Expression: openURL" - Expression: setVolume" - Sprachausgabe: {param_message} - Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung - StatusRequest - Expression: param_bluetooth == "off" - Bluetooth ein-/ausschalten: Aus - Expression: param_bluetooth == "on" - Bluetooth ein-/ausschalten: Ein - Expression: setBTDevice" - Bluetooth eingeschaltet - Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} - Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} - Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} - Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} - HTTP Response SetCommand - Bluetooth Gerät verbunden: {param_btdeviceone} - Bluetooth Gerät verbunden: {param_btdevicetwo} - Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} - Pause: 3s (Gerät wach halten) - Expression: notifysnd" - Audio Player steuern: Medienknopf Play (Google Play Musik) - Expression: openApp" - Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" - Expression: Reboot - Benachrichtigung aus Statusbar entfernen: Alle - Expression: All - Benachrichtigung aus Statusbar entfernen: Alle (Automagic) - Expression: Automagic - Expression: Clear Automagic Meldungen" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 800cfb642730633bea717dc921c1c62592a4c797 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 29 Oct 2015 09:05:08 +0100 Subject: [PATCH 25/25] neues Flowset XML --- 74_AMADautomagicFlows0.8.0.xml | 1356 ++++++++++++++++++++++++++++++++ 1 file changed, 1356 insertions(+) create mode 100644 74_AMADautomagicFlows0.8.0.xml diff --git a/74_AMADautomagicFlows0.8.0.xml b/74_AMADautomagicFlows0.8.0.xml new file mode 100644 index 0000000..4ef4778 --- /dev/null +++ b/74_AMADautomagicFlows0.8.0.xml @@ -0,0 +1,1356 @@ + + + + false + com.android.music.metachanged + true + com.android.music.metachanged + + + + + + + + global_artist = getString("artist"); +global_track = getString("track"); +global_album = getString("album"); + false + + + true + Display Status: Aus + false + false + + + true + Display Status: Ein + false + true + + + true + Globale Variable: global_own_reading + true + global_own_reading + + + true + Globale Variable: global_touched + false + global_touched + + + false + HTTP Request: /fhem-amad/deviceInfo/ + true + /fhem-amad/deviceInfo/ + 8090 + true + + + false + HTTP Request: /fhem-amad/setCommands/* + true + /fhem-amad/setCommands/* + 8090 + true + + + true + Periodischer Timer: alle 4m + false + 240000 + true + false + false + Mon + Tue + Wed + Thu + Fri + Sat + Sun + 8 + 0 + 17 + 0 + + + true + Akku Ladestand: grösser als 0% + 0 + HIGHER_THAN + + + false + App Task läuft: App3 (neuster) + + true + + + false + App Task läuft: App4 (neuster) + + true + + + false + App Task läuft: App5 (neuster) + + true + + + false + App Task läuft: gplay (neuster) + com.google.android.music + true + + + false + App Task läuft: tuneinradio (neuster) + tunein.player + true + + + true + App Task läuft: {header_activetask} (neuster) + {header_activetask} + true + + + false + Benachrichtigung in Statusbar angezeigt: Automagic + ch.gridvision.ppam.androidautomagic + TEXT + CONTAINS_TEXT + + false + false + + + true + Bluetooth eingeschaltet + + + true + Bluetooth Gerät verbunden: Beliebiges Geräte + true + + + + + true + Display automatisch drehen eingeschaltet + + + true + Display eingeschaltet + + + true + Display Orientierung: Portrait + true + + + false + Expression: All + param_app == "All" + + + false + Expression: App3 + param_app == "" + + + false + Expression: App4 + param_app == "" + + + false + Expression: App5 + param_app == "" + + + false + Expression: Automagic + param_app == "Automagic" + + + false + Expression: Clear Automagic Meldungen" + request_path == "/fhem-amad/setCommands/clearnotificationbar" + + + true + Expression: global_touched=="ja" + global_touched=="ja" + + + true + Expression: global_touched=="wait" + global_touched=="wait" + + + false + Expression: gplay + param_app == "gplay" + + + false + Expression: mediaPlayer" + request_path == "/fhem-amad/setCommands/mediaPlayer" + + + false + Expression: notifysnd" + request_path == "/fhem-amad/setCommands/playnotifysnd" + + + false + Expression: openApp" + request_path == "/fhem-amad/setCommands/openApp" + + + false + Expression: openURL" + request_path == "/fhem-amad/setCommands/openURL" + + + true + Expression: param_bluetooth == "off" + param_bluetooth == "off" + + + true + Expression: param_bluetooth == "on" + param_bluetooth == "on" + + + true + Expression: param_button == "back" + param_button == "back" + + + true + Expression: param_button == "next" + param_button == "next" + + + true + Expression: param_button == "play" + param_button == "play" + + + true + Expression: param_button == "stop" + param_button == "stop" + + + true + Expression: param_fullscreen == "off" + param_fullscreen == "off" + + + true + Expression: param_fullscreen == "on" + param_fullscreen == "on" + + + true + Expression: param_orientation == "auto" + param_orientation == "auto" + + + true + Expression: param_orientation == "landscape" + param_orientation == "landscape" + + + true + Expression: param_orientation == "portrait" + param_orientation == "portrait" + + + true + Expression: param_screen=="off" + param_screen=="off" + + + true + Expression: param_screen=="on" + param_screen=="on" + + + false + Expression: Reboot + param_syscmd == "reboot" + + + false + Expression: screenMsg" + request_path == "/fhem-amad/setCommands/screenMsg" + + + false + Expression: setAlarm" + request_path == "/fhem-amad/setCommands/setAlarm" + + + false + Expression: setBluetooth" + request_path == "/fhem-amad/setCommands/setbluetooth" + + + false + Expression: setBrightness" + request_path == "/fhem-amad/setCommands/setBrightness" + + + false + Expression: setBTDevice" + request_path == "/fhem-amad/setCommands/setbtdevice" + + + false + Expression: setScreenFullscreen" + request_path == "/fhem-amad/setCommands/setScreenFullscreen" + + + false + Expression: setScreenOnOff" + request_path == "/fhem-amad/setCommands/setScreenOnOff" + + + false + Expression: setScreenOrientation" + request_path == "/fhem-amad/setCommands/setScreenOrientation" + + + false + Expression: setVolume" + request_path == "/fhem-amad/setCommands/setVolume" + + + false + Expression: System Command" + request_path == "/fhem-amad/setCommands/systemcommand" + + + true + Expression: trigger == "com.android.music.metachanged" + trigger == "com.android.music.metachanged" + + + true + Expression: trigger == "Globale Variable: global_own_reading" + trigger == "Globale Variable: global_own_reading" + + + true + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + trigger == "HTTP Request: /fhem-amad/setCommands/*" + + + false + Expression: ttsMsg" + request_path == "/fhem-amad/setCommands/ttsMsg" + + + false + Expression: tuneinradio + param_app == "tuneinradio" + + + true + Flow Aktiv: Informations + Informations + + + true + Flow Aktiv: SetCommands + SetCommands + + + true + Musik Aktiv + + + true + WLAN Verbunden: Alle SSIDs + true + + + + false + App Starten: App3 + + + + + false + App Starten: App4 + + + + + false + App Starten: App5 + + + + + false + App Starten: PlayMusic + com.google.android.music + + + + false + App Starten: tuneinradio + tunein.player + + + + true + Audio Player steuern: Medienknopf Play (Google Play Musik) + true + LAUNCH + KEYCODE_MEDIA_PLAY + true + com.google.android.music + com.google.android.music.playback.MediaButtonIntentReceiver + Google Play Musik + + + true + Audio Player steuern: Medienknopf Stopp (Google Play Musik) + true + LAUNCH + KEYCODE_MEDIA_STOP + true + com.google.android.music + com.google.android.music.playback.MediaButtonIntentReceiver + Google Play Musik + + + true + Audio Player steuern: Medienknopf Weiter (Google Play Musik) + true + LAUNCH + KEYCODE_MEDIA_NEXT + true + com.google.android.music + com.google.android.music.playback.MediaButtonIntentReceiver + Google Play Musik + + + true + Audio Player steuern: Medienknopf Zurück (Google Play Musik) + true + LAUNCH + KEYCODE_MEDIA_PREVIOUS + true + com.google.android.music + com.google.android.music.playback.MediaButtonIntentReceiver + Google Play Musik + + + true + Benachrichtigung auf Bildschirm: {param_message} (lange) + true + {param_message} + + 200 + 250 + false + 1.0 + true + false + TOP_LEFT + 0 + 0 + + + true + Benachrichtigung aus Statusbar entfernen: Alle + false + true + 1 + true + + true + {id} + + + true + Benachrichtigung aus Statusbar entfernen: Alle (Automagic) + true + true + 1 + false + + true + {id} + + + true + Bluetooth ein-/ausschalten: Aus + false + + + true + Bluetooth ein-/ausschalten: Ein + true + + + true + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} + A2DP + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} + A2DP + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} + INPUT_DEVICE + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} + INPUT_DEVICE + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} + HEADSET + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} + HEADSET + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} + PAN + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} + PAN + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} + A2DP + {param_swtobtdevicemac} + + true + + + true + Display automatisch drehen ein-/ausschalten: Aus + false + + + true + Display automatisch drehen ein-/ausschalten: Ein + true + + + true + Gerät sperren + + + false + HTTP Response Information + powerLevel@@{battery_percentage}@@@@powerPlugged@@{battery_plugged}@@@@volumeMusikBluetooth@@{volumeMusikBluetooth}@@@@volumeMusikSpeaker@@{volumeMusikSpeaker}@@@@screenBrightness@@{screenBrightness}@@@@nextAlarmTime@@{next_alarmtime}@@@@nextAlarmDay@@{next_alarmday}@@@@screen@@{screen_state}@@@@automagicState@@{notification_text}@@@@screenOrientation@@{screen_orientation}@@@@currentMusicTrack@@{global_track}@@@@currentMusicAlbum@@{global_album}@@@@currentMusicArtist@@{global_artist}@@@@bluetooth@@{bluetooth_state}@@@@connectedBTdevices@@{connected_devices_names}@@@@connectedBTdevicesMAC@@{connected_devices_addresses}@@@@flow_SetCommands@@{setCommandFlow_state}@@@@checkActiveTask@@{runTask} + true + text/plain + + + false + HTTP Response SetCommand + flow_informations@@{informationFlow_state}@@@@ + true + text/plain + + + false + Initialisiere Variable Nächster Alarm: next_alarm + next_alarm + + + false + Initialisiere Variable Systemeinstellung: screenBrightness + SYSTEM + screen_brightness + screenBrightness + + + false + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth + SYSTEM + volume_music_bt_a2dp + volumeMusikBluetooth + + + false + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker + SYSTEM + volume_music_speaker + volumeMusikSpeaker + + + true + Kommandozeilenbefehl als Root ausführen: getevent -c 1 in + getevent -c 1 + + + stdout + stderr + exit_code + + + false + Lautstärken setzen + false + global_volume_alarm + false + global_volume_dtmf + true + param_volume + false + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + true + Neustart + + + + false + Own Reading + http://{global_fhemip}:8090 + false + false + + POST + GENERAL_TEXT + text/plain + {substring(getValue("global_own_reading",""),14)}@@{replaceAll(getValue("global_{substring(getValue('global_own_reading',''),14)}","nicht gefunden"),"\\s","%20")}@@@@ + @@@@readingsNameXYZ@@readingsValueABC + 60000 + true + FHEMDEVICE: {global_fhemdevice} +FHEMCMD: setreading + true + response + /storage/emulated/0/Download/file.bin + + + true + Pause: 10s (Schlafmodus zulassen) + 10s + false + + + true + Pause: 15s (Gerät wach halten) + 15s + true + + + true + Pause: 2s (Gerät wach halten) + 2s + true + + + true + Pause: 3s (Gerät wach halten) + 3s + true + + + false + Reading Music Metachanged + http://{global_fhemip}:8090 + false + false + + POST + GENERAL_TEXT + text/plain + currentMusicTrack@@{global_track}@@@@currentMusicAlbum@@{global_album}@@@@currentMusicArtist@@{global_artist}@@@@ + @@@@readingsNameXYZ@@readingsValueABC + 60000 + true + FHEMDEVICE: {global_fhemdevice} +FHEMCMD: setreading + true + response + /storage/emulated/0/Download/file.bin + + + true + Schalte Display ein: Hell für 120s + true + 120s + true + + + true + Script: bluetooth_state = "off" + + + + true + Script: bluetooth_state = "on" + + + + true + Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; + + + + true + Script: global_display="an";global_own_reading="{getDate()}_display" + + + + true + Script: global_display="aus";global_own_reading="{getDate()}_display" + + + + true + Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} + + + + true + Script: global_touch="ja";global_own_reading="{getDate()}_touch";global_touched="ja" + + + + true + Script: global_touch="nein";global_own_reading="{getDate()}_touch" + + + + true + Script: global_touched="ja" + + + + true + Script: global_touched="wait" + + + + true + Script: informationFlow_state = "aktiv" + + + + true + Script: informationFlow_state = "inaktiv" + + + + true + Script: next_alarmday = "{next_alarm,dateformat,c}" + + + + true + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + + + + true + Script: notification_text = "no supported from your device" + + + + true + Script: runTask = "0" + + + + true + Script: runTask = "1" + + + + true + Script: screen_orientation = "auto" + + + + true + Script: screen_orientation = "landscape" + + + + true + Script: screen_orientation = "portrait" + + + + true + Script: screen_state = "off" + + + + true + Script: screen_state = "on" + + + + true + Script: setCommandFlow_state = "aktiv" + + + + true + Script: setCommandFlow_state = "inaktiv" + + + + true + Setze Alarm: um {param_hour}:{param_minute} + + {param_hour} + {param_minute} + + + true + Setze Display Orientierung: Auf Default zurücksetzen + UNSPECIFIED + false + + + true + Setze Display Orientierung: Landscape + LANDSCAPE + false + + + true + Setze Display Orientierung: Portrait + PORTRAIT + false + + + true + Setze Flow Status: Aktivieren Informations + true + Informations + + + + true + Setze Flow Status: Aktivieren SetCommands + true + SetCommands + + + + true + Setze Systemeinstellung: System screen_brightness auf {param_brightness} + SYSTEM + screen_brightness + {param_brightness} + true + + + true + Setze Vollbild Modus: Auf Default zurücksetzen + UNSPECIFIED + false + + + true + Setze Vollbild Modus: Navigation nicht anzeigen + HIDE_NAVIGATION + false + + + true + Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung + FILE + Lautlos + /storage/emulated/0/Notifications/{param_notifyfile} + NOTIFICATION + false + true + true + TRANSIENT + + + true + Sprachausgabe: {param_message} + MUSIC + {param_message} + de_DE + true + 1.0 + true + 1.0 + true + false + false + true + TRANSIENT + + + false + StatusRequest + http://{global_fhemip}:8090 + false + false + + POST + GENERAL_TEXT + text/plain + + @@@@readingsNameXYZ@@readingsValueABC + 60000 + true + FHEMDEVICE: {global_fhemdevice} +FHEMCMD: statusrequest + true + response + /storage/emulated/0/Download/file.bin + + + true + URL in Browser öffnen: {param_url} (mit Chrome) + {param_url} + true + com.android.chrome + com.google.android.apps.chrome.Main + Chrome + + + Informations + FHEM Info / Steuerung über AMAD Modul v0.8.0 + true + QUEUE + 120 + + HTTP Request: /fhem-amad/deviceInfo/ + com.android.music.metachanged + Globale Variable: global_own_reading + + Script: notification_text = "no supported from your device" + Script: screen_orientation = "auto" + Display automatisch drehen eingeschaltet + Script: screen_orientation = "portrait" + Display Orientierung: Portrait + Script: screen_orientation = "landscape" + Bluetooth eingeschaltet + Script: bluetooth_state = "off" + Script: screen_state = "off" + Script: screen_state = "on" + Display eingeschaltet + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + Initialisiere Variable Nächster Alarm: next_alarm + Script: next_alarmday = "{next_alarm,dateformat,c}" + Initialisiere Variable Systemeinstellung: screenBrightness + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth + Flow Aktiv: SetCommands + Script: setCommandFlow_state = "aktiv" + Setze Flow Status: Aktivieren SetCommands + Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; + Musik Aktiv + Pause: 2s (Gerät wach halten) + Expression: trigger == "com.android.music.metachanged" + Expression: trigger == "Globale Variable: global_own_reading" + WLAN Verbunden: Alle SSIDs + WLAN Verbunden: Alle SSIDs + Script: bluetooth_state = "on" + Akku Ladestand: grösser als 0% + Script: setCommandFlow_state = "inaktiv" + Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} + App Task läuft: {header_activetask} (neuster) + Script: runTask = "0" + Script: runTask = "1" + Benachrichtigung in Statusbar angezeigt: Automagic + Reading Music Metachanged + Own Reading + HTTP Response Information + Bluetooth Gerät verbunden: Beliebiges Geräte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Meldung Display An + AMAD FHEM / OwnReadings Examples + false + PARALLEL + + Display Status: Ein + + Script: global_display="an";global_own_reading="{getDate()}_display" + + + + Meldung Display Aus + AMAD FHEM / OwnReadings Examples + false + PARALLEL + + Display Status: Aus + + Script: global_display="aus";global_own_reading="{getDate()}_display" + + + + Meldung kein Touch + AMAD FHEM / OwnReadings Examples + false + STOP + + Globale Variable: global_touched + + Pause: 15s (Gerät wach halten) + Script: global_touched="wait" + Expression: global_touched=="ja" + Expression: global_touched=="wait" + Script: global_touch="nein";global_own_reading="{getDate()}_touch" + + + + + + + + Meldung Touch + AMAD FHEM / OwnReadings Examples + false + STOP + + Periodischer Timer: alle 4m + + Kommandozeilenbefehl als Root ausführen: getevent -c 1 in + Script: global_touched="ja" + Script: global_touch="ja";global_own_reading="{getDate()}_touch";global_touched="ja" + Pause: 10s (Schlafmodus zulassen) + + + + + + + + SetCommands + FHEM Info / Steuerung über AMAD Modul v0.8.0 + true + QUEUE + 120 + + HTTP Request: /fhem-amad/deviceInfo/ + HTTP Request: /fhem-amad/setCommands/* + + Expression: param_screen=="on" + Expression: setBrightness" + Expression: setAlarm" + Expression: screenMsg" + URL in Browser öffnen: {param_url} (mit Chrome) + Benachrichtigung auf Bildschirm: {param_message} (lange) + Expression: setScreenFullscreen" + Expression: param_orientation == "auto" + Setze Display Orientierung: Portrait + Setze Display Orientierung: Landscape + Expression: param_orientation == "landscape" + Expression: param_orientation == "portrait" + Setze Vollbild Modus: Navigation nicht anzeigen + Setze Vollbild Modus: Auf Default zurücksetzen + Audio Player steuern: Medienknopf Zurück (Google Play Musik) + Expression: param_button == "back" + Expression: param_button == "next" + Setze Display Orientierung: Auf Default zurücksetzen + Expression: param_button == "play" + Expression: mediaPlayer" + Audio Player steuern: Medienknopf Weiter (Google Play Musik) + Expression: param_button == "stop" + Expression: param_screen=="off" + Gerät sperren + Expression: setScreenOnOff" + App Task läuft: App5 (neuster) + Expression: App5 + Expression: App4 + App Task läuft: App3 (neuster) + Expression: App3 + App Starten: App3 + App Starten: App4 + App Task läuft: App4 (neuster) + Expression: tuneinradio + App Task läuft: tuneinradio (neuster) + App Starten: tuneinradio + App Starten: App5 + App Task läuft: gplay (neuster) + Expression: gplay + App Starten: PlayMusic + Expression: System Command" + Neustart + Flow Aktiv: Informations + Expression: ttsMsg" + Lautstärken setzen + Setze Systemeinstellung: System screen_brightness auf {param_brightness} + Schalte Display ein: Hell für 120s + Display automatisch drehen ein-/ausschalten: Aus + Display automatisch drehen ein-/ausschalten: Ein + Setze Alarm: um {param_hour}:{param_minute} + Audio Player steuern: Medienknopf Stopp (Google Play Musik) + Expression: setScreenOrientation" + Expression: param_fullscreen == "off" + Expression: param_fullscreen == "on" + Expression: setBluetooth" + Expression: openURL" + Expression: setVolume" + Sprachausgabe: {param_message} + Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung + Expression: param_bluetooth == "off" + Bluetooth ein-/ausschalten: Aus + Expression: param_bluetooth == "on" + Bluetooth ein-/ausschalten: Ein + Expression: notifysnd" + Audio Player steuern: Medienknopf Play (Google Play Musik) + Expression: openApp" + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + Expression: Reboot + Benachrichtigung aus Statusbar entfernen: Alle + Expression: All + Benachrichtigung aus Statusbar entfernen: Alle (Automagic) + Expression: Automagic + Expression: Clear Automagic Meldungen" + Setze Flow Status: Aktivieren Informations + Script: informationFlow_state = "inaktiv" + Script: informationFlow_state = "aktiv" + HTTP Response SetCommand + Bluetooth eingeschaltet + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} + Expression: setBTDevice" + Pause: 3s (Gerät wach halten) + Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} + Pause: 2s (Gerät wach halten) + StatusRequest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file