From 82ba0bf86c29a901aa5ebed354f93998ddb5c3bb Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sat, 31 Oct 2015 22:18:54 +0100 Subject: [PATCH] =?UTF-8?q?bugfix=20statusRequest=20bei=20Screen=20Off=20i?= =?UTF-8?q?m=20SetCommand=20Flow,=20bugfix=20definierter=20Raum=20wird=20b?= =?UTF-8?q?ei=20modify=20auf=20AMAD=20ge=C3=A4ndert,=20erste=20Codeteile?= =?UTF-8?q?=20f=C3=BCr=20Spracheingabe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 31 +- ....8.0.xml => 74_AMADautomagicFlows0.8.1.xml | 552 ++++++++++-------- 2 files changed, 324 insertions(+), 259 deletions(-) rename 74_AMADautomagicFlows0.8.0.xml => 74_AMADautomagicFlows0.8.1.xml (74%) diff --git a/74_AMAD.pm b/74_AMAD.pm index 9125dc1..110ef10 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.8.0"; +my $version = "0.8.1"; @@ -92,7 +92,7 @@ sub AMAD_Define($$) { $hash->{BRIDGE} = 1; $modules{AMAD}{defptr}{BRIDGE} = $hash; - $attr{$name}{room} = "AMAD"; + $attr{$name}{room} = "AMAD" if( !defined( $attr{$name}{room} ) ); Log3 $name, 3, "AMAD ($name) - defined Bridge with Socketport $hash->{PORT}"; AMAD_CommBridge_Open( $hash ); @@ -103,7 +103,7 @@ sub AMAD_Define($$) { Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)"; - $attr{$name}{room} = "AMAD"; + $attr{$name}{room} = "AMAD" if( !defined( $attr{$name}{room} ) ); readingsSingleUpdate ( $hash, "state", "initialized", 1 ) if( $hash->{HOST} ); readingsSingleUpdate ( $hash, "deviceState", "online", 1 ) if( $hash->{HOST} ); @@ -459,6 +459,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 if( lc $cmd eq 'screenmsg' || lc $cmd eq 'ttsmsg' @@ -477,6 +478,7 @@ sub AMAD_Set($$@) { || lc $cmd eq 'notifysndfile' || lc $cmd eq 'changetobtdevice' || lc $cmd eq 'clearnotificationbar' + || lc $cmd eq 'activatevoiceinput' || lc $cmd eq 'statusrequest' ) { Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val); @@ -487,7 +489,7 @@ sub AMAD_Set($$@) { 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 AMAD_SelectSetCmd( $hash, $cmd, @val ) if( @val ) || ( lc $cmd eq 'statusrequest' ) || ( lc $cmd eq 'activatevoiceinput' ); } return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; @@ -593,6 +595,14 @@ sub AMAD_SelectSetCmd($$@) { return AMAD_HTTP_POST( $hash,$url ); } + elsif( lc $cmd eq 'activatevoiceinput' ) { + #my $cmd = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setvoicecmd"; + + return AMAD_HTTP_POST( $hash,$url ); + } + elsif( lc $cmd eq 'screenfullscreen' ) { my $mod = join( " ", @data ); @@ -875,9 +885,8 @@ sub AMAD_CommBridge_Read($) { $response; - ## hier den close Client einbauen auf hash vom Accept $chash siehe oben - ## close($hash->{CD}) - + + #### Verarbeitung der Daten welche über die AMADCommBridge kommen #### ### @@ -927,6 +936,14 @@ sub AMAD_CommBridge_Read($) { return; } + elsif ( $data[0] =~ /FHEMCMD: voicecmd\b/ ) { + my $fhemCmd = $data[1]; + + readingsSingleUpdate( $brihash, "receiveVoiceCommand", $fhemCmd, 1 ); + + return; + } + elsif ( $data[0] =~ /FHEMCMD: statusrequest\b/ ) { @data = split( '\R', $data[0] ); diff --git a/74_AMADautomagicFlows0.8.0.xml b/74_AMADautomagicFlows0.8.1.xml similarity index 74% rename from 74_AMADautomagicFlows0.8.0.xml rename to 74_AMADautomagicFlows0.8.1.xml index 4ef4778..b8385f5 100644 --- a/74_AMADautomagicFlows0.8.0.xml +++ b/74_AMADautomagicFlows0.8.1.xml @@ -20,7 +20,7 @@ global_album = getString("album"); true Display Status: Aus - false + true false @@ -77,6 +77,11 @@ global_album = getString("album"); 17 0 + + true + Sprachbefehl angefordert + true + true Akku Ladestand: grösser als 0% @@ -198,6 +203,11 @@ global_album = getString("album"); Expression: gplay param_app == "gplay" + + true + Expression: header_activetask != "none" + header_activetask != "none" + false Expression: mediaPlayer" @@ -328,6 +338,11 @@ global_album = getString("album"); Expression: setScreenOrientation" request_path == "/fhem-amad/setCommands/setScreenOrientation" + + false + Expression: setVoiceCommand" + request_path == "/fhem-amad/setCommands/setvoicecmd" + false Expression: setVolume" @@ -353,6 +368,11 @@ global_album = getString("album"); Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" trigger == "HTTP Request: /fhem-amad/setCommands/*" + + true + Expression: trigger == "Sprachbefehl angefordert" + trigger == "Sprachbefehl angefordert" + false Expression: ttsMsg" @@ -827,6 +847,11 @@ global_fhemdevice = {header_fhemdevice} Script: runTask = "1" + + true + Script: runTask = "null" + + true Script: screen_orientation = "auto" @@ -949,6 +974,15 @@ global_fhemdevice = {header_fhemdevice} true TRANSIENT + + true + Spracheingabe: ohne Benutzeroberfläche + false + + true + de-DE + false + false StatusRequest @@ -980,10 +1014,10 @@ FHEMCMD: statusrequest Informations - FHEM Info / Steuerung über AMAD Modul v0.8.0 + FHEM Info / Steuerung über AMAD Modul v0.8.1 true QUEUE - 120 + 240 HTTP Request: /fhem-amad/deviceInfo/ com.android.music.metachanged @@ -1017,74 +1051,79 @@ FHEMCMD: statusrequest 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 + 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} + 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" - - + + - + - + - - - - + + + + - + - - - - + + + + - - - + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + Meldung Display An @@ -1147,210 +1186,219 @@ FHEMCMD: statusrequest SetCommands - FHEM Info / Steuerung über AMAD Modul v0.8.0 + FHEM Info / Steuerung über AMAD Modul v0.8.1 true QUEUE - 120 - + 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) + 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: 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Expression: trigger == "Sprachbefehl angefordert" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file