neues Reading userFlowState und Fehlerbereinigungen
This commit is contained in:
		
							
								
								
									
										45
									
								
								74_AMAD.pm
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								74_AMAD.pm
									
									
									
									
									
								
							@@ -64,6 +64,7 @@ sub AMAD_Initialize($) {
 | 
				
			|||||||
			  "setOpenUrlBrowser ".
 | 
								  "setOpenUrlBrowser ".
 | 
				
			||||||
			  "setNotifySndFilePath ".
 | 
								  "setNotifySndFilePath ".
 | 
				
			||||||
			  "setTtsMsgSpeed ".
 | 
								  "setTtsMsgSpeed ".
 | 
				
			||||||
 | 
								  "setUserFlowState ".
 | 
				
			||||||
			  "root:0,1 ".
 | 
								  "root:0,1 ".
 | 
				
			||||||
			  "port ".
 | 
								  "port ".
 | 
				
			||||||
			  "disable:1 ".
 | 
								  "disable:1 ".
 | 
				
			||||||
@@ -190,9 +191,13 @@ sub AMAD_Attr(@) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    elsif( $attrName eq "checkActiveTask" ) {
 | 
					    elsif( $attrName eq "checkActiveTask" ) {
 | 
				
			||||||
    
 | 
					        if( $cmd eq "del" ) {
 | 
				
			||||||
        AMAD_statusRequest( $hash );
 | 
					            CommandDeleteReading( undef, "$name checkActiveTask" ); 
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        Log3 $name, 3, "AMAD ($name) - $cmd $attrName $attrVal and run statusRequest";
 | 
					        Log3 $name, 3, "AMAD ($name) - $cmd $attrName $attrVal and run statusRequest";
 | 
				
			||||||
 | 
					        RemoveInternalTimer( $hash );
 | 
				
			||||||
 | 
					        InternalTimer( gettimeofday(), "AMAD_GetUpdate", $hash, 0 )
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    elsif( $attrName eq "port" ) {
 | 
					    elsif( $attrName eq "port" ) {
 | 
				
			||||||
@@ -224,12 +229,24 @@ sub AMAD_Attr(@) {
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    elsif( $attrName eq "setScreenlockPIN" ) {
 | 
					    elsif( $attrName eq "setScreenlockPIN" ) {
 | 
				
			||||||
	if( $cmd eq "set" && $attrVal ) {
 | 
						if( $cmd eq "set" && $attrVal ) {
 | 
				
			||||||
                $attrVal = AMAD_encrypt($attrVal);
 | 
					            $attrVal = AMAD_encrypt($attrVal);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            CommandDeleteReading( undef, "$name screenLock" );
 | 
					            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( $cmd eq "set" ) {
 | 
				
			||||||
        if( $attrVal && $orig ne $attrVal ) {
 | 
					        if( $attrVal && $orig ne $attrVal ) {
 | 
				
			||||||
            $attr{$name}{$attrName} = $attrVal;
 | 
					            $attr{$name}{$attrName} = $attrVal;
 | 
				
			||||||
@@ -276,6 +293,7 @@ sub AMAD_statusRequest($) {
 | 
				
			|||||||
    my $apssid = $hash->{APSSID};
 | 
					    my $apssid = $hash->{APSSID};
 | 
				
			||||||
    my $fhemip = ReadingsVal( $bname, "fhemServerIP", "none" );
 | 
					    my $fhemip = ReadingsVal( $bname, "fhemServerIP", "none" );
 | 
				
			||||||
    my $activetask = AttrVal( $name, "checkActiveTask", "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
 | 
					    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,
 | 
						    timeout	=> 15,
 | 
				
			||||||
	    hash	=> $hash,
 | 
						    hash	=> $hash,
 | 
				
			||||||
	    method	=> "GET",
 | 
						    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,
 | 
						    doTrigger	=> 1,
 | 
				
			||||||
	    callback	=> \&AMAD_statusRequestErrorHandling,
 | 
						    callback	=> \&AMAD_statusRequestErrorHandling,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -528,7 +546,7 @@ sub AMAD_Set($$@) {
 | 
				
			|||||||
	$list .= "currentFlowsetUpdate:noArg ";
 | 
						$list .= "currentFlowsetUpdate:noArg ";
 | 
				
			||||||
	$list .= "installFlowSource ";
 | 
						$list .= "installFlowSource ";
 | 
				
			||||||
	$list .= "doNotDisturb:never,always,alarmClockOnly,onlyImportant ";
 | 
						$list .= "doNotDisturb:never,always,alarmClockOnly,onlyImportant ";
 | 
				
			||||||
	$list .= "flowState ";
 | 
						$list .= "userFlowState ";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if( lc $cmd eq 'screenmsg'
 | 
						if( lc $cmd eq 'screenmsg'
 | 
				
			||||||
	    || lc $cmd eq 'ttsmsg'
 | 
						    || lc $cmd eq 'ttsmsg'
 | 
				
			||||||
@@ -559,7 +577,7 @@ sub AMAD_Set($$@) {
 | 
				
			|||||||
	    || lc $cmd eq 'installflowsource'
 | 
						    || lc $cmd eq 'installflowsource'
 | 
				
			||||||
	    || lc $cmd eq 'opencall'
 | 
						    || lc $cmd eq 'opencall'
 | 
				
			||||||
	    || lc $cmd eq 'donotdisturb'
 | 
						    || lc $cmd eq 'donotdisturb'
 | 
				
			||||||
	    || lc $cmd eq 'flowstate'
 | 
						    || lc $cmd eq 'userflowstate'
 | 
				
			||||||
	    || lc $cmd eq 'vibrate') {
 | 
						    || lc $cmd eq 'vibrate') {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val);
 | 
						    Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val);
 | 
				
			||||||
@@ -628,13 +646,12 @@ sub AMAD_SelectSetCmd($$@) {
 | 
				
			|||||||
	return AMAD_HTTP_POST( $hash,$url );
 | 
						return AMAD_HTTP_POST( $hash,$url );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    elsif( lc $cmd eq 'flowstate' ) {
 | 
					    elsif( lc $cmd eq 'userflowstate' ) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        my $datas = join( " ", @data );
 | 
					        my $datas = join( " ", @data );
 | 
				
			||||||
        my ($state,$flow) = split( ";", $datas);
 | 
					        my ($state,$flow) = split( ":", $datas);
 | 
				
			||||||
	
 | 
					        
 | 
				
			||||||
	$flow =~ s/%/%25/g;
 | 
						$flow          =~ s/\s/%20/g;    
 | 
				
			||||||
	$flow =~ s/\s/%20/g;    
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/flowState?flowstate=".$state."&flowname=".$flow;
 | 
						my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/flowState?flowstate=".$state."&flowname=".$flow;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@@ -1452,6 +1469,7 @@ sub AMAD_decrypt($) {
 | 
				
			|||||||
    <li>screenOrientation - Landscape/Portrait, screen orientation (horizontal,vertical)</li>
 | 
					    <li>screenOrientation - Landscape/Portrait, screen orientation (horizontal,vertical)</li>
 | 
				
			||||||
    <li>screenOrientationMode - auto/manual, mode for screen orientation</li>
 | 
					    <li>screenOrientationMode - auto/manual, mode for screen orientation</li>
 | 
				
			||||||
    <li>state - current state of AMAD device</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>volume - media volume setting</li>
 | 
				
			||||||
    <li>volumeNotification - notification volume setting</li>
 | 
					    <li>volumeNotification - notification volume setting</li>
 | 
				
			||||||
    <br>
 | 
					    <br>
 | 
				
			||||||
@@ -1469,7 +1487,6 @@ sub AMAD_decrypt($) {
 | 
				
			|||||||
    <li>currentFlowsetUpdate - start flowset update on Android device</li>
 | 
					    <li>currentFlowsetUpdate - start flowset update on Android device</li>
 | 
				
			||||||
    <li>installFlowSource - install a Automagic flow on device, <u>XML file must be stored in /tmp/ with extension xml</u>. <b>Example:</b> <i>set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml</i></li>
 | 
					    <li>installFlowSource - install a Automagic flow on device, <u>XML file must be stored in /tmp/ with extension xml</u>. <b>Example:</b> <i>set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml</i></li>
 | 
				
			||||||
    <li>doNotDisturb - sets the do not Disturb Mode, always Disturb, never Disturb, alarmClockOnly alarm Clock only, onlyImportant only important Disturbs</li>
 | 
					    <li>doNotDisturb - sets the do not Disturb Mode, always Disturb, never Disturb, alarmClockOnly alarm Clock only, onlyImportant only important Disturbs</li>
 | 
				
			||||||
    <li>flowState - set Flow/s active or inactive,<b><i>set Nexus7Wohnzimmer inactive;Badezimmer vorheizen</i> or <i>set Nexus7Wohnzimmer inactive;Badezimmer vorheizen,Nachtlicht Steven</i></b></li>
 | 
					 | 
				
			||||||
    <li>mediaAmazonMusic - play/stop/next/back , controlling the amazon music media player</li>
 | 
					    <li>mediaAmazonMusic - play/stop/next/back , controlling the amazon music media player</li>
 | 
				
			||||||
    <li>mediaGoogleMusic - play/stop/next/back , controlling the google play music media player</li>
 | 
					    <li>mediaGoogleMusic - play/stop/next/back , controlling the google play music media player</li>
 | 
				
			||||||
    <li>mediaSpotifyMusic - play/stop/next/back , controlling the spotify media player</li>
 | 
					    <li>mediaSpotifyMusic - play/stop/next/back , controlling the spotify media player</li>
 | 
				
			||||||
@@ -1481,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>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>
 | 
				
			||||||
 | 
					    <li>userFlowState - set Flow/s active or inactive,<b><i>set Nexus7Wohnzimmer inactive:Badezimmer vorheizen</i> or <i>set Nexus7Wohnzimmer inactive:Badezimmer vorheizen,Nachtlicht Steven</i></b></li>
 | 
				
			||||||
    <li>vibrate - vibrate Android device</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>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>
 | 
					    <li>volumeNotification - set notifications volume</li>
 | 
				
			||||||
@@ -1613,6 +1631,7 @@ sub AMAD_decrypt($) {
 | 
				
			|||||||
    <li>screenOrientation - Landscape,Portrait, Bildschirmausrichtung (Horizontal,Vertikal)</li>
 | 
					    <li>screenOrientation - Landscape,Portrait, Bildschirmausrichtung (Horizontal,Vertikal)</li>
 | 
				
			||||||
    <li>screenOrientationMode - auto/manual, Modus für die Ausrichtung (Automatisch, Manuell)</li>
 | 
					    <li>screenOrientationMode - auto/manual, Modus für die Ausrichtung (Automatisch, Manuell)</li>
 | 
				
			||||||
    <li>state - aktueller Status</li>
 | 
					    <li>state - aktueller Status</li>
 | 
				
			||||||
 | 
					    <li>userFlowState - aktueller Status eines Flows, festgelegt unter dem setUserFlowState Attribut</li>
 | 
				
			||||||
    <li>volume - Media Lautstärkewert</li>
 | 
					    <li>volume - Media Lautstärkewert</li>
 | 
				
			||||||
    <li>volumeNotification - Benachrichtigungs Lautstärke</li>
 | 
					    <li>volumeNotification - Benachrichtigungs Lautstärke</li>
 | 
				
			||||||
    <br>
 | 
					    <br>
 | 
				
			||||||
@@ -1629,7 +1648,6 @@ sub AMAD_decrypt($) {
 | 
				
			|||||||
    <li>clearNotificationBar - All,Automagic, löscht alle Meldungen oder nur die Automagic Meldungen in der Statusleiste</li>
 | 
					    <li>clearNotificationBar - All,Automagic, löscht alle Meldungen oder nur die Automagic Meldungen in der Statusleiste</li>
 | 
				
			||||||
    <li>currentFlowsetUpdate - fürt ein Flowsetupdate auf dem Device durch</li>
 | 
					    <li>currentFlowsetUpdate - fürt ein Flowsetupdate auf dem Device durch</li>
 | 
				
			||||||
    <li>doNotDisturb - schaltet den nicht stören Modus, always immer stören, never niemals stören, alarmClockOnly nur Wecker darf stören, onlyImportant nur wichtige Störungen</li>
 | 
					    <li>doNotDisturb - schaltet den nicht stören Modus, always immer stören, never niemals stören, alarmClockOnly nur Wecker darf stören, onlyImportant nur wichtige Störungen</li>
 | 
				
			||||||
    <li>flowState - aktiviert oder deaktiviert einen oder mehrere Flows,<b><i>set Nexus7Wohnzimmer inactive;Badezimmer vorheizen</i> oder <i>set Nexus7Wohnzimmer inactive;Badezimmer vorheizen,Nachtlicht Steven</i></b></li>
 | 
					 | 
				
			||||||
    <li>installFlowSource - installiert einen Flow auf dem Device, <u>das XML File muss unter /tmp/ liegen und die Endung xml haben</u>. <b>Bsp:</b> <i>set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml</i></li>
 | 
					    <li>installFlowSource - installiert einen Flow auf dem Device, <u>das XML File muss unter /tmp/ liegen und die Endung xml haben</u>. <b>Bsp:</b> <i>set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml</i></li>
 | 
				
			||||||
    <li>mediaAmazonMusic - play, stop, next, back  ,steuert den Amazon Musik Mediaplayer</li>
 | 
					    <li>mediaAmazonMusic - play, stop, next, back  ,steuert den Amazon Musik Mediaplayer</li>
 | 
				
			||||||
    <li>mediaGoogleMusic - play, stop, next, back  ,steuert den Google Play Musik Mediaplayer</li>
 | 
					    <li>mediaGoogleMusic - play, stop, next, back  ,steuert den Google Play Musik Mediaplayer</li>
 | 
				
			||||||
@@ -1641,6 +1659,7 @@ sub AMAD_decrypt($) {
 | 
				
			|||||||
    <li>statusRequest - Fordert einen neuen Statusreport beim Device an. Es können nicht von allen Readings per statusRequest die Daten geholt werden. Einige wenige geben nur bei Statusänderung ihren Status wieder.</li>
 | 
					    <li>statusRequest - Fordert einen neuen Statusreport beim Device an. Es können nicht von allen Readings per statusRequest die Daten geholt werden. Einige wenige geben nur bei Statusänderung ihren Status wieder.</li>
 | 
				
			||||||
    <li>timer - setzt einen Timer innerhalb der als Standard definierten ClockAPP auf dem Device. Es können nur Sekunden angegeben werden.</li>
 | 
					    <li>timer - setzt einen Timer innerhalb der als Standard definierten ClockAPP auf dem Device. Es kö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>
 | 
				
			||||||
 | 
					    <li>userFlowState - aktiviert oder deaktiviert einen oder mehrere Flows,<b><i>set Nexus7Wohnzimmer inactive:Badezimmer vorheizen</i> oder <i>set Nexus7Wohnzimmer inactive:Badezimmer vorheizen,Nachtlicht Steven</i></b></li>
 | 
				
			||||||
    <li>vibrate - lässt das Androidgerät vibrieren</li>
 | 
					    <li>vibrate - lässt das Androidgerät vibrieren</li>
 | 
				
			||||||
    <li>volume - setzt die Medialautstärke. Entweder die internen Lautsprecher oder sofern angeschlossen die Bluetoothlautsprecher und per Klinkenstecker angeschlossene Lautsprecher, + oder - vor dem Wert reduziert die aktuelle Lautstärke um den Wert</li>
 | 
					    <li>volume - setzt die Medialautstärke. Entweder die internen Lautsprecher oder sofern angeschlossen die Bluetoothlautsprecher und per Klinkenstecker angeschlossene Lautsprecher, + oder - vor dem Wert reduziert die aktuelle Lautstärke um den Wert</li>
 | 
				
			||||||
    <li>volumeNotification - setzt die Benachrichtigungslautstärke.</li>
 | 
					    <li>volumeNotification - setzt die Benachrichtigungslautstärke.</li>
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user