From a61bd9032433eda138389fefae9ddc6c02ec71bf Mon Sep 17 00:00:00 2001 From: markooldenburg <> Date: Tue, 8 Dec 2015 12:53:37 +0000 Subject: [PATCH] 74_AMAD: New Mijor Release 1.0.0 - Add Reading Android Version - Add VoiceInput fo VoiceCommands - Bug Fixes - Call ReadingsVal from Automagic HTTP Request with Response git-svn-id: https://svn.fhem.de/fhem/trunk@10130 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 5 + fhem/FHEM/74_AMAD.pm | 244 +++-- ....1.xml => 74_AMADautomagicFlows_1.0.0.xml} | 936 ++++++++++++------ 3 files changed, 783 insertions(+), 402 deletions(-) rename fhem/FHEM/lib/{74_AMADautomagicFlows0.8.1.xml => 74_AMADautomagicFlows_1.0.0.xml} (61%) diff --git a/fhem/CHANGED b/fhem/CHANGED index 281809505..0c1ec6da1 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,10 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - updated: 74_AMAD: New Mijor Release 1.0.0 + Add Reading Android Version + Add VoiceInput fo VoiceCommands + Bug Fixes + Call ReadingsVal from Automagic HTTP Request with Response - feature: 89_rssFeed: New module to get data from rss news feeds - feature: FB_CALLMONITOR: added attribute disabledForIntervals to specify specific time ranges, where FB_CALLMONITOR will be disabled diff --git a/fhem/FHEM/74_AMAD.pm b/fhem/FHEM/74_AMAD.pm index b91128eae..ca02cf336 100644 --- a/fhem/FHEM/74_AMAD.pm +++ b/fhem/FHEM/74_AMAD.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -my $version = "0.8.3"; +my $version = "1.0.0"; @@ -58,8 +58,8 @@ sub AMAD_Initialize($) { "root:0,1 ". "interval ". "port ". - "disable:1 "; - $hash->{AttrList} .= $readingFnAttributes; + "disable:1 ". + $readingFnAttributes; foreach my $d(sort keys %{$modules{AMAD}{defptr}}) { my $hash = $modules{AMAD}{defptr}{$d}; @@ -73,7 +73,7 @@ sub AMAD_Define($$) { my @a = split( "[ \t][ \t]*", $def ); - return "too few parameters: define AMAD " if( @a != 3 && $a[0] ne "AMADCommBridge" ); + return "too few parameters: define AMAD " if( @a < 2 && @a > 3 ); my $name = $a[0]; my $host = $a[2]; @@ -88,7 +88,7 @@ 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, did you want to define a AMAD host use: define AMAD " if( $modules{AMAD}{defptr}{BRIDGE} ); $hash->{BRIDGE} = 1; $modules{AMAD}{defptr}{BRIDGE} = $hash; @@ -110,7 +110,7 @@ sub AMAD_Define($$) { InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ) if( $hash->{HOST} ); $modules{AMAD}{defptr}{$hash->{HOST}} = $hash; - + return undef; } } @@ -121,8 +121,7 @@ sub AMAD_Undef($$) { if( $hash->{BRIDGE} ) { delete $modules{AMAD}{defptr}{BRIDGE}; - my $ret = TcpServer_Close( $hash ); - return $ret; + TcpServer_Close( $hash ); } else { delete $modules{AMAD}{defptr}{$hash->{HOST}}; @@ -133,7 +132,8 @@ sub AMAD_Undef($$) { my $host = $hash->{HOST}; return if( $host ); - CommandDelete( undef, "AMADCommBridge" ); + my $name = $hash->{NAME}; + CommandDelete( undef, $name ); } } } @@ -244,10 +244,12 @@ sub AMAD_GetUpdateTimer($) { sub AMAD_RetrieveAutomagicInfo($) { my ($hash) = @_; + my $bhash = $modules{AMAD}{defptr}{BRIDGE}; + my $bname = $bhash->{NAME}; my $name = $hash->{NAME}; my $host = $hash->{HOST}; my $port = $hash->{PORT}; - my $fhemip = ReadingsVal( "AMADCommBridge", "fhemServerIP", "none" ); + my $fhemip = ReadingsVal( $bname, "fhemServerIP", "none" ); my $activetask = AttrVal( $name, "checkActiveTask", "none" ); @@ -435,7 +437,10 @@ sub AMAD_Set($$@) { my ( $hash, $name, $cmd, @val ) = @_; - if( $name ne "AMADCommBridge" ) { + my $bhash = $modules{AMAD}{defptr}{BRIDGE}; + my $bname = $bhash->{NAME}; + + if( $name ne "$bname" ) { my $apps = AttrVal( $name, "setOpenApp", "none" ); my $btdev = AttrVal( $name, "setBluetoothDevice", "none" ); my $activetask = AttrVal( $name, "setActiveTask", "none" ); @@ -445,7 +450,7 @@ sub AMAD_Set($$@) { $list .= "ttsMsg "; $list .= "volume:slider,0,1,15 "; $list .= "deviceState:online,offline "; - $list .= "mediaPlayer:play,stop,next,back " if( ReadingsVal( "AMADCommBridge", "fhemServerIP", "none" ) ne "none"); + $list .= "mediaPlayer:play,stop,next,back " if( ReadingsVal( $bname, "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" ); @@ -459,7 +464,7 @@ sub AMAD_Set($$@) { $list .= "notifySndFile "; $list .= "clearNotificationBar:All,Automagic "; $list .= "changetoBTDevice:$btdev " if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); - #$list .= "activateVoiceInput:noArg "; # erste Codeteile für Spracheingabe + $list .= "activateVoiceInput:noArg "; if( lc $cmd eq 'screenmsg' || lc $cmd eq 'ttsmsg' @@ -495,7 +500,8 @@ sub AMAD_Set($$@) { return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; } - elsif( $name eq "AMADCommBridge" ) { + #elsif( $name eq "$bname" ) { + elsif( $modules{AMAD}{defptr}{BRIDGE} ) { my $list = ""; @@ -836,29 +842,29 @@ sub AMAD_HTTP_POSTerrorHandling($$$) { sub AMAD_CommBridge_Open($) { - my ( $hash ) = @_; - my $name = $hash->{NAME}; + my ( $bhash ) = @_; + my $bname = $bhash->{NAME}; # Oeffnen des TCP Sockets - my $ret = TcpServer_Open( $hash, "8090", "global" ); + my $bret = TcpServer_Open( $bhash, "8090", "global" ); - if( $ret && !$init_done ) { - Log3 $name, 3, "$ret. Exiting."; + if( $bret && !$init_done ) { + Log3 $bname, 3, "$bret. Exiting."; exit(1); } - readingsSingleUpdate ( $hash, "state", "opened", 1 ); - Log3 $name, 5, "Socket wird geöffnet."; + readingsSingleUpdate ( $bhash, "state", "opened", 1 ); + Log3 $bname, 5, "Socket wird geöffnet."; - return $ret; + return $bret; } sub AMAD_CommBridge_Read($) { my ( $hash ) = @_; my $name = $hash->{NAME}; - my $brihash = $modules{AMAD}{defptr}{BRIDGE}; - + my $bhash = $modules{AMAD}{defptr}{BRIDGE}; + my $bname = $bhash->{NAME}; if( $hash->{SERVERSOCKET} ) { # Accept and create a child TcpServer_Accept( $hash, "AMAD" ); @@ -875,16 +881,7 @@ sub AMAD_CommBridge_Read($) { CommandDelete( undef, $hash->{NAME} ); return; } - - 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", - "Content-Type: text/plain\r\n", - "Content-Length: ".length($response)."\r\n\r\n", - $response; - - + #### Verarbeitung der Daten welche über die AMADCommBridge kommen #### @@ -894,26 +891,22 @@ sub AMAD_CommBridge_Read($) { ### my @data = split( '\R\R', $buf ); - my $chash; - my $fhemdev; + + my $header = AMAD_Header2Hash( $data[0] ); + my $device = $header->{FHEMDEVICE}; + my $dhash = $defs{$device}; + my $response; + my $c; + + my $fhemcmd = $header->{FHEMCMD}; - - my @fhemdev = split( '\R', $data[0] ); - foreach my $ret( @fhemdev ) { - if( $ret =~ /FHEMDEVICE: (.*)/ ) { - $fhemdev = $1; - } - } - - $chash = $defs{$fhemdev}; - - - if ( $data[0] =~ /FHEMCMD: setreading\b/ ) { + if ( $fhemcmd =~ /setreading\b/ ) { my $tv = $data[1]; @data = split( '\R', $data[0] ); - + ### Begin Response Processing + Log3 $name, 4, "AMAD ($name) - AMAD_CommBridge: processing receive reading values"; my @valuestring = split( '@@@@', $tv ); my %buffer; @@ -928,46 +921,142 @@ sub AMAD_CommBridge_Read($) { while( ( $t, $v ) = each %buffer ) { $v =~ s/null//g; - - readingsBeginUpdate( $chash ); - readingsBulkUpdate( $chash, $t, $v ) if( defined( $v ) ); + + readingsBeginUpdate( $dhash ); + readingsBulkUpdate( $dhash, $t, $v ) if( defined( $v ) ); } - - readingsBulkUpdate( $chash, "lastStatusRequestState", "statusRequest_done" ); - readingsEndUpdate( $chash, 1 ); + + readingsBulkUpdate( $dhash, "lastStatusRequestState", "statusRequest_done" ); + readingsEndUpdate( $dhash, 1 ); ### End Response Processing + + $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM was processes\r\n"; + $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; return; } - elsif ( $data[0] =~ /FHEMCMD: set\b/ ) { + elsif ( $fhemcmd =~ /set\b/ ) { my $fhemCmd = $data[1]; - fhem ("$fhemCmd") if( ReadingsVal( "AMADCommBridge", "expertMode", 0 ) eq "1" ); - readingsSingleUpdate( $brihash, "receiveFhemCommand", $fhemCmd, 1 ); + fhem ("set $fhemCmd") if( ReadingsVal( $bname, "expertMode", 0 ) eq "1" ); + readingsSingleUpdate( $bhash, "receiveFhemCommand", "set ".$fhemCmd, 0 ); + Log3 $name, 4, "AMAD ($name) - AMAD_CommBridge: set reading receive fhem command"; + + $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM execute set command now\r\n"; + $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; return; } - elsif ( $data[0] =~ /FHEMCMD: voicecmd\b/ ) { + elsif ( $fhemcmd =~ /voiceinputvalue\b/ ) { my $fhemCmd = $data[1]; - readingsSingleUpdate( $brihash, "receiveVoiceCommand", $fhemCmd, 1 ); + readingsBeginUpdate( $bhash); + readingsBulkUpdate( $bhash, "receiveVoiceCommand", $fhemCmd ); + readingsBulkUpdate( $bhash, "receiveVoiceDevice", $device ); + readingsEndUpdate( $bhash, 1 ); + Log3 $name, 4, "AMAD ($name) - AMAD_CommBridge: set reading receive voice command"; + $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM was processes\r\n"; + $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; + return; } - elsif ( $data[0] =~ /FHEMCMD: statusrequest\b/ ) { - - return AMAD_GetUpdateLocal( $chash ); + elsif ( $fhemcmd eq "statusrequest" ) { + + $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM was processes\r\n"; + $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; + + Log3 $name, 4, "AMAD ($name) - AMAD_CommBridge: Call statusRequest"; + return AMAD_GetUpdateLocal( $dhash ); } + + elsif ( $fhemcmd =~ /readingsval\b/ ) { + my $fhemCmd = $data[1]; + my @datavalue = split( ' ', $data[1] ); + + $response = ReadingsVal( $datavalue[0], $datavalue[1], $datavalue[2] ); + $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; + + Log3 $name, 4, "AMAD ($name) - AMAD_CommBridge: response ReadingsVal Value to Automagic Device"; + return; + } + + elsif ( $fhemcmd =~ /fhemfunc\b/ ) { + my $fhemCmd = $data[1]; + + Log3 $name, 4, "AMAD ($name) - AMAD_CommBridge: receive fhem-function command"; + + if( $fhemcmd =~ /^{.*}$/ ) { + + $response = $fhemCmd if( ReadingsVal( $bname, "expertMode", 0 ) eq "1" ); + + } else { + + $response = "header lines: \r\n AMADCommBridge receive no typical FHEM function\r\n FHEM to do nothing\r\n"; + } + + $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; + + return; + } + + + $response = "header lines: \r\n AMADCommBridge receive incomplete or corrupt Data\r\n FHEM to do nothing\r\n"; + $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; +} + +sub AMAD_Header2Hash($) { + my ( $string ) = @_; + my %hash = (); + + foreach my $line (split("\r\n", $string)) { + my ($key,$value) = split( ": ", $line ); + next if( !$value ); + + $value =~ s/^ //; + $hash{$key} = $value; + } + + return \%hash; } -1; +1; + =pod =begin html @@ -980,6 +1069,7 @@ sub AMAD_CommBridge_Read($) { The AndroidAPP Auto Magic (this 3rd party app costs 2.90Euro) works better than Tasker and is more user-friendly.
The following information can be displayed:
    +
  • Android Version
  • State of Automagic on the device
  • Bluetooth on / off
  • Connected Bluetooth devices
  • @@ -1004,6 +1094,7 @@ sub AMAD_CommBridge_Read($) {

    With this module it is also possible to control an Android device as follows.
      +
    • Activate Voice Input
    • Switch Bluetooth on/off
    • Set or change the connection to a specific Bluetooth device
    • State of the device (online, offline)
    • @@ -1056,7 +1147,8 @@ sub AMAD_CommBridge_Read($) { 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! + When you define the first AMAD device instance another device named AMADCommBridge will also be defined. Its room attribute is AMAD. + 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. @@ -1065,6 +1157,7 @@ sub AMAD_CommBridge_Read($) { Readings
          +
        • androidVersion - installed Android Version
        • 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
        • @@ -1135,6 +1228,7 @@ sub AMAD_CommBridge_Read($) { Set
            +
          • activateVoiceInput - activat Voice Input on Android Device
          • 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.
          • @@ -1178,11 +1272,6 @@ sub AMAD_CommBridge_Read($) { My 10 "Tablet in the living room is media player for the living room with Bluetooth speakers. The volume is automatically set down when the Fritzbox signals a incoming call on the living room handset.



          - And finally I would like to say thank you.
          - The biggest thank is for my mentor Andre (justme1968), who told me lots of useful hints that helped me to understandPerl code and made programming a real fun.
          - I would also like to thank Jens (jensb) who has supported me when I made my first steps in Perl code.
          - And lastbut not least a special thank to PAH (Prof. Dr. Peter Henning), without his statement "Keine Ahnung hatten wir alle mal, das ist keine Ausrede" (We had all times of 'I do not know', that's no excuse), - I would not have started to get interested in module development of FHEM :-)

          - Thanks to Jürgen (ujaudio) for the english translation
        =end html @@ -1197,6 +1286,7 @@ sub AMAD_CommBridge_Read($) { Die AndroidAPP Automagic (welche nicht von mir stammt und 2.90Euro kostet) funktioniert wie Tasker, ist aber bei weitem User freundlicher. Im Auslieferungszustand werden folgende Zustände dargestellt:
          +
        • Android Version
        • Zustand von Automagic auf dem Gerät
        • Bluetooth An/Aus
        • Zustand einer definierten App (läuft aktiv im Vordergrund oder nicht?)
        • @@ -1223,6 +1313,7 @@ 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.
            +
          • aktiviert Spracheingabe
          • Bluetooth Ein/Aus schalten
          • zu einem bestimmten Bluetoothgerät wechseln/verbinden
          • Status des Gerätes (Online,Offline)
          • @@ -1274,7 +1365,7 @@ sub AMAD_CommBridge_Read($) { 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!!! + Beim ersten anlegen einer AMAD Deviceinstanz wird automatisch ein Gerät Namens AMADCommBridge im Raum AMAD angelegt. 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.
              @@ -1286,6 +1377,7 @@ sub AMAD_CommBridge_Read($) { Readings
                +
              • androidVersion - aktuell installierte Androidversion
              • 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
              • @@ -1356,6 +1448,7 @@ sub AMAD_CommBridge_Read($) { Set
                  +
                • activateVoiceInput - schaltet die Spracheingabe ein
                • 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
                • @@ -1408,14 +1501,7 @@ sub AMAD_CommBridge_Read($) { Wohnzimmer Handgerät signalisiert.



                - Und zu guter letzt möchte ich mich noch bedanken.
                - 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 :-)
                - 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 tolle Idee und Umsetzung von eigenen AMAD Readings aus externen Flows.
              =end html_DE -=cut +=cut \ No newline at end of file diff --git a/fhem/FHEM/lib/74_AMADautomagicFlows0.8.1.xml b/fhem/FHEM/lib/74_AMADautomagicFlows_1.0.0.xml similarity index 61% rename from fhem/FHEM/lib/74_AMADautomagicFlows0.8.1.xml rename to fhem/FHEM/lib/74_AMADautomagicFlows_1.0.0.xml index b8385f517..d5029594d 100644 --- a/fhem/FHEM/lib/74_AMADautomagicFlows0.8.1.xml +++ b/fhem/FHEM/lib/74_AMADautomagicFlows_1.0.0.xml @@ -1,5 +1,5 @@ - + false com.android.music.metachanged @@ -20,7 +20,7 @@ global_album = getString("album"); true Display Status: Aus - true + false false @@ -76,6 +76,7 @@ global_album = getString("album"); 0 17 0 + false true @@ -128,6 +129,8 @@ global_album = getString("album"); false Benachrichtigung in Statusbar angezeigt: Automagic ch.gridvision.ppam.androidautomagic + true + 1 TEXT CONTAINS_TEXT @@ -144,6 +147,7 @@ global_album = getString("album"); true + ANY true @@ -188,6 +192,11 @@ global_album = getString("album"); Expression: Clear Automagic Meldungen" request_path == "/fhem-amad/setCommands/clearnotificationbar" + + true + Expression: getAndroidSDKVersion() >= "19" + getAndroidSDKVersion() >= "19" + true Expression: global_touched=="ja" @@ -268,6 +277,11 @@ global_album = getString("album"); Expression: param_fullscreen == "on" param_fullscreen == "on" + + true + Expression: param_notifyfile == "RedAlert.mp3" + param_notifyfile == "RedAlert.mp3" + true Expression: param_orientation == "auto" @@ -383,6 +397,11 @@ global_album = getString("album"); Expression: tuneinradio param_app == "tuneinradio" + + true + Expression: value != "" + value != "" + true Flow Aktiv: Informations @@ -403,6 +422,15 @@ global_album = getString("album"); true + + false + AMAD Voice Control + false + + true + de-DE + false + false App Starten: App3 @@ -437,7 +465,7 @@ global_album = getString("album"); true Audio Player steuern: Medienknopf Play (Google Play Musik) true - LAUNCH + TOGGLE_PAUSE KEYCODE_MEDIA_PLAY true com.google.android.music @@ -448,7 +476,7 @@ global_album = getString("album"); true Audio Player steuern: Medienknopf Stopp (Google Play Musik) true - LAUNCH + STOP KEYCODE_MEDIA_STOP true com.google.android.music @@ -493,6 +521,22 @@ global_album = getString("album"); 0 0 + + true + Benachrichtigung auf Bildschirm: {value} (lange) + true + {value} + + 200 + 250 + false + 1.0 + true + false + TOP_LEFT + 0 + 0 + true Benachrichtigung aus Statusbar entfernen: Alle @@ -503,6 +547,9 @@ global_album = getString("album"); true {id} + TEXT + CONTAINS_TEXT + true @@ -514,6 +561,9 @@ global_album = getString("album"); true {id} + TEXT + CONTAINS_TEXT + true @@ -607,14 +657,61 @@ global_album = getString("album"); Display automatisch drehen ein-/ausschalten: Ein true + + true + Flows ausführen: VoiceControl + VoiceControl + + true + false + false + true Gerät sperren + + false + Get Android Version + + 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} + 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}@@@@androidVersion@@{androidVersion} true text/plain @@ -661,9 +758,39 @@ global_album = getString("album"); stderr exit_code + + true + Lautstärke einstellen: Benachrichtigung auf Level 7 + NOTIFICATION + 7 + false + false + false - Lautstärken setzen + Lautstärken setzen Benachrichtigung + false + global_volume_alarm + false + global_volume_dtmf + false + param_volume + true + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + Lautstärken setzen param_volume false global_volume_alarm false @@ -683,11 +810,85 @@ global_album = getString("album"); false global_interruptions_mode + + true + Lautstärken Speichern + false + global_volume_alarm + false + global_volume_dtmf + false + global_volume_music + true + 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 + Notification Lautstärke Speichern + false + global_volume_alarm + false + global_volume_dtmf + false + global_volume_music + true + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + Notification Lautstärke Wiederherstellen + false + global_volume_alarm + false + global_volume_dtmf + false + param_volume + true + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + NotificationLautstärke auf Level 7 + NOTIFICATION + 7 + false + false + false Own Reading @@ -698,7 +899,7 @@ global_album = getString("album"); POST GENERAL_TEXT text/plain - {substring(getValue("global_own_reading",""),14)}@@{replaceAll(getValue("global_{substring(getValue('global_own_reading',''),14)}","nicht gefunden"),"\\s","%20")}@@@@ + {substring(getValue("global_own_reading",""),14)}@@{getValue("global_{substring(getValue('global_own_reading',''),14)}","nicht gefunden")}@@@@ @@@@readingsNameXYZ@@readingsValueABC 60000 true @@ -707,30 +908,35 @@ FHEMCMD: setreading true response /storage/emulated/0/Download/file.bin + true true Pause: 10s (Schlafmodus zulassen) 10s false + false true Pause: 15s (Gerät wach halten) 15s true + false true Pause: 2s (Gerät wach halten) 2s true + false true Pause: 3s (Gerät wach halten) 3s true + false false @@ -751,6 +957,7 @@ FHEMCMD: setreading true response /storage/emulated/0/Download/file.bin + true true @@ -834,8 +1041,13 @@ global_fhemdevice = {header_fhemdevice} true - Script: notification_text = "no supported from your device" - + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + + + + true + Script: notification_text = "not supported from your device" + true @@ -847,6 +1059,11 @@ global_fhemdevice = {header_fhemdevice} Script: runTask = "1" + + true + Script: runTask = "not supported android version" + + true Script: runTask = "null" @@ -887,6 +1104,27 @@ global_fhemdevice = {header_fhemdevice} Script: setCommandFlow_state = "inaktiv" + + false + Send Voice Input Value to AMADCommBridge + http://{global_fhemip}:8090 + false + false + + POST + GENERAL_TEXT + text/plain + {value} + @@@@readingsNameXYZ@@readingsValueABC + 60000 + true + FHEMDEVICE: {global_fhemdevice} +FHEMCMD: voiceinputvalue + true + response + /storage/emulated/0/Download/file.bin + true + true Setze Alarm: um {param_hour}:{param_minute} @@ -974,14 +1212,21 @@ global_fhemdevice = {header_fhemdevice} true TRANSIENT - - true - Spracheingabe: ohne Benutzeroberfläche - false - - true - de-DE - false + + false + Spracheingabe wurde nicht erkannt + NOTIFICATION + Ihre Eingabe wurde nicht verstanden + de_DE + true + 1.0 + true + 1.0 + true + false + false + true + TRANSIENT false @@ -1002,6 +1247,7 @@ FHEMCMD: statusrequest true response /storage/emulated/0/Download/file.bin + true true @@ -1014,7 +1260,7 @@ FHEMCMD: statusrequest Informations - FHEM Info / Steuerung über AMAD Modul v0.8.1 + FHEM Info / Steuerung über AMAD Modul v1.0.0 true QUEUE 240 @@ -1023,107 +1269,120 @@ FHEMCMD: statusrequest 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" - Script: setCommandFlow_state = "inaktiv" - Benachrichtigung in Statusbar angezeigt: Automagic - Reading Music Metachanged - Own Reading - HTTP Response Information - Bluetooth Gerät verbunden: Beliebiges Geräte - Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} + Initialisiere Variable Nächster Alarm: next_alarm + Initialisiere Variable Systemeinstellung: screenBrightness + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth + Flow Aktiv: SetCommands + Musik Aktiv + Pause: 2s (Gerät wach halten) + Expression: trigger == "com.android.music.metachanged" + WLAN Verbunden: Alle SSIDs + WLAN Verbunden: Alle SSIDs + Reading Music Metachanged + Display automatisch drehen eingeschaltet + Script: runTask = "1" + Setze Flow Status: Aktivieren SetCommands + Script: setCommandFlow_state = "inaktiv" + Script: setCommandFlow_state = "aktiv" + Script: global_artist = "no soundplayer activ"; global_track = "no soundplayer activ"; global_album = "no soundplayer activ"; + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + Script: next_alarmday = "{next_alarm,dateformat,c}" + Script: screen_orientation = "auto" + Script: screen_orientation = "portrait" + Script: screen_orientation = "landscape" + HTTP Response Information + Display Orientierung: Portrait + Script: runTask = "0" + App Task läuft: {header_activetask} (neuster) + Expression: getAndroidSDKVersion() >= "19" + Expression: header_activetask != "none" + Script: runTask = "null" + Script: runTask = "not supported android version" + Expression: trigger == "Globale Variable: global_own_reading" + Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice} + Script: notification_text = "not supported from your device" + Benachrichtigung in Statusbar angezeigt: Automagic + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" Akku Ladestand: grösser als 0% - Script: runTask = "null" - Script: runTask = "0" - App Task läuft: {header_activetask} (neuster) - Expression: header_activetask != "none" - Script: runTask = "1" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Script: screen_state = "off" + Script: screen_state = "on" + Display eingeschaltet + Expression: getAndroidSDKVersion() >= "19" + Bluetooth Gerät verbunden: Beliebiges Geräte + Script: bluetooth_state = "on" + Bluetooth eingeschaltet + Script: bluetooth_state = "off" + Get Android Version + Own Reading + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + - - - + + + + + + + + + - - - - - - - + + + + + + + + + + + + Meldung Display An @@ -1176,229 +1435,260 @@ FHEMCMD: statusrequest 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) + Pause: 10s (Schlafmodus zulassen) + Script: global_touch="ja";global_own_reading="{getDate()}_touch";global_touched="ja" - - - + + + SetCommands - FHEM Info / Steuerung über AMAD Modul v0.8.1 + FHEM Info / Steuerung über AMAD Modul v1.0.0 true QUEUE 240 - 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) + + HTTP Request: /fhem-amad/deviceInfo/ + HTTP Request: /fhem-amad/setCommands/* + Sprachbefehl angefordert + + 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 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" - 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: Reboot - Benachrichtigung aus Statusbar entfernen: Alle - Expression: All - Benachrichtigung aus Statusbar entfernen: Alle (Automagic) - Expression: Automagic - Setze Flow Status: Aktivieren Informations - Script: informationFlow_state = "inaktiv" - 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} - Pause: 3s (Gerät wach halten) - Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} - Pause: 2s (Gerät wach halten) - StatusRequest - Gerät sperren - Expression: Clear Automagic Meldungen" - Script: informationFlow_state = "aktiv" - Expression: setBTDevice" - Spracheingabe: ohne Benutzeroberfläche - Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" - Expression: setVoiceCommand" - - HTTP Request: /fhem-amad/deviceInfo/ - HTTP Request: /fhem-amad/setCommands/* - Sprachbefehl angefordert - - Expression: trigger == "Sprachbefehl angefordert" - - - - - - - - - - - - - - - - + Expression: param_button == "stop" + Expression: param_screen=="off" + 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" + 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} + Expression: setScreenOrientation" + Expression: param_fullscreen == "off" + Expression: param_fullscreen == "on" + Expression: setBluetooth" + Expression: setVolume" + Sprachausgabe: {param_message} + Expression: param_bluetooth == "off" + Expression: param_bluetooth == "on" + Bluetooth ein-/ausschalten: Ein + Expression: openApp" + Expression: Reboot + Benachrichtigung aus Statusbar entfernen: Alle + Expression: All + Benachrichtigung aus Statusbar entfernen: Alle (Automagic) + Expression: Automagic + Setze Flow Status: Aktivieren Informations + Script: informationFlow_state = "inaktiv" + 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} + Pause: 3s (Gerät wach halten) + Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} + Pause: 2s (Gerät wach halten) + Gerät sperren + Expression: Clear Automagic Meldungen" + Script: informationFlow_state = "aktiv" + Expression: setBTDevice" + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + Expression: trigger == "Sprachbefehl angefordert" + Expression: openURL" + Expression: setVoiceCommand" + Audio Player steuern: Medienknopf Play (Google Play Musik) + Audio Player steuern: Medienknopf Weiter (Google Play Musik) + Audio Player steuern: Medienknopf Zurück (Google Play Musik) + StatusRequest + Bluetooth ein-/ausschalten: Aus + Audio Player steuern: Medienknopf Stopp (Google Play Musik) + Lautstärken setzen param_volume + Lautstärke einstellen: Benachrichtigung auf Level 7 + Lautstärken Speichern + Expression: param_notifyfile == "RedAlert.mp3" + Expression: notifysnd" + Expression: param_notifyfile == "RedAlert.mp3" + Lautstärken setzen Benachrichtigung + Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung + NotificationLautstärke auf Level 7 + Notification Lautstärke Speichern + Notification Lautstärke Wiederherstellen + HTTP Response SetCommand + Flows ausführen: VoiceControl + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + VoiceControl + FHEM Info / Steuerung über AMAD Modul v1.0.0 + true + QUEUE + + Expression: value != "" + Spracheingabe wurde nicht erkannt + Benachrichtigung auf Bildschirm: {value} (lange) + AMAD Voice Control + Send Voice Input Value to AMADCommBridge + + + + + \ No newline at end of file