diff --git a/74_AMAD.pm b/74_AMAD.pm
index 9e12867..e3f7ca3 100644
--- a/74_AMAD.pm
+++ b/74_AMAD.pm
@@ -37,7 +37,7 @@ use TcpServerUtils;
use Encode qw(encode);
-my $version = "1.2.1";
+my $version = "1.3.0";
@@ -405,7 +405,17 @@ sub AMAD_RetrieveAutomagicInfoFinished($$$) {
### End Error Handling
$hash->{helper}{infoErrorCounter} = 0;
-
+
+ AMAD_ResponseProcessing($hash,$data);
+}
+
+sub AMAD_ResponseProcessing($$) {
+
+ my ( $hash, $data ) = @_;
+
+ my $name = $hash->{NAME};
+ my $host = $hash->{HOST};
+
### Begin Response Processing
readingsSingleUpdate( $hash, "state", "active", 1) if( ReadingsVal( $name, "state", 0 ) ne "initialized" or ReadingsVal( $name, "state", 0 ) ne "active" );
@@ -460,7 +470,7 @@ sub AMAD_Set($$@) {
$list .= "deviceState:online,offline ";
$list .= "mediaPlayer:play,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none");
$list .= "screenBrightness:slider,0,1,255 ";
- $list .= "screen:on,off ";
+ $list .= "screen:on,off,lock,unlock ";
$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 ";
@@ -473,9 +483,9 @@ sub AMAD_Set($$@) {
$list .= "clearNotificationBar:All,Automagic ";
$list .= "changetoBTDevice:$btdev " if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" );
$list .= "activateVoiceInput:noArg ";
- $list .= "screenLock:on,off " if( AttrVal( $name, "setScreenlockPIN", "none" ) ne "none" );
$list .= "volumeNotification:slider,0,1,7 ";
- $list .= "vibrate:noArg";
+ $list .= "vibrate:noArg ";
+ $list .= "sendIntent ";
if( lc $cmd eq 'screenmsg'
|| lc $cmd eq 'ttsmsg'
@@ -498,6 +508,7 @@ sub AMAD_Set($$@) {
|| lc $cmd eq 'volumenotification'
|| lc $cmd eq 'screenlock'
|| lc $cmd eq 'statusrequest'
+ || lc $cmd eq 'sendintent'
|| lc $cmd eq 'vibrate') {
Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val);
@@ -513,8 +524,7 @@ sub AMAD_Set($$@) {
return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list";
}
-
- #elsif( $name eq "$bname" ) {
+
elsif( $modules{AMAD}{defptr}{BRIDGE} ) {
my $list = "";
@@ -611,10 +621,25 @@ sub AMAD_SelectSetCmd($$@) {
elsif( lc $cmd eq 'screen' ) {
my $mod = join( " ", @data );
+
+ if ($mod eq "on" || $mod eq "off") {
+
+ my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenOnOff?screen=$mod" if ($mod eq "on" || $mod eq "off");
+
+ return AMAD_HTTP_POST( $hash,$url );
+ }
+
+ elsif ($mod eq "lock" || $mod eq "unlock") {
+
+ return "Please set \"setScreenlockPIN\" Attribut first" if( AttrVal( $name, "setScreenlockPIN", "none" ) eq "none" );
+ my $PIN = AttrVal( $name, "setScreenlockPIN", undef );
+ $PIN = AMAD_decrypt($PIN);
- my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenOnOff?screen=$mod";
+ my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/screenlock?lockmod=".$mod."&lockPIN=".$PIN;
- return AMAD_HTTP_POST( $hash,$url );
+ readingsSingleUpdate( $hash, $cmd, $mod, 1 );
+ return AMAD_HTTP_POST( $hash,$url );
+ }
}
elsif( lc $cmd eq 'screenorientation' ) {
@@ -720,23 +745,21 @@ sub AMAD_SelectSetCmd($$@) {
return AMAD_HTTP_POST( $hash,$url );
}
- elsif( lc $cmd eq 'screenlock' ) {
- my $lockmod = join( " ", @data );
- my $PIN = AttrVal( $name, "setScreenlockPIN", undef );
- $PIN = AMAD_decrypt($PIN);
-
- my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/screenlock?lockmod=".$lockmod."&lockPIN=".$PIN;
-
- readingsSingleUpdate( $hash, $cmd, $lockmod, 1 );
- return AMAD_HTTP_POST( $hash,$url );
- }
-
elsif( lc $cmd eq 'vibrate' ) {
my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setvibrate";
return AMAD_HTTP_POST( $hash,$url );
}
+
+ elsif( lc $cmd eq 'sendintent' ) {
+ my $intentstring = join( " ", @data );
+ my ( $action, $exkey1, $exval1, $exkey2, $exval2 ) = split( "[ \t][ \t]*", $intentstring );
+
+ my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/sendIntent?action=".$action."&exkey1=".$exkey1."&exval1=".$exval1."&exkey2=".$exkey2."&exval2=".$exval2;
+
+ return AMAD_HTTP_POST( $hash,$url );
+ }
return undef;
}
@@ -947,35 +970,12 @@ sub AMAD_CommBridge_Read($) {
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";
+ ### Begin Response Processing
+ Log3 $name, 4, "AMAD ($name) - AMAD_CommBridge: processing receive reading values";
- 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( $dhash );
- readingsBulkUpdate( $dhash, $t, $v ) if( defined( $v ) );
- }
-
- readingsBulkUpdate( $dhash, "lastStatusRequestState", "statusRequest_done" );
- readingsEndUpdate( $dhash, 1 );
-
- ### End Response Processing
-
+ AMAD_ResponseProcessing($dhash,$tv);
+
$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",
diff --git a/74_AMADautomagicFlows_1.2.0.xml b/74_AMADautomagicFlows_1.3.x.xml
similarity index 78%
rename from 74_AMADautomagicFlows_1.2.0.xml
rename to 74_AMADautomagicFlows_1.3.x.xml
index 65bfeb0..1101c06 100644
--- a/74_AMADautomagicFlows_1.2.0.xml
+++ b/74_AMADautomagicFlows_1.3.x.xml
@@ -17,30 +17,12 @@ 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/
@@ -57,27 +39,6 @@ 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
- false
-
true
Sprachbefehl angefordert
@@ -196,16 +157,6 @@ global_album = getString("album");
Expression: getAndroidSDKVersion() >= "19"
getAndroidSDKVersion() >= "19"
-
- true
- Expression: global_touched=="ja"
- global_touched=="ja"
-
-
- true
- Expression: global_touched=="wait"
- global_touched=="wait"
-
false
Expression: gplay
@@ -278,8 +229,8 @@ global_album = getString("album");
true
- Expression: param_lockmod == "on"
- param_lockmod == "on"
+ Expression: param_lockmod == "lock"
+ param_lockmod == "lock"
true
@@ -321,6 +272,11 @@ global_album = getString("album");
Expression: screenMsg"
request_path == "/fhem-amad/setCommands/screenMsg"
+
+ false
+ Expression: sendIntent"
+ request_path == "/fhem-amad/setCommands/sendIntent"
+
false
Expression: setAlarm"
@@ -683,6 +639,25 @@ global_album = getString("album");
true
+
+ true
+ Broadcast senden: {param_action}
+ {param_action}
+ false
+ android.intent.category.DEFAULT
+ false
+
+ false
+ text/plain
+ false
+
+
+ FLAG_ACTIVITY_NEW_TASK
+ putString("{param_exkey1}", "{param_exval1}");
+putString("{param_exkey2}", "{param_exval2}");
+ false
+
+
true
Display automatisch drehen ein-/ausschalten: Aus
@@ -811,16 +786,6 @@ androidVersion = "4.0 - 4.0.2 Ice Cream Sandwich"
volume_ring_speaker
volumeNotification
-
- true
- Kommandozeilenbefehl als Root ausführen: getevent -c 1 in
- getevent -c 1
-
-
- stdout
- stderr
- exit_code
-
false
Lautstärken setzen param_notifivolume
@@ -943,20 +908,6 @@ FHEMCMD: setreading
/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)
@@ -1004,6 +955,11 @@ FHEMCMD: setreading
Script: airplanemode = "off"
+
+ true
+ Script: androidVersion = "not supported funktion"
+
+
true
Script: bluetooth_state = "off"
@@ -1021,42 +977,12 @@ 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"
@@ -1344,187 +1270,132 @@ FHEMCMD: statusrequest
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"
- 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"
- Script: notification_text = "not supported from your device"
- Benachrichtigung in Statusbar angezeigt: Automagic
- Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff"
- 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"
- Own Reading
- Expression: trigger == "Globale Variable: global_own_reading"
- Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice}
- Initialisiere Variable Systemeinstellung: volumeNotification
- Flugmodus eingeschaltet
- Stromversorgung: Angeschlossen
- Script: airplanemode = "off"
- HTTP Response Information
+ 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"
+ Display Orientierung: Portrait
+ Script: runTask = "0"
+ App Task läuft: {header_activetask} (neuster)
+ Expression: header_activetask != "none"
+ Script: runTask = "null"
+ Script: notification_text = "not supported from your device"
+ Benachrichtigung in Statusbar angezeigt: Automagic
+ Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff"
+ 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"
+ Own Reading
+ Expression: trigger == "Globale Variable: global_own_reading"
+ Script: global_fhemip = {header_fhemip} global_fhemdevice = {header_fhemdevice}
+ Initialisiere Variable Systemeinstellung: volumeNotification
+ Flugmodus eingeschaltet
+ Stromversorgung: Angeschlossen
+ Script: airplanemode = "off"
+ HTTP Response Information
+ Script: setCommandFlow_state = "inaktiv"
+ Script: setCommandFlow_state = "aktiv"
+ Expression: getAndroidSDKVersion() >= "19"
+ Script: runTask = "not supported android version"
Get Android Version
+ Script: androidVersion = "not supported funktion"
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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"
- Pause: 10s (Schlafmodus zulassen)
- Script: global_touch="ja";global_own_reading="{getDate()}_touch";global_touched="ja"
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
SetCommands
@@ -1618,38 +1489,40 @@ FHEMCMD: statusrequest
Expression: trigger == "Sprachbefehl angefordert"
Expression: param_orientation == "portrait"
Setze Lock PIN/Passwort: PIN/Passwort zurücksetzen
- Expression: param_lockmod == "on"
- Expression: setScreenlock"
- Setze Lock PIN/Passwort: Setze PIN von Variable param_lockpin
- Expression: Reboot
- Expression: System Command"
- Neustart
- Expression: Shutdown
- Herunterfahren
- Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung
- Benachrichtigung aus Statusbar entfernen: Alle
- Benachrichtigung aus Statusbar entfernen: Alle (Automagic)
- Expression: Automagic
- Expression: All
- Lautstärken setzen param_notifivolume
- Expression: setNotifiVolume"
- Expression: notifysnd"
- NotificationLautstärke auf Level 7
- Notification Lautstärke Speichern
- Expression: param_notifyfile == "RedAlert.mp3"
- Notification Lautstärke Wiederherstellen
- Expression: setVoiceCommand"
- Flows ausführen: VoiceControl
- Expression: setVibrate"
- Vibrieren: Pattern 2 (-- --)
- Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*"
- Expression: Clear Automagic Meldungen"
- Flugmodus ein-/ausschalten: Ein
- Expression: Airplanemode
- Setze Display Helligkeit: {param_brightness}
+ Setze Lock PIN/Passwort: Setze PIN von Variable param_lockpin
+ Expression: Reboot
+ Expression: System Command"
+ Neustart
+ Expression: Shutdown
+ Herunterfahren
+ Sound: /storage/emulated/0/Notifications/{param_notifyfile} als Benachrichtigung
+ Benachrichtigung aus Statusbar entfernen: Alle
+ Benachrichtigung aus Statusbar entfernen: Alle (Automagic)
+ Expression: Automagic
+ Expression: All
+ Lautstärken setzen param_notifivolume
+ Expression: setNotifiVolume"
+ Expression: notifysnd"
+ NotificationLautstärke auf Level 7
+ Notification Lautstärke Speichern
+ Expression: param_notifyfile == "RedAlert.mp3"
+ Notification Lautstärke Wiederherstellen
+ Expression: setVoiceCommand"
+ Flows ausführen: VoiceControl
+ Expression: setVibrate"
+ Vibrieren: Pattern 2 (-- --)
+ Expression: Clear Automagic Meldungen"
+ Flugmodus ein-/ausschalten: Ein
+ Expression: Airplanemode
+ Setze Display Helligkeit: {param_brightness}
+ Expression: param_lockmod == "lock"
+ Expression: setScreenlock"
+ Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*"
+ Broadcast senden: {param_action}
+ Expression: sendIntent"
-
+
@@ -1725,56 +1598,58 @@ FHEMCMD: statusrequest
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
VoiceControl