diff --git a/fhem/CHANGED b/fhem/CHANGED index c063ee05f..37d7da5b4 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -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. diff --git a/fhem/FHEM/74_AMAD.pm b/fhem/FHEM/74_AMAD.pm index a712c9806..d7ec41547 100644 --- a/fhem/FHEM/74_AMAD.pm +++ b/fhem/FHEM/74_AMAD.pm @@ -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($) {
  • screenOrientation - Landscape/Portrait, screen orientation (horizontal,vertical)
  • screenOrientationMode - auto/manual, mode for screen orientation
  • state - current state of AMAD device
  • +
  • userFlowState - current state of a Flow, established under setUserFlowState Attribut
  • volume - media volume setting
  • volumeNotification - notification volume setting

  • @@ -1465,6 +1498,7 @@ sub AMAD_decrypt($) {
  • 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.
  • timer - set a countdown timer in the "Clock" stock app. Only seconds are allowed as parameter.
  • ttsMsg - send a message which will be played as voice message
  • +
  • userFlowState - set Flow/s active or inactive,set Nexus7Wohnzimmer Badezimmer:inactive vorheizen or set Nexus7Wohnzimmer Badezimmer vorheizen,Nachtlicht Steven:inactive
  • vibrate - vibrate Android device
  • volume - set media volume. Works on internal speaker or, if connected, bluetooth speaker or speaker connected via stereo jack
  • volumeNotification - set notifications volume
  • @@ -1597,6 +1631,7 @@ sub AMAD_decrypt($) {
  • screenOrientation - Landscape,Portrait, Bildschirmausrichtung (Horizontal,Vertikal)
  • screenOrientationMode - auto/manual, Modus für die Ausrichtung (Automatisch, Manuell)
  • state - aktueller Status
  • +
  • userFlowState - aktueller Status eines Flows, festgelegt unter dem setUserFlowState Attribut
  • volume - Media Lautstärkewert
  • volumeNotification - Benachrichtigungs Lautstärke

  • @@ -1624,6 +1659,7 @@ sub AMAD_decrypt($) {
  • 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.
  • timer - setzt einen Timer innerhalb der als Standard definierten ClockAPP auf dem Device. Es können nur Sekunden angegeben werden.
  • ttsMsg - versendet eine Nachricht welche als Sprachnachricht ausgegeben wird
  • +
  • userFlowState - aktiviert oder deaktiviert einen oder mehrere Flows,set Nexus7Wohnzimmer Badezimmer vorheizen:inactive oder set Nexus7Wohnzimmer Badezimmer vorheizen,Nachtlicht Steven:inactive
  • vibrate - lässt das Androidgerät vibrieren
  • 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
  • volumeNotification - setzt die Benachrichtigungslautstärke.
  • diff --git a/fhem/FHEM/lib/74_AMADautomagicFlowset_2.6.3.xml b/fhem/FHEM/lib/74_AMADautomagicFlowset_2.6.4.xml similarity index 77% rename from fhem/FHEM/lib/74_AMADautomagicFlowset_2.6.3.xml rename to fhem/FHEM/lib/74_AMADautomagicFlowset_2.6.4.xml index bf63819d3..7f72f23ab 100644 --- a/fhem/FHEM/lib/74_AMADautomagicFlowset_2.6.3.xml +++ b/fhem/FHEM/lib/74_AMADautomagicFlowset_2.6.4.xml @@ -508,6 +508,11 @@ irname=getString("name") Expression: fhemcmd == "voiceinputvalue" fhemcmd == "voiceinputvalue" + + false + Expression: flowState" + request_path == "/fhem-amad/setCommands/flowState" + true Expression: getAndroidSDKVersion() >= "16" @@ -518,6 +523,11 @@ irname=getString("name") Expression: getAndroidSDKVersion() >= "19" getAndroidSDKVersion() >= "19" + + true + Expression: getAndroidSDKVersion() >= "21" + getAndroidSDKVersion() >= "21" + true Expression: global_activetask != null @@ -530,7 +540,7 @@ irname=getString("name") true - Expression: global_bridgeport == null or global_bridgeport != {header_bport} or global_fhemip == null or global_fhemip != {header_fhemip} or global_fhemdevice == null or global_fhemdevice != {header_fhemdevice} or global_activetask == null or global_activetask != {header_activetask} or global_apssid == null or global_apssid != {header_apssid} or global_deviceport != null or global_deviceport!= {header_dport} + Expression: global_bridgeport == null or global_bridgeport != {header_bport} or global_fhemip == null or global_fhemip != {header_fhemip} or global_fhemdevice == null or global_fhemdevice != {header_fhemdevice} or global_activetask == null or global_activetask != {header_activetask} or global_apssid == null or global_apssid != {header_apssid} or global_deviceport != null or global_deviceport != {header_dport} or global_userflowstate != null or global_userflowstate != {header_userflowstate} global_bridgeport == null or global_bridgeport != {header_bport} @@ -547,13 +557,21 @@ or global_apssid == null or global_apssid != {header_apssid} or global_deviceport != null -or global_deviceport!= {header_dport} +or global_deviceport != {header_dport} + +or global_userflowstate != null +or global_userflowstate != {header_userflowstate} true Expression: global_fhemip != null or header_fhemip != null global_fhemip != null or header_fhemip != null + + true + Expression: global_userflowstate != "none" + global_userflowstate != "none" + false Expression: installFlow" @@ -649,6 +667,16 @@ or global_deviceport!= {header_dport} Expression: param_disturbmod == "onlyImportant" param_disturbmod == "onlyImportant" + + true + Expression: param_flowstate == "active" + param_flowstate == "active" + + + true + Expression: param_flowstate == "active" or param_flowstate == "inactive" + param_flowstate == "active" or param_flowstate == "inactive" + true Expression: param_fullscreen == "off" @@ -980,6 +1008,11 @@ or trigger == "HTTP Request: /fhem-amad/deviceInfo/" Flow Aktiv: SetCommands SetCommands + + true + Flow Aktiv: {global_userflowstate} + {global_userflowstate} + true Gerätespeicherplatz: Freier Speicherplatz > 1kb (/sdcard) @@ -1781,7 +1814,10 @@ if (header_apssid != null or header_apssid != {global_apssid}) { global_apssid = {header_apssid} } if (header_dport != null or header_dport != {global_deviceport}) { - global_deviceport = {header_dport} } + global_deviceport = {header_dport} } + +if (header_userflowstate != null or header_userflowstate != {global_userflowstate}) { + global_userflowstate = {header_userflowstate} } false @@ -1955,6 +1991,12 @@ fhemcmd = "setreading"; true Script: flow_informations = "flow_informations@@" + {informationFlow_state}; fhemcmd = "setreading"; + + + true + Script: flow_informations = "userFlowState@@" + {flowState}; fhemcmd = "setreading"; + @@ -1963,6 +2005,16 @@ fhemcmd = "setreading"; + + true + Script: flowState = "active" + + + + true + Script: flowState = "inactive" + + true Script: if(package_name == "com.google.android.music") { musicapp = "Google Musik" } if(package_name == "com.amazon.mp3") { musicapp = "Amazon Musik" } if(package_name == "com.google.android.videos") { musicapp = "Google Video" } if(package_name == "com.spotify.music") { musicapp = "Spotify Musik" } if(package_name == "com.google.android.youtube") { musicapp = "YouTube" } if(package_name == "tunein.player") { musicapp = "TuneIn Player" } if(package_name == "com.rhapsody.alditalk") { musicapp = "Aldi Life Musik" } @@ -2153,6 +2205,11 @@ fhemcmd = "setreading"; Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + + true + Script: notification_text = "Flow '{param_flowname}' has been set {param_flowstate}" + + true Script: notification_text = "Flow install: path for download not exist" @@ -2269,7 +2326,7 @@ fhemcmd = "setreading"; false Script: Set FHEMDATA -