2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-25 22:09:21 +00:00

74_AMAD: New Version 2.6.3 new Reading userFlowState, new set Command userFlowState

git-svn-id: https://svn.fhem.de/fhem/trunk@12194 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markooldenburg 2016-09-23 09:04:43 +00:00
parent f85a9bece1
commit 5f82a69a5d
3 changed files with 714 additions and 569 deletions

View File

@ -1,5 +1,8 @@
# 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 Version 2.6.3 new Reading userFlowState,
new set Command userFlowState, checkAndroidVersion
on doNotDisturb Reading
- change: suppressReading attribute added for all devices (Forum #57841)
- bugfix: 88_HMCCU: Fixed CUxD device datapoint handling
- change: 10_IT: create events during readings update.

View File

@ -37,8 +37,8 @@ use TcpServerUtils;
use Encode qw(encode);
my $modulversion = "2.6.2";
my $flowsetversion = "2.6.3";
my $modulversion = "2.6.3";
my $flowsetversion = "2.6.4";
@ -64,6 +64,7 @@ sub AMAD_Initialize($) {
"setOpenUrlBrowser ".
"setNotifySndFilePath ".
"setTtsMsgSpeed ".
"setUserFlowState ".
"root:0,1 ".
"port ".
"disable:1 ".
@ -190,9 +191,13 @@ sub AMAD_Attr(@) {
}
elsif( $attrName eq "checkActiveTask" ) {
AMAD_statusRequest( $hash );
if( $cmd eq "del" ) {
CommandDeleteReading( undef, "$name checkActiveTask" );
}
Log3 $name, 3, "AMAD ($name) - $cmd $attrName $attrVal and run statusRequest";
RemoveInternalTimer( $hash );
InternalTimer( gettimeofday(), "AMAD_GetUpdate", $hash, 0 )
}
elsif( $attrName eq "port" ) {
@ -224,12 +229,24 @@ sub AMAD_Attr(@) {
elsif( $attrName eq "setScreenlockPIN" ) {
if( $cmd eq "set" && $attrVal ) {
$attrVal = AMAD_encrypt($attrVal);
$attrVal = AMAD_encrypt($attrVal);
} else {
CommandDeleteReading( undef, "$name screenLock" );
}
}
elsif( $attrName eq "setUserFlowState" ) {
if( $cmd eq "del" ) {
CommandDeleteReading( undef, "$name userFlowState" );
}
Log3 $name, 3, "AMAD ($name) - $cmd $attrName $attrVal and run statusRequest";
RemoveInternalTimer( $hash );
InternalTimer( gettimeofday(), "AMAD_GetUpdate", $hash, 0 )
}
if( $cmd eq "set" ) {
if( $attrVal && $orig ne $attrVal ) {
$attr{$name}{$attrName} = $attrVal;
@ -276,6 +293,7 @@ sub AMAD_statusRequest($) {
my $apssid = $hash->{APSSID};
my $fhemip = ReadingsVal( $bname, "fhemServerIP", "none" );
my $activetask = AttrVal( $name, "checkActiveTask", "none" );
my $userFlowState = AttrVal( $name, "setUserFlowState", "none" );
my $url = "http://" . $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Pfad muß so im Automagic als http request Trigger drin stehen
@ -286,7 +304,7 @@ sub AMAD_statusRequest($) {
timeout => 15,
hash => $hash,
method => "GET",
header => "Connection: close\r\nfhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $bport",
header => "Connection: close\r\nfhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $bport\r\nuserflowstate: $userFlowState",
doTrigger => 1,
callback => \&AMAD_statusRequestErrorHandling,
}
@ -528,6 +546,7 @@ sub AMAD_Set($$@) {
$list .= "currentFlowsetUpdate:noArg ";
$list .= "installFlowSource ";
$list .= "doNotDisturb:never,always,alarmClockOnly,onlyImportant ";
$list .= "userFlowState ";
if( lc $cmd eq 'screenmsg'
|| lc $cmd eq 'ttsmsg'
@ -558,6 +577,7 @@ sub AMAD_Set($$@) {
|| lc $cmd eq 'installflowsource'
|| lc $cmd eq 'opencall'
|| lc $cmd eq 'donotdisturb'
|| lc $cmd eq 'userflowstate'
|| lc $cmd eq 'vibrate') {
Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val);
@ -626,6 +646,18 @@ sub AMAD_SelectSetCmd($$@) {
return AMAD_HTTP_POST( $hash,$url );
}
elsif( lc $cmd eq 'userflowstate' ) {
my $datas = join( " ", @data );
my ($flow,$state) = split( ":", $datas);
$flow =~ s/\s/%20/g;
my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/flowState?flowstate=".$state."&flowname=".$flow;
return AMAD_HTTP_POST( $hash,$url );
}
elsif( lc $cmd eq 'volume' ) {
my $vol = join( " ", @data );
@ -1437,6 +1469,7 @@ sub AMAD_decrypt($) {
<li>screenOrientation - Landscape/Portrait, screen orientation (horizontal,vertical)</li>
<li>screenOrientationMode - auto/manual, mode for screen orientation</li>
<li>state - current state of AMAD device</li>
<li>userFlowState - current state of a Flow, established under setUserFlowState Attribut</li>
<li>volume - media volume setting</li>
<li>volumeNotification - notification volume setting</li>
<br>
@ -1465,6 +1498,7 @@ sub AMAD_decrypt($) {
<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>ttsMsg - send a message which will be played as voice message</li>
<li>userFlowState - set Flow/s active or inactive,<b><i>set Nexus7Wohnzimmer Badezimmer:inactive vorheizen</i> or <i>set Nexus7Wohnzimmer Badezimmer vorheizen,Nachtlicht Steven:inactive</i></b></li>
<li>vibrate - vibrate Android device</li>
<li>volume - set media volume. Works on internal speaker or, if connected, bluetooth speaker or speaker connected via stereo jack</li>
<li>volumeNotification - set notifications volume</li>
@ -1597,6 +1631,7 @@ sub AMAD_decrypt($) {
<li>screenOrientation - Landscape,Portrait, Bildschirmausrichtung (Horizontal,Vertikal)</li>
<li>screenOrientationMode - auto/manual, Modus f&uuml;r die Ausrichtung (Automatisch, Manuell)</li>
<li>state - aktueller Status</li>
<li>userFlowState - aktueller Status eines Flows, festgelegt unter dem setUserFlowState Attribut</li>
<li>volume - Media Lautst&auml;rkewert</li>
<li>volumeNotification - Benachrichtigungs Lautst&auml;rke</li>
<br>
@ -1624,6 +1659,7 @@ sub AMAD_decrypt($) {
<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>ttsMsg - versendet eine Nachricht welche als Sprachnachricht ausgegeben wird</li>
<li>userFlowState - aktiviert oder deaktiviert einen oder mehrere Flows,<b><i>set Nexus7Wohnzimmer Badezimmer vorheizen:inactive</i> oder <i>set Nexus7Wohnzimmer Badezimmer vorheizen,Nachtlicht Steven:inactive</i></b></li>
<li>vibrate - l&auml;sst das Androidger&auml;t vibrieren</li>
<li>volume - setzt die Medialautst&auml;rke. Entweder die internen Lautsprecher oder sofern angeschlossen die Bluetoothlautsprecher und per Klinkenstecker angeschlossene Lautsprecher, + oder - vor dem Wert reduziert die aktuelle Lautst&auml;rke um den Wert</li>
<li>volumeNotification - setzt die Benachrichtigungslautst&auml;rke.</li>