Support for send sms

This commit is contained in:
Marko Oldenburg 2017-01-29 14:19:24 +01:00
parent 94e23ab359
commit 8f5c48628b
2 changed files with 710 additions and 670 deletions

View File

@ -2,7 +2,7 @@
# #
# Developed with Kate # Developed with Kate
# #
# (c) 2015-2016 Copyright: Marko Oldenburg (leongaultier at gmail dot com) # (c) 2015-2017 Copyright: Marko Oldenburg (leongaultier at gmail dot com)
# All rights reserved # All rights reserved
# #
# This script is free software; you can redistribute it and/or modify # This script is free software; you can redistribute it and/or modify
@ -37,8 +37,8 @@ use TcpServerUtils;
use Encode qw(encode); use Encode qw(encode);
my $modulversion = "2.6.7"; my $modulversion = "2.6.8";
my $flowsetversion = "2.6.7"; my $flowsetversion = "2.6.8";
@ -555,6 +555,7 @@ sub AMAD_Set($$@) {
$list .= "installFlowSource "; $list .= "installFlowSource ";
$list .= "doNotDisturb:never,always,alarmClockOnly,onlyImportant "; $list .= "doNotDisturb:never,always,alarmClockOnly,onlyImportant ";
$list .= "userFlowState "; $list .= "userFlowState ";
$list .= "sendSMS ";
if( lc $cmd eq 'screenmsg' if( lc $cmd eq 'screenmsg'
|| lc $cmd eq 'ttsmsg' || lc $cmd eq 'ttsmsg'
@ -580,6 +581,7 @@ sub AMAD_Set($$@) {
|| lc $cmd eq 'volumenotification' || lc $cmd eq 'volumenotification'
|| lc $cmd eq 'screenlock' || lc $cmd eq 'screenlock'
|| lc $cmd eq 'statusrequest' || lc $cmd eq 'statusrequest'
|| lc $cmd eq 'sendsms'
|| lc $cmd eq 'sendintent' || lc $cmd eq 'sendintent'
|| lc $cmd eq 'currentflowsetupdate' || lc $cmd eq 'currentflowsetupdate'
|| lc $cmd eq 'installflowsource' || lc $cmd eq 'installflowsource'
@ -928,6 +930,18 @@ sub AMAD_SelectSetCmd($$@) {
return AMAD_HTTP_POST( $hash,$url ); return AMAD_HTTP_POST( $hash,$url );
} }
elsif( lc $cmd eq 'sendsms' ) {
my $string = join( " ", @data );
my ($smsmessage, $smsnumber) = split( "\\|", $string );
$smsmessage =~ s/%/%25/g;
$smsmessage =~ s/\s/%20/g;
my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/sendSms?smsmessage=".$smsmessage."&smsnumber=".$smsnumber;
return AMAD_HTTP_POST( $hash,$url );
}
return undef; return undef;
} }
@ -1505,6 +1519,7 @@ sub AMAD_decrypt($) {
<li>screenBrightness - 0-255, set screen brighness</li> <li>screenBrightness - 0-255, set screen brighness</li>
<li>screenMsg - display message on screen of Android device</li> <li>screenMsg - display message on screen of Android device</li>
<li>sendintent - send intent string <u>Example:</u><i> set $AMADDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio</i>, first parameter contains the action, second parameter contains the extra. At most two extras can be used.</li> <li>sendintent - send intent string <u>Example:</u><i> set $AMADDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio</i>, first parameter contains the action, second parameter contains the extra. At most two extras can be used.</li>
<li>sendSMS - Sends an SMS to a specific phone number. Bsp.: sendSMS Dies ist ein Test|555487263</li>
<li>statusRequest - Get a new status report of Android device. Not all readings can be updated using a statusRequest as some readings are only updated if the value of the reading changes.</li> <li>statusRequest - Get a new status report of Android device. Not all readings can be updated using a statusRequest as some readings are only updated if the value of the reading changes.</li>
<li>timer - set a countdown timer in the "Clock" stock app. Only seconds are allowed as parameter.</li> <li>timer - set a countdown timer in the "Clock" stock app. Only seconds are allowed as parameter.</li>
<li>ttsMsg - send a message which will be played as voice message</li> <li>ttsMsg - send a message which will be played as voice message</li>
@ -1668,6 +1683,7 @@ sub AMAD_decrypt($) {
<li>screenBrightness - setzt die Bildschirmhelligkeit, von 0-255.</li> <li>screenBrightness - setzt die Bildschirmhelligkeit, von 0-255.</li>
<li>screenMsg - versendet eine Bildschirmnachricht</li> <li>screenMsg - versendet eine Bildschirmnachricht</li>
<li>sendintent - sendet einen Intentstring <u>Bsp:</u><i> set $AMADDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio</i>, der erste Befehl ist die Aktion und der zweite das Extra. Es k&ouml;nnen immer zwei Extras mitgegeben werden.</li> <li>sendintent - sendet einen Intentstring <u>Bsp:</u><i> set $AMADDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio</i>, der erste Befehl ist die Aktion und der zweite das Extra. Es k&ouml;nnen immer zwei Extras mitgegeben werden.</li>
<li>sendSMS - sendet eine SMS an eine bestimmte Telefonnummer. Bsp.: sendSMS Dies ist ein Test|555487263</li>
<li>statusRequest - Fordert einen neuen Statusreport beim Device an. Es k&ouml;nnen nicht von allen Readings per statusRequest die Daten geholt werden. Einige wenige geben nur bei Status&auml;nderung ihren Status wieder.</li> <li>statusRequest - Fordert einen neuen Statusreport beim Device an. Es k&ouml;nnen nicht von allen Readings per statusRequest die Daten geholt werden. Einige wenige geben nur bei Status&auml;nderung ihren Status wieder.</li>
<li>timer - setzt einen Timer innerhalb der als Standard definierten ClockAPP auf dem Device. Es k&ouml;nnen nur Sekunden angegeben werden.</li> <li>timer - setzt einen Timer innerhalb der als Standard definierten ClockAPP auf dem Device. Es k&ouml;nnen nur Sekunden angegeben werden.</li>
<li>ttsMsg - versendet eine Nachricht welche als Sprachnachricht ausgegeben wird</li> <li>ttsMsg - versendet eine Nachricht welche als Sprachnachricht ausgegeben wird</li>