From d5691dfceb8d582aca566ec98a02b4c56e7fd9d3 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sat, 13 May 2017 00:26:16 +0200 Subject: [PATCH 01/32] CommBridge Function is running --- 73_AMADCommBridge.pm | 1204 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1204 insertions(+) create mode 100644 73_AMADCommBridge.pm diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm new file mode 100644 index 0000000..7975ecb --- /dev/null +++ b/73_AMADCommBridge.pm @@ -0,0 +1,1204 @@ +############################################################################### +# +# Developed with Kate +# +# (c) 2015-2017 Copyright: Marko Oldenburg (leongaultier at gmail dot com) +# All rights reserved +# +# This script is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# any later version. +# +# The GNU General Public License can be found at +# http://www.gnu.org/copyleft/gpl.html. +# A copy is found in the textfile GPL.txt and important notices to the license +# from the author is found in LICENSE.txt distributed with these scripts. +# +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# +# $Id$ +# +############################################################################### +## +## +## Das JSON Modul immer in einem eval aufrufen +# $data = eval{decode_json($data)}; +# +# if($@){ +# Log3($SELF, 2, "$TYPE ($SELF) - error while request: $@"); +# +# readingsSingleUpdate($hash, "state", "error", 1); +# +# return; +# } +## +## + + + +package main; + +use strict; +use warnings; +use Time::HiRes qw(gettimeofday); + +use HttpUtils; +use TcpServerUtils; +use Encode qw(encode); + + +my $modulversion = "3alpha5"; +my $flowsetversion = "2.6.12"; + + + + +# Declare functions +sub AMADCommBridge_Attr(@); +sub AMADCommBridge_Open($); +sub AMADCommBridge_Read($); +sub AMADCommBridge_Define($$); +sub AMADCommBridge_Header2Hash($); +sub AMADCommBridge_HTTP_POST($$); +sub AMADCommBridge_HTTP_POSTerrorHandling($$$); +sub AMADCommBridge_Initialize($); +sub AMADCommBridge_Set($@); +sub AMADCommBridge_statusRequest($); +sub AMADCommBridge_statusRequestErrorHandling($$$); +sub AMADCommBridge_Undef($$); +sub AMADCommBridge_ResponseProcessing($$); +sub AMADCommBridge_Close($); + + + + +sub AMADCommBridge_Initialize($) { + + my ($hash) = @_; + + + # Provider + $hash->{ReadFn} = "AMADCommBridge_Read"; + $hash->{WriteFn} = "AMADCommBridge_Write"; + $hash->{Clients} = ":AMADDevice:"; + $hash->{MatchList} = { "1:AMADDevice" => '.*' }; + + + # Consumer + $hash->{SetFn} = "AMADCommBridge_Set"; + $hash->{DefFn} = "AMADCommBridge_Define"; + $hash->{UndefFn} = "AMADCommBridge_Undef"; + + $hash->{AttrFn} = "AMADCommBridge_Attr"; + $hash->{AttrList} = "expertMode:0,1 ". + "port ". + "disable:1 ". + $readingFnAttributes; + + foreach my $d(sort keys %{$modules{AMADCommBridge}{defptr}}) { + + my $hash = $modules{AMADCommBridge}{defptr}{$d}; + $hash->{VERSIONMODUL} = $modulversion; + $hash->{VERSIONFLOWSET} = $flowsetversion; + } +} + +sub AMADCommBridge_Define($$) { + + my ( $hash, $def ) = @_; + + my @a = split( "[ \t][ \t]*", $def ); + + + return "too few parameters: define AMADCommBridge ''" if( @a < 2 and @a > 3 ); + + my $name = $a[0]; + my $host = $a[2]; + + my $port; + $port = $a[3] if($a[3]); + $port = 8090 if( not defined($port) and (!$port) ); + + $hash->{BRIDGE} = 1; + $hash->{HOST} = $host; + $hash->{PORT} = $port; + $hash->{VERSIONMODUL} = $modulversion; + $hash->{VERSIONFLOWSET} = $flowsetversion; + + ### Muss in das logische Modul eingepflegt werden +# $hash->{helper}{infoErrorCounter} = 0 if( $hash->{HOST} ); +# $hash->{helper}{setCmdErrorCounter} = 0 if( $hash->{HOST} ); +# $hash->{helper}{deviceStateErrorCounter} = 0 if( $hash->{HOST} ); + + $attr{$name}{room} = "AMAD" if( !defined( $attr{$name}{room} ) ); + + Log3 $name, 3, "AMADCommBridge ($name) - defined AMADCommBridge at $host with Socketport $port"; + + AMADCommBridge_Open( $hash ); + + $modules{AMADCommBridge}{defptr}{BRIDGE} = $hash; + + return undef; +} + +sub AMADCommBridge_Undef($$) { + + my ( $hash, $arg ) = @_; + + + delete $modules{AMADCommBridge}{defptr}{BRIDGE} if( defined($modules{AMADCommBridge}{defptr}{BRIDGE}) and $hash->{BRIDGE} ); + TcpServer_Close( $hash ); + + return undef; +} + +sub AMADCommBridge_Attr(@) { + + my ( $cmd, $name, $attrName, $attrVal ) = @_; + my $hash = $defs{$name}; + + my $orig = $attrVal; + + if( $attrName eq "disable" ) { + if( $cmd eq "set" ) { + if( $attrVal eq "0" ) { + + readingsSingleUpdate ( $hash, "state", "enabled", 1 ); + AMADCommBridge_Open($hash); + Log3 $name, 3, "AMADCommBridge ($name) - enabled"; + } else { + + AMADCommBridge_Close($hash); + readingsSingleUpdate ( $hash, "state", "disabled", 1 ) if( not defined($hash->{FD}) ); + Log3 $name, 3, "AMADCommBridge ($name) - disabled"; + } + + } else { + + readingsSingleUpdate ( $hash, "state", "enabled", 1 ); + AMADCommBridge_Open($hash); + Log3 $name, 3, "AMADCommBridge ($name) - enabled"; + } + } + + elsif( $attrName eq "port" ) { + if( $cmd eq "set" ) { + + $hash->{PORT} = $attrVal; + + delete $modules{AMADCommBridge}{defptr}{BRIDGE}; + TcpServer_Close( $hash ); + Log3 $name, 3, "AMADCommBridge ($name) - CommBridge Port changed. CommBridge are closed and new open!"; + + AMADCommBridge_CommBridge_Open( $hash ); + + } else { + + $hash->{PORT} = 8090; + + delete $modules{AMADCommBridge}{defptr}{BRIDGE}; + TcpServer_Close( $hash ); + Log3 $name, 3, "AMADCommBridge ($name) - CommBridge Port changed. CommBridge are closed and new open!"; + + AMADCommBridge_Open( $hash ); + } + } + + return undef; +} + +sub AMADCommBridge_statusRequest($) { + + my ($hash) = @_; + my $name = $hash->{NAME}; + my $fhemip = $hash->{HOST}; + my $port = $hash->{PORT}; + my $host; + my $activetask = AttrVal( $name, "checkActiveTask", "none" ); + my $userFlowState = AttrVal( $name, "setUserFlowState", "none" ); + my $apssid = "none"; + $apssid = $hash->{APSSID} if( defined($hash->{APSSID}) ); + $apssid = $attr{$name}{setAPSSID} if( defined($attr{$name}{setAPSSID}) ); + + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Pfad muß so im Automagic als http request Trigger drin stehen + + HttpUtils_NonblockingGet( + { + url => $url, + timeout => 5, + hash => $hash, + method => "GET", + header => "Connection: close\r\nfhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $port\r\nuserflowstate: $userFlowState", + doTrigger => 1, + callback => \&AMADCommBridge_statusRequestErrorHandling, + } + ); + + Log3 $name, 5, "AMADCommBridge ($name) - Send statusRequest with URL: \"$url\" and Header: \"fhemIP: $fhemip\r\nfhemDevice: $name\r\nactiveTask: $activetask\r\napSSID: $apssid\""; +} + +sub AMADCommBridge_statusRequestErrorHandling($$$) { + + my ( $param, $err, $data ) = @_; + my $hash = $param->{hash}; + my $doTrigger = $param->{doTrigger}; + my $name = $hash->{NAME}; + my $host = $hash->{HOST}; + + + ### Begin Error Handling + if( $hash->{helper}{infoErrorCounter} > 0 ) { + + readingsBeginUpdate( $hash ); + readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_error" ); + + if( ReadingsVal( $name, "flow_Informations", "active" ) eq "inactive" && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; + + readingsBulkUpdate( $hash, "deviceState", "offline" ); + readingsBulkUpdate ( $hash, "state", "AMAD Flows inactive, device set offline"); + } + + elsif( $hash->{helper}{infoErrorCounter} > 7 && $hash->{helper}{setCmdErrorCounter} > 4 ) { + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; + + $attr{$name}{disable} = 1; + readingsBulkUpdate ( $hash, "state", "Unknown Error, device disabled"); + + $hash->{helper}{infoErrorCounter} = 0; + $hash->{helper}{setCmdErrorCounter} = 0; + + return; + } + + elsif( ReadingsVal( $name, "flow_Informations", "active" ) eq "inactive" ) { + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: Informations Flow on your Device is inactive, will try to reactivate"; + } + + elsif( $hash->{helper}{infoErrorCounter} > 7 ) { + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; + + readingsBulkUpdate( $hash, "deviceState", "offline" ); + readingsBulkUpdate ( $hash, "state", "To many Errors, device set offline"); + $hash->{helper}{infoErrorCounter} = 0; + } + + elsif($hash->{helper}{infoErrorCounter} > 2 && ReadingsVal( $name, "flow_Informations", "active" ) eq "active" ){ + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: Please check the AutomagicAPP on your Device"; + } + + readingsEndUpdate( $hash, 1 ); + } + + if( defined( $err ) ) { + if( $err ne "" ) { + + readingsBeginUpdate( $hash ); + readingsBulkUpdate ( $hash, "state", "$err") if( ReadingsVal( $name, "state", 1 ) ne "initialized" ); + $hash->{helper}{infoErrorCounter} = ( $hash->{helper}{infoErrorCounter} + 1 ); + + readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_error" ); + + if( $err =~ /timed out/ ) { + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: connect to your device is timed out. check network"; + } + + elsif( ( $err =~ /Keine Route zum Zielrechner/ ) && $hash->{helper}{infoErrorCounter} > 1 ) { + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: no route to target. bad network configuration or network is down"; + + } else { + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: $err"; + } + + readingsEndUpdate( $hash, 1 ); + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: AMADCommBridge_statusRequestErrorHandling: error while requesting AutomagicInfo: $err"; + + return; + } + } + + if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { + + readingsBeginUpdate( $hash ); + readingsBulkUpdate ( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state", 1 ) ne "initialized" ); + $hash->{helper}{infoErrorCounter} = ( $hash->{helper}{infoErrorCounter} + 1 ); + + readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_error" ); + + if( $param->{code} ne 200 ) { + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: ".$param->{code}; + } + + readingsEndUpdate( $hash, 1 ); + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: received http code ".$param->{code}." without any data after requesting AMAD AutomagicInfo"; + + return; + } + + if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { + readingsBeginUpdate( $hash ); + readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state" ,0) ne "initialized" ); + $hash->{helper}{infoErrorCounter} = ( $hash->{helper}{infoErrorCounter} + 1 ); + + readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_error" ); + + if( $param->{code} eq 404 && ReadingsVal( $name, "flow_Informations", "inactive" ) eq "inactive" ) { + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: check the informations flow on your device"; + } + + elsif( $param->{code} eq 404 && ReadingsVal( $name, "flow_Informations", "active" ) eq "active" ) { + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: check the automagicApp on your device"; + + } else { + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: http error ".$param->{code}; + } + + readingsEndUpdate( $hash, 1 ); + + Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: received http code ".$param->{code}." receive Error after requesting AMAD AutomagicInfo"; + + return; + } + + ### End Error Handling + + $hash->{helper}{infoErrorCounter} = 0; +} + +sub AMADCommBridge_Set($@) { + + my ($hash, $name, $cmd, @args) = @_; + my ($arg, @params) = @args; + + + if( $cmd eq 'open' ) { + + AMADCommBridge_Open($hash); + + } elsif( $cmd eq 'close' ) { + + AMADCommBridge_Close($hash); + + } else { + my $list = "open:noArg close:noArg"; + return "Unknown argument $cmd, choose one of $list"; + } +} + +sub AMADCommBridge_HTTP_POST($$) { + + my ( $hash, $url ) = @_; + my $name = $hash->{NAME}; + + my $state = ReadingsVal( $name, "state", 0 ); + + readingsSingleUpdate( $hash, "state", "Send HTTP POST", 1 ); + + HttpUtils_NonblockingGet( + { + url => $url, + timeout => 15, + hash => $hash, + method => "POST", + header => "Connection: close", + doTrigger => 1, + callback => \&AMADCommBridge_HTTP_POSTerrorHandling, + } + ); + + Log3 $name, 4, "AMADCommBridge ($name) - Send HTTP POST with URL $url"; + + readingsSingleUpdate( $hash, "state", $state, 1 ); + + return undef; +} + +sub AMADCommBridge_HTTP_POSTerrorHandling($$$) { + + my ( $param, $err, $data ) = @_; + my $hash = $param->{hash}; + my $name = $hash->{NAME}; + + + ### Begin Error Handling + if( $hash->{helper}{setCmdErrorCounter} > 2 ) { + + readingsBeginUpdate( $hash ); + readingsBulkUpdate( $hash, "lastSetCommandState", "statusRequest_error" ); + + if( ReadingsVal( $name, "flow_Informations", "active" ) eq "inactive" && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { + + Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; + + readingsBulkUpdate( $hash, "deviceState", "offline" ); + readingsBulkUpdate( $hash, "state", "AMAD Flows inactive, device set offline" ); + } + + elsif( $hash->{helper}{infoErrorCounter} > 7 && $hash->{helper}{setCmdErrorCounter} > 4 ) { + + Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; + + $attr{$name}{disable} = 1; + readingsBulkUpdate( $hash, "state", "Unknown Error, device disabled" ); + $hash->{helper}{infoErrorCounter} = 0; + $hash->{helper}{setCmdErrorCounter} = 0; + + return; + } + + elsif( ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { + + Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: Flow SetCommands on your Device is inactive, will try to reactivate"; + } + + elsif( $hash->{helper}{setCmdErrorCounter} > 9 ) { + + Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; + + readingsBulkUpdate( $hash, "deviceState", "offline" ); + readingsBulkUpdate( $hash, "state", "To many Errors, device set offline" ); + $hash->{helper}{setCmdErrorCounter} = 0; + } + + elsif( $hash->{helper}{setCmdErrorCounter} > 4 && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "active" ){ + + Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: Please check the AutomagicAPP on your Device"; + } + + readingsEndUpdate( $hash, 1 ); + } + + if( defined( $err ) ) { + if( $err ne "" ) { + readingsBeginUpdate( $hash ); + readingsBulkUpdate( $hash, "state", $err ) if( ReadingsVal( $name, "state", 0 ) ne "initialized" ); + $hash->{helper}{setCmdErrorCounter} = ($hash->{helper}{setCmdErrorCounter} + 1); + + readingsBulkUpdate( $hash, "lastSetCommandState", "setCmd_error" ); + + if( $err =~ /timed out/ ) { + + Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: connect to your device is timed out. check network"; + } + + elsif( $err =~ /Keine Route zum Zielrechner/ ) { + + Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: no route to target. bad network configuration or network is down"; + + } else { + + Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: $err"; + } + + readingsEndUpdate( $hash, 1 ); + + Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: error while POST Command: $err"; + + return; + } + } + + if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { + + readingsBeginUpdate( $hash ); + readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $hash, "state", 0 ) ne "initialized" ); + + $hash->{helper}{setCmdErrorCounter} = ( $hash->{helper}{setCmdErrorCounter} + 1 ); + + readingsBulkUpdate($hash, "lastSetCommandState", "setCmd_error" ); + + readingsEndUpdate( $hash, 1 ); + + Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: received http code ".$param->{code}; + + return; + } + + if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { + + readingsBeginUpdate( $hash ); + readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state", 0 ) ne "initialized" ); + + $hash->{helper}{setCmdErrorCounter} = ( $hash->{helper}{setCmdErrorCounter} + 1 ); + + readingsBulkUpdate( $hash, "lastSetCommandState", "setCmd_error" ); + + if( $param->{code} eq 404 ) { + + readingsBulkUpdate( $hash, "lastSetCommandError", "" ); + Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: setCommands flow is inactive on your device!"; + + } else { + + Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: http error ".$param->{code}; + } + + return; + } + + ### End Error Handling + + readingsSingleUpdate( $hash, "lastSetCommandState", "setCmd_done", 1 ); + $hash->{helper}{setCmdErrorCounter} = 0; + + return undef; +} + +sub AMADCommBridge_Open($) { + + my $hash = shift; + my $name = $hash->{NAME}; + my $port = $hash->{PORT}; + + + # Oeffnen des TCP Sockets + my $ret = TcpServer_Open( $hash, $port, "global" ); + + if( $ret && !$init_done ) { + + Log3 $name, 3, "AMADCommBridge ($name) - $ret. Exiting."; + exit(1); + } + + readingsSingleUpdate ( $hash, "state", "opened", 1 ) if( defined($hash->{FD}) ); + Log3 $name, 3, "AMADCommBridge ($name) - Socket opened."; + + return; +} + +sub AMADCommBridge_Close($) { + + my $hash = shift; + + my $name = $hash->{NAME}; + + delete $modules{AMADCommBridge}{defptr}{BRIDGE}; + TcpServer_Close( $hash ); + + if( not defined($hash->{FD}) ) { + readingsSingleUpdate ( $hash, "state", "closed", 1 ); + Log3 $name, 3, "AMADCommBridge ($name) - Socket closed."; + + } else { + Log3 $name, 3, "AMADCommBridge ($name) - can't close Socket."; + } + + return; +} + +sub AMADCommBridge_Read($) { + + my $hash = shift; + + + if( $hash->{SERVERSOCKET} ) { # Accept and create a child + TcpServer_Accept( $hash, "AMADCommBridge" ); + return; + } + + # Read 1024 byte of data + my $buf; + my $ret = sysread($hash->{CD}, $buf, 1024); + + + # When there is an error in connection return + if( !defined($ret ) || $ret <= 0 ) { + CommandDelete( undef, $hash->{NAME} ); + return; + } + + AMADCommBridge_ResponseProcessing($hash,$buf); +} + +sub AMADCommBridge_ResponseProcessing($$) { + + my ($hash,$buf) = @_; + + my $name = $hash->{NAME}; + my $bhash = $modules{AMADCommBridge}{defptr}{BRIDGE}; + my $bname = $bhash->{NAME}; + + + #### Verarbeitung der Daten welche über die AMADCommBridge kommen #### + + Log3 $bname, 5, "AMADCommBridge ($name) - Receive RAW Message in Debugging Mode: $buf"; + + ### + ## Consume Content + ### + + my @data = split( '\R\R', $buf ); + + my $header = AMADCommBridge_Header2Hash( $data[0] ); + my $response; + my $c; + my $device = $header->{FHEMDEVICE} if(defined($header->{FHEMDEVICE})); + my $fhemcmd = $header->{FHEMCMD} if(defined($header->{FHEMCMD})); + + + + + if ( $data[0] =~ /currentFlowsetUpdate.xml/ ) { + + my $fhempath = $attr{global}{modpath}; + $response = qx(cat $fhempath/FHEM/lib/74_AMADautomagicFlowset_$flowsetversion.xml); + $c = $hash->{CD}; + print $c "HTTP/1.1 200 OK\r\n", + "Content-Type: text/plain\r\n", + "Connection: close\r\n", + "Content-Length: ".length($response)."\r\n\r\n", + $response; + + return; + } + + elsif ( $data[0] =~ /installFlow_([^.]*.xml)/ ) { + + if( defined($1) ){ + $response = qx(cat /tmp/$1); + $c = $hash->{CD}; + print $c "HTTP/1.1 200 OK\r\n", + "Content-Type: text/plain\r\n", + "Connection: close\r\n", + "Content-Length: ".length($response)."\r\n\r\n", + $response; + + return; + } + } + + + + elsif( !defined($device) ) { + readingsSingleUpdate( $bhash, "transmitterERROR", $hash->{NAME}." has no device name sends", 1 ) if( AttrVal( $bname, "expertMode", 0 ) eq "1" ); + Log3 $bname, 4, "AMADCommBridge ($name) - ERROR - no device name given. please check your global variable in automagic"; + + $response = "header lines: \r\n AMADCommBridge receive no device name. please check your global variable in automagic\r\n FHEM to do nothing\r\n"; + $c = $hash->{CD}; + print $c "HTTP/1.1 200 OK\r\n", + "Content-Type: text/plain\r\n", + "Connection: close\r\n", + "Content-Length: ".length($response)."\r\n\r\n", + $response; + + return; + } + + + + if( defined($fhemcmd) and ($fhemcmd) ) { + if ( $fhemcmd =~ /setreading\b/ ) { + my $tv = $data[1]; + return Log3 $bname, 3, "AMADCommBridge ($name) - AMADCommBridge: processing receive no reading values from Device: $device" + unless( defined($tv) and ($tv) ); + + Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge: processing receive reading values - Device: $device Data: $tv"; + + # Hier muß dann der Dispatcher aufgerufen werden + #AMADCommBridge_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", + "Content-Type: text/plain\r\n", + "Connection: close\r\n", + "Content-Length: ".length($response)."\r\n\r\n", + $response; + + return; + } + + elsif ( $fhemcmd =~ /set\b/ ) { + my $fhemCmd = $data[1]; + + fhem ("set $fhemCmd") if( ReadingsVal( $bname, "expertMode", 0 ) eq "1" ); + readingsSingleUpdate( $bhash, "receiveFhemCommand", "set ".$fhemCmd, 0 ); + Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: set reading receive fhem command"; + + $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM execute set command now\r\n"; + $c = $hash->{CD}; + print $c "HTTP/1.1 200 OK\r\n", + "Content-Type: text/plain\r\n", + "Connection: close\r\n", + "Content-Length: ".length($response)."\r\n\r\n", + $response; + + return; + } + + elsif ( $fhemcmd =~ /voiceinputvalue\b/ ) { + my $fhemCmd = lc $data[1]; + + readingsBeginUpdate( $bhash); + readingsBulkUpdate( $bhash, "receiveVoiceCommand", $fhemCmd ); + readingsBulkUpdate( $bhash, "receiveVoiceDevice", $device ); + readingsEndUpdate( $bhash, 1 ); + Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: set reading receive voice command: $fhemCmd from Device $device"; + + $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", + "Content-Type: text/plain\r\n", + "Connection: close\r\n", + "Content-Length: ".length($response)."\r\n\r\n", + $response; + + return; + } + + elsif ( $fhemcmd =~ /readingsval\b/ ) { + my $fhemCmd = $data[1]; + my @datavalue = split( ' ', $fhemCmd ); + + $response = ReadingsVal( $datavalue[0], $datavalue[1], $datavalue[2] ); + $c = $hash->{CD}; + print $c "HTTP/1.1 200 OK\r\n", + "Content-Type: text/plain\r\n", + "Connection: close\r\n", + "Content-Length: ".length($response)."\r\n\r\n", + $response; + + Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: response ReadingsVal Value to Automagic Device"; + return; + } + +# elsif ( $fhemcmd =~ /fhemfunc\b/ ) { +# my $fhemCmd = $data[1]; +# +# Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: receive fhem-function command"; +# +# if( $fhemCmd =~ /^{.*}$/ ) { +# +# $response = $fhemCmd if( ReadingsVal( $name, "expertMode", 0 ) eq "1" ); +# +# } else { +# +# $response = "header lines: \r\n AMADCommBridge receive no typical FHEM function\r\n FHEM to do nothing\r\n"; +# } +# +# $c = $hash->{CD}; +# print $c "HTTP/1.1 200 OK\r\n", +# "Content-Type: text/plain\r\n", +# "Connection: close\r\n", +# "Content-Length: ".length($response)."\r\n\r\n", +# $response; +# +# return; +# } + + } + + + $response = "header lines: \r\n AMADCommBridge receive incomplete or corrupt Data\r\n FHEM to do nothing\r\n"; + $c = $hash->{CD}; + print $c "HTTP/1.1 200 OK\r\n", + "Content-Type: text/plain\r\n", + "Connection: close\r\n", + "Content-Length: ".length($response)."\r\n\r\n", + $response; +} + +sub AMADCommBridge_Header2Hash($) { + + my $string = shift; + my %hash = (); + + foreach my $line (split("\r\n", $string)) { + my ($key,$value) = split( ": ", $line ); + next if( !$value ); + + $value =~ s/^ //; + $hash{$key} = $value; + } + + return \%hash; +} + + + + + + +1; + +=pod + +=item device +=item summary Integrates Android devices into FHEM and displays several settings. +=item summary_DE Integriert Android-Geräte in FHEM und zeigt verschiedene Einstellungen an. + +=begin html + + +

AMAD

+
    + AMAD - Automagic Android Device +
    + This module integrates Android devices into FHEM and displays several settings using the Android app "Automagic". + Automagic is comparable to the "Tasker" app for automating tasks and configuration settings. But Automagic is more user-friendly. The "Automagic Premium" app currently costs EUR 2.90. +
    + Any information retrievable by Automagic can be displayed in FHEM by this module. Just define your own Automagic-"flow" and send the data to the AMADCommBridge. One even can control several actions on Android devices. +
    + To be able to make use of all these functions the Automagic app and additional flows need to be installed on the Android device. The flows can be retrieved from the FHEM directory, the app can be bought in Google Play Store. +

    + How to use AMAD? +
      +
    • install the "Automagic Premium" app from the Google Play store.
    • +
    • install the flowset 74_AMADautomagicFlowset$VERSION.xml from the directory $INSTALLFHEM/FHEM/lib/ on your Android device and activate.
    • +
    +
    + Now you need to define a device in FHEM. +

    + + Define +

      + define <name> AMAD <IP-ADDRESS> +

      + Example: +

        + define WandTabletWohnzimmer AMAD 192.168.0.23
        +
      +
      + With this command two new AMAD devices in a room called AMAD are created. The parameter <IP-ADDRESS< defines the IP address of your Android device. The second device created is the AMADCommBridge which serves as a communication device from each Android device to FHEM.
      + !!!Coming Soon!!! The communication port of each AMAD device may be set by the definition of the "port" attribute. One needs background knowledge of Automagic and HTTP requests as this port will be set in the HTTP request trigger of both flows, therefore the port also needs to be set there. +
      + The communication port of the AMADCommBridge device can easily be changed within the attribut "port".
      +
    +
    + AMAD Communication Bridge +
      + Creating your first AMAD device automatically creates the AMADCommBridge device in the room AMAD. With the help of the AMADCommBridge any Android device communicates initially to FHEM.To make the IP addresse of the FHEM server known to the Android device, the FHEM server IP address needs to be configured in the AMADCommBridge. WITHOUT THIS STEP THE AMADCommBridge WILL NOT WORK PROPERLY.
      + Please us the following command for configuration of the FHEM server IP address in the AMADCommBridge: set AMADCommBridge fhemServerIP <FHEM-IP>.
      + Additionally the expertMode may be configured. By this setting a direct communication with FHEM will be established without the restriction of needing to make use of a notify to execute set commands. +

    +
    + You are finished now! After 15 seconds latest the readings of your AMAD Android device should be updated. Consequently each 15 seconds a status request will be sent. If the state of your AMAD Android device does not change to "active" over a longer period of time one should take a look into the log file for error messages. +


    + + Readings +
      +
    • airplanemode - on/off, state of the aeroplane mode
    • +
    • androidVersion - currently installed version of Android
    • +
    • automagicState - state of the Automagic App (prerequisite Android >4.3). In case you have Android >4.3 and the reading says "not supported", you need to enable Automagic inside Android / Settings / Sound & notification / Notification access
    • +
    • batteryHealth - the health of the battery (1=unknown, 2=good, 3=overheat, 4=dead, 5=over voltage, 6=unspecified failure, 7=cold)
    • +
    • batterytemperature - the temperature of the battery
    • +
    • bluetooth - on/off, bluetooth state
    • +
    • checkActiveTask - state of an app (needs to be defined beforehand). 0=not active or not active in foreground, 1=active in foreground, see note below
    • +
    • connectedBTdevices - list of all devices connected via bluetooth
    • +
    • connectedBTdevicesMAC - list of MAC addresses of all devices connected via bluetooth
    • +
    • currentMusicAlbum - currently playing album of mediaplayer
    • +
    • currentMusicApp - currently playing player app (Amazon Music, Google Play Music, Google Play Video, Spotify, YouTube, TuneIn Player, Aldi Life Music)
    • +
    • currentMusicArtist - currently playing artist of mediaplayer
    • +
    • currentMusicIcon - cover of currently play albumNoch nicht fertig implementiert
    • +
    • currentMusicState - state of currently/last used mediaplayer
    • +
    • currentMusicTrack - currently playing song title of mediaplayer
    • +
    • daydream - on/off, daydream currently active
    • +
    • deviceState - state of Android devices. unknown, online, offline.
    • +
    • doNotDisturb - state of do not Disturb Mode
    • +
    • dockingState - undocked/docked, Android device in docking station
    • +
    • flow_SetCommands - active/inactive, state of SetCommands flow
    • +
    • flow_informations - active/inactive, state of Informations flow
    • +
    • flowsetVersionAtDevice - currently installed version of the flowsets on the Android device
    • +
    • incomingCallerName - Callername from last Call
    • +
    • incomingCallerNumber - Callernumber from last Call
    • +
    • incommingWhatsAppMessageFrom - last WhatsApp message
    • +
    • incommingWhatsTelegramMessageFrom - last telegram message
    • +
    • intentRadioName - name of the most-recent streamed intent radio
    • +
    • intentRadioState - state of intent radio player
    • +
    • keyguardSet - 0/1 keyguard set, 0=no 1=yes, does not indicate whether it is currently active
    • +
    • lastSetCommandError - last error message of a set command
    • +
    • lastSetCommandState - last state of a set command, command send successful/command send unsuccessful
    • +
    • lastStatusRequestError - last error message of a statusRequest command
    • +
    • lastStatusRequestState - ast state of a statusRequest command, command send successful/command send unsuccessful
    • +
    • nextAlarmDay - currently set day of alarm
    • +
    • nextAlarmState - alert/done, current state of "Clock" stock-app
    • +
    • nextAlarmTime - currently set time of alarm
    • +
    • powerLevel - state of battery in %
    • +
    • powerPlugged - 0=no/1,2=yes, power supply connected
    • +
    • screen - on locked,unlocked/off locked,unlocked, state of display
    • +
    • screenBrightness - 0-255, level of screen-brightness
    • +
    • screenFullscreen - on/off, full screen mode
    • +
    • 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
    • +
      + Prerequisite for using the reading checkActivTask the package name of the application to be checked needs to be defined in the attribute checkActiveTask. Example: attr Nexus10Wohnzimmer + checkActiveTask com.android.chrome für den Chrome Browser. +

      +
    +

    + + Set +
      +
    • activateVoiceInput - start voice input on Android device
    • +
    • bluetooth - on/off, switch bluetooth on/off
    • +
    • clearNotificationBar - All/Automagic, deletes all or only Automagic notifications in status bar
    • +
    • closeCall - hang up a running call
    • +
    • currentFlowsetUpdate - start flowset update on Android device
    • +
    • installFlowSource - install a Automagic flow on device, XML file must be stored in /tmp/ with extension xml. Example: set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml
    • +
    • doNotDisturb - sets the do not Disturb Mode, always Disturb, never Disturb, alarmClockOnly alarm Clock only, onlyImportant only important Disturbs
    • +
    • mediaAmazonMusic - play/stop/next/back , controlling the amazon music media player
    • +
    • mediaGoogleMusic - play/stop/next/back , controlling the google play music media player
    • +
    • mediaSpotifyMusic - play/stop/next/back , controlling the spotify media player
    • +
    • mediaTuneinRadio - play/stop/next/back , controlling the TuneinRadio media player
    • +
    • mediaAldiMusic - play/stop/next/back , controlling the Aldi music media player
    • +
    • mediaAudible - play/stop/next/back , controlling the Audible media player
    • +
    • mediaYouTube - play/stop/next/back , controlling the YouTube media player
    • +
    • mediaVlcPlayer - play/stop/next/back , controlling the VLC media player
    • +
    • nextAlarmTime - sets the alarm time. Only valid for the next 24 hours.
    • +
    • notifySndFile - plays a media-file which by default needs to be stored in the folder "/storage/emulated/0/Notifications/" of the Android device. You may use the attribute setNotifySndFilePath for defining a different folder.
    • +
    • openCall - initial a call and hang up after optional time / set DEVICE openCall 0176354 10 call this number and hang up after 10s
    • +
    • screenBrightness - 0-255, set screen brighness
    • +
    • screenMsg - display message on screen of Android device
    • +
    • sendintent - send intent string Example: set $AMADDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio, first parameter contains the action, second parameter contains the extra. At most two extras can be used.
    • +
    • sendSMS - Sends an SMS to a specific phone number. Bsp.: sendSMS Dies ist ein Test|555487263
    • +
    • startDaydream - start Daydream
    • +
    • 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
    • +
    +
    + Set (depending on attribute values) +
      +
    • changetoBtDevice - switch to another bluetooth device. Attribute setBluetoothDevice needs to be set. See note below!
    • +
    • openApp - start an app. attribute setOpenApp
    • +
    • openURL - opens a URLS in the standard browser as long as no other browser is set by the attribute setOpenUrlBrowser.Example: attr Tablet setOpenUrlBrowser de.ozerov.fully|de.ozerov.fully.MainActivity, first parameter: package name, second parameter: Class Name
    • +
    • screen - on/off/lock/unlock, switch screen on/off or lock/unlock screen. In Automagic "Preferences" the "Device admin functions" need to be enabled, otherwise "Screen off" does not work. attribute setScreenOnForTimer changes the time the display remains switched on!
    • +
    • screenFullscreen - on/off, activates/deactivates full screen mode. attribute setFullscreen
    • +
    • screenLock - Locks screen with request for PIN. attribute setScreenlockPIN - enter PIN here. Only use numbers, 4-16 numbers required.
    • +
    • screenOrientation - Auto,Landscape,Portait, set screen orientation (automatic, horizontal, vertical). attribute setScreenOrientation
    • +
    • system - issue system command (only with rooted Android devices). reboot,shutdown,airplanemodeON (can only be switched ON) attribute root, in Automagic "Preferences" "Root functions" need to be enabled.
    • +
    • setAPSSID - set WLAN AccesPoint SSID to prevent WLAN sleeps
    • +
    • setNotifySndFilePath - set systempath to notifyfile (default /storage/emulated/0/Notifications/
    • +
    • setTtsMsgSpeed - set speaking speed for TTS (Value between 0.5 - 4.0, 0.5 Step) default is 1.0
    • +
    • setTtsMsgLang - set speaking language for TTS, de or en (default is de)
    • +
      + To be able to use "openApp" the corresponding attribute "setOpenApp" needs to contain the app package name. +

      + To be able to switch between bluetooth devices the attribute "setBluetoothDevice" needs to contain (a list of) bluetooth devices defined as follows: attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC No spaces are allowed in any BTdeviceName. Defining MAC please make sure to use the character : (colon) after each second digit/character.
      + Example: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76 +
    +

    + + state +
      +
    • initialized - shown after initial define.
    • +
    • active - device is active.
    • +
    • disabled - device is disabled by the attribute "disable".
    • +
    +


    + Further examples and reading: + +


    +
+ +=end html +=begin html_DE + + +

AMAD

+
    + AMAD - Automagic Android Device +
    + Dieses Modul liefert, in Verbindung mit der Android APP Automagic, diverse Informationen von Android Geräten. + Die AndroidAPP Automagic (welche nicht von mir stammt und 2.90 Euro kostet) funktioniert wie Tasker, ist aber bei weitem User freundlicher. +
    + Mit etwas Einarbeitung können jegliche Informationen welche Automagic bereit stellt in FHEM angezeigt werden. Hierzu bedarf es lediglich eines eigenen Flows welcher seine Daten an die AMADCommBridge sendet. Das Modul gibt auch die Möglichkeit Androidgeräte zu steuern. +
    + Für all diese Aktionen und Informationen wird auf dem Androidgerät "Automagic" und ein so genannter Flow benötigt. Die App ist über den Google PlayStore zu beziehen. Das benötigte Flowset bekommt man aus dem FHEM Verzeichnis. +

    + Wie genau verwendet man nun AMAD? +
      +
    • man installiert die App "Automagic Premium" aus dem PlayStore.
    • +
    • dann installiert man das Flowset 74_AMADautomagicFlowset$VERSION.xml aus dem Ordner $INSTALLFHEM/FHEM/lib/ auf dem Androidgerät und aktiviert die Flows.
    • +
    +
    + Es muß noch ein Device in FHEM anlegt werden. +

    + + Define +

      + define <name> AMAD <IP-ADRESSE> +

      + Beispiel: +

        + define WandTabletWohnzimmer AMAD 192.168.0.23
        +
      +
      + Diese Anweisung erstellt zwei neues AMAD-Device im Raum AMAD.Der Parameter <IP-ADRESSE> legt die IP Adresse des Android Gerätes fest.
      + Das zweite Device ist die AMADCommBridge welche als Kommunikationsbrücke vom Androidgerät zu FHEM diehnt. !!!Comming Soon!!! Wer den Port ändern möchte, kann dies über das Attribut "port" tun. Ihr solltet aber wissen was Ihr tut, da dieser Port im HTTP Request Trigger der beiden Flows eingestellt ist. Demzufolge muß der Port dort auch geändert werden. Der Port für die Bridge kann ohne Probleme im Bridge Device mittels dem Attribut "port" verändert werden. +
      + Der Port für die Bridge kann ohne Probleme im Bridge Device mittels dem Attribut "port" verändert werden.
      +
    +
    + AMAD Communication Bridge +
      + Beim ersten anlegen einer AMAD Deviceinstanz wird automatisch ein Gerät Namens AMADCommBridge im Raum AMAD mit angelegt. Dieses Gerät diehnt zur Kommunikation vom Androidgerät zu FHEM ohne das zuvor eine Anfrage von FHEM aus ging. Damit das Androidgerät die IP von FHEM kennt, muss diese sofort nach dem anlegen der Bridge über den set Befehl in ein entsprechendes Reading in die Bridge geschrieben werden. DAS IST SUPER WICHTIG UND FÜR DIE FUNKTION DER BRIDGE NOTWENDIG.
      + Hierfür muß folgender Befehl ausgeführt werden. set AMADCommBridge fhemServerIP <FHEM-IP>.
      + Als zweites Reading kann expertMode gesetzen werden. Mit diesem Reading wird eine unmittelbare Komminikation mit FHEM erreicht ohne die Einschränkung über ein + Notify gehen zu müssen und nur reine set Befehle ausführen zu können. +

    + NUN bitte die Flows AKTIVIEREN!!!
    +
    + Fertig! Nach anlegen der Geräteinstanz und dem eintragen der fhemServerIP in der CommBridge sollten nach spätestens 15 Sekunden bereits die ersten Readings reinkommen. Nun wird alle 15 Sekunden probiert einen Status Request erfolgreich ab zu schließen. Wenn der Status sich über einen längeren Zeitraum nicht auf "active" ändert, sollte man im Log nach eventuellen Fehlern suchen. +


    + + Readings +
      +
    • airplanemode - Status des Flugmodus
    • +
    • androidVersion - aktuell installierte Androidversion
    • +
    • automagicState - Statusmeldungen von der AutomagicApp (Voraussetzung Android >4.3). Ist Android größer 4.3 vorhanden und im Reading steht "wird nicht unterstützt", muß in den Androideinstellungen unter Ton und Benachrichtigungen -> Benachrichtigungszugriff ein Haken für Automagic gesetzt werden
    • +
    • batteryHealth - Zustand der Battery (1=unbekannt, 2=gut, 3=Überhitzt, 4=tot, 5=Überspannung, 6=unbekannter Fehler, 7=kalt)
    • +
    • batterytemperature - Temperatur der Batterie
    • +
    • bluetooth - on/off, Bluetooth Status an oder aus
    • +
    • checkActiveTask - Zustand einer zuvor definierten APP. 0=nicht aktiv oder nicht aktiv im Vordergrund, 1=aktiv im Vordergrund, siehe Hinweis unten
    • +
    • connectedBTdevices - eine Liste der verbundenen Gerät
    • +
    • connectedBTdevicesMAC - eine Liste der MAC Adressen aller verbundender BT Geräte
    • +
    • currentMusicAlbum - aktuell abgespieltes Musikalbum des verwendeten Mediaplayers
    • +
    • currentMusicApp - aktuell verwendeter Mediaplayer (Amazon Music, Google Play Music, Google Play Video, Spotify, YouTube, TuneIn Player, Aldi Life Music)
    • +
    • currentMusicArtist - aktuell abgespielter Musikinterpret des verwendeten Mediaplayers
    • +
    • currentMusicIcon - Cover vom aktuell abgespielten Album Noch nicht fertig implementiert
    • +
    • currentMusicState - Status des aktuellen/zuletzt verwendeten Mediaplayers
    • +
    • currentMusicTrack - aktuell abgespielter Musiktitel des verwendeten Mediaplayers
    • +
    • daydream - on/off, Daydream gestartet oder nicht
    • +
    • deviceState - Status des Androidgerätes. unknown, online, offline.
    • +
    • doNotDisturb - aktueller Status des nicht stören Modus
    • +
    • dockingState - undocked/docked Status ob sich das Gerät in einer Dockinstation befindet.
    • +
    • flow_SetCommands - active/inactive, Status des SetCommands Flow
    • +
    • flow_informations - active/inactive, Status des Informations Flow
    • +
    • flowsetVersionAtDevice - aktuell installierte Flowsetversion auf dem Device
    • +
    • incomingCallerName - Anrufername des eingehenden Anrufes
    • +
    • incomingCallerNumber - Anrufernummer des eingehenden Anrufes
    • +
    • incommingWhatsAppMessageFrom - letzte WhatsApp Nachricht
    • +
    • incommingWhatsTelegramMessageFrom - letzte Telegram Nachricht
    • +
    • intentRadioName - zuletzt gesrreamter Intent Radio Name
    • +
    • intentRadioState - Status des IntentRadio Players
    • +
    • keyguardSet - 0/1 Displaysperre gesetzt 0=nein 1=ja, bedeutet nicht das sie gerade aktiv ist
    • +
    • lastSetCommandError - letzte Fehlermeldung vom set Befehl
    • +
    • lastSetCommandState - letzter Status vom set Befehl, Befehl erfolgreich/nicht erfolgreich gesendet
    • +
    • lastStatusRequestError - letzte Fehlermeldung vom statusRequest Befehl
    • +
    • lastStatusRequestState - letzter Status vom statusRequest Befehl, Befehl erfolgreich/nicht erfolgreich gesendet
    • +
    • nextAlarmDay - aktiver Alarmtag
    • +
    • nextAlarmState - aktueller Status des "Androidinternen" Weckers
    • +
    • nextAlarmTime - aktive Alarmzeit
    • +
    • powerLevel - Status der Batterie in %
    • +
    • powerPlugged - Netzteil angeschlossen? 0=NEIN, 1|2=JA
    • +
    • screen - on locked/unlocked, off locked/unlocked gibt an ob der Bildschirm an oder aus ist und gleichzeitig gesperrt oder nicht gesperrt
    • +
    • screenBrightness - Bildschirmhelligkeit von 0-255
    • +
    • screenFullscreen - on/off, Vollbildmodus (An,Aus)
    • +
    • 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
    • +
      + Beim Reading checkActivTask muß zuvor der Packagename der zu prüfenden App als Attribut checkActiveTask angegeben werden. Beispiel: attr Nexus10Wohnzimmer + checkActiveTask com.android.chrome für den Chrome Browser. +

      +
    +

    + + Set +
      +
    • activateVoiceInput - aktiviert die Spracheingabe
    • +
    • bluetooth - on/off, aktiviert/deaktiviert Bluetooth
    • +
    • clearNotificationBar - All,Automagic, löscht alle Meldungen oder nur die Automagic Meldungen in der Statusleiste
    • +
    • closeCall - beendet einen laufenden Anruf
    • +
    • currentFlowsetUpdate - fürt ein Flowsetupdate auf dem Device durch
    • +
    • 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
    • +
    • installFlowSource - installiert einen Flow auf dem Device, das XML File muss unter /tmp/ liegen und die Endung xml haben. Bsp: set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml
    • +
    • mediaAmazonMusic - play, stop, next, back ,steuert den Amazon Musik Mediaplayer
    • +
    • mediaGoogleMusic - play, stop, next, back ,steuert den Google Play Musik Mediaplayer
    • +
    • mediaSpotifyMusic - play, stop, next, back ,steuert den Spotify Mediaplayer
    • +
    • mediaTuneinRadio - play, stop, next, back ,steuert den TuneIn Radio Mediaplayer
    • +
    • mediaAldiMusic - play, stop, next, back ,steuert den Aldi Musik Mediaplayer
    • +
    • mediaAudible - play, stop, next, back ,steuert den Audible Mediaplayer
    • +
    • mediaYouTube - play, stop, next, back ,steuert den YouTube Mediaplayer
    • +
    • mediaVlcPlayer - play, stop, next, back ,steuert den VLC Mediaplayer
    • +
    • nextAlarmTime - setzt die Alarmzeit. gilt aber nur innerhalb der nächsten 24Std.
    • +
    • openCall - ruft eine Nummer an und legt optional nach X Sekunden auf / set DEVICE openCall 01736458 10 / ruft die Nummer an und beendet den Anruf nach 10s
    • +
    • screenBrightness - setzt die Bildschirmhelligkeit, von 0-255.
    • +
    • screenMsg - versendet eine Bildschirmnachricht
    • +
    • sendintent - sendet einen Intentstring Bsp: set $AMADDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio, der erste Befehl ist die Aktion und der zweite das Extra. Es können immer zwei Extras mitgegeben werden.
    • +
    • sendSMS - sendet eine SMS an eine bestimmte Telefonnummer. Bsp.: sendSMS Dies ist ein Test|555487263
    • +
    • startDaydream - startet den Daydream
    • +
    • 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.
    • +
    +
    + Set abhängig von gesetzten Attributen +
      +
    • changetoBtDevice - wechselt zu einem anderen Bluetooth Gerät. Attribut setBluetoothDevice muß gesetzt sein. Siehe Hinweis unten!
    • +
    • notifySndFile - spielt die angegebene Mediadatei auf dem Androidgerät ab. Die aufzurufende Mediadatei sollte sich im Ordner /storage/emulated/0/Notifications/ befinden. Ist dies nicht der Fall kann man über das Attribut setNotifySndFilePath einen Pfad vorgeben.
    • +
    • openApp - öffnet eine ausgewählte App. Attribut setOpenApp
    • +
    • openURL - öffnet eine URL im Standardbrowser, sofern kein anderer Browser über das Attribut setOpenUrlBrowser ausgewählt wurde. Bsp: attr Tablet setOpenUrlBrowser de.ozerov.fully|de.ozerov.fully.MainActivity, das erste ist der Package Name und das zweite der Class Name
    • +
    • setAPSSID - setzt die AccessPoint SSID um ein WLAN sleep zu verhindern
    • +
    • screen - on/off/lock/unlock schaltet den Bildschirm ein/aus oder sperrt/entsperrt ihn, in den Automagic Einstellungen muss "Admin Funktion" gesetzt werden sonst funktioniert "Screen off" nicht. Attribut setScreenOnForTimer ändert die Zeit wie lange das Display an bleiben soll!
    • +
    • screenFullscreen - on/off, (aktiviert/deaktiviert) den Vollbildmodus. Attribut setFullscreen
    • +
    • screenLock - Sperrt den Bildschirm mit Pinabfrage. Attribut setScreenlockPIN - hier die Pin dafür eingeben. Erlaubt sind nur Zahlen. Es müßen mindestens 4, bis max 16 Zeichen verwendet werden.
    • +
    • screenOrientation - Auto,Landscape,Portait, aktiviert die Bildschirmausrichtung (Automatisch,Horizontal,Vertikal). Attribut setScreenOrientation
    • +
    • system - setzt Systembefehle ab (nur bei gerootetet Geräen). reboot,shutdown,airplanemodeON (kann nur aktiviert werden) Attribut root, in den Automagic Einstellungen muss "Root Funktion" gesetzt werden
    • +
    • setNotifySndFilePath - setzt den korrekten Systempfad zur Notifydatei (default ist /storage/emulated/0/Notifications/
    • +
    • setTtsMsgSpeed - setzt die Sprachgeschwindigkeit bei der Sprachausgabe(Werte zwischen 0.5 bis 4.0 in 0.5er Schritten) default ist 1.0
    • +
    • setTtsMsgSpeed - setzt die Sprache bei der Sprachausgabe, de oder en (default ist de)
    • +
      + Um openApp verwenden zu können, muss als Attribut der Package Name der App angegeben werden. +

      + Um zwischen Bluetoothgeräten wechseln zu können, muß das Attribut setBluetoothDevice mit folgender Syntax gesetzt werden. attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC Es muss + zwingend darauf geachtet werden das beim BTdeviceName kein Leerzeichen vorhanden ist. Am besten zusammen oder mit Unterstrich. Achtet bei der MAC darauf das Ihr wirklich nach jeder zweiten Zahl auch + einen : drin habt
      + Beispiel: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76 +
    +

    + + state +
      +
    • initialized - Ist der Status kurz nach einem define.
    • +
    • active - die Geräteinstanz ist im aktiven Status.
    • +
    • disabled - die Geräteinstanz wurde über das Attribut disable deaktiviert
    • +
    +


    + Anwendungsbeispiele: + +


    +
+ +=end html_DE +=cut From ad0a42a9c31ba145f81e41277cf87ca0c41baa9e Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sun, 14 May 2017 14:25:41 +0200 Subject: [PATCH 02/32] neuste Version --- 74_AMAD.pm | 1867 -------------- 74_AMADautomagicFlowset_2.6.12.xml | 3745 ---------------------------- README.md | 151 -- 3 files changed, 5763 deletions(-) delete mode 100644 74_AMAD.pm delete mode 100644 74_AMADautomagicFlowset_2.6.12.xml delete mode 100644 README.md diff --git a/74_AMAD.pm b/74_AMAD.pm deleted file mode 100644 index 4356ddf..0000000 --- a/74_AMAD.pm +++ /dev/null @@ -1,1867 +0,0 @@ -############################################################################### -# -# Developed with Kate -# -# (c) 2015-2017 Copyright: Marko Oldenburg (leongaultier at gmail dot com) -# All rights reserved -# -# This script is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# any later version. -# -# The GNU General Public License can be found at -# http://www.gnu.org/copyleft/gpl.html. -# A copy is found in the textfile GPL.txt and important notices to the license -# from the author is found in LICENSE.txt distributed with these scripts. -# -# This script is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# -# $Id$ -# -############################################################################### -## -## -## Das JSON Modul immer in einem eval aufrufen -# $data = eval{decode_json($data)}; -# -# if($@){ -# Log3($SELF, 2, "$TYPE ($SELF) - error while request: $@"); -# -# readingsSingleUpdate($hash, "state", "error", 1); -# -# return; -# } -## -## - - - -package main; - -use strict; -use warnings; -use Time::HiRes qw(gettimeofday); - -use HttpUtils; -use TcpServerUtils; -use Encode qw(encode); - - -my $modulversion = "2.6.13"; -my $flowsetversion = "2.6.12"; - - - - -# Declare functions -sub AMAD_Attr(@); -sub AMAD_checkDeviceState($); -sub AMAD_CommBridge_Open($); -sub AMAD_CommBridge_Read($); -sub AMAD_decrypt($); -sub AMAD_Define($$); -sub AMAD_encrypt($); -sub AMAD_GetUpdate($); -sub AMAD_Header2Hash($); -sub AMAD_HTTP_POST($$); -sub AMAD_HTTP_POSTerrorHandling($$$); -sub AMAD_Initialize($); -sub AMAD_ResponseProcessing($$); -sub AMAD_SelectSetCmd($$@); -sub AMAD_Set($$@); -sub AMAD_statusRequest($); -sub AMAD_statusRequestErrorHandling($$$); -sub AMAD_Undef($$); - - - - -sub AMAD_Initialize($) { - - my ($hash) = @_; - - $hash->{SetFn} = "AMAD_Set"; - $hash->{DefFn} = "AMAD_Define"; - $hash->{UndefFn} = "AMAD_Undef"; - $hash->{AttrFn} = "AMAD_Attr"; - $hash->{ReadFn} = "AMAD_CommBridge_Read"; - - $hash->{AttrList} = "setOpenApp ". - "checkActiveTask ". - "setFullscreen:0,1 ". - "setScreenOrientation:0,1 ". - "setScreenBrightness:noArg ". - "setBluetoothDevice ". - "setScreenlockPIN ". - "setScreenOnForTimer ". - "setOpenUrlBrowser ". - "setNotifySndFilePath ". - "setTtsMsgSpeed ". - "setUserFlowState ". - "setTtsMsgLang:de,en ". - "setAPSSID ". - "root:0,1 ". - "port ". - "disable:1 ". - $readingFnAttributes; - - foreach my $d(sort keys %{$modules{AMAD}{defptr}}) { - - my $hash = $modules{AMAD}{defptr}{$d}; - $hash->{VERSIONMODUL} = $modulversion; - $hash->{VERSIONFLOWSET} = $flowsetversion; - } -} - -sub AMAD_Define($$) { - - my ( $hash, $def ) = @_; - - my @a = split( "[ \t][ \t]*", $def ); - - - return "too few parameters: define AMAD " if( $a[0] ne "AMADCommBridge" and @a < 2 and @a > 4 ); - - my $name = $a[0]; - my $host = $a[2] if( $a[2] ); - $a[3] =~ s/@@/ /g if( $a[3] ); - my $apssid = $a[3] if( $a[3] ); - my $port = 8090; - - $hash->{HOST} = $host if( $host ); - $hash->{PORT} = $port; - $hash->{APSSID} = $apssid if( $hash->{HOST} ); - $hash->{VERSIONMODUL} = $modulversion; - $hash->{VERSIONFLOWSET} = $flowsetversion; - $hash->{helper}{infoErrorCounter} = 0 if( $hash->{HOST} ); - $hash->{helper}{setCmdErrorCounter} = 0 if( $hash->{HOST} ); - $hash->{helper}{deviceStateErrorCounter} = 0 if( $hash->{HOST} ); - - - - - if( ! $hash->{HOST} ) { - return "there is already a AMAD Bridge, did you want to define a AMAD host use: define AMAD " if( $modules{AMAD}{defptr}{BRIDGE} ); - - $hash->{BRIDGE} = 1; - $modules{AMAD}{defptr}{BRIDGE} = $hash; - $attr{$name}{room} = "AMAD" if( !defined( $attr{$name}{room} ) ); - - Log3 $name, 3, "AMAD ($name) - defined Bridge with Socketport $hash->{PORT}"; - Log3 $name, 3, "AMAD ($name) - Attention!!! By the first run, dont forget to \"set $name fhemServerIP \""; - - AMAD_CommBridge_Open( $hash ); - - } else { - if( ! $modules{AMAD}{defptr}{BRIDGE} && $init_done ) { - CommandDefine( undef, "AMADCommBridge AMAD" ); - } - - Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and AccessPoint-SSID $hash->{APSSID}" if( $hash->{APSSID} ); - Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and NONE AccessPoint-SSID" if( ! $hash->{APSSID} ); - - $attr{$name}{room} = "AMAD" if( !defined( $attr{$name}{room} ) ); - - readingsSingleUpdate ( $hash, "state", "initialized", 1 ) if( $hash->{HOST} ); - readingsSingleUpdate ( $hash, "deviceState", "unknown", 1 ) if( $hash->{HOST} ); - - RemoveInternalTimer($hash); - - - if( $init_done ) { - - AMAD_GetUpdate($hash); - - } else { - - InternalTimer( gettimeofday()+30, "AMAD_GetUpdate", $hash, 0 ) if( ($hash->{HOST}) ); - } - - $modules{AMAD}{defptr}{$hash->{HOST}} = $hash; - - return undef; - } -} - -sub AMAD_Undef($$) { - - my ( $hash, $arg ) = @_; - - if( $hash->{BRIDGE} or $hash->{TEMPORARY} == 1 ) { - delete $modules{AMAD}{defptr}{BRIDGE} if( defined($modules{AMAD}{defptr}{BRIDGE}) and $hash->{BRIDGE} ); - TcpServer_Close( $hash ); - } - - elsif( $hash->{HOST} ) { - - delete $modules{AMAD}{defptr}{$hash->{HOST}}; - RemoveInternalTimer( $hash ); - - foreach my $d(sort keys %{$modules{AMAD}{defptr}}) { - my $hash = $modules{AMAD}{defptr}{$d}; - my $host = $hash->{HOST}; - - return if( $host ); - my $name = $hash->{NAME}; - CommandDelete( undef, $name ); - } - } - - return undef; -} - -sub AMAD_Attr(@) { - - my ( $cmd, $name, $attrName, $attrVal ) = @_; - my $hash = $defs{$name}; - - my $orig = $attrVal; - - if( $attrName eq "disable" ) { - if( $cmd eq "set" ) { - if( $attrVal eq "0" ) { - - RemoveInternalTimer( $hash ); - InternalTimer( gettimeofday()+2, "AMAD_GetUpdate", $hash, 0 ) if( ReadingsVal( $hash->{NAME}, "state", 0 ) eq "disabled" ); - readingsSingleUpdate ( $hash, "state", "active", 1 ); - Log3 $name, 3, "AMAD ($name) - enabled"; - } else { - - readingsSingleUpdate ( $hash, "state", "disabled", 1 ); - RemoveInternalTimer( $hash ); - Log3 $name, 3, "AMAD ($name) - disabled"; - } - - } else { - - RemoveInternalTimer( $hash ); - InternalTimer( gettimeofday()+2, "AMAD_GetUpdate", $hash, 0 ) if( ReadingsVal( $hash->{NAME}, "state", 0 ) eq "disabled" ); - readingsSingleUpdate ( $hash, "state", "active", 1 ); - Log3 $name, 3, "AMAD ($name) - enabled"; - } - } - - elsif( $attrName eq "checkActiveTask" ) { - 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" ) { - if( $cmd eq "set" ) { - - $hash->{PORT} = $attrVal; - Log3 $name, 3, "AMAD ($name) - set port to $attrVal"; - - if( $hash->{BRIDGE} ) { - delete $modules{AMAD}{defptr}{BRIDGE}; - TcpServer_Close( $hash ); - Log3 $name, 3, "AMAD ($name) - CommBridge Port changed. CommBridge are closed and new open!"; - - AMAD_CommBridge_Open( $hash ); - } - } else { - - $hash->{PORT} = 8090; - Log3 $name, 3, "AMAD ($name) - set port to default"; - - if( $hash->{BRIDGE} ) { - delete $modules{AMAD}{defptr}{BRIDGE}; - TcpServer_Close( $hash ); - Log3 $name, 3, "AMAD ($name) - CommBridge Port changed. CommBridge are closed and new open!"; - - AMAD_CommBridge_Open( $hash ); - } - } - } - - elsif( $attrName eq "setScreenlockPIN" ) { - if( $cmd eq "set" && $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; - return $attrName ." set to ". $attrVal if( $init_done ); - } - } - - return undef; -} - -sub AMAD_GetUpdate($) { - - my ( $hash ) = @_; - my $name = $hash->{NAME}; - my $bhash = $modules{AMAD}{defptr}{BRIDGE}; - my $bname = $bhash->{NAME}; - - RemoveInternalTimer( $hash ); - - if( $init_done && ( ReadingsVal( $name, "deviceState", "unknown" ) eq "unknown" or ReadingsVal( $name, "deviceState", "online" ) eq "online" ) && AttrVal( $name, "disable", 0 ) ne "1" && ReadingsVal( $bname, "fhemServerIP", "not set" ) ne "not set" ) { - - AMAD_statusRequest( $hash ); - AMAD_checkDeviceState( $hash ); - - } else { - - Log3 $name, 4, "AMAD ($name) - GetUpdate, FHEM or Device not ready yet"; - Log3 $name, 3, "AMAD ($bname) - GetUpdate, Please set $bname fhemServerIP NOW!" if( ReadingsVal( $bname, "fhemServerIP", "none" ) eq "none" ); - - InternalTimer( gettimeofday()+15, "AMAD_GetUpdate", $hash, 0 ); - } -} - -sub AMAD_statusRequest($) { - - my ($hash) = @_; - my $bhash = $modules{AMAD}{defptr}{BRIDGE}; - my $bname = $bhash->{NAME}; - my $name = $hash->{NAME}; - my $host = $hash->{HOST}; - my $port = $hash->{PORT}; - my $bport = $bhash->{PORT}; - my $fhemip = ReadingsVal( $bname, "fhemServerIP", "none" ); - my $activetask = AttrVal( $name, "checkActiveTask", "none" ); - my $userFlowState = AttrVal( $name, "setUserFlowState", "none" ); - my $apssid = "none"; - $apssid = $hash->{APSSID} if( defined($hash->{APSSID}) ); - $apssid = $attr{$name}{setAPSSID} if( defined($attr{$name}{setAPSSID}) ); - - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Pfad muß so im Automagic als http request Trigger drin stehen - - HttpUtils_NonblockingGet( - { - url => $url, - timeout => 5, - hash => $hash, - method => "GET", - 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, - } - ); - - Log3 $name, 5, "AMAD ($name) - Send statusRequest with URL: \"$url\" and Header: \"fhemIP: $fhemip\r\nfhemDevice: $name\r\nactiveTask: $activetask\r\napSSID: $apssid\""; -} - -sub AMAD_statusRequestErrorHandling($$$) { - - my ( $param, $err, $data ) = @_; - my $hash = $param->{hash}; - my $doTrigger = $param->{doTrigger}; - my $name = $hash->{NAME}; - my $host = $hash->{HOST}; - - - ### Begin Error Handling - if( $hash->{helper}{infoErrorCounter} > 0 ) { - - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_error" ); - - if( ReadingsVal( $name, "flow_Informations", "active" ) eq "inactive" && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; - - readingsBulkUpdate( $hash, "deviceState", "offline" ); - readingsBulkUpdate ( $hash, "state", "AMAD Flows inactive, device set offline"); - } - - elsif( $hash->{helper}{infoErrorCounter} > 7 && $hash->{helper}{setCmdErrorCounter} > 4 ) { - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; - - $attr{$name}{disable} = 1; - readingsBulkUpdate ( $hash, "state", "Unknown Error, device disabled"); - - $hash->{helper}{infoErrorCounter} = 0; - $hash->{helper}{setCmdErrorCounter} = 0; - - return; - } - - elsif( ReadingsVal( $name, "flow_Informations", "active" ) eq "inactive" ) { - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: Informations Flow on your Device is inactive, will try to reactivate"; - } - - elsif( $hash->{helper}{infoErrorCounter} > 7 ) { - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; - - readingsBulkUpdate( $hash, "deviceState", "offline" ); - readingsBulkUpdate ( $hash, "state", "To many Errors, device set offline"); - $hash->{helper}{infoErrorCounter} = 0; - } - - elsif($hash->{helper}{infoErrorCounter} > 2 && ReadingsVal( $name, "flow_Informations", "active" ) eq "active" ){ - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: Please check the AutomagicAPP on your Device"; - } - - readingsEndUpdate( $hash, 1 ); - } - - if( defined( $err ) ) { - if( $err ne "" ) { - - readingsBeginUpdate( $hash ); - readingsBulkUpdate ( $hash, "state", "$err") if( ReadingsVal( $name, "state", 1 ) ne "initialized" ); - $hash->{helper}{infoErrorCounter} = ( $hash->{helper}{infoErrorCounter} + 1 ); - - readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_error" ); - - if( $err =~ /timed out/ ) { - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: connect to your device is timed out. check network"; - } - - elsif( ( $err =~ /Keine Route zum Zielrechner/ ) && $hash->{helper}{infoErrorCounter} > 1 ) { - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: no route to target. bad network configuration or network is down"; - - } else { - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: $err"; - } - - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: AMAD_statusRequestErrorHandling: error while requesting AutomagicInfo: $err"; - - return; - } - } - - if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { - - readingsBeginUpdate( $hash ); - readingsBulkUpdate ( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state", 1 ) ne "initialized" ); - $hash->{helper}{infoErrorCounter} = ( $hash->{helper}{infoErrorCounter} + 1 ); - - readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_error" ); - - if( $param->{code} ne 200 ) { - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: ".$param->{code}; - } - - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: received http code ".$param->{code}." without any data after requesting AMAD AutomagicInfo"; - - return; - } - - if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state" ,0) ne "initialized" ); - $hash->{helper}{infoErrorCounter} = ( $hash->{helper}{infoErrorCounter} + 1 ); - - readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_error" ); - - if( $param->{code} eq 404 && ReadingsVal( $name, "flow_Informations", "inactive" ) eq "inactive" ) { - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: check the informations flow on your device"; - } - - elsif( $param->{code} eq 404 && ReadingsVal( $name, "flow_Informations", "active" ) eq "active" ) { - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: check the automagicApp on your device"; - - } else { - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: http error ".$param->{code}; - } - - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 5, "AMAD ($name) - statusRequestERROR: received http code ".$param->{code}." receive Error after requesting AMAD AutomagicInfo"; - - return; - } - - ### End Error Handling - - $hash->{helper}{infoErrorCounter} = 0; -} - -sub AMAD_ResponseProcessing($$) { - - my ( $hash, $data ) = @_; - - my $name = $hash->{NAME}; - my $host = $hash->{HOST}; - - ### Begin Response Processing - Log3 $name, 5, "AMAD ($name) - Processing data: $data"; - readingsSingleUpdate( $hash, "state", "active", 1) if( ReadingsVal( $name, "state", 0 ) ne "initialized" or ReadingsVal( $name, "state", 0 ) ne "active" ); - - my @valuestring = split( '@@@@', $data ); - my %buffer; - - foreach( @valuestring ) { - - my @values = split( '@@' , $_ ); - $buffer{$values[0]} = $values[1]; - } - - - readingsBeginUpdate( $hash ); - - my $t; - my $v; - while( ( $t, $v ) = each %buffer ) { - if( defined( $v ) ) { - - readingsBulkUpdate( $hash, "deviceState", "offline" ) if( $t eq "airplanemode" && $v eq "on" ); - readingsBulkUpdate( $hash, "deviceState", "online" ) if( $t eq "airplanemode" && $v eq "off" ); - $v =~ s/\bnull\b/off/g if( ($t eq "nextAlarmDay" || $t eq "nextAlarmTime") && $v eq "null" ); - - - $v =~ s/\bnull\b//g; - - readingsBulkUpdate( $hash, $t, $v ); - } - } - - readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_done" ); - - - - $hash->{helper}{infoErrorCounter} = 0; - ### End Response Processing - - readingsBulkUpdate( $hash, "state", "active" ) if( ReadingsVal( $name, "state", 0 ) eq "initialized" ); - readingsEndUpdate( $hash, 1 ); - - $hash->{helper}{deviceStateErrorCounter} = 0 if( $hash->{helper}{deviceStateErrorCounter} > 0 and ReadingsVal( $name, "deviceState", "offline") eq "online" ); - - return undef; -} - -sub AMAD_Set($$@) { - - my ( $hash, $name, $cmd, @val ) = @_; - - my $bhash = $modules{AMAD}{defptr}{BRIDGE}; - my $bname = $bhash->{NAME}; - - if( $name ne "$bname" ) { - my $apps = AttrVal( $name, "setOpenApp", "none" ); - my $btdev = AttrVal( $name, "setBluetoothDevice", "none" ); - my $activetask = AttrVal( $name, "setActiveTask", "none" ); - - my $list = ""; - $list .= "screenMsg "; - $list .= "ttsMsg "; - $list .= "volume:slider,0,1,15 "; - $list .= "mediaGoogleMusic:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaAmazonMusic:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaSpotifyMusic:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaTuneinRadio:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaAldiMusic:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaYouTube:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaVlcPlayer:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaAudible:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "screenBrightness:slider,0,1,255 "; - $list .= "screen:on,off,lock,unlock "; - $list .= "screenOrientation:auto,landscape,portrait " if( AttrVal( $name, "setScreenOrientation", "0" ) eq "1" ); - $list .= "screenFullscreen:on,off " if( AttrVal( $name, "setFullscreen", "0" ) eq "1" ); - $list .= "openURL "; - $list .= "openApp:$apps " if( AttrVal( $name, "setOpenApp", "none" ) ne "none" ); - $list .= "nextAlarmTime:time "; - $list .= "timer:slider,1,1,60 "; - $list .= "statusRequest:noArg "; - $list .= "system:reboot,shutdown,airplanemodeON " if( AttrVal( $name, "root", "0" ) eq "1" ); - $list .= "bluetooth:on,off "; - $list .= "notifySndFile "; - $list .= "clearNotificationBar:All,Automagic "; - $list .= "changetoBTDevice:$btdev " if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); - $list .= "activateVoiceInput:noArg "; - $list .= "volumeNotification:slider,0,1,7 "; - $list .= "volumeRingSound:slider,0,1,7 "; - $list .= "vibrate:noArg "; - $list .= "sendIntent "; - $list .= "openCall "; - $list .= "closeCall:noArg "; - $list .= "currentFlowsetUpdate:noArg "; - $list .= "installFlowSource "; - $list .= "doNotDisturb:never,always,alarmClockOnly,onlyImportant "; - $list .= "userFlowState "; - $list .= "sendSMS "; - $list .= "startDaydream:noArg "; - - if( lc $cmd eq 'screenmsg' - || lc $cmd eq 'ttsmsg' - || lc $cmd eq 'volume' - || lc $cmd eq 'mediagooglemusic' - || lc $cmd eq 'mediaamazonmusic' - || lc $cmd eq 'mediaspotifymusic' - || lc $cmd eq 'mediatuneinradio' - || lc $cmd eq 'mediaaldimusic' - || lc $cmd eq 'mediayoutube' - || lc $cmd eq 'mediavlcplayer' - || lc $cmd eq 'mediaaudible' - || lc $cmd eq 'screenbrightness' - || lc $cmd eq 'screenorientation' - || lc $cmd eq 'screenfullscreen' - || lc $cmd eq 'screen' - || lc $cmd eq 'openurl' - || lc $cmd eq 'openapp' - || lc $cmd eq 'nextalarmtime' - || lc $cmd eq 'timer' - || lc $cmd eq 'bluetooth' - || lc $cmd eq 'system' - || lc $cmd eq 'notifysndfile' - || lc $cmd eq 'changetobtdevice' - || lc $cmd eq 'clearnotificationbar' - || lc $cmd eq 'activatevoiceinput' - || lc $cmd eq 'volumenotification' - || lc $cmd eq 'volumeringsound' - || lc $cmd eq 'screenlock' - || lc $cmd eq 'statusrequest' - || lc $cmd eq 'sendsms' - || lc $cmd eq 'sendintent' - || lc $cmd eq 'currentflowsetupdate' - || lc $cmd eq 'installflowsource' - || lc $cmd eq 'opencall' - || lc $cmd eq 'closecall' - || lc $cmd eq 'donotdisturb' - || lc $cmd eq 'userflowstate' - || lc $cmd eq 'startdaydream' - || lc $cmd eq 'vibrate') { - - Log3 $name, 5, "AMAD ($name) - set $name $cmd ".join(" ", @val); - - return AMAD_SelectSetCmd( $hash, $cmd, @val ) if( lc $cmd eq 'statusrequest' ); - return "set command only works if state not equal initialized" if( ReadingsVal( $hash->{NAME}, "state", 0 ) eq "initialized"); - return "Cannot set command, FHEM Device is disabled" if( AttrVal( $name, "disable", "0" ) eq "1" ); - - return "Cannot set command, FHEM Device is unknown" if( ReadingsVal( $name, "deviceState", "online" ) eq "unknown" ); - return "Cannot set command, FHEM Device is offline" if( ReadingsVal( $name, "deviceState", "online" ) eq "offline" ); - - return AMAD_SelectSetCmd( $hash, $cmd, @val ) if( (@val) or (lc $cmd eq 'activatevoiceinput') or (lc $cmd eq 'vibrate') or (lc $cmd eq 'currentflowsetupdate') or (lc $cmd eq 'closecall') or (lc $cmd eq 'startdaydream') ); - } - - return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; - - } elsif( $modules{AMAD}{defptr}{BRIDGE} ) { - - my $list = ""; - - ## set Befehle für die AMAD_CommBridge - $list .= "expertMode:0,1 " if( $modules{AMAD}{defptr}{BRIDGE} ); - $list .= "fhemServerIP " if( $modules{AMAD}{defptr}{BRIDGE} ); - - if( lc $cmd eq 'expertmode' - || lc $cmd eq 'fhemserverip' ) { - - readingsSingleUpdate( $hash, $cmd, $val[0], 0 ); - - return; - } - - return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; - } -} - -sub AMAD_SelectSetCmd($$@) { - - my ( $hash, $cmd, @data ) = @_; - my $name = $hash->{NAME}; - my $host = $hash->{HOST}; - my $port = $hash->{PORT}; - - if( lc $cmd eq 'screenmsg' ) { - my $msg = join( " ", @data ); - - $msg =~ s/%/%25/g; - $msg =~ s/\s/%20/g; - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/screenMsg?message=$msg"; - Log3 $name, 4, "AMAD ($name) - Sub AMAD_SetScreenMsg"; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'ttsmsg' ) { - - my $msg = join( " ", @data ); - my $speed = AttrVal( $name, "setTtsMsgSpeed", "1.0" ); - my $lang = AttrVal( $name, "setTtsMsgLang","de" ); - - $msg =~ s/%/%25/g; - $msg =~ s/\s/%20/g; - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/ttsMsg?message=".$msg."&msgspeed=".$speed."&msglang=".$lang; - - 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 ); - - if( $vol =~ /^\+(.*)/ or $vol =~ /^-(.*)/ ) { - - if( $vol =~ /^\+(.*)/ ) { - - $vol =~ s/^\+//g; - $vol = ReadingsVal( $name, "volume", 15 ) + $vol; - } - - elsif( $vol =~ /^-(.*)/ ) { - - $vol =~ s/^-//g; - printf $vol; - $vol = ReadingsVal( $name, "volume", 15 ) - $vol; - } - } - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setVolume?volume=$vol"; - - return AMAD_HTTP_POST( $hash, $url ); - } - - elsif( lc $cmd eq 'volumenotification' ) { - - my $vol = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setNotifiVolume?notifivolume=$vol"; - - return AMAD_HTTP_POST( $hash, $url ); - } - - elsif( lc $cmd eq 'volumeringsound' ) { - - my $vol = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setRingSoundVolume?ringsoundvolume=$vol"; - - return AMAD_HTTP_POST( $hash, $url ); - } - - elsif( lc $cmd =~ /^media/ ) { - - my $btn = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/multimediaControl?mplayer=".$cmd."&button=".$btn; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'screenbrightness' ) { - - my $bri = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setBrightness?brightness=$bri"; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'screen' ) { - - my $mod = join( " ", @data ); - my $scot = AttrVal( $name, "setScreenOnForTimer", undef ); - $scot = 60 if( !$scot ); - - if ($mod eq "on" || $mod eq "off") { - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenOnOff?screen=".$mod."&screenontime=".$scot 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/screenlock?lockmod=".$mod."&lockPIN=".$PIN; - - return AMAD_HTTP_POST( $hash,$url ); - } - } - - elsif( lc $cmd eq 'screenorientation' ) { - - my $mod = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenOrientation?orientation=$mod"; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'activatevoiceinput' ) { - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setvoicecmd"; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'screenfullscreen' ) { - - my $mod = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenFullscreen?fullscreen=$mod"; - - readingsSingleUpdate( $hash, $cmd, $mod, 1 ); - - return AMAD_HTTP_POST( $hash, $url ); - } - - elsif( lc $cmd eq 'openurl' ) { - - my $openurl = join( " ", @data ); - my $browser = AttrVal( $name, "setOpenUrlBrowser", "com.android.chrome|com.google.android.apps.chrome.Main" ); - my @browserapp = split( /\|/, $browser ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/openURL?url=".$openurl."&browserapp=".$browserapp[0]."&browserappclass=".$browserapp[1]; - - return AMAD_HTTP_POST( $hash, $url ); - } - - elsif (lc $cmd eq 'nextalarmtime') { - - my $value = join( " ", @data ); - my @alarm = split( ":", $value ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setAlarm?hour=".$alarm[0]."&minute=".$alarm[1]; - - return AMAD_HTTP_POST( $hash, $url ); - } - - elsif (lc $cmd eq 'timer') { - - my $timer = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setTimer?minute=$timer"; - - return AMAD_HTTP_POST( $hash, $url ); - } - - elsif( lc $cmd eq 'statusrequest' ) { - - AMAD_statusRequest( $hash ); - return undef; - } - - elsif( lc $cmd eq 'openapp' ) { - - my $app = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/openApp?app=$app"; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'system' ) { - - my $systemcmd = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/systemcommand?syscmd=$systemcmd"; - - readingsSingleUpdate( $hash, "airplanemode", "on", 1 ) if( $systemcmd eq "airplanemodeON" ); - readingsSingleUpdate( $hash, "deviceState", "offline", 1 ) if( $systemcmd eq "airplanemodeON" || $systemcmd eq "shutdown" ); - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'donotdisturb' ) { - - my $disturbmod = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/donotdisturb?disturbmod=$disturbmod"; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'bluetooth' ) { - - my $mod = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setbluetooth?bluetooth=$mod"; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'notifysndfile' ) { - - my $notify = join( " ", @data ); - my $filepath = AttrVal( $name, "setNotifySndFilePath", "/storage/emulated/0/Notifications/" ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/playnotifysnd?notifyfile=".$notify."¬ifypath=".$filepath; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'changetobtdevice' ) { - - my $swToBtDevice = join( " ", @data ); - my @swToBtMac = split( /\|/, $swToBtDevice ); - my $btDevices = AttrVal( $name, "setBluetoothDevice", "none" ) if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); - my @btDevice = split( ',', $btDevices ); - my @btDeviceOne = split( /\|/, $btDevice[0] ); - my @btDeviceTwo = split( /\|/, $btDevice[1] ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setbtdevice?swToBtDeviceMac=".$swToBtMac[1]."&btDeviceOne=".$btDeviceOne[1]."&btDeviceTwo=".$btDeviceTwo[1]; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'clearnotificationbar' ) { - - my $appname = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/clearnotificationbar?app=$appname"; - - 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 ); - $exkey1 = "" if( !$exkey1 ); - $exval1 = "" if( !$exval1 ); - $exkey2 = "" if( !$exkey2 ); - $exval2 = "" if( !$exval2 ); - - 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 ); - } - - elsif( lc $cmd eq 'installflowsource' ) { - - my $flowname = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/installFlow?flowname=$flowname"; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'opencall' ) { - - my $string = join( " ", @data ); - my ($callnumber, $time) = split( "[ \t][ \t]*", $string ); - $time = "none" if( !$time ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/openCall?callnumber=".$callnumber."&hanguptime=".$time; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'closecall' ) { - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/closeCall"; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'startdaydream' ) { - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/startDaydream"; - - return AMAD_HTTP_POST( $hash,$url ); - } - - elsif( lc $cmd eq 'currentflowsetupdate' ) { - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/currentFlowsetUpdate"; - - 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; -} - -sub AMAD_HTTP_POST($$) { - - my ( $hash, $url ) = @_; - my $name = $hash->{NAME}; - - my $state = ReadingsVal( $name, "state", 0 ); - - readingsSingleUpdate( $hash, "state", "Send HTTP POST", 1 ); - - HttpUtils_NonblockingGet( - { - url => $url, - timeout => 15, - hash => $hash, - method => "POST", - header => "Connection: close", - doTrigger => 1, - callback => \&AMAD_HTTP_POSTerrorHandling, - } - ); - - Log3 $name, 4, "AMAD ($name) - Send HTTP POST with URL $url"; - - readingsSingleUpdate( $hash, "state", $state, 1 ); - - return undef; -} - -sub AMAD_HTTP_POSTerrorHandling($$$) { - - my ( $param, $err, $data ) = @_; - my $hash = $param->{hash}; - my $name = $hash->{NAME}; - - - ### Begin Error Handling - if( $hash->{helper}{setCmdErrorCounter} > 2 ) { - - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "lastSetCommandState", "statusRequest_error" ); - - if( ReadingsVal( $name, "flow_Informations", "active" ) eq "inactive" && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { - - Log3 $name, 5, "AMAD ($name) - setCommandERROR: CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; - - readingsBulkUpdate( $hash, "deviceState", "offline" ); - readingsBulkUpdate( $hash, "state", "AMAD Flows inactive, device set offline" ); - } - - elsif( $hash->{helper}{infoErrorCounter} > 7 && $hash->{helper}{setCmdErrorCounter} > 4 ) { - - Log3 $name, 5, "AMAD ($name) - setCommandERROR: UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; - - $attr{$name}{disable} = 1; - readingsBulkUpdate( $hash, "state", "Unknown Error, device disabled" ); - $hash->{helper}{infoErrorCounter} = 0; - $hash->{helper}{setCmdErrorCounter} = 0; - - return; - } - - elsif( ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { - - Log3 $name, 5, "AMAD ($name) - setCommandERROR: Flow SetCommands on your Device is inactive, will try to reactivate"; - } - - elsif( $hash->{helper}{setCmdErrorCounter} > 9 ) { - - Log3 $name, 5, "AMAD ($name) - setCommandERROR: To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; - - readingsBulkUpdate( $hash, "deviceState", "offline" ); - readingsBulkUpdate( $hash, "state", "To many Errors, device set offline" ); - $hash->{helper}{setCmdErrorCounter} = 0; - } - - elsif( $hash->{helper}{setCmdErrorCounter} > 4 && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "active" ){ - - Log3 $name, 5, "AMAD ($name) - setCommandERROR: Please check the AutomagicAPP on your Device"; - } - - readingsEndUpdate( $hash, 1 ); - } - - if( defined( $err ) ) { - if( $err ne "" ) { - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "state", $err ) if( ReadingsVal( $name, "state", 0 ) ne "initialized" ); - $hash->{helper}{setCmdErrorCounter} = ($hash->{helper}{setCmdErrorCounter} + 1); - - readingsBulkUpdate( $hash, "lastSetCommandState", "setCmd_error" ); - - if( $err =~ /timed out/ ) { - - Log3 $name, 5, "AMAD ($name) - setCommandERROR: connect to your device is timed out. check network"; - } - - elsif( $err =~ /Keine Route zum Zielrechner/ ) { - - Log3 $name, 5, "AMAD ($name) - setCommandERROR: no route to target. bad network configuration or network is down"; - - } else { - - Log3 $name, 5, "AMAD ($name) - setCommandERROR: $err"; - } - - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 5, "AMAD ($name) - setCommandERROR: error while POST Command: $err"; - - return; - } - } - - if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { - - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $hash, "state", 0 ) ne "initialized" ); - - $hash->{helper}{setCmdErrorCounter} = ( $hash->{helper}{setCmdErrorCounter} + 1 ); - - readingsBulkUpdate($hash, "lastSetCommandState", "setCmd_error" ); - - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 5, "AMAD ($name) - setCommandERROR: received http code ".$param->{code}; - - return; - } - - if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { - - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state", 0 ) ne "initialized" ); - - $hash->{helper}{setCmdErrorCounter} = ( $hash->{helper}{setCmdErrorCounter} + 1 ); - - readingsBulkUpdate( $hash, "lastSetCommandState", "setCmd_error" ); - - if( $param->{code} eq 404 ) { - - readingsBulkUpdate( $hash, "lastSetCommandError", "" ); - Log3 $name, 5, "AMAD ($name) - setCommandERROR: setCommands flow is inactive on your device!"; - - } else { - - Log3 $name, 5, "AMAD ($name) - setCommandERROR: http error ".$param->{code}; - } - - return; - } - - ### End Error Handling - - readingsSingleUpdate( $hash, "lastSetCommandState", "setCmd_done", 1 ); - $hash->{helper}{setCmdErrorCounter} = 0; - - return undef; -} - -sub AMAD_checkDeviceState($) { - - my ( $hash ) = @_; - my $name = $hash->{NAME}; - - Log3 $name, 4, "AMAD ($name) - AMAD_checkDeviceState: run Check"; - - RemoveInternalTimer( $hash ); - - if( ReadingsAge( $name, "deviceState", 90 ) > 90 ) { - - AMAD_statusRequest( $hash ) if( $hash->{helper}{deviceStateErrorCounter} == 0 ); - readingsSingleUpdate( $hash, "deviceState", "offline", 1 ) if( ReadingsAge( $name, "deviceState", 180) > 180 and $hash->{helper}{deviceStateErrorCounter} > 0 ); - $hash->{helper}{deviceStateErrorCounter} = ( $hash->{helper}{deviceStateErrorCounter} + 1 ); - } - - InternalTimer( gettimeofday()+90, "AMAD_checkDeviceState", $hash, 0 ); - - Log3 $name, 4, "AMAD ($name) - AMAD_checkDeviceState: set new Timer"; -} - -sub AMAD_CommBridge_Open($) { - - my ( $hash ) = @_; - my $name = $hash->{NAME}; - my $port = $hash->{PORT}; - - - # Oeffnen des TCP Sockets - my $ret = TcpServer_Open( $hash, $port, "global" ); - - if( $ret && !$init_done ) { - - Log3 $name, 3, "$ret. Exiting."; - exit(1); - } - - readingsSingleUpdate ( $hash, "state", "opened", 1 ); - Log3 $name, 5, "Socket wird geöffnet."; - - return $ret; -} - -sub AMAD_CommBridge_Read($) { - - my ( $hash ) = @_; - my $name = $hash->{NAME}; - my $bhash = $modules{AMAD}{defptr}{BRIDGE}; - my $bname = $bhash->{NAME}; - - - - if( $hash->{SERVERSOCKET} ) { # Accept and create a child - TcpServer_Accept( $hash, "AMAD" ); - return; - } - - # Read 1024 byte of data - my $buf; - my $ret = sysread($hash->{CD}, $buf, 1024); - - - - # When there is an error in connection return - if( !defined($ret ) || $ret <= 0 ) { - CommandDelete( undef, $hash->{NAME} ); - return; - } - - - #### Verarbeitung der Daten welche über die AMADCommBridge kommen #### - - Log3 $bname, 5, "AMAD ($bname) - Receive RAW Message in Debugging Mode: $buf"; - - ### - ## Consume Content - ### - - my @data = split( '\R\R', $buf ); - - my $header = AMAD_Header2Hash( $data[0] ); - my $response; - my $c; - my $device = $header->{FHEMDEVICE} if(defined($header->{FHEMDEVICE})); - my $fhemcmd = $header->{FHEMCMD} if(defined($header->{FHEMCMD})); - my $dhash = $defs{$device} if(defined($device)); - - - - - if ( $data[0] =~ /currentFlowsetUpdate.xml/ ) { - - my $fhempath = $attr{global}{modpath}; - $response = qx(cat $fhempath/FHEM/lib/74_AMADautomagicFlowset_$flowsetversion.xml); - $c = $hash->{CD}; - print $c "HTTP/1.1 200 OK\r\n", - "Content-Type: text/plain\r\n", - "Connection: close\r\n", - "Content-Length: ".length($response)."\r\n\r\n", - $response; - - return; - } - - elsif ( $data[0] =~ /installFlow_([^.]*.xml)/ ) { - - if( defined($1) ){ - $response = qx(cat /tmp/$1); - $c = $hash->{CD}; - print $c "HTTP/1.1 200 OK\r\n", - "Content-Type: text/plain\r\n", - "Connection: close\r\n", - "Content-Length: ".length($response)."\r\n\r\n", - $response; - - return; - } - } - - - - elsif( !defined($device) ) { - readingsSingleUpdate( $bhash, "transmitterERROR", $name." has no device name sends", 1 ) if( ReadingsVal( $bname, "expertMode", 0 ) eq "1" ); - Log3 $name, 4, "AMAD ($name) - ERROR - no device name given. please check your global variable in automagic"; - - $response = "header lines: \r\n AMADCommBridge receive no device name. please check your global variable in automagic\r\n FHEM to do nothing\r\n"; - $c = $hash->{CD}; - print $c "HTTP/1.1 200 OK\r\n", - "Content-Type: text/plain\r\n", - "Connection: close\r\n", - "Content-Length: ".length($response)."\r\n\r\n", - $response; - - return; - } - - - - if( defined($fhemcmd) and ($fhemcmd) ) { - if ( $fhemcmd =~ /setreading\b/ ) { - my $tv = $data[1]; - return Log3 $bname, 3, "AMAD ($bname) - AMAD_CommBridge: processing receive no reading values from Device: $device" - unless( defined($tv) and ($tv) ); - - Log3 $bname, 4, "AMAD ($bname) - AMAD_CommBridge: processing receive reading values - Device: $device Data: $tv"; - - 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", - "Content-Type: text/plain\r\n", - "Connection: close\r\n", - "Content-Length: ".length($response)."\r\n\r\n", - $response; - - return; - } - - elsif ( $fhemcmd =~ /set\b/ ) { - my $fhemCmd = $data[1]; - - fhem ("set $fhemCmd") if( ReadingsVal( $bname, "expertMode", 0 ) eq "1" ); - readingsSingleUpdate( $bhash, "receiveFhemCommand", "set ".$fhemCmd, 0 ); - Log3 $bname, 4, "AMAD ($bname) - AMAD_CommBridge: set reading receive fhem command"; - - $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM execute set command now\r\n"; - $c = $hash->{CD}; - print $c "HTTP/1.1 200 OK\r\n", - "Content-Type: text/plain\r\n", - "Connection: close\r\n", - "Content-Length: ".length($response)."\r\n\r\n", - $response; - - return; - } - - elsif ( $fhemcmd =~ /voiceinputvalue\b/ ) { - my $fhemCmd = lc $data[1]; - - readingsBeginUpdate( $bhash); - readingsBulkUpdate( $bhash, "receiveVoiceCommand", $fhemCmd ); - readingsBulkUpdate( $bhash, "receiveVoiceDevice", $device ); - readingsEndUpdate( $bhash, 1 ); - Log3 $bname, 4, "AMAD ($bname) - AMAD_CommBridge: set reading receive voice command: $fhemCmd from Device $device"; - - $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", - "Content-Type: text/plain\r\n", - "Connection: close\r\n", - "Content-Length: ".length($response)."\r\n\r\n", - $response; - - return; - } - - elsif ( $fhemcmd =~ /readingsval\b/ ) { - my $fhemCmd = $data[1]; - my @datavalue = split( ' ', $fhemCmd ); - - $response = ReadingsVal( $datavalue[0], $datavalue[1], $datavalue[2] ); - $c = $hash->{CD}; - print $c "HTTP/1.1 200 OK\r\n", - "Content-Type: text/plain\r\n", - "Connection: close\r\n", - "Content-Length: ".length($response)."\r\n\r\n", - $response; - - Log3 $bname, 4, "AMAD ($bname) - AMAD_CommBridge: response ReadingsVal Value to Automagic Device"; - return; - } - - elsif ( $fhemcmd =~ /fhemfunc\b/ ) { - my $fhemCmd = $data[1]; - - Log3 $bname, 4, "AMAD ($bname) - AMAD_CommBridge: receive fhem-function command"; - - if( $fhemCmd =~ /^{.*}$/ ) { - - $response = $fhemCmd if( ReadingsVal( $bname, "expertMode", 0 ) eq "1" ); - - } else { - - $response = "header lines: \r\n AMADCommBridge receive no typical FHEM function\r\n FHEM to do nothing\r\n"; - } - - $c = $hash->{CD}; - print $c "HTTP/1.1 200 OK\r\n", - "Content-Type: text/plain\r\n", - "Connection: close\r\n", - "Content-Length: ".length($response)."\r\n\r\n", - $response; - - return; - } - - } - - - $response = "header lines: \r\n AMADCommBridge receive incomplete or corrupt Data\r\n FHEM to do nothing\r\n"; - $c = $hash->{CD}; - print $c "HTTP/1.1 200 OK\r\n", - "Content-Type: text/plain\r\n", - "Connection: close\r\n", - "Content-Length: ".length($response)."\r\n\r\n", - $response; -} - -sub AMAD_Header2Hash($) { - - my ( $string ) = @_; - my %hash = (); - - foreach my $line (split("\r\n", $string)) { - my ($key,$value) = split( ": ", $line ); - next if( !$value ); - - $value =~ s/^ //; - $hash{$key} = $value; - } - - return \%hash; -} - -sub AMAD_encrypt($) { - - my ($decodedPIN) = @_; - my $key = getUniqueId(); - my $encodedPIN; - - return $decodedPIN if( $decodedPIN =~ /^crypt:(.*)/ ); - - for my $char (split //, $decodedPIN) { - my $encode = chop($key); - $encodedPIN .= sprintf("%.2x",ord($char)^ord($encode)); - $key = $encode.$key; - } - - return 'crypt:'. $encodedPIN; -} - -sub AMAD_decrypt($) { - - my ($encodedPIN) = @_; - my $key = getUniqueId(); - my $decodedPIN; - - $encodedPIN = $1 if( $encodedPIN =~ /^crypt:(.*)/ ); - - for my $char (map { pack('C', hex($_)) } ($encodedPIN =~ /(..)/g)) { - my $decode = chop($key); - $decodedPIN .= chr(ord($char)^ord($decode)); - $key = $decode.$key; - } - - return $decodedPIN; -} - - - - -1; - -=pod - -=item device -=item summary Integrates Android devices into FHEM and displays several settings. -=item summary_DE Integriert Android-Geräte in FHEM und zeigt verschiedene Einstellungen an. - -=begin html - - -

AMAD

-
    - AMAD - Automagic Android Device -
    - This module integrates Android devices into FHEM and displays several settings using the Android app "Automagic". - Automagic is comparable to the "Tasker" app for automating tasks and configuration settings. But Automagic is more user-friendly. The "Automagic Premium" app currently costs EUR 2.90. -
    - Any information retrievable by Automagic can be displayed in FHEM by this module. Just define your own Automagic-"flow" and send the data to the AMADCommBridge. One even can control several actions on Android devices. -
    - To be able to make use of all these functions the Automagic app and additional flows need to be installed on the Android device. The flows can be retrieved from the FHEM directory, the app can be bought in Google Play Store. -

    - How to use AMAD? -
      -
    • install the "Automagic Premium" app from the Google Play store.
    • -
    • install the flowset 74_AMADautomagicFlowset$VERSION.xml from the directory $INSTALLFHEM/FHEM/lib/ on your Android device and activate.
    • -
    -
    - Now you need to define a device in FHEM. -

    - - Define -

      - define <name> AMAD <IP-ADDRESS> -

      - Example: -

        - define WandTabletWohnzimmer AMAD 192.168.0.23
        -
      -
      - With this command two new AMAD devices in a room called AMAD are created. The parameter <IP-ADDRESS< defines the IP address of your Android device. The second device created is the AMADCommBridge which serves as a communication device from each Android device to FHEM.
      - !!!Coming Soon!!! The communication port of each AMAD device may be set by the definition of the "port" attribute. One needs background knowledge of Automagic and HTTP requests as this port will be set in the HTTP request trigger of both flows, therefore the port also needs to be set there. -
      - The communication port of the AMADCommBridge device can easily be changed within the attribut "port".
      -
    -
    - AMAD Communication Bridge -
      - Creating your first AMAD device automatically creates the AMADCommBridge device in the room AMAD. With the help of the AMADCommBridge any Android device communicates initially to FHEM.To make the IP addresse of the FHEM server known to the Android device, the FHEM server IP address needs to be configured in the AMADCommBridge. WITHOUT THIS STEP THE AMADCommBridge WILL NOT WORK PROPERLY.
      - Please us the following command for configuration of the FHEM server IP address in the AMADCommBridge: set AMADCommBridge fhemServerIP <FHEM-IP>.
      - Additionally the expertMode may be configured. By this setting a direct communication with FHEM will be established without the restriction of needing to make use of a notify to execute set commands. -

    -
    - You are finished now! After 15 seconds latest the readings of your AMAD Android device should be updated. Consequently each 15 seconds a status request will be sent. If the state of your AMAD Android device does not change to "active" over a longer period of time one should take a look into the log file for error messages. -


    - - Readings -
      -
    • airplanemode - on/off, state of the aeroplane mode
    • -
    • androidVersion - currently installed version of Android
    • -
    • automagicState - state of the Automagic App (prerequisite Android >4.3). In case you have Android >4.3 and the reading says "not supported", you need to enable Automagic inside Android / Settings / Sound & notification / Notification access
    • -
    • batteryHealth - the health of the battery (1=unknown, 2=good, 3=overheat, 4=dead, 5=over voltage, 6=unspecified failure, 7=cold)
    • -
    • batterytemperature - the temperature of the battery
    • -
    • bluetooth - on/off, bluetooth state
    • -
    • checkActiveTask - state of an app (needs to be defined beforehand). 0=not active or not active in foreground, 1=active in foreground, see note below
    • -
    • connectedBTdevices - list of all devices connected via bluetooth
    • -
    • connectedBTdevicesMAC - list of MAC addresses of all devices connected via bluetooth
    • -
    • currentMusicAlbum - currently playing album of mediaplayer
    • -
    • currentMusicApp - currently playing player app (Amazon Music, Google Play Music, Google Play Video, Spotify, YouTube, TuneIn Player, Aldi Life Music)
    • -
    • currentMusicArtist - currently playing artist of mediaplayer
    • -
    • currentMusicIcon - cover of currently play albumNoch nicht fertig implementiert
    • -
    • currentMusicState - state of currently/last used mediaplayer
    • -
    • currentMusicTrack - currently playing song title of mediaplayer
    • -
    • daydream - on/off, daydream currently active
    • -
    • deviceState - state of Android devices. unknown, online, offline.
    • -
    • doNotDisturb - state of do not Disturb Mode
    • -
    • dockingState - undocked/docked, Android device in docking station
    • -
    • flow_SetCommands - active/inactive, state of SetCommands flow
    • -
    • flow_informations - active/inactive, state of Informations flow
    • -
    • flowsetVersionAtDevice - currently installed version of the flowsets on the Android device
    • -
    • incomingCallerName - Callername from last Call
    • -
    • incomingCallerNumber - Callernumber from last Call
    • -
    • incommingWhatsAppMessageFrom - last WhatsApp message
    • -
    • incommingWhatsTelegramMessageFrom - last telegram message
    • -
    • intentRadioName - name of the most-recent streamed intent radio
    • -
    • intentRadioState - state of intent radio player
    • -
    • keyguardSet - 0/1 keyguard set, 0=no 1=yes, does not indicate whether it is currently active
    • -
    • lastSetCommandError - last error message of a set command
    • -
    • lastSetCommandState - last state of a set command, command send successful/command send unsuccessful
    • -
    • lastStatusRequestError - last error message of a statusRequest command
    • -
    • lastStatusRequestState - ast state of a statusRequest command, command send successful/command send unsuccessful
    • -
    • nextAlarmDay - currently set day of alarm
    • -
    • nextAlarmState - alert/done, current state of "Clock" stock-app
    • -
    • nextAlarmTime - currently set time of alarm
    • -
    • powerLevel - state of battery in %
    • -
    • powerPlugged - 0=no/1,2=yes, power supply connected
    • -
    • screen - on locked,unlocked/off locked,unlocked, state of display
    • -
    • screenBrightness - 0-255, level of screen-brightness
    • -
    • screenFullscreen - on/off, full screen mode
    • -
    • 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
    • -
      - Prerequisite for using the reading checkActivTask the package name of the application to be checked needs to be defined in the attribute checkActiveTask. Example: attr Nexus10Wohnzimmer - checkActiveTask com.android.chrome für den Chrome Browser. -

      -
    -

    - - Set -
      -
    • activateVoiceInput - start voice input on Android device
    • -
    • bluetooth - on/off, switch bluetooth on/off
    • -
    • clearNotificationBar - All/Automagic, deletes all or only Automagic notifications in status bar
    • -
    • closeCall - hang up a running call
    • -
    • currentFlowsetUpdate - start flowset update on Android device
    • -
    • installFlowSource - install a Automagic flow on device, XML file must be stored in /tmp/ with extension xml. Example: set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml
    • -
    • doNotDisturb - sets the do not Disturb Mode, always Disturb, never Disturb, alarmClockOnly alarm Clock only, onlyImportant only important Disturbs
    • -
    • mediaAmazonMusic - play/stop/next/back , controlling the amazon music media player
    • -
    • mediaGoogleMusic - play/stop/next/back , controlling the google play music media player
    • -
    • mediaSpotifyMusic - play/stop/next/back , controlling the spotify media player
    • -
    • mediaTuneinRadio - play/stop/next/back , controlling the TuneinRadio media player
    • -
    • mediaAldiMusic - play/stop/next/back , controlling the Aldi music media player
    • -
    • mediaAudible - play/stop/next/back , controlling the Audible media player
    • -
    • mediaYouTube - play/stop/next/back , controlling the YouTube media player
    • -
    • mediaVlcPlayer - play/stop/next/back , controlling the VLC media player
    • -
    • nextAlarmTime - sets the alarm time. Only valid for the next 24 hours.
    • -
    • notifySndFile - plays a media-file which by default needs to be stored in the folder "/storage/emulated/0/Notifications/" of the Android device. You may use the attribute setNotifySndFilePath for defining a different folder.
    • -
    • openCall - initial a call and hang up after optional time / set DEVICE openCall 0176354 10 call this number and hang up after 10s
    • -
    • screenBrightness - 0-255, set screen brighness
    • -
    • screenMsg - display message on screen of Android device
    • -
    • sendintent - send intent string Example: set $AMADDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio, first parameter contains the action, second parameter contains the extra. At most two extras can be used.
    • -
    • sendSMS - Sends an SMS to a specific phone number. Bsp.: sendSMS Dies ist ein Test|555487263
    • -
    • startDaydream - start Daydream
    • -
    • 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
    • -
    -
    - Set (depending on attribute values) -
      -
    • changetoBtDevice - switch to another bluetooth device. Attribute setBluetoothDevice needs to be set. See note below!
    • -
    • openApp - start an app. attribute setOpenApp
    • -
    • openURL - opens a URLS in the standard browser as long as no other browser is set by the attribute setOpenUrlBrowser.Example: attr Tablet setOpenUrlBrowser de.ozerov.fully|de.ozerov.fully.MainActivity, first parameter: package name, second parameter: Class Name
    • -
    • screen - on/off/lock/unlock, switch screen on/off or lock/unlock screen. In Automagic "Preferences" the "Device admin functions" need to be enabled, otherwise "Screen off" does not work. attribute setScreenOnForTimer changes the time the display remains switched on!
    • -
    • screenFullscreen - on/off, activates/deactivates full screen mode. attribute setFullscreen
    • -
    • screenLock - Locks screen with request for PIN. attribute setScreenlockPIN - enter PIN here. Only use numbers, 4-16 numbers required.
    • -
    • screenOrientation - Auto,Landscape,Portait, set screen orientation (automatic, horizontal, vertical). attribute setScreenOrientation
    • -
    • system - issue system command (only with rooted Android devices). reboot,shutdown,airplanemodeON (can only be switched ON) attribute root, in Automagic "Preferences" "Root functions" need to be enabled.
    • -
    • setAPSSID - set WLAN AccesPoint SSID to prevent WLAN sleeps
    • -
    • setNotifySndFilePath - set systempath to notifyfile (default /storage/emulated/0/Notifications/
    • -
    • setTtsMsgSpeed - set speaking speed for TTS (Value between 0.5 - 4.0, 0.5 Step) default is 1.0
    • -
    • setTtsMsgLang - set speaking language for TTS, de or en (default is de)
    • -
      - To be able to use "openApp" the corresponding attribute "setOpenApp" needs to contain the app package name. -

      - To be able to switch between bluetooth devices the attribute "setBluetoothDevice" needs to contain (a list of) bluetooth devices defined as follows: attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC No spaces are allowed in any BTdeviceName. Defining MAC please make sure to use the character : (colon) after each second digit/character.
      - Example: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76 -
    -

    - - state -
      -
    • initialized - shown after initial define.
    • -
    • active - device is active.
    • -
    • disabled - device is disabled by the attribute "disable".
    • -
    -


    - Further examples and reading: - -


    -
- -=end html -=begin html_DE - - -

AMAD

-
    - AMAD - Automagic Android Device -
    - Dieses Modul liefert, in Verbindung mit der Android APP Automagic, diverse Informationen von Android Geräten. - Die AndroidAPP Automagic (welche nicht von mir stammt und 2.90 Euro kostet) funktioniert wie Tasker, ist aber bei weitem User freundlicher. -
    - Mit etwas Einarbeitung können jegliche Informationen welche Automagic bereit stellt in FHEM angezeigt werden. Hierzu bedarf es lediglich eines eigenen Flows welcher seine Daten an die AMADCommBridge sendet. Das Modul gibt auch die Möglichkeit Androidgeräte zu steuern. -
    - Für all diese Aktionen und Informationen wird auf dem Androidgerät "Automagic" und ein so genannter Flow benötigt. Die App ist über den Google PlayStore zu beziehen. Das benötigte Flowset bekommt man aus dem FHEM Verzeichnis. -

    - Wie genau verwendet man nun AMAD? -
      -
    • man installiert die App "Automagic Premium" aus dem PlayStore.
    • -
    • dann installiert man das Flowset 74_AMADautomagicFlowset$VERSION.xml aus dem Ordner $INSTALLFHEM/FHEM/lib/ auf dem Androidgerät und aktiviert die Flows.
    • -
    -
    - Es muß noch ein Device in FHEM anlegt werden. -

    - - Define -

      - define <name> AMAD <IP-ADRESSE> -

      - Beispiel: -

        - define WandTabletWohnzimmer AMAD 192.168.0.23
        -
      -
      - Diese Anweisung erstellt zwei neues AMAD-Device im Raum AMAD.Der Parameter <IP-ADRESSE> legt die IP Adresse des Android Gerätes fest.
      - Das zweite Device ist die AMADCommBridge welche als Kommunikationsbrücke vom Androidgerät zu FHEM diehnt. !!!Comming Soon!!! Wer den Port ändern möchte, kann dies über das Attribut "port" tun. Ihr solltet aber wissen was Ihr tut, da dieser Port im HTTP Request Trigger der beiden Flows eingestellt ist. Demzufolge muß der Port dort auch geändert werden. Der Port für die Bridge kann ohne Probleme im Bridge Device mittels dem Attribut "port" verändert werden. -
      - Der Port für die Bridge kann ohne Probleme im Bridge Device mittels dem Attribut "port" verändert werden.
      -
    -
    - AMAD Communication Bridge -
      - Beim ersten anlegen einer AMAD Deviceinstanz wird automatisch ein Gerät Namens AMADCommBridge im Raum AMAD mit angelegt. Dieses Gerät diehnt zur Kommunikation vom Androidgerät zu FHEM ohne das zuvor eine Anfrage von FHEM aus ging. Damit das Androidgerät die IP von FHEM kennt, muss diese sofort nach dem anlegen der Bridge über den set Befehl in ein entsprechendes Reading in die Bridge geschrieben werden. DAS IST SUPER WICHTIG UND FÜR DIE FUNKTION DER BRIDGE NOTWENDIG.
      - Hierfür muß folgender Befehl ausgeführt werden. set AMADCommBridge fhemServerIP <FHEM-IP>.
      - Als zweites Reading kann expertMode gesetzen werden. Mit diesem Reading wird eine unmittelbare Komminikation mit FHEM erreicht ohne die Einschränkung über ein - Notify gehen zu müssen und nur reine set Befehle ausführen zu können. -

    - NUN bitte die Flows AKTIVIEREN!!!
    -
    - Fertig! Nach anlegen der Geräteinstanz und dem eintragen der fhemServerIP in der CommBridge sollten nach spätestens 15 Sekunden bereits die ersten Readings reinkommen. Nun wird alle 15 Sekunden probiert einen Status Request erfolgreich ab zu schließen. Wenn der Status sich über einen längeren Zeitraum nicht auf "active" ändert, sollte man im Log nach eventuellen Fehlern suchen. -


    - - Readings -
      -
    • airplanemode - Status des Flugmodus
    • -
    • androidVersion - aktuell installierte Androidversion
    • -
    • automagicState - Statusmeldungen von der AutomagicApp (Voraussetzung Android >4.3). Ist Android größer 4.3 vorhanden und im Reading steht "wird nicht unterstützt", muß in den Androideinstellungen unter Ton und Benachrichtigungen -> Benachrichtigungszugriff ein Haken für Automagic gesetzt werden
    • -
    • batteryHealth - Zustand der Battery (1=unbekannt, 2=gut, 3=Überhitzt, 4=tot, 5=Überspannung, 6=unbekannter Fehler, 7=kalt)
    • -
    • batterytemperature - Temperatur der Batterie
    • -
    • bluetooth - on/off, Bluetooth Status an oder aus
    • -
    • checkActiveTask - Zustand einer zuvor definierten APP. 0=nicht aktiv oder nicht aktiv im Vordergrund, 1=aktiv im Vordergrund, siehe Hinweis unten
    • -
    • connectedBTdevices - eine Liste der verbundenen Gerät
    • -
    • connectedBTdevicesMAC - eine Liste der MAC Adressen aller verbundender BT Geräte
    • -
    • currentMusicAlbum - aktuell abgespieltes Musikalbum des verwendeten Mediaplayers
    • -
    • currentMusicApp - aktuell verwendeter Mediaplayer (Amazon Music, Google Play Music, Google Play Video, Spotify, YouTube, TuneIn Player, Aldi Life Music)
    • -
    • currentMusicArtist - aktuell abgespielter Musikinterpret des verwendeten Mediaplayers
    • -
    • currentMusicIcon - Cover vom aktuell abgespielten Album Noch nicht fertig implementiert
    • -
    • currentMusicState - Status des aktuellen/zuletzt verwendeten Mediaplayers
    • -
    • currentMusicTrack - aktuell abgespielter Musiktitel des verwendeten Mediaplayers
    • -
    • daydream - on/off, Daydream gestartet oder nicht
    • -
    • deviceState - Status des Androidgerätes. unknown, online, offline.
    • -
    • doNotDisturb - aktueller Status des nicht stören Modus
    • -
    • dockingState - undocked/docked Status ob sich das Gerät in einer Dockinstation befindet.
    • -
    • flow_SetCommands - active/inactive, Status des SetCommands Flow
    • -
    • flow_informations - active/inactive, Status des Informations Flow
    • -
    • flowsetVersionAtDevice - aktuell installierte Flowsetversion auf dem Device
    • -
    • incomingCallerName - Anrufername des eingehenden Anrufes
    • -
    • incomingCallerNumber - Anrufernummer des eingehenden Anrufes
    • -
    • incommingWhatsAppMessageFrom - letzte WhatsApp Nachricht
    • -
    • incommingWhatsTelegramMessageFrom - letzte Telegram Nachricht
    • -
    • intentRadioName - zuletzt gesrreamter Intent Radio Name
    • -
    • intentRadioState - Status des IntentRadio Players
    • -
    • keyguardSet - 0/1 Displaysperre gesetzt 0=nein 1=ja, bedeutet nicht das sie gerade aktiv ist
    • -
    • lastSetCommandError - letzte Fehlermeldung vom set Befehl
    • -
    • lastSetCommandState - letzter Status vom set Befehl, Befehl erfolgreich/nicht erfolgreich gesendet
    • -
    • lastStatusRequestError - letzte Fehlermeldung vom statusRequest Befehl
    • -
    • lastStatusRequestState - letzter Status vom statusRequest Befehl, Befehl erfolgreich/nicht erfolgreich gesendet
    • -
    • nextAlarmDay - aktiver Alarmtag
    • -
    • nextAlarmState - aktueller Status des "Androidinternen" Weckers
    • -
    • nextAlarmTime - aktive Alarmzeit
    • -
    • powerLevel - Status der Batterie in %
    • -
    • powerPlugged - Netzteil angeschlossen? 0=NEIN, 1|2=JA
    • -
    • screen - on locked/unlocked, off locked/unlocked gibt an ob der Bildschirm an oder aus ist und gleichzeitig gesperrt oder nicht gesperrt
    • -
    • screenBrightness - Bildschirmhelligkeit von 0-255
    • -
    • screenFullscreen - on/off, Vollbildmodus (An,Aus)
    • -
    • 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
    • -
      - Beim Reading checkActivTask muß zuvor der Packagename der zu prüfenden App als Attribut checkActiveTask angegeben werden. Beispiel: attr Nexus10Wohnzimmer - checkActiveTask com.android.chrome für den Chrome Browser. -

      -
    -

    - - Set -
      -
    • activateVoiceInput - aktiviert die Spracheingabe
    • -
    • bluetooth - on/off, aktiviert/deaktiviert Bluetooth
    • -
    • clearNotificationBar - All,Automagic, löscht alle Meldungen oder nur die Automagic Meldungen in der Statusleiste
    • -
    • closeCall - beendet einen laufenden Anruf
    • -
    • currentFlowsetUpdate - fürt ein Flowsetupdate auf dem Device durch
    • -
    • 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
    • -
    • installFlowSource - installiert einen Flow auf dem Device, das XML File muss unter /tmp/ liegen und die Endung xml haben. Bsp: set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml
    • -
    • mediaAmazonMusic - play, stop, next, back ,steuert den Amazon Musik Mediaplayer
    • -
    • mediaGoogleMusic - play, stop, next, back ,steuert den Google Play Musik Mediaplayer
    • -
    • mediaSpotifyMusic - play, stop, next, back ,steuert den Spotify Mediaplayer
    • -
    • mediaTuneinRadio - play, stop, next, back ,steuert den TuneIn Radio Mediaplayer
    • -
    • mediaAldiMusic - play, stop, next, back ,steuert den Aldi Musik Mediaplayer
    • -
    • mediaAudible - play, stop, next, back ,steuert den Audible Mediaplayer
    • -
    • mediaYouTube - play, stop, next, back ,steuert den YouTube Mediaplayer
    • -
    • mediaVlcPlayer - play, stop, next, back ,steuert den VLC Mediaplayer
    • -
    • nextAlarmTime - setzt die Alarmzeit. gilt aber nur innerhalb der nächsten 24Std.
    • -
    • openCall - ruft eine Nummer an und legt optional nach X Sekunden auf / set DEVICE openCall 01736458 10 / ruft die Nummer an und beendet den Anruf nach 10s
    • -
    • screenBrightness - setzt die Bildschirmhelligkeit, von 0-255.
    • -
    • screenMsg - versendet eine Bildschirmnachricht
    • -
    • sendintent - sendet einen Intentstring Bsp: set $AMADDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio, der erste Befehl ist die Aktion und der zweite das Extra. Es können immer zwei Extras mitgegeben werden.
    • -
    • sendSMS - sendet eine SMS an eine bestimmte Telefonnummer. Bsp.: sendSMS Dies ist ein Test|555487263
    • -
    • startDaydream - startet den Daydream
    • -
    • 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.
    • -
    -
    - Set abhängig von gesetzten Attributen -
      -
    • changetoBtDevice - wechselt zu einem anderen Bluetooth Gerät. Attribut setBluetoothDevice muß gesetzt sein. Siehe Hinweis unten!
    • -
    • notifySndFile - spielt die angegebene Mediadatei auf dem Androidgerät ab. Die aufzurufende Mediadatei sollte sich im Ordner /storage/emulated/0/Notifications/ befinden. Ist dies nicht der Fall kann man über das Attribut setNotifySndFilePath einen Pfad vorgeben.
    • -
    • openApp - öffnet eine ausgewählte App. Attribut setOpenApp
    • -
    • openURL - öffnet eine URL im Standardbrowser, sofern kein anderer Browser über das Attribut setOpenUrlBrowser ausgewählt wurde. Bsp: attr Tablet setOpenUrlBrowser de.ozerov.fully|de.ozerov.fully.MainActivity, das erste ist der Package Name und das zweite der Class Name
    • -
    • setAPSSID - setzt die AccessPoint SSID um ein WLAN sleep zu verhindern
    • -
    • screen - on/off/lock/unlock schaltet den Bildschirm ein/aus oder sperrt/entsperrt ihn, in den Automagic Einstellungen muss "Admin Funktion" gesetzt werden sonst funktioniert "Screen off" nicht. Attribut setScreenOnForTimer ändert die Zeit wie lange das Display an bleiben soll!
    • -
    • screenFullscreen - on/off, (aktiviert/deaktiviert) den Vollbildmodus. Attribut setFullscreen
    • -
    • screenLock - Sperrt den Bildschirm mit Pinabfrage. Attribut setScreenlockPIN - hier die Pin dafür eingeben. Erlaubt sind nur Zahlen. Es müßen mindestens 4, bis max 16 Zeichen verwendet werden.
    • -
    • screenOrientation - Auto,Landscape,Portait, aktiviert die Bildschirmausrichtung (Automatisch,Horizontal,Vertikal). Attribut setScreenOrientation
    • -
    • system - setzt Systembefehle ab (nur bei gerootetet Geräen). reboot,shutdown,airplanemodeON (kann nur aktiviert werden) Attribut root, in den Automagic Einstellungen muss "Root Funktion" gesetzt werden
    • -
    • setNotifySndFilePath - setzt den korrekten Systempfad zur Notifydatei (default ist /storage/emulated/0/Notifications/
    • -
    • setTtsMsgSpeed - setzt die Sprachgeschwindigkeit bei der Sprachausgabe(Werte zwischen 0.5 bis 4.0 in 0.5er Schritten) default ist 1.0
    • -
    • setTtsMsgSpeed - setzt die Sprache bei der Sprachausgabe, de oder en (default ist de)
    • -
      - Um openApp verwenden zu können, muss als Attribut der Package Name der App angegeben werden. -

      - Um zwischen Bluetoothgeräten wechseln zu können, muß das Attribut setBluetoothDevice mit folgender Syntax gesetzt werden. attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC Es muss - zwingend darauf geachtet werden das beim BTdeviceName kein Leerzeichen vorhanden ist. Am besten zusammen oder mit Unterstrich. Achtet bei der MAC darauf das Ihr wirklich nach jeder zweiten Zahl auch - einen : drin habt
      - Beispiel: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76 -
    -

    - - state -
      -
    • initialized - Ist der Status kurz nach einem define.
    • -
    • active - die Geräteinstanz ist im aktiven Status.
    • -
    • disabled - die Geräteinstanz wurde über das Attribut disable deaktiviert
    • -
    -


    - Anwendungsbeispiele: - -


    -
- -=end html_DE -=cut diff --git a/74_AMADautomagicFlowset_2.6.12.xml b/74_AMADautomagicFlowset_2.6.12.xml deleted file mode 100644 index ddf86ed..0000000 --- a/74_AMADautomagicFlowset_2.6.12.xml +++ /dev/null @@ -1,3745 +0,0 @@ - - - - true - Akku Ladestand: grösser als 0% - true - 0 - HIGHER_THAN - false - true - - - false - App Task Beendet - true - * - - - true - Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic - true - ch.gridvision.ppam.androidautomagic - TEXT - CONTAINS_TEXT - - false - false - - - true - Benachrichtigung in Statusbar angezeigt: com.whatsapp - true - com.whatsapp - TEXT - CONTAINS_TEXT - - false - true - - - true - Benachrichtigung in Statusbar angezeigt: org.telegram.messenger - true - org.telegram.messenger - TEXT - CONTAINS_TEXT - - false - true - - - true - Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic - true - ch.gridvision.ppam.androidautomagic - TEXT - CONTAINS_TEXT - - false - false - - - true - Bluetooth Status: Schaltet aus, Aus - true - false - false - true - true - - - true - Bluetooth Status: Schaltet ein, Ein - true - true - true - false - false - - - true - Daydream Status: Gestartet - true - true - - - true - Daydream Status: Gestoppt - true - false - - - true - Display Orientierung: Landscape - true - false - - - true - Display Orientierung: Portrait - true - true - - - true - Display Status: Aus - true - false - - - true - Display Status: Ein - true - true - - - true - Dock Event: Docked - true - true - - - true - Dock Event: Undocked - true - false - - - true - Eingehender Anruf. Status: Klingelt, Nummern: Alle - true - true - - true - true - false - false - false - - - true - Flugmodus: Aus - true - false - - - true - Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT - true - com.android.deskclock.ALARM_ALERT - - - - - - - - - false - - - true - Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS - true - com.android.deskclock.ALARM_DISMISS - - - - - - - - - false - - - true - Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE - true - com.android.deskclock.ALARM_DONE - - - - - - - - - false - - - true - Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE - true - com.android.deskclock.ALARM_SNOOZE - - - - - - - - - false - - - true - Genereller Broadcast: wenn org.smblott.intentradio.STATE - true - org.smblott.intentradio.STATE - - - - - - - - irstate=getString("state"); -irname=getString("name") - false - - - false - HTTP Request: /fhem-amad/currentFlowsetUpdate - true - /fhem-amad/currentFlowsetUpdate - 8090 - true - - - false - HTTP Request: /fhem-amad/deviceInfo/ - true - /fhem-amad/deviceInfo/ - 8090 - true - - - false - HTTP Request: /fhem-amad/setCommands/* - true - /fhem-amad/setCommands/* - 8090 - true - - - false - Medien Session verändert - true - com.amazon.mp3,com.amazon.avod.thirdpartyclient,com.audible.application,com.rhapsody.alditalk,com.spotify.music,com.google.android.videos,com.google.android.music,org.smblott.intentradioio,de.maxdome.app.android,tunein.player,org.videolan.vlc,com.google.android.youtube - - - false - Periodischer Timer: alle 30s - true - 30000 - true - false - false - Mon - Tue - Wed - Thu - Fri - Sat - Sun - 8 - 0 - 17 - 0 - true - false - - - true - Sprachbefehl angefordert - true - - - true - Stromversorgung: Angeschlossen - true - true - true - true - true - - - true - Stromversorgung: Entfernt - true - false - true - true - true - - - false - Systemeinstellung verändert: System next_alarm - true - SYSTEM - next_alarm_formatted - setting - - - true - Systemeinstellung verändert: System screen_brightness - true - SYSTEM - screen_brightness - screenBrightness - - - true - Systemeinstellung verändert: System volume_music_bt_a2dp - true - SYSTEM - volume_music_bt_a2dp - volume - - - true - Systemeinstellung verändert: System volume_music_headphone - true - SYSTEM - volume_music_headphone - volume - - - false - Systemeinstellung verändert: System volume_music_headset - true - SYSTEM - volume_music_headset - volume - - - true - Systemeinstellung verändert: System volume_music_speaker - true - SYSTEM - volume_music_speaker - volume - - - true - Systemeinstellung verändert: System volume_ring - true - SYSTEM - volume_ring - volumeRingSound - - - true - Systemeinstellung verändert: System volume_ring_speaker - true - SYSTEM - volume_ring_speaker - volumeNotification - - - true - Unterbrechnungen-Modus: Alle / Immer unterbrechen - true - OFF - - - true - Unterbrechnungen-Modus: Keine / Nicht unterbrechen - true - NO_INTERRUPTIONS - - - true - Unterbrechnungen-Modus: Nur Wecker (Android 6+) - true - ALARMS_ONLY - - - true - Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen - true - IMPORTANT_INTERRUPTIONS - - - false - App Task läuft: App (neuster) - {param_app} - true - - - true - App Task läuft: {global_activetask} (neuster) - {global_activetask} - true - - - false - Benachrichtigung in Statusbar angezeigt: Automagic - ch.gridvision.ppam.androidautomagic - true - 1 - TEXT - CONTAINS_TEXT - - false - false - - - false - Benachrichtigung in Statusbar angezeigt: Telegram Messenger - org.telegram.messenger - true - 1 - TEXT - CONTAINS_TEXT - - false - false - - - false - Benachrichtigung in Statusbar angezeigt: WhatsApp - com.whatsapp - true - 1 - TEXT - CONTAINS_TEXT - - false - false - - - true - Bluetooth eingeschaltet - - - true - Bluetooth Gerät verbunden: Beliebiges Geräte - true - - - ANY - - - true - Bluetooth Gerät verbunden: Beliebiges Geräte (Advanced Audio Distribution) - true - - - A2DP - - - true - Display automatisch drehen eingeschaltet - - - true - Display eingeschaltet - - - true - Display Orientierung: Portrait - true - - - true - Dock Status: Docked - true - true - true - true - true - false - - - true - Expression: airpcount < 11 - airpcount < 11 - - - false - Expression: Airplanemode - param_syscmd == "airplanemodeON" - - - false - Expression: All - param_app == "All" - - - false - Expression: Automagic - param_app == "Automagic" - - - false - Expression: Clear Automagic Meldungen" - request_path == "/fhem-amad/setCommands/clearnotificationbar" - - - false - Expression: closeCall" - request_path == "/fhem-amad/setCommands/closeCall" - - - true - Expression: contains(value, " und ") - contains(value, " und ") - - - false - Expression: do not Disturb" - request_path == "/fhem-amad/setCommands/donotdisturb" - - - true - Expression: fhemcmd == "readingsval" - fhemcmd == "readingsval" - - - true - Expression: fhemcmd == "set" - fhemcmd == "set" - - - true - Expression: fhemcmd == "setreading" - fhemcmd == "setreading" - - - true - Expression: fhemcmd == "voiceinputvalue" - fhemcmd == "voiceinputvalue" - - - false - Expression: flowState" - request_path == "/fhem-amad/setCommands/flowState" - - - true - Expression: getAndroidSDKVersion() >= "16" - getAndroidSDKVersion() >= "16" - - - true - Expression: getAndroidSDKVersion() >= "19" - getAndroidSDKVersion() >= "19" - - - true - Expression: getAndroidSDKVersion() >= "21" - getAndroidSDKVersion() >= "21" - - - true - Expression: global_activetask != null - global_activetask != null - - - true - Expression: global_fhemip != null or global_bridgeport != null - global_fhemip != null or global_bridgeport != null - - - true - Expression: global_userflowstate != "none" - global_userflowstate != "none" - - - false - Expression: installFlow" - request_path == "/fhem-amad/setCommands/installFlow" - - - true - Expression: keyguard == "locked" - keyguard == "locked" - - - true - Expression: Leon == "Gaultier" - Leon == "Gaultier" - - - false - Expression: multimediaControl" - request_path == "/fhem-amad/setCommands/multimediaControl" - - - false - Expression: notifysnd" - request_path == "/fhem-amad/setCommands/playnotifysnd" - - - false - Expression: openApp" - request_path == "/fhem-amad/setCommands/openApp" - - - false - Expression: openCall" - request_path == "/fhem-amad/setCommands/openCall" - - - false - Expression: openURL" - request_path == "/fhem-amad/setCommands/openURL" - - - true - Expression: package_name == {global_activetask} - package_name == {global_activetask} - - - true - Expression: param_bluetooth == "off" - param_bluetooth == "off" - - - true - Expression: param_bluetooth == "on" - param_bluetooth == "on" - - - true - Expression: param_button == "back" - param_button == "back" - - - true - Expression: param_button == "next" - param_button == "next" - - - true - Expression: param_button == "play/pause" - param_button == "play/pause" - - - true - Expression: param_button == "stop" - param_button == "stop" - - - true - Expression: param_disturbmod == "alarmClockOnly" - param_disturbmod == "alarmClockOnly" - - - true - Expression: param_disturbmod == "always" - param_disturbmod == "always" - - - true - Expression: param_disturbmod == "never" - param_disturbmod == "never" - - - true - 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" - param_fullscreen == "off" - - - true - Expression: param_fullscreen == "on" - param_fullscreen == "on" - - - true - Expression: param_lockmod == "lock" - param_lockmod == "lock" - - - true - Expression: param_notifyfile == "RedAlert.mp3" - param_notifyfile == "RedAlert.mp3" - - - false - Expression: param_option - param_hanguptime != "none" - - - true - Expression: param_orientation == "auto" - param_orientation == "auto" - - - true - Expression: param_orientation == "landscape" - param_orientation == "landscape" - - - true - Expression: param_orientation == "portrait" - param_orientation == "portrait" - - - true - Expression: param_screen=="off" - param_screen=="off" - - - true - Expression: param_screen=="on" - param_screen=="on" - - - false - Expression: Reboot - param_syscmd == "reboot" - - - true - Expression: scrcount < 5 - scrcount < 5 - - - false - Expression: screenMsg" - request_path == "/fhem-amad/setCommands/screenMsg" - - - false - Expression: sendIntent" - request_path == "/fhem-amad/setCommands/sendIntent" - - - false - Expression: sendSms" - request_path == "/fhem-amad/setCommands/sendSms" - - - false - Expression: setAlarm" - request_path == "/fhem-amad/setCommands/setAlarm" - - - false - Expression: setBluetooth" - request_path == "/fhem-amad/setCommands/setbluetooth" - - - false - Expression: setBrightness" - request_path == "/fhem-amad/setCommands/setBrightness" - - - false - Expression: setBTDevice" - request_path == "/fhem-amad/setCommands/setbtdevice" - - - false - Expression: setNotifiVolume" - request_path == "/fhem-amad/setCommands/setNotifiVolume" - - - false - Expression: setRingSoundVolume" - request_path == "/fhem-amad/setCommands/setRingSoundVolume" - - - false - Expression: setScreenFullscreen" - request_path == "/fhem-amad/setCommands/setScreenFullscreen" - - - false - Expression: setScreenlock" - request_path == "/fhem-amad/setCommands/screenlock" - - - false - Expression: setScreenOnOff" - request_path == "/fhem-amad/setCommands/setScreenOnOff" - - - false - Expression: setScreenOrientation" - request_path == "/fhem-amad/setCommands/setScreenOrientation" - - - false - Expression: setTimer" - request_path == "/fhem-amad/setCommands/setTimer" - - - false - Expression: setVibrate" - request_path == "/fhem-amad/setCommands/setvibrate" - - - false - Expression: setVoiceCommand" - request_path == "/fhem-amad/setCommands/setvoicecmd" - - - false - Expression: setVolume" - request_path == "/fhem-amad/setCommands/setVolume" - - - false - Expression: Shutdown - param_syscmd == "shutdown" - - - false - Expression: startDaydream" - request_path == "/fhem-amad/setCommands/startDaydream" - - - false - Expression: System Command" - request_path == "/fhem-amad/setCommands/systemcommand" - - - true - Expression: trigger == "Akku Ladestand: grösser als 0%" - trigger == "Akku Ladestand: grösser als 0%" - - - true - Expression: trigger == "App Task Beendet" - trigger == "App Task Beendet" - - - true - Expression: trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" - or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" - or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - true - Expression: trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" - trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" - - - true - Expression: trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" - trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" - - - true - Expression: trigger == "Bluetooth Status: Schaltet aus, Aus" or trigger == "Bluetooth Status: Schaltet ein, Ein" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "Bluetooth Status: Schaltet aus, Aus" - or trigger == "Bluetooth Status: Schaltet ein, Ein" - or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - true - Expression: trigger == "Daydream Status: Gestartet" - trigger == "Daydream Status: Gestartet" - - - true - Expression: trigger == "Daydream Status: Gestartet" or trigger == "Daydream Status: Gestoppt" - trigger == "Daydream Status: Gestartet" - or trigger == "Daydream Status: Gestoppt" - - - true - Expression: trigger == "Display Orientierung: Landscape" or trigger == "Display Orientierung: Portrait" or trigger == "Display Status: Ein" or trigger == "Display Status: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "Display Orientierung: Landscape" - or trigger == "Display Orientierung: Portrait" - or trigger == "Display Status: Ein" - or trigger == "Display Status: Aus" - or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - true - Expression: trigger == "Display Status: Aus" or trigger == "Display Status: Ein" or udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "Display Status: Aus" - or trigger == "Display Status: Ein" - or udef_trigger == "setLockPin" - or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - true - Expression: trigger == "Dock Event: Docked" or trigger == "Dock Event: Undocked" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "Dock Event: Docked" - or trigger == "Dock Event: Undocked" - or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - true - Expression: trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" - trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" - - - true - Expression: trigger == "Flugmodus: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "Flugmodus: Aus" - or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - true - Expression: trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" -or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" -or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" -or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" -or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - true - Expression: trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" - trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" - - - true - Expression: trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - true - Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" - trigger == "HTTP Request: /fhem-amad/setCommands/*" - - - true - Expression: trigger == "Medien Session verändert" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "Medien Session verändert" - or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - true - Expression: trigger == "Periodischer Timer: alle 30s" - trigger == "Periodischer Timer: alle 30s" - - - true - Expression: trigger == "Periodischer Timer: alle 30s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "Periodischer Timer: alle 30s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - true - Expression: trigger == "Sprachbefehl angefordert" - trigger == "Sprachbefehl angefordert" - - - true - Expression: trigger == "Systemeinstellung verändert: System next_alarm" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "Systemeinstellung verändert: System next_alarm" - or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - true - Expression: trigger == "Systemeinstellung verändert: System screen_brightness" - trigger == "Systemeinstellung verändert: System screen_brightness" - - - true - Expression: trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" or trigger == "Systemeinstellung verändert: System volume_music_speaker" or trigger == "Systemeinstellung verändert: System volume_music_headphone" or trigger == "Systemeinstellung verändert: System volume_music_headset" - trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" - or trigger == "Systemeinstellung verändert: System volume_music_speaker" - or trigger == "Systemeinstellung verändert: System volume_music_headphone" - or trigger == "Systemeinstellung verändert: System volume_music_headset" - - - true - Expression: trigger == "Systemeinstellung verändert: System volume_ring" - trigger == "Systemeinstellung verändert: System volume_ring" - - - true - Expression: trigger == "Systemeinstellung verändert: System volume_ring_speaker" - trigger == "Systemeinstellung verändert: System volume_ring_speaker" - - - true - Expression: trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" -or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" -or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" -or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" -or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - false - Expression: ttsMsg" - request_path == "/fhem-amad/setCommands/ttsMsg" - - - false - Expression: ttsMsgLang" - param_msglang == "en" - - - true - Expression: udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - udef_trigger == "setLockPin" - or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - - - true - Expression: value != "" - value != "" - - - true - Flow Aktiv: Informations - Informations - - - true - Flow Aktiv: SetCommands - SetCommands - - - true - Flow Aktiv: {global_userflowstate} - {global_userflowstate} - - - true - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/sdcard) - /sdcard - true - true - 1024 - - - true - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) - /storage/emulated/0 - true - true - 1024 - - - true - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/sdcard0) - /storage/sdcard0 - true - true - 1024 - - - true - Host erreichbar: {global_fhemip}:{global_bridgeport} - SOCKET - {global_fhemip} - {global_bridgeport} - - - true - Keyguard gesperrt - - - true - Keyguard mit Sicherheit - - - true - Musik Aktiv - - - true - Stromversorgung: Angeschlossen - true - true - true - true - - - true - Unterbrechnungen-Modus: Alle / Immer unterbrechen - OFF - - - true - Unterbrechnungen-Modus: Keine / Nicht unterbrechen - NO_INTERRUPTIONS - - - true - Unterbrechnungen-Modus: Nur Wecker (Android 6+) - ALARMS_ONLY - - - true - Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen - IMPORTANT_INTERRUPTIONS - - - true - WLAN verfügbar: {global_apssid} - {global_apssid} - - - false - AMAD Voice Control - true - - true - de-DE - false - - - true - Anruf beenden - - - false - App Starten: App - {param_app} - - - - true - Audio Player steuern: Medienknopf Play/Pause (/{kname}) - true - TOGGLE_PAUSE - KEYCODE_MEDIA_PLAY_PAUSE - true - {pname} - {kname} - - - - true - Audio Player steuern: Medienknopf Stopp ({pname}/{kname}) - true - STOP - KEYCODE_MEDIA_STOP - true - {pname} - {kname} - - - - true - Audio Player steuern: Medienknopf Weiter ({pname}/{kname}) - true - NEXT - KEYCODE_MEDIA_NEXT - true - {pname} - {kname} - - - - true - Audio Player steuern: Medienknopf Zurück ({pname}/{kname}) - true - PREVIOUS - KEYCODE_MEDIA_PREVIOUS - true - {pname} - {kname} - - - - true - Benachrichtigung auf Bildschirm: [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! (lange) - true - [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! - - 200 - 250 - false - 1.0 - true - false - TOP_LEFT - 0 - 0 - - - true - Benachrichtigung auf Bildschirm: {param_message} (lange) - true - {param_message} - - 200 - 250 - false - 1.0 - true - false - TOP_LEFT - 0 - 0 - - - true - Benachrichtigung auf Bildschirm: {response} (lange) - true - {response} - - 200 - 250 - false - 1.00 - true - false - TOP_LEFT - 0 - 0 - - - true - Benachrichtigung auf Bildschirm: {value} (lange) - true - {value} - - 200 - 250 - false - 1.0 - true - false - TOP_LEFT - 0 - 0 - - - true - Benachrichtigung aus Statusbar entfernen: Alle - false - true - 1 - true - - true - {id} - TEXT - CONTAINS_TEXT - - - - true - Benachrichtigung aus Statusbar entfernen: Alle (Automagic) - true - true - 1 - false - - true - {id} - TEXT - CONTAINS_TEXT - - - - true - Bluetooth ein-/ausschalten: Aus - false - - - true - Bluetooth ein-/ausschalten: Ein - true - - - true - Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} - A2DP - {param_btdeviceone} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} - A2DP - {param_btdevicetwo} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} - INPUT_DEVICE - {param_btdeviceone} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} - INPUT_DEVICE - {param_btdevicetwo} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} - HEADSET - {param_btdeviceone} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} - HEADSET - {param_btdevicetwo} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} - PAN - {param_btdeviceone} - - false - - - true - Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} - PAN - {param_btdevicetwo} - - false - - - true - Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} - A2DP - {param_swtobtdevicemac} - - 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 - Dateien löschen: /sdcard/Download/currentFlowsetUpdate.xml - /sdcard/Download/currentFlowsetUpdate.xml - true - - - true - Dateien löschen: /storage/emulated/0/Download/currentFlowsetUpdate.xml - /storage/emulated/0/Download/currentFlowsetUpdate.xml - true - - - true - Dateien löschen: /storage/emulated/0/Download/installFlow_{param_flowname} - /storage/emulated/0/Download/installFlow_{param_flowname} - true - - - true - Dateien löschen: /storage/sdcard0/Download/currentFlowsetUpdate.xml - /storage/sdcard0/Download/currentFlowsetUpdate.xml - true - - - true - Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} - /storage/sdcard0/Download/installFlow_{param_flowname} - true - - - true - Display automatisch drehen ein-/ausschalten: Aus - false - - - true - Display automatisch drehen ein-/ausschalten: Ein - true - - - true - Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /sdcard/Download - http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml - /sdcard/Download - true - - - true - Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /storage/emulated/0/Download - http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml - /storage/emulated/0/Download - true - - - true - Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /storage/sdcard0/Download - http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml - /storage/sdcard0/Download - true - - - true - Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/emulated/0/Download - http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} - /storage/emulated/0/Download - true - - - true - Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download - http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} - /storage/sdcard0/Download - true - - - true - Flows ausführen: Send Data to AMADCommBridge - Send Data to AMADCommBridge - - false - false - false - - - false - Flows ausführen: Send Data to AMADCommBridge mit warten - Send Data to AMADCommBridge - - false - true - false - - - false - Flows ausführen: udef_trigger setLockPin - Informations - - false - true - false - - - true - Flows ausführen: VoiceControl - VoiceControl - - true - false - false - - - true - Flows löschen: MultimediaControl - MultimediaControl - true - - - true - Flows/Widgets importieren: /sdcard/Download/currentFlowsetUpdate.xml - /sdcard/Download/currentFlowsetUpdate.xml - true - - - true - Flows/Widgets importieren: /storage/emulated/0/Download/currentFlowsetUpdate.xml - /storage/emulated/0/Download/currentFlowsetUpdate.xml - true - - - true - Flows/Widgets importieren: /storage/emulated/0/Download/installFlow_{param_flowname} - /storage/emulated/0/Download/installFlow_{param_flowname} - true - - - true - Flows/Widgets importieren: /storage/sdcard0/Download/currentFlowsetUpdate.xml - /storage/sdcard0/Download/currentFlowsetUpdate.xml - true - - - true - Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} - /storage/sdcard0/Download/installFlow_{param_flowname} - true - - - true - Flugmodus ein-/ausschalten: Ein - SYSTEM_SETTING - true - - - true - Gerät sperren - - - false - Get Android Version - - - - true - Herunterfahren - - - false - HTTP Request: send READINGS data to AMADCommBridge - http://{global_fhemip}:{global_bridgeport} - false - false - - POST - GENERAL_TEXT - text/plain - {fhemdata} - @@@@readingsNameXYZ@@readingsValueABC - 60000 - true - FHEMDEVICE: {global_fhemdevice} -FHEMCMD: setreading -Connection: close - true - response - /storage/emulated/0/Download/file.bin - false - - - false - HTTP Request: send READINGSVAL data to AMADCommBridge - http://{global_fhemip}:{global_bridgeport} - false - false - - POST - GENERAL_TEXT - text/plain - {readingsvalcmd} - @@@@readingsNameXYZ@@readingsValueABC - 60000 - true - FHEMDEVICE: {global_fhemdevice} -FHEMCMD: readingsval -Connection: close - true - response - /storage/emulated/0/Download/file.bin - false - - - false - HTTP Request: send SET data to AMADCommBridge - http://{global_fhemip}:{global_bridgeport} - false - false - - POST - GENERAL_TEXT - text/plain - {setcmd} - @@@@readingsNameXYZ@@readingsValueABC - 60000 - true - FHEMDEVICE: {global_fhemdevice} -FHEMCMD: set -Connection: close - true - response - /storage/emulated/0/Download/file.bin - false - - - false - HTTP Request: send VOICEINPUTVALUE data to AMADCommBridge - http://{global_fhemip}:{global_bridgeport} - false - false - - POST - GENERAL_TEXT - text/plain - {voiceinputdata} - @@@@readingsNameXYZ@@readingsValueABC - 60000 - true - FHEMDEVICE: {global_fhemdevice} -FHEMCMD: voiceinputvalue -Connection: close - true - response - /storage/emulated/0/Download/file.bin - true - - - false - Initialisiere Variable Nächster Alarm: next_alarm - next_alarm - - - false - Initialisiere Variable Systemeinstellung: screenBrightness - SYSTEM - screen_brightness - screenBrightness - - - false - Initialisiere Variable Systemeinstellung: volumeMusikBluetooth.2 - SYSTEM - volume_music_bt_a2dp - volumeBT - - - false - Initialisiere Variable Systemeinstellung: volumeMusikSpeaker.2 - SYSTEM - volume_music_speaker - volumeSP - - - false - Initialisiere Variable Systemeinstellung: volumeNotification - SYSTEM - volume_ring_speaker - volumeNotification - - - false - Initialisiere Variable Systemeinstellung: volumeRingSound - SYSTEM - volume_ring - volumeRingSound - - - false - Lautstärken setzen param_notifivolume - false - global_volume_alarm - false - global_volume_dtmf - false - param_volume - true - param_notifivolume - false - global_volume_ring - false - global_volume_system - false - global_volume_voice_call - false - global_ringer_mode - false - global_interruptions_mode - - - false - Lautstärken setzen param_ringsoundvolume - false - global_volume_alarm - false - global_volume_dtmf - false - param_volume - false - param_notifivolume - true - param_ringsoundvolume - false - global_volume_system - false - global_volume_voice_call - false - global_ringer_mode - false - global_interruptions_mode - - - false - Lautstärken setzen param_volume - false - global_volume_alarm - false - global_volume_dtmf - true - param_volume - false - global_volume_notification - false - global_volume_ring - false - global_volume_system - false - global_volume_voice_call - false - global_ringer_mode - false - global_interruptions_mode - - - true - Neustart - - - - false - Notification Lautstärke Speichern - false - global_volume_alarm - false - global_volume_dtmf - false - global_volume_music - true - global_volume_notification - false - global_volume_ring - false - global_volume_system - false - global_volume_voice_call - false - global_ringer_mode - false - global_interruptions_mode - - - false - Notification Lautstärke Wiederherstellen - false - global_volume_alarm - false - global_volume_dtmf - false - param_volume - true - global_volume_notification - false - global_volume_ring - false - global_volume_system - false - global_volume_voice_call - false - global_ringer_mode - false - global_interruptions_mode - - - false - NotificationLautstärke auf Level 7 - NOTIFICATION - ADJUST_SET_ABSOLUTE - 7 - false - false - - - true - Nummer anrufen: {param_callnumber} - {param_callnumber} - true - - - true - Pause: 2s (Gerät wach halten) - 2s - true - false - - - true - Pause: 3s (Gerät wach halten) - 3s - true - false - - - true - Pause: {param_hanguptime}s (Gerät wach halten) - {param_hanguptime}s - true - false - - - false - Prüfe und setze Bridgeport Variable - - - - false - Prüfe und setze globale Variablen - - - - false - Schalte Display ein - false - 5s - true - - - true - Schalte Display ein: Hell für {param_screenontime}s - true - {param_screenontime}s - true - - - true - Script: airpcount = 0 - - - - true - Script: airpcount = airpcount + 1 - - - - true - Script: airplanemode = "airplanemode@@" + {airplanemode}; fhemcmd = "setreading"; - - - - true - Script: airplanemode = "airplanemode@@on"; fhemcmd = "setreading"; - - - - true - Script: airplanemode = "off" - - - - true - Script: androidVersion = "androidVersion@@" + {androidVersion}; fhemcmd = "setreading"; - - - - true - Script: androidVersion = "not supported funktion" - - - - true - Script: automagicState = "automagicState@@" + {notification_text}; fhemcmd = "setreading"; - - - - true - Script: bluetooth = "bluetooth@@" + {bluetooth_state}; fhemcmd = "setreading"; - - - - true - Script: bluetooth_state = "off" - - - - true - Script: bluetooth_state = "on" - - - - true - Script: btdeviceinfo = "connectedBTdevices@@" + {connected_devices_names} + "@@@@connectedBTdevicesMAC@@" + {connected_devices_addresses}; fhemcmd = "setreading"; - - - - true - Script: checkActiveTask = "checkActiveTask@@" + {runTask}; fhemcmd = "setreading"; - - - - true - Script: connected_devices_names = "none"; connected_devices_addresses = "none" - - - - true - Script: currentMusic = "currentMusicTrack@@" + {title} + "@@@@currentMusicAlbum@@" + {description} + "@@@@currentMusicArtist@@" + {subtitle} + "@@@@currentMusicApp@@" + {musicapp} + "@@@@currentMusicIcon@@" + {icon} + "@@@@currentMusicState@@" + {playback_state}; fhemcmd = "setreading"; - - - - true - Script: daydream = "daydream@@" + {daydream_state}; fhemcmd = "setreading"; - - - - true - Script: daydream_state = "off" - - - - true - Script: daydream_state = "on" - - - - true - Script: deviceState = "deviceState@@online"; fhemcmd = "setreading"; - - - - true - Script: dndValue = "alarmClockOnly" - - - - true - Script: dndValue = "always" - - - - true - Script: dndValue = "never" - - - - true - Script: dndValue = "onlyImportant" - - - - true - Script: dock_state = "docked" - - - - true - Script: dock_state = "undocked" - - - - true - Script: dockingState = "dockingState@@" + {dock_state}; fhemcmd = "setreading"; - - - - true - Script: doNotDisturb = "doNotDisturb@@" + {dndValue}; fhemcmd = "setreading"; - - - - true - Script: flow_informations = "flow_informations@@" + {informationFlow_state}; fhemcmd = "setreading"; - - - - true - Script: flow_informations = "userFlowState@@" + {flowState}; fhemcmd = "setreading"; - - - - true - Script: flow_SetCommands = "flow_SetCommands@@" + {setCommandFlow_state}; 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } - - - - true - Script: if(playback_state == 0) { playback_state = "keiner" } if(playback_state == 1) { playback_state = "gestoppt" } if(playback_state == 2) { playback_state = "pausiert" } if(playback_state == 3) { playback_state = "spielt ab" } if(playback_state == 4) { playback_state = "spult vorwärts" } if(playback_state == 5) { playback_state = "spült rückwärts" } if(playback_state == 6) { playback_state = "buffert" } if(playback_state == 7) { playback_state = "Fehler" } if(playback_state == 8) { playback_state = "verbindet" } if(playback_state == 9) { playback_state = "springt zum vorherigen" } if(playback_state == 10) { playback_state = "springt zum nächsten" } if(playback_state == 11) { playback_state = "springt zu Position in Wiedergabeliste" } - - - - true - Script: if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT") { nextalarmstate = "alert" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS") { nextalarmstate = "dismiss" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE") { nextalarmstate = "done" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE") { nextalarmstate = "snooze" } - - - - true - Script: incomingCaller = "incomingCallerName@@" + {contact_name} + "@@@@incomingCallerNumber@@" + {incoming_number}; fhemcmd = "setreading"; - - - - true - Script: incommingTelegramMessage = "incommingTelegramMessageFrom@@" + {notification_text}; fhemcmd = "setreading"; - - - - true - Script: incommingWhatsAppMessage = "incommingWhatsAppMessageFrom@@" + {notification_text}; fhemcmd = "setreading"; - - - - true - Script: informationFlow_state = "aktiv" - - - - true - Script: informationFlow_state = "inaktiv" - - - - true - Script: intentRadioState = "intentRadioState@@" + {irstate} + "@@@@intentRadioName@@" + {irname}; fhemcmd = "setreading"; - - - - true - Script: keyguard = "locked" - - - - true - Script: keyguard = "unlocked" - - - - true - Script: keyguardSet = "0" - - - - true - Script: keyguardSet = "1" - - - - true - Script: keyguardSet = "keyguardSet@@" + {keyguardSet}; fhemcmd = "setreading"; - - - - true - Script: keyguardSet = "not supported from your device" - - - - true - Script: next_alarmday = "{next_alarm,dateformat,c}" - - - - true - Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" - - - - true - Script: nextAlarm = "nextAlarmTime@@" + {next_alarmtime} + "@@@@nextAlarmDay@@" + {next_alarmday}; fhemcmd = "setreading"; - - - - true - Script: nextAlarmState = "nextAlarmState@@" + {nextalarmstate}; fhemcmd = "setreading"; - - - - true - 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" - - - - true - Script: notification_text = "Flowset Update: path for download not exist" - - - - true - Script: notification_text = "not supported from your device" - - - - true - Script: powerinfo = "powerLevel@@" + "{battery_percentage,numberformat,0}" + "@@@@powerPlugged@@" + {battery_plugged} + "@@@@batteryTemperature@@" + "{battery_temperature/10.0,numberformat.0.0}" + "@@@@batteryHealth@@" + {battery_health}; fhemcmd = "setreading"; - - - - true - Script: runTask = "0" - - - - true - Script: runTask = "1" - - - - true - Script: runTask = "not supported android version" - - - - true - Script: runTask = "null" - - - - true - Script: scrcount = 0 - - - - true - Script: scrcount = scrcount + 1 - - - - true - Script: screen = "screen@@" + {screen_state}; fhemcmd = "setreading"; - - - - true - Script: screen_orientation = "landscape" - - - - true - Script: screen_orientation = "portrait" - - - - true - Script: screen_orientation_mode = "auto" - - - - true - Script: screen_orientation_mode = "manual" - - - - true - Script: screen_state = "off {keyguard}" - - - - true - Script: screen_state = "off" - - - - true - Script: screen_state = "on {keyguard}" - - - - true - Script: screen_state = "on" - - - - true - Script: screenBrightness = "screenBrightness@@" + {screenBrightness}; fhemcmd = "setreading"; - - - - true - Script: screenOrientation = "screenOrientation@@" + {screen_orientation} + "@@@@screenOrientationMode@@" + {screen_orientation_mode}; fhemcmd = "setreading"; - - - - false - Script: Set FHEMDATA - - - - true - Script: setCommandFlow_state = "aktiv" - - - - true - Script: setCommandFlow_state = "inaktiv" - - - - true - Script: subtitle = "no player active"; title = "no player active"; description = "no player active"; musicapp = "no player active"; icon = "no player active" - - - - true - Script: udef_trigger = "setLockPin" - - - - true - Script: voiceinputdata = value; fhemcmd = "voiceinputvalue"; - - - - true - Script: voiceinputdata = {left(value, (indexOf(value, " und ")))}; fhemcmd = "voiceinputvalue"; - - - - true - Script: volume = {volumeBT} - - - - true - Script: volume = {volumeSP} - - - - true - Script: volumeNotification = "volumeNotification@@" + {volumeNotification}; fhemcmd = "setreading"; - - - - true - Script: volumeRingSound = "volumeRingSound@@" + {volumeRingSound}; fhemcmd = "setreading"; - - - - true - Script: volumevalue = "volume@@" + {volume}; fhemcmd = "setreading"; - - - - false - Script: Zuordnung Mediaplayer - - - - true - Setze Alarm: um {param_hour}:{param_minute} - - {param_hour} - {param_minute} - - - false - true - - - true - Setze Display Helligkeit: {param_brightness} - false - {param_brightness} - false - 50 - true - - - true - Setze Display Orientierung: Auf Default zurücksetzen - UNSPECIFIED - false - - - true - Setze Display Orientierung: Landscape - LANDSCAPE - false - - - true - Setze Display Orientierung: Portrait - PORTRAIT - false - - - true - Setze Flow Status: Aktivieren Informations - true - Informations - - - - true - Setze Flow Status: Aktivieren SetCommands - true - SetCommands - - - - true - Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} - true - {imported_flow_names,listformat,comma} - - - - true - Setze Flow Status: Aktivieren {param_flowname} - true - {param_flowname} - - - - true - Setze Flow Status: Deaktivieren {param_flowname} - false - {param_flowname} - - - - true - Setze Lock PIN/Passwort: PIN/Passwort zurücksetzen - true - PIN - false - param_lockPIN - - - true - Setze Lock PIN/Passwort: Setze PIN von Variable param_lockpin - false - PIN - false - param_lockpin - - - false - Setze Timer - - {param_minute}m - true - - - true - Setze Unterbrechnungen-Modus: Alle / Immer unterbrechen - NOTIFICATION_LISTENER - OFF - - - true - Setze Unterbrechnungen-Modus: Keine / Nicht unterbrechen - NOTIFICATION_LISTENER - NO_INTERRUPTIONS - - - true - Setze Unterbrechnungen-Modus: Nur Wecker (Android 6+) - NOTIFICATION_LISTENER - ALARMS_ONLY - - - true - Setze Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen - NOTIFICATION_LISTENER - IMPORTANT_INTERRUPTIONS - - - false - Setze voice Variablen - - - - true - Setze Vollbild Modus: Auf Default zurücksetzen - UNSPECIFIED - false - - - true - Setze Vollbild Modus: Navigation nicht anzeigen - HIDE_NAVIGATION - false - - - true - SMS senden an: an {param_smsnumber} '{param_smsmessage}' (10 in 12h) - {param_smsnumber} - {param_smsmessage} - true - true - 10 - 43200000 - false - false - true - 600000 - - - true - Sound: {param_notifypath}{param_notifyfile} als Benachrichtigung - FILE - Lautlos - {param_notifypath}{param_notifyfile} - NOTIFICATION - false - true - true - TRANSIENT - - - false - Sprachausgabe: Deutsch - MUSIC - {param_message} - de_DE - true - 1.0 - true - {param_msgspeed} - true - false - false - true - TRANSIENT - - - false - Sprachausgabe: Englisch - MUSIC - {param_message} - en_US - true - 1.0 - true - {param_msgspeed} - true - false - false - true - TRANSIENT - - - false - Spracheingabe wurde nicht erkannt - NOTIFICATION - Ihre Eingabe wurde nicht verstanden - de_DE - true - 1.0 - true - 1.0 - true - false - false - true - TRANSIENT - - - true - Starte Daydream - - - true - URL in Browser öffnen: {param_url} (mit {param_browserapp}/{param_browserappclass}) - {param_url} - true - {param_browserapp} - {param_browserappclass} - - - - true - Vibrieren: Pattern 2 (-- --) - false - vibrate_pattern_2 - 0,500 - - - true - WLAN Reassoziieren - - - Informations - AMAD2 Info/Control Flowset v2.6.12 - true - QUEUE - 900 - - Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE - Genereller Broadcast: wenn org.smblott.intentradio.STATE - Systemeinstellung verändert: System volume_music_headphone - Systemeinstellung verändert: System volume_music_headset - Stromversorgung: Angeschlossen - Bluetooth Status: Schaltet ein, Ein - Display Status: Aus - Display Orientierung: Portrait - Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE - Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS - Bluetooth Status: Schaltet aus, Aus - Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen - Benachrichtigung in Statusbar angezeigt: com.whatsapp - Daydream Status: Gestoppt - Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic - Akku Ladestand: grösser als 0% - Eingehender Anruf. Status: Klingelt, Nummern: Alle - Display Status: Ein - Systemeinstellung verändert: System volume_music_speaker - Systemeinstellung verändert: System screen_brightness - Daydream Status: Gestartet - Dock Event: Docked - Systemeinstellung verändert: System volume_music_bt_a2dp - Unterbrechnungen-Modus: Alle / Immer unterbrechen - HTTP Request: /fhem-amad/deviceInfo/ - Periodischer Timer: alle 30s - Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT - Benachrichtigung in Statusbar angezeigt: org.telegram.messenger - Stromversorgung: Entfernt - Systemeinstellung verändert: System next_alarm - Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic - App Task Beendet - Unterbrechnungen-Modus: Keine / Nicht unterbrechen - Dock Event: Undocked - Display Orientierung: Landscape - Unterbrechnungen-Modus: Nur Wecker (Android 6+) - Flugmodus: Aus - Systemeinstellung verändert: System volume_ring_speaker - Systemeinstellung verändert: System volume_ring - Medien Session verändert - - Script: daydream_state = "on" - Script: daydream_state = "off" - Expression: airpcount < 11 - Script: keyguard = "unlocked" - Display Orientierung: Portrait - Script: screen_orientation = "portrait" - Script: screen_orientation = "landscape" - Script: dock_state = "docked" - Script: dock_state = "undocked" - Script: keyguardSet = "0" - Script: screen_orientation_mode = "manual" - Script: scrcount = 0 - Script: keyguard = "locked" - Expression: scrcount < 5 - Script: scrcount = scrcount + 1 - Pause: 2s (Gerät wach halten) - Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" - Benachrichtigung in Statusbar angezeigt: Automagic - Script: airpcount = airpcount + 1 - Dock Status: Docked - Script: notification_text = "not supported from your device" - Display automatisch drehen eingeschaltet - Expression: trigger == "Daydream Status: Gestartet" - Bluetooth eingeschaltet - Expression: trigger == "App Task Beendet" - Keyguard gesperrt - Expression: keyguard == "locked" - Expression: getAndroidSDKVersion() >= "19" - Expression: getAndroidSDKVersion() >= "16" - Script: keyguardSet = "not supported from your device" - Display eingeschaltet - Display eingeschaltet - Expression: getAndroidSDKVersion() >= "16" - Unterbrechnungen-Modus: Nur Wecker (Android 6+) - Unterbrechnungen-Modus: Keine / Nicht unterbrechen - Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen - Unterbrechnungen-Modus: Alle / Immer unterbrechen - Script: dndValue = "always" - Script: dndValue = "onlyImportant" - Script: dndValue = "never" - Script: dndValue = "alarmClockOnly" - Script: screen_state = "on" - Script: screen_state = "off" - Script: screen_state = "on {keyguard}" - Script: screen_state = "off {keyguard}" - Script: airplanemode = "off" - Script: bluetooth_state = "on" - Script: androidVersion = "not supported funktion" - Expression: package_name == {global_activetask} - App Task läuft: {global_activetask} (neuster) - Script: runTask = "1" - Script: runTask = "0" - Expression: getAndroidSDKVersion() >= "19" - Script: runTask = "not supported android version" - Script: runTask = "null" - Expression: trigger == "Periodischer Timer: alle 30s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Periodischer Timer: alle 30s" - Expression: global_activetask != null - Expression: trigger == "Display Status: Aus" or trigger == "Display Status: Ein" or udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Daydream Status: Gestartet" or trigger == "Daydream Status: Gestoppt" - Expression: trigger == "Display Orientierung: Landscape" or trigger == "Display Orientierung: Portrait" or trigger == "Display Status: Ein" or trigger == "Display Status: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Dock Event: Docked" or trigger == "Dock Event: Undocked" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Akku Ladestand: grösser als 0%" - Stromversorgung: Angeschlossen - Script: screen_orientation_mode = "auto" - Script: screen = "screen@@" + {screen_state}; fhemcmd = "setreading"; - Script: bluetooth = "bluetooth@@" + {bluetooth_state}; fhemcmd = "setreading"; - Script: daydream = "daydream@@" + {daydream_state}; fhemcmd = "setreading"; - Script: automagicState = "automagicState@@" + {notification_text}; fhemcmd = "setreading"; - Script: dockingState = "dockingState@@" + {dock_state}; fhemcmd = "setreading"; - Script: incomingCaller = "incomingCallerName@@" + {contact_name} + "@@@@incomingCallerNumber@@" + {incoming_number}; fhemcmd = "setreading"; - Script: androidVersion = "androidVersion@@" + {androidVersion}; fhemcmd = "setreading"; - Script: checkActiveTask = "checkActiveTask@@" + {runTask}; fhemcmd = "setreading"; - Script: deviceState = "deviceState@@online"; fhemcmd = "setreading"; - Script: bluetooth_state = "off" - Script: if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT") { nextalarmstate = "alert" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS") { nextalarmstate = "dismiss" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE") { nextalarmstate = "done" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE") { nextalarmstate = "snooze" } - Bluetooth Gerät verbunden: Beliebiges Geräte - Script: btdeviceinfo = "connectedBTdevices@@" + {connected_devices_names} + "@@@@connectedBTdevicesMAC@@" + {connected_devices_addresses}; fhemcmd = "setreading"; - Script: connected_devices_names = "none"; connected_devices_addresses = "none" - Expression: trigger == "Bluetooth Status: Schaltet aus, Aus" or trigger == "Bluetooth Status: Schaltet ein, Ein" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Keyguard mit Sicherheit - Script: keyguardSet = "1" - Script: keyguardSet = "keyguardSet@@" + {keyguardSet}; fhemcmd = "setreading"; - Expression: udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" - Expression: trigger == "Flugmodus: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Script: screenBrightness = "screenBrightness@@" + {screenBrightness}; fhemcmd = "setreading"; - Expression: trigger == "Systemeinstellung verändert: System screen_brightness" - Bluetooth Gerät verbunden: Beliebiges Geräte (Advanced Audio Distribution) - Script: volumevalue = "volume@@" + {volume}; fhemcmd = "setreading"; - Script: volume = {volumeBT} - Script: screenOrientation = "screenOrientation@@" + {screen_orientation} + "@@@@screenOrientationMode@@" + {screen_orientation_mode}; fhemcmd = "setreading"; - Script: powerinfo = "powerLevel@@" + "{battery_percentage,numberformat,0}" + "@@@@powerPlugged@@" + {battery_plugged} + "@@@@batteryTemperature@@" + "{battery_temperature/10.0,numberformat.0.0}" + "@@@@batteryHealth@@" + {battery_health}; fhemcmd = "setreading"; - Pause: 2s (Gerät wach halten) - Musik Aktiv - Script: currentMusic = "currentMusicTrack@@" + {title} + "@@@@currentMusicAlbum@@" + {description} + "@@@@currentMusicArtist@@" + {subtitle} + "@@@@currentMusicApp@@" + {musicapp} + "@@@@currentMusicIcon@@" + {icon} + "@@@@currentMusicState@@" + {playback_state}; fhemcmd = "setreading"; - Script: airplanemode = "airplanemode@@" + {airplanemode}; fhemcmd = "setreading"; - Benachrichtigung auf Bildschirm: [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! (lange) - Expression: trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" or trigger == "Systemeinstellung verändert: System volume_music_speaker" or trigger == "Systemeinstellung verändert: System volume_music_headphone" or trigger == "Systemeinstellung verändert: System volume_music_headset" - Initialisiere Variable Systemeinstellung: volumeMusikBluetooth.2 - Script: volume = {volumeSP} - Initialisiere Variable Systemeinstellung: volumeMusikSpeaker.2 - Expression: trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: getAndroidSDKVersion() >= "21" - Flow Aktiv: SetCommands - Script: setCommandFlow_state = "aktiv" - Script: setCommandFlow_state = "inaktiv" - Setze Flow Status: Aktivieren SetCommands - Script: flow_SetCommands = "flow_SetCommands@@" + {setCommandFlow_state}; fhemcmd = "setreading"; - Script: flowState = "active" - Script: flow_informations = "userFlowState@@" + {flowState}; fhemcmd = "setreading"; - Expression: global_userflowstate != "none" - Flow Aktiv: {global_userflowstate} - Expression: trigger == "Periodischer Timer: alle 30s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Periodischer Timer: alle 30s" - Script: flowState = "inactive" - Expression: Leon == "Gaultier" - Flows löschen: MultimediaControl - Script: airpcount = 0 - Host erreichbar: {global_fhemip}:{global_bridgeport} - Pause: 2s (Gerät wach halten) - WLAN verfügbar: {global_apssid} - WLAN Reassoziieren - Expression: trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Systemeinstellung verändert: System next_alarm" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Initialisiere Variable Nächster Alarm: next_alarm - Script: next_alarmday = "{next_alarm,dateformat,c}" - Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" - Script: nextAlarm = "nextAlarmTime@@" + {next_alarmtime} + "@@@@nextAlarmDay@@" + {next_alarmday}; fhemcmd = "setreading"; - Prüfe und setze globale Variablen - Expression: global_fhemip != null or global_bridgeport != null - Flows ausführen: Send Data to AMADCommBridge - Script: nextAlarmState = "nextAlarmState@@" + {nextalarmstate}; fhemcmd = "setreading"; - Script: doNotDisturb = "doNotDisturb@@" + {dndValue}; fhemcmd = "setreading"; - Expression: getAndroidSDKVersion() >= "19" - Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" - Script: notification_text = "not supported from your device" - Script: incommingWhatsAppMessage = "incommingWhatsAppMessageFrom@@" + {notification_text}; fhemcmd = "setreading"; - Expression: getAndroidSDKVersion() >= "19" - Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" - Script: intentRadioState = "intentRadioState@@" + {irstate} + "@@@@intentRadioName@@" + {irname}; fhemcmd = "setreading"; - Expression: trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" - Expression: trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" - Benachrichtigung in Statusbar angezeigt: WhatsApp - Script: notification_text = "not supported from your device" - Benachrichtigung in Statusbar angezeigt: Telegram Messenger - Script: incommingTelegramMessage = "incommingTelegramMessageFrom@@" + {notification_text}; fhemcmd = "setreading"; - Script: volumeNotification = "volumeNotification@@" + {volumeNotification}; fhemcmd = "setreading"; - Host erreichbar: {global_fhemip}:{global_bridgeport} - Expression: trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" - Initialisiere Variable Systemeinstellung: screenBrightness - Expression: trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Systemeinstellung verändert: System volume_ring_speaker" - Initialisiere Variable Systemeinstellung: volumeNotification - Expression: trigger == "Systemeinstellung verändert: System volume_ring" - Script: volumeRingSound = "volumeRingSound@@" + {volumeRingSound}; fhemcmd = "setreading"; - Initialisiere Variable Systemeinstellung: volumeRingSound - Script: subtitle = "no player active"; title = "no player active"; description = "no player active"; musicapp = "no player active"; icon = "no player active" - Script: if(playback_state == 0) { playback_state = "keiner" } if(playback_state == 1) { playback_state = "gestoppt" } if(playback_state == 2) { playback_state = "pausiert" } if(playback_state == 3) { playback_state = "spielt ab" } if(playback_state == 4) { playback_state = "spult vorwärts" } if(playback_state == 5) { playback_state = "spült rückwärts" } if(playback_state == 6) { playback_state = "buffert" } if(playback_state == 7) { playback_state = "Fehler" } if(playback_state == 8) { playback_state = "verbindet" } if(playback_state == 9) { playback_state = "springt zum vorherigen" } if(playback_state == 10) { playback_state = "springt zum nächsten" } if(playback_state == 11) { playback_state = "springt zu Position in Wiedergabeliste" } - Expression: trigger == "Medien Session verändert" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } - Get Android Version - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Send Data to AMADCommBridge - AMAD2 Info/Control Flowset v2.6.12 - true - PARALLEL - 900 - - HTTP Request: send VOICEINPUTVALUE data to AMADCommBridge - HTTP Request: send SET data to AMADCommBridge - Benachrichtigung auf Bildschirm: {response} (lange) - HTTP Request: send READINGS data to AMADCommBridge - Expression: fhemcmd == "set" - Expression: fhemcmd == "voiceinputvalue" - Host erreichbar: {global_fhemip}:{global_bridgeport} - Expression: fhemcmd == "setreading" - Expression: fhemcmd == "readingsval" - HTTP Request: send READINGSVAL data to AMADCommBridge - Script: Set FHEMDATA - - - - - - - - - - - - - SetCommands - AMAD2 Info/Control Flowset v2.6.12 - true - QUEUE - 900 - - Periodischer Timer: alle 30s - HTTP Request: /fhem-amad/deviceInfo/ - Sprachbefehl angefordert - HTTP Request: /fhem-amad/setCommands/* - - Expression: setBrightness" - Expression: setScreenFullscreen" - Expression: param_orientation == "auto" - Setze Display Orientierung: Portrait - Setze Display Orientierung: Landscape - Expression: param_orientation == "landscape" - Setze Vollbild Modus: Navigation nicht anzeigen - Setze Vollbild Modus: Auf Default zurücksetzen - Setze Display Orientierung: Auf Default zurücksetzen - Display automatisch drehen ein-/ausschalten: Aus - Display automatisch drehen ein-/ausschalten: Ein - Expression: setScreenOrientation" - Expression: param_fullscreen == "off" - Expression: param_bluetooth == "off" - Expression: param_bluetooth == "on" - Bluetooth ein-/ausschalten: Ein - Bluetooth eingeschaltet - Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} - Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} - Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} - Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} - Pause: 3s (Gerät wach halten) - Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} - Pause: 2s (Gerät wach halten) - Expression: setBTDevice" - Bluetooth ein-/ausschalten: Aus - Expression: param_orientation == "portrait" - Expression: setVoiceCommand" - Setze Display Helligkeit: {param_brightness} - Expression: setScreenlock" - Expression: sendIntent" - Setze Flow Status: Aktivieren Informations - Expression: param_lockmod == "lock" - Setze Lock PIN/Passwort: PIN/Passwort zurücksetzen - Setze Lock PIN/Passwort: Setze PIN von Variable param_lockpin - Expression: trigger == "Sprachbefehl angefordert" - Expression: setAlarm" - Setze Timer - Expression: screenMsg" - Benachrichtigung auf Bildschirm: {param_message} (lange) - Script: udef_trigger = "setLockPin" - Flows ausführen: udef_trigger setLockPin - Display eingeschaltet - Gerät sperren - Schalte Display ein - Gerät sperren - Expression: setTimer" - Expression: param_option - Pause: {param_hanguptime}s (Gerät wach halten) - Anruf beenden - Broadcast senden: {param_action} - URL in Browser öffnen: {param_url} (mit {param_browserapp}/{param_browserappclass}) - Setze Unterbrechnungen-Modus: Alle / Immer unterbrechen - Setze Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen - Setze Unterbrechnungen-Modus: Keine / Nicht unterbrechen - Setze Unterbrechnungen-Modus: Nur Wecker (Android 6+) - Expression: openURL" - Expression: param_fullscreen == "on" - Expression: do not Disturb" - Expression: param_disturbmod == "always" - Expression: param_disturbmod == "onlyImportant" - Expression: param_disturbmod == "never" - Expression: param_disturbmod == "alarmClockOnly" - Flows ausführen: VoiceControl - Flows ausführen: Send Data to AMADCommBridge - Expression: setBluetooth" - Flow Aktiv: Informations - Script: informationFlow_state = "aktiv" - Script: informationFlow_state = "inaktiv" - Script: flow_informations = "flow_informations@@" + {informationFlow_state}; fhemcmd = "setreading"; - Host erreichbar: {global_fhemip}:{global_bridgeport} - Sprachausgabe: Deutsch - Expression: ttsMsg" - Expression: param_screen=="on" - Expression: setScreenOnOff" - Gerät sperren - Expression: param_screen=="off" - Expression: openApp" - App Task läuft: App (neuster) - Expression: setVolume" - App Starten: App - Dateien löschen: /storage/emulated/0/Download/installFlow_{param_flowname} - Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} - Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} - Script: notification_text = "Flow install: path for download not exist" - Script: automagicState = "automagicState@@" + {notification_text}; fhemcmd = "setreading"; - Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} - Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} - Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download - Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download - Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/emulated/0/Download - Flows/Widgets importieren: /storage/emulated/0/Download/installFlow_{param_flowname} - Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} - Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/sdcard0) - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/sdcard) - Expression: installFlow" - Neustart - Expression: Reboot - Expression: System Command" - Expression: Shutdown - Expression: Airplanemode - Script: airplanemode = "airplanemode@@on"; fhemcmd = "setreading"; - Flows ausführen: Send Data to AMADCommBridge mit warten - Flugmodus ein-/ausschalten: Ein - Herunterfahren - Notification Lautstärke Wiederherstellen - Expression: param_notifyfile == "RedAlert.mp3" - Sound: {param_notifypath}{param_notifyfile} als Benachrichtigung - Benachrichtigung aus Statusbar entfernen: Alle - Benachrichtigung aus Statusbar entfernen: Alle (Automagic) - Expression: Automagic - Expression: All - Expression: notifysnd" - NotificationLautstärke auf Level 7 - Notification Lautstärke Speichern - Expression: param_notifyfile == "RedAlert.mp3" - Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} - Expression: Clear Automagic Meldungen" - Expression: setVibrate" - Vibrieren: Pattern 2 (-- --) - Audio Player steuern: Medienknopf Zurück ({pname}/{kname}) - Expression: param_button == "stop" - Expression: param_button == "next" - Expression: param_button == "back" - Schalte Display ein: Hell für {param_screenontime}s - Sprachausgabe: Englisch - Expression: ttsMsgLang" - Expression: global_fhemip != null or global_bridgeport != null - Setze Alarm: um {param_hour}:{param_minute} - Audio Player steuern: Medienknopf Weiter ({pname}/{kname}) - Expression: openCall" - Nummer anrufen: {param_callnumber} - Expression: sendSms" - Expression: param_flowstate == "active" or param_flowstate == "inactive" - Expression: param_flowstate == "active" - SMS senden an: an {param_smsnumber} '{param_smsmessage}' (10 in 12h) - Setze Flow Status: Deaktivieren {param_flowname} - Setze Flow Status: Aktivieren {param_flowname} - Script: notification_text = "Flow '{param_flowname}' has been set {param_flowstate}" - Script: automagicState = "automagicState@@" + {notification_text}; fhemcmd = "setreading"; - Expression: flowState" - Expression: closeCall" - Audio Player steuern: Medienknopf Stopp ({pname}/{kname}) - Expression: multimediaControl" - Starte Daydream - Expression: startDaydream" - Lautstärken setzen param_volume - Expression: setNotifiVolume" - Lautstärken setzen param_notifivolume - Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" - Expression: setRingSoundVolume" - Lautstärken setzen param_ringsoundvolume - Expression: param_button == "play/pause" - Audio Player steuern: Medienknopf Play/Pause (/{kname}) - Script: Zuordnung Mediaplayer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Update AMAD Flowset - AMAD2 Info/Control Flowset v2.6.12 - true - QUEUE - - HTTP Request: /fhem-amad/currentFlowsetUpdate - - Flows/Widgets importieren: /storage/emulated/0/Download/currentFlowsetUpdate.xml - Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} - Dateien löschen: /storage/emulated/0/Download/currentFlowsetUpdate.xml - Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} - Dateien löschen: /storage/sdcard0/Download/currentFlowsetUpdate.xml - Flows/Widgets importieren: /storage/sdcard0/Download/currentFlowsetUpdate.xml - Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /storage/sdcard0/Download - Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /sdcard/Download - Flows/Widgets importieren: /sdcard/Download/currentFlowsetUpdate.xml - Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} - Dateien löschen: /sdcard/Download/currentFlowsetUpdate.xml - Script: notification_text = "Flowset Update: path for download not exist" - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/sdcard0) - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/sdcard) - Prüfe und setze Bridgeport Variable - Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /storage/emulated/0/Download - Script: automagicState = "automagicState@@" + {notification_text}; fhemcmd = "setreading"; - Flows ausführen: Send Data to AMADCommBridge - - - - - - - - - - - - - - - - - - - - - - - - - VoiceControl - AMAD2 Info/Control Flowset v2.6.12 - true - QUEUE - - Expression: value != "" - Flows ausführen: Send Data to AMADCommBridge - Benachrichtigung auf Bildschirm: {value} (lange) - Spracheingabe wurde nicht erkannt - Flows ausführen: Send Data to AMADCommBridge - Setze voice Variablen - Script: voiceinputdata = value; fhemcmd = "voiceinputvalue"; - Script: voiceinputdata = {left(value, (indexOf(value, " und ")))}; fhemcmd = "voiceinputvalue"; - Expression: contains(value, " und ") - AMAD Voice Control - - - - - - - - - - - - - \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 8d8be1e..0000000 --- a/README.md +++ /dev/null @@ -1,151 +0,0 @@ -

AMAD

-
    - AMAD - Automagic Android Device -
    - Dieses Modul liefert, in Verbindung mit der Android APP Automagic, diverse Informationen von Android Geräten. - Die AndroidAPP Automagic (welche nicht von mir stammt und 2.90 Euro kostet) funktioniert wie Tasker, ist aber bei weitem User freundlicher. -
    - Mit etwas Einarbeitung können jegliche Informationen welche Automagic bereit stellt in FHEM angezeigt werden. Hierzu bedarf es lediglich eines eigenen Flows welcher seine Daten an die AMADCommBridge sendet. Das Modul gibt auch die Möglichkeit Androidgeräte zu steuern. -
    - Für all diese Aktionen und Informationen wird auf dem Androidgerät "Automagic" und ein so genannter Flow benötigt. Die App ist über den Google PlayStore zu beziehen. Das benötigte Flowset bekommt man aus dem FHEM Verzeichnis. -

    - Wie genau verwendet man nun AMAD? -
      -
    • man installiert die App "Automagic Premium" aus dem PlayStore oder die Testversion von hier
    • -
    • dann installiert man das Flowset 74_AMADautomagicFlowset$VERSION.xml aus dem Ordner $INSTALLFHEM/FHEM/lib/ auf dem Androidgerät und aktiviert die Flows.
    • -
    -
    - Es muß noch ein Device in FHEM anlegt werden. -

    - - Define -

      - define <name> AMAD <IP-ADRESSE> <WLANAP-SSID('s)> -

      - Beispiel: -

        - define WandTabletWohnzimmer AMAD 192.168.0.23 TuxNetAP,Opa@@Zu@@Hause
        -
      -
      - Diese Anweisung erstellt zwei neues AMAD-Device im Raum AMAD.Der Parameter <IP-ADRESSE> legt die IP Adresse des Android Gerätes fest und der Parameter WLANAP-SSID die SSID Deines WLAN's. Es können mehrere SSID's mit angegeben werden, welche dann durch Komma getrennt sein müssen. Haben die SSID's Leerzeichen im Namen werde die Leerzeichen durch 2 @ aufgefüllt. Gibt es Androidgeräte welche nicht über WLAN sondern USB-Ethernet angeschlossen sind, ist die WLANAP-SSID mit "usb-ethernet" zu benennen
      - Das zweite Device ist die AMADCommBridge welche als Kommunikationsbrücke vom Androidgerät zu FHEM diehnt. !!!Comming Soon!!! Wer den Port ändern möchte, kann dies über das Attribut "port" tun. Ihr solltet aber wissen was Ihr tut, da dieser Port im HTTP Request Trigger der beiden Flows eingestellt ist. Demzufolge muß der Port dort auch geändert werden. Der Port für die Bridge kann ohne Probleme im Bridge Device mittels dem Attribut "port" verändert werden. -
      - Der Port für die Bridge kann ohne Probleme im Bridge Device mittels dem Attribut "port" verändert werden.
      -
    -
    - AMAD Communication Bridge -
      - Beim ersten anlegen einer AMAD Deviceinstanz wird automatisch ein Gerät Namens AMADCommBridge im Raum AMAD mit angelegt. Dieses Gerät diehnt zur Kommunikation vom Androidgerät zu FHEM ohne das zuvor eine Anfrage von FHEM aus ging. Damit das Androidgerät die IP von FHEM kennt, muss diese sofort nach dem anlegen der Bridge über den set Befehl in ein entsprechendes Reading in die Bridge geschrieben werden. DAS IST SUPER WICHTIG UND FÜR DIE FUNKTION DER BRIDGE NOTWENDIG.
      - Hierfür muß folgender Befehl ausgeführt werden. set AMADCommBridge fhemServerIP <FHEM-IP>.
      - Als zweites Reading kann expertMode gesetzen werden. Mit diesem Reading wird eine unmittelbare Komminikation mit FHEM erreicht ohne die Einschränkung über ein - Notify gehen zu müssen und nur reine set Befehle ausführen zu können. -

    - NUN bitte die Flows AKTIVIEREN!!!
    -
    - Fertig! Nach anlegen der Geräteinstanz und dem eintragen der fhemServerIP in der CommBridge sollten nach spätestens 15 Sekunden bereits die ersten Readings reinkommen. Nun wird alle 15 Sekunden probiert einen Status Request erfolgreich ab zu schließen. Wenn der Status sich über einen längeren Zeitraum nicht auf "active" ändert, sollte man im Log nach eventuellen Fehlern suchen. -


    - - Readings -
      -
    • airplanemode - Status des Flugmodus
    • -
    • androidVersion - aktuell installierte Androidversion
    • -
    • automagicState - Statusmeldungen von der AutomagicApp (Voraussetzung Android >4.3). Ist Android größer 4.3 vorhanden und im Reading steht "wird nicht unterstützt", muß in den Androideinstellungen unter Ton und Benachrichtigungen -> Benachrichtigungszugriff ein Haken für Automagic gesetzt werden
    • -
    • bluetooth - on/off, Bluetooth Status an oder aus
    • -
    • checkActiveTask - Zustand einer zuvor definierten APP. 0=nicht aktiv oder nicht aktiv im Vordergrund, 1=aktiv im Vordergrund, siehe Hinweis unten
    • -
    • connectedBTdevices - eine Liste der verbundenen Gerät
    • -
    • connectedBTdevicesMAC - eine Liste der MAC Adressen aller verbundender BT Geräte
    • -
    • currentMusicAlbum - aktuell abgespieltes Musikalbum des verwendeten Mediaplayers
    • -
    • currentMusicApp - aktuell verwendeter Mediaplayers
    • -
    • currentMusicArtist - aktuell abgespielter Musikinterpret des verwendeten Mediaplayers
    • -
    • currentMusicTrack - aktuell abgespielter Musiktitel des verwendeten Mediaplayers
    • -
    • daydream - on/off, Daydream gestartet oder nicht
    • -
    • deviceState - Status des Androidgerätes. unknown, online, offline.
    • -
    • dockingState - undocked/docked Status ob sich das Gerät in einer Dockinstation befindet.
    • -
    • flow_SetCommands - active/inactive, Status des SetCommands Flow
    • -
    • flow_informations - active/inactive, Status des Informations Flow
    • -
    • flowsetVersionAtDevice - aktuell installierte Flowsetversion auf dem Device
    • -
    • intentRadioName - zuletzt gesrreamter Intent Radio Name
    • -
    • intentRadioState - Status des IntentRadio Players
    • -
    • keyguardSet - 0/1 Displaysperre gesetzt 0=nein 1=ja, bedeutet nicht das sie gerade aktiv ist
    • -
    • lastSetCommandError - letzte Fehlermeldung vom set Befehl
    • -
    • lastSetCommandState - letzter Status vom set Befehl, Befehl erfolgreich/nicht erfolgreich gesendet
    • -
    • lastStatusRequestError - letzte Fehlermeldung vom statusRequest Befehl
    • -
    • lastStatusRequestState - letzter Status vom statusRequest Befehl, Befehl erfolgreich/nicht erfolgreich gesendet
    • -
    • nextAlarmDay - aktiver Alarmtag
    • -
    • nextAlarmState - aktueller Status des "Androidinternen" Weckers
    • -
    • nextAlarmTime - aktive Alarmzeit
    • -
    • powerLevel - Status der Batterie in %
    • -
    • powerPlugged - Netzteil angeschlossen? 0=NEIN, 1|2=JA
    • -
    • screen - on locked/unlocked, off locked/unlocked gibt an ob der Bildschirm an oder aus ist und gleichzeitig gesperrt oder nicht gesperrt
    • -
    • screenBrightness - Bildschirmhelligkeit von 0-255
    • -
    • screenFullscreen - on/off, Vollbildmodus (An,Aus)
    • -
    • screenOrientation - Landscape,Portrait, Bildschirmausrichtung (Horizontal,Vertikal)
    • -
    • screenOrientationMode - auto/manual, Modus für die Ausrichtung (Automatisch, Manuell)
    • -
    • state - aktueller Status
    • -
    • volume - Media Lautstärkewert
    • -
    • volumeNotification - Benachrichtigungs Lautstärke
    • -
      - Beim Reading checkActivTask muß zuvor der Packagename der zu prüfenden App als Attribut checkActiveTask angegeben werden. Beispiel: attr Nexus10Wohnzimmer - checkActiveTask com.android.chrome für den Chrome Browser. -

      -
    -

    - - Set -
      -
    • activateVoiceInput - aktiviert die Spracheingabe
    • -
    • amazonMusic - play, stop, next, back ,steuert den Amazon Musik Mediaplayer
    • -
    • bluetooth - on/off, aktiviert/deaktiviert Bluetooth
    • -
    • clearNotificationBar - All,Automagic, löscht alle Meldungen oder nur die Automagic Meldungen in der Statusleiste
    • -
    • currentFlowsetUpdate - fürt ein Flowsetupdate auf dem Device durch
    • -
    • googleMusic - play, stop, next, back ,steuert den Google Play Musik Mediaplayer
    • -
    • installFlowSource - installiert einen Flow auf dem Device, das XML File muss unter /tmp/ liegen und die Endung xml haben. Bsp: set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml
    • -
    • nextAlarmTime - setzt die Alarmzeit. gilt aber nur innerhalb der nächsten 24Std.
    • -
    • screenBrightness - setzt die Bildschirmhelligkeit, von 0-255.
    • -
    • screenMsg - versendet eine Bildschirmnachricht
    • -
    • sendintent - sendet einen Intentstring Bsp: set $AMADDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio, der erste Befehl ist die Aktion und der zweite das Extra. Es können immer zwei Extras mitgegeben werden.
    • -
    • spotifyMusic - play, stop, next, back ,steuert den Spotify Mediaplayer
    • -
    • 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
    • -
    • 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
    • -
    • volumeNotification - setzt die Benachrichtigungslautstärke.
    • -
    -
    - Set abhängig von gesetzten Attributen -
      -
    • changetoBtDevice - wechselt zu einem anderen Bluetooth Gerät. Attribut setBluetoothDevice muß gesetzt sein. Siehe Hinweis unten!
    • -
    • notifySndFile - spielt die angegebene Mediadatei auf dem Androidgerät ab. Die aufzurufende Mediadatei sollte sich im Ordner /storage/emulated/0/Notifications/ befinden. Ist dies nicht der Fall kann man über das Attribut setNotifySndFilePath einen Pfad vorgeben.
    • -
    • openApp - öffnet eine ausgewählte App. Attribut setOpenApp
    • -
    • openURL - öffnet eine URL im Standardbrowser, sofern kein anderer Browser über das Attribut setOpenUrlBrowser ausgewählt wurde. Bsp: attr Tablet setOpenUrlBrowser de.ozerov.fully|de.ozerov.fully.MainActivity, das erste ist der Package Name und das zweite der Class Name
    • -
    • screen - on/off/lock/unlock schaltet den Bildschirm ein/aus oder sperrt/entsperrt ihn, in den Automagic Einstellungen muss "Admin Funktion" gesetzt werden sonst funktioniert "Screen off" nicht. Attribut setScreenOnForTimer ändert die Zeit wie lange das Display an bleiben soll!
    • -
    • screenFullscreen - on/off, (aktiviert/deaktiviert) den Vollbildmodus. Attribut setFullscreen
    • -
    • screenLock - Sperrt den Bildschirm mit Pinabfrage. Attribut setScreenlockPIN - hier die Pin dafür eingeben. Erlaubt sind nur Zahlen. Es müßen mindestens 4, bis max 16 Zeichen verwendet werden.
    • -
    • screenOrientation - Auto,Landscape,Portait, aktiviert die Bildschirmausrichtung (Automatisch,Horizontal,Vertikal). Attribut setScreenOrientation
    • -
    • system - setzt Systembefehle ab (nur bei gerootetet Geräen). reboot,shutdown,airplanemodeON (kann nur aktiviert werden) Attribut root, in den Automagic Einstellungen muss "Root Funktion" gesetzt werden
    • -
    • setNotifySndFilePath - setzt den korrekten Systempfad zur Notifydatei (default ist /storage/emulated/0/Notifications/
    • -
    • setTtsMsgSpeed - setzt die Sprachgeschwindigkeit bei der Sprachausgabe(Werte zwischen 0.5 bis 4.0 in 0.5er Schritten) default ist 1.0
    • -
      - Um openApp verwenden zu können, muss als Attribut der Package Name der App angegeben werden. -

      - Um zwischen Bluetoothgeräten wechseln zu können, muß das Attribut setBluetoothDevice mit folgender Syntax gesetzt werden. attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC Es muss - zwingend darauf geachtet werden das beim BTdeviceName kein Leerzeichen vorhanden ist. Am besten zusammen oder mit Unterstrich. Achtet bei der MAC darauf das Ihr wirklich nach jeder zweiten Zahl auch - einen : drin habt
      - Beispiel: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76 -
    -

    - - state -
      -
    • initialized - Ist der Status kurz nach einem define.
    • -
    • active - die Geräteinstanz ist im aktiven Status.
    • -
    • disabled - die Geräteinstanz wurde über das Attribut disable deaktiviert
    • -
    -


    - Anwendungsbeispiele: - -


    -
From 8eb066b919ff335854abc83398fdfc4154903c65 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 16 May 2017 08:36:33 +0200 Subject: [PATCH 03/32] AMADCommBridge weitestgehend abgeschlossen, AMADDevice Modul - automatisches anlegen der AMAD Devices implementiert --- 73_AMADCommBridge.pm | 104 ++-- 74_AMADDevice.pm | 1318 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1385 insertions(+), 37 deletions(-) create mode 100644 74_AMADDevice.pm diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index 7975ecb..49f0934 100644 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -36,6 +36,13 @@ # # return; # } +# +# +###### Möglicher Aufbau eines JSON Strings für die AMADCommBridge +# +# {"amad": {"AMADDEVICE": "nexus7-Wohnzimmer","FHEMCMD": "setreading"},"payload": {"reading0": "value0","reading1": "value1","readingX": "valueX"}} +# +# ## ## @@ -43,16 +50,18 @@ package main; + +my $missingModul = ""; + use strict; use warnings; -use Time::HiRes qw(gettimeofday); use HttpUtils; use TcpServerUtils; -use Encode qw(encode); +eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3alpha5"; +my $modulversion = "3alpha9"; my $flowsetversion = "2.6.12"; @@ -95,7 +104,7 @@ sub AMADCommBridge_Initialize($) { $hash->{UndefFn} = "AMADCommBridge_Undef"; $hash->{AttrFn} = "AMADCommBridge_Attr"; - $hash->{AttrList} = "expertMode:0,1 ". + $hash->{AttrList} = "expertMode:1 ". "port ". "disable:1 ". $readingFnAttributes; @@ -115,8 +124,9 @@ sub AMADCommBridge_Define($$) { my @a = split( "[ \t][ \t]*", $def ); - return "too few parameters: define AMADCommBridge ''" if( @a < 2 and @a > 3 ); - + return "too few parameters: define AMADCommBridge'" if( @a != 2); + return "Cannot define a HEOS device. Perl modul $missingModul is missing." if ( $missingModul ); + my $name = $a[0]; my $host = $a[2]; @@ -125,7 +135,6 @@ sub AMADCommBridge_Define($$) { $port = 8090 if( not defined($port) and (!$port) ); $hash->{BRIDGE} = 1; - $hash->{HOST} = $host; $hash->{PORT} = $port; $hash->{VERSIONMODUL} = $modulversion; $hash->{VERSIONFLOWSET} = $flowsetversion; @@ -137,7 +146,7 @@ sub AMADCommBridge_Define($$) { $attr{$name}{room} = "AMAD" if( !defined( $attr{$name}{room} ) ); - Log3 $name, 3, "AMADCommBridge ($name) - defined AMADCommBridge at $host with Socketport $port"; + Log3 $name, 3, "AMADCommBridge ($name) - defined AMADCommBridge with Socketport $port"; AMADCommBridge_Open( $hash ); @@ -398,9 +407,13 @@ sub AMADCommBridge_Set($@) { } elsif( $cmd eq 'close' ) { AMADCommBridge_Close($hash); + + } elsif( $cmd eq 'fhemServerIP' ) { + + readingsSingleUpdate($hash,$cmd,$arg,1); } else { - my $list = "open:noArg close:noArg"; + my $list = "open:noArg close:noArg fhemServerIP"; return "Unknown argument $cmd, choose one of $list"; } } @@ -638,22 +651,30 @@ sub AMADCommBridge_ResponseProcessing($$) { my $bhash = $modules{AMADCommBridge}{defptr}{BRIDGE}; my $bname = $bhash->{NAME}; + my @data = split( '\R\R', $buf ); + + + #### Verarbeitung der Daten welche über die AMADCommBridge kommen #### Log3 $bname, 5, "AMADCommBridge ($name) - Receive RAW Message in Debugging Mode: $buf"; - ### - ## Consume Content - ### - my @data = split( '\R\R', $buf ); - - my $header = AMADCommBridge_Header2Hash( $data[0] ); my $response; my $c; - my $device = $header->{FHEMDEVICE} if(defined($header->{FHEMDEVICE})); - my $fhemcmd = $header->{FHEMCMD} if(defined($header->{FHEMCMD})); + my $json = $data[1]; + my $decode_json; + + $decode_json = eval{decode_json($json)}; + if($@){ + Log3 $bname, 3, "AMADCommBridge ($name) - error while request: $@"; + readingsSingleUpdate($bhash, "state", "error", 1); + return; + } + + my $amadDevice = $decode_json->{amad}{AMADDEVICE}; + my $fhemcmd = $decode_json->{amad}{FHEMCMD}; @@ -689,7 +710,7 @@ sub AMADCommBridge_ResponseProcessing($$) { - elsif( !defined($device) ) { + elsif( !defined($amadDevice) ) { readingsSingleUpdate( $bhash, "transmitterERROR", $hash->{NAME}." has no device name sends", 1 ) if( AttrVal( $bname, "expertMode", 0 ) eq "1" ); Log3 $bname, 4, "AMADCommBridge ($name) - ERROR - no device name given. please check your global variable in automagic"; @@ -709,13 +730,14 @@ sub AMADCommBridge_ResponseProcessing($$) { if( defined($fhemcmd) and ($fhemcmd) ) { if ( $fhemcmd =~ /setreading\b/ ) { my $tv = $data[1]; - return Log3 $bname, 3, "AMADCommBridge ($name) - AMADCommBridge: processing receive no reading values from Device: $device" + return Log3 $bname, 3, "AMADCommBridge ($name) - AMADCommBridge: processing receive no reading values from Device: $amadDevice" unless( defined($tv) and ($tv) ); - Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge: processing receive reading values - Device: $device Data: $tv"; - - # Hier muß dann der Dispatcher aufgerufen werden - #AMADCommBridge_ResponseProcessing($dhash,$tv); + Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge: processing receive reading values - Device: $amadDevice Data: $tv"; + + Dispatch($bhash,$json,undef); + Log3 $name, 4, "AMADCommBridge ($name) - call Dispatcher"; + readingsSingleUpdate($bhash,'fhemServerIP',$decode_json->{payload}{'DEVICE-IP'},1) if( defined($decode_json->{payload}{'DEVICE-IP'})); $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM was processes\r\n"; $c = $hash->{CD}; @@ -751,9 +773,9 @@ sub AMADCommBridge_ResponseProcessing($$) { readingsBeginUpdate( $bhash); readingsBulkUpdate( $bhash, "receiveVoiceCommand", $fhemCmd ); - readingsBulkUpdate( $bhash, "receiveVoiceDevice", $device ); + readingsBulkUpdate( $bhash, "receiveVoiceDevice", $amadDevice ); readingsEndUpdate( $bhash, 1 ); - Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: set reading receive voice command: $fhemCmd from Device $device"; + Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: set reading receive voice command: $fhemCmd from Device $amadDevice"; $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM was processes\r\n"; $c = $hash->{CD}; @@ -818,21 +840,29 @@ sub AMADCommBridge_ResponseProcessing($$) { $response; } -sub AMADCommBridge_Header2Hash($) { +################## +### my little helper +################## + +##### bleibt zu Anschauungszwecken erhalten +#sub AMADCommBridge_Header2Hash($) { +# +# my $string = shift; +# my %hash = (); +# +# foreach my $line (split("\r\n", $string)) { +# my ($key,$value) = split( ": ", $line ); +# next if( !$value ); +# +# $value =~ s/^ //; +# $hash{$key} = $value; +# } +# +# return \%hash; +#} - my $string = shift; - my %hash = (); - foreach my $line (split("\r\n", $string)) { - my ($key,$value) = split( ": ", $line ); - next if( !$value ); - $value =~ s/^ //; - $hash{$key} = $value; - } - - return \%hash; -} diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm new file mode 100644 index 0000000..5da3e24 --- /dev/null +++ b/74_AMADDevice.pm @@ -0,0 +1,1318 @@ +############################################################################### +# +# Developed with Kate +# +# (c) 2015-2017 Copyright: Marko Oldenburg (leongaultier at gmail dot com) +# All rights reserved +# +# This script is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# any later version. +# +# The GNU General Public License can be found at +# http://www.gnu.org/copyleft/gpl.html. +# A copy is found in the textfile GPL.txt and important notices to the license +# from the author is found in LICENSE.txt distributed with these scripts. +# +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# +# $Id$ +# +############################################################################### +## +## +## Das JSON Modul immer in einem eval aufrufen +# $data = eval{decode_json($data)}; +# +# if($@){ +# Log3($SELF, 2, "$TYPE ($SELF) - error while request: $@"); +# +# readingsSingleUpdate($hash, "state", "error", 1); +# +# return; +# } +# +# +###### Möglicher Aufbau eines JSON Strings für die AMADCommBridge +# +# {"amad": {"AMADDEVICE": "nexus7-Wohnzimmer","FHEMCMD": "setreading"},"payload": {"reading0": "value0","reading1": "value1","readingX": "valueX"}} +# +# +## +## +## +## + + + +package main; + + +my $missingModul = ""; + +use strict; +use warnings; + +use Encode qw(encode); +eval "use JSON;1" or $missingModul .= "JSON "; + + +my $modulversion = "3alpha9"; +my $flowsetversion = "2.6.12"; + + + + +# Declare functions +sub AMADDevice_Attr(@); +sub AMADDevice_checkDeviceState($); +sub AMADDevice_decrypt($); +sub AMADDevice_Define($$); +sub AMADDevice_encrypt($); +sub AMADDevice_GetUpdate($); +sub AMADDevice_Initialize($); +sub AMADDevice_WriteReadings($$); +sub AMADDevice_SelectSetCmd($$@); +sub AMADDevice_Set($$@); +sub AMADDevice_Undef($$); +sub AMADDevice_Parse($$); + + + + +sub AMADDevice_Initialize($) { + + my ($hash) = @_; + + $hash->{Match} = '.*'; + + $hash->{SetFn} = "AMADDevice_Set"; + $hash->{DefFn} = "AMADDevice_Define"; + $hash->{UndefFn} = "AMADDevice_Undef"; + $hash->{AttrFn} = "AMADDevice_Attr"; + $hash->{ParseFn} = "AMADDevice_Parse"; + + $hash->{AttrList} = "setOpenApp ". + "checkActiveTask ". + "setFullscreen:0,1 ". + "setScreenOrientation:0,1 ". + "setScreenBrightness:noArg ". + "setBluetoothDevice ". + "setScreenlockPIN ". + "setScreenOnForTimer ". + "setOpenUrlBrowser ". + "setNotifySndFilePath ". + "setTtsMsgSpeed ". + "setUserFlowState ". + "setTtsMsgLang:de,en ". + "setAPSSID ". + "root:0,1 ". + "port ". + "disable:1 ". + $readingFnAttributes; + + foreach my $d(sort keys %{$modules{AMADDevice}{defptr}}) { + + my $hash = $modules{AMADDevice}{defptr}{$d}; + $hash->{VERSIONMODUL} = $modulversion; + $hash->{VERSIONFLOWSET} = $flowsetversion; + } +} + +sub AMADDevice_Define($$) { + + my ( $hash, $def ) = @_; + my @a = split( "[ \t]+", $def ); + splice( @a, 1, 1 ); + my $iodev; + my $i = 0; + + + foreach my $param ( @a ) { + if( $param =~ m/IODev=([^\s]*)/ ) { + + $iodev = $1; + splice( @a, $i, 3 ); + last; + } + + $i++; + } + + return "too few parameters: define AMADDevice " if( @a < 2 ); + return "Cannot define a HEOS device. Perl modul $missingModul is missing." if ( $missingModul ); + + + my ($name,$host) = @a; + + $hash->{HOST} = $host; + $hash->{PORT} = 8090; + $hash->{VERSIONMODUL} = $modulversion; + $hash->{VERSIONFLOWSET} = $flowsetversion; + $hash->{helper}{infoErrorCounter} = 0 if( $hash->{HOST} ); + $hash->{helper}{setCmdErrorCounter} = 0 if( $hash->{HOST} ); + $hash->{helper}{deviceStateErrorCounter} = 0 if( $hash->{HOST} ); + + + AssignIoPort($hash,$iodev) if( !$hash->{IODev} ); + + if(defined($hash->{IODev}->{NAME})) { + + Log3 $name, 3, "AMADDevice ($name) - I/O device is " . $hash->{IODev}->{NAME}; + + } else { + + Log3 $name, 1, "AMADDevice ($name) - no I/O device"; + } + + + $iodev = $hash->{IODev}->{NAME}; + + my $code = $iodev ."-". $name if( defined($iodev) ); + my $d = $modules{AMADDevice}{defptr}{$code}; + + return "AMADDevice device $name on AMADCommBridge $iodev already defined." + if( defined($d) && $d->{IODev} == $hash->{IODev} && $d->{NAME} ne $name ); + + Log3 $name, 3, "AMADDevice ($name) - defined with Code: $code on port $hash->{PORT}"; + + $attr{$name}{room} = "AMAD" if( !defined( $attr{$name}{room} ) ); + + readingsBeginUpdate($hash); + readingsBulkUpdate( $hash, "state", "initialized"); + readingsBulkUpdate( $hash, "deviceState", "unknown"); + readingsEndUpdate($hash,1); + + + if( $init_done ) { + + #AMADDevice_GetUpdate($hash); + + } else { + + #InternalTimer( gettimeofday()+30, "AMADDevice_GetUpdate", $hash, 0 ) if( ($hash->{HOST}) ); + } + + $modules{AMADDevice}{defptr}{$code} = $hash; + + return undef; +} + +sub AMADDevice_Undef($$) { + + my ( $hash, $arg ) = @_; + my $name = $hash->{NAME}; + + my $code = $hash->{IODev}->{NAME} ."-". $name if( defined($hash->{IODev}->{NAME}) ); + + RemoveInternalTimer( $hash ); + delete $modules{AMADDevice}{defptr}{$code}; + + return undef; +} + +sub AMADDevice_Attr(@) { + + my ( $cmd, $name, $attrName, $attrVal ) = @_; + my $hash = $defs{$name}; + + my $orig = $attrVal; + + if( $attrName eq "disable" ) { + if( $cmd eq "set" ) { + if( $attrVal eq "0" ) { + + RemoveInternalTimer( $hash ); + InternalTimer( gettimeofday()+2, "AMADDevice_GetUpdate", $hash, 0 ) if( ReadingsVal( $hash->{NAME}, "state", 0 ) eq "disabled" ); + readingsSingleUpdate ( $hash, "state", "active", 1 ); + Log3 $name, 3, "AMADDevice ($name) - enabled"; + } else { + + readingsSingleUpdate ( $hash, "state", "disabled", 1 ); + RemoveInternalTimer( $hash ); + Log3 $name, 3, "AMADDevice ($name) - disabled"; + } + + } else { + + RemoveInternalTimer( $hash ); + InternalTimer( gettimeofday()+2, "AMADDevice_GetUpdate", $hash, 0 ) if( ReadingsVal( $hash->{NAME}, "state", 0 ) eq "disabled" ); + readingsSingleUpdate ( $hash, "state", "active", 1 ); + Log3 $name, 3, "AMADDevice ($name) - enabled"; + } + } + + elsif( $attrName eq "checkActiveTask" ) { + if( $cmd eq "del" ) { + CommandDeleteReading( undef, "$name checkActiveTask" ); + } + + Log3 $name, 3, "AMADDevice ($name) - $cmd $attrName $attrVal and run statusRequest"; + RemoveInternalTimer( $hash ); + InternalTimer( gettimeofday(), "AMADDevice_GetUpdate", $hash, 0 ) + } + + elsif( $attrName eq "port" ) { + if( $cmd eq "set" ) { + + $hash->{PORT} = $attrVal; + Log3 $name, 3, "AMADDevice ($name) - set port to $attrVal"; + + if( $hash->{BRIDGE} ) { + delete $modules{AMADDevice}{defptr}{BRIDGE}; + TcpServer_Close( $hash ); + Log3 $name, 3, "AMADDevice ($name) - CommBridge Port changed. CommBridge are closed and new open!"; + + AMADDevice_CommBridge_Open( $hash ); + } + } else { + + $hash->{PORT} = 8090; + Log3 $name, 3, "AMADDevice ($name) - set port to default"; + + if( $hash->{BRIDGE} ) { + delete $modules{AMADDevice}{defptr}{BRIDGE}; + TcpServer_Close( $hash ); + Log3 $name, 3, "AMADDevice ($name) - CommBridge Port changed. CommBridge are closed and new open!"; + + AMADDevice_CommBridge_Open( $hash ); + } + } + } + + elsif( $attrName eq "setScreenlockPIN" ) { + if( $cmd eq "set" && $attrVal ) { + + $attrVal = AMADDevice_encrypt($attrVal); + + } else { + + CommandDeleteReading( undef, "$name screenLock" ); + } + } + + elsif( $attrName eq "setUserFlowState" ) { + if( $cmd eq "del" ) { + + CommandDeleteReading( undef, "$name userFlowState" ); + } + + Log3 $name, 3, "AMADDevice ($name) - $cmd $attrName $attrVal and run statusRequest"; + RemoveInternalTimer( $hash ); + InternalTimer( gettimeofday(), "AMADDevice_GetUpdate", $hash, 0 ) + } + + + + if( $cmd eq "set" ) { + if( $attrVal && $orig ne $attrVal ) { + + $attr{$name}{$attrName} = $attrVal; + return $attrName ." set to ". $attrVal if( $init_done ); + } + } + + return undef; +} + +sub AMADDevice_GetUpdate($) { + + my ( $hash ) = @_; + my $name = $hash->{NAME}; + my $bhash = $modules{AMADDevice}{defptr}{BRIDGE}; + my $bname = $bhash->{NAME}; + + RemoveInternalTimer( $hash ); + + if( $init_done && ( ReadingsVal( $name, "deviceState", "unknown" ) eq "unknown" or ReadingsVal( $name, "deviceState", "online" ) eq "online" ) && AttrVal( $name, "disable", 0 ) ne "1" && ReadingsVal( $bname, "fhemServerIP", "not set" ) ne "not set" ) { + + AMADDevice_statusRequest( $hash ); + AMADDevice_checkDeviceState( $hash ); + + } else { + + Log3 $name, 4, "AMADDevice ($name) - GetUpdate, FHEM or Device not ready yet"; + Log3 $name, 3, "AMADDevice ($bname) - GetUpdate, Please set $bname fhemServerIP NOW!" if( ReadingsVal( $bname, "fhemServerIP", "none" ) eq "none" ); + + InternalTimer( gettimeofday()+15, "AMADDevice_GetUpdate", $hash, 0 ); + } +} + +sub AMADDevice_WriteReadings($$) { + + my ( $hash, $decode_json ) = @_; + + my $name = $hash->{NAME}; + my $host = $hash->{HOST}; + + + ############################ + #### schreiben der Readings + readingsBeginUpdate($hash); + + Log3 $name, 5, "AMADDevice ($name) - Processing data: $decode_json"; + readingsSingleUpdate( $hash, "state", "active", 1) if( ReadingsVal( $name, "state", 0 ) ne "initialized" or ReadingsVal( $name, "state", 0 ) ne "active" ); + + ### Event Readings + my $t; + my $v; + + + while( ( $t, $v ) = each %{$decode_json->{payload}} ) { + readingsBulkUpdate( $hash, $t, $v ) if( defined( $v ) ); + $v =~ s/\bnull\b/off/g if( ($t eq "nextAlarmDay" || $t eq "nextAlarmTime") && $v eq "null" ); + $v =~ s/\bnull\b//g; + } + + readingsBulkUpdate( $hash, "deviceState", "offline" ) if( $decode_json->{payload}{airplanemode} && $decode_json->{payload}{airplanemode} eq "on" ); + readingsBulkUpdate( $hash, "deviceState", "online" ) if( $decode_json->{payload}{airplanemode} && $decode_json->{payload}{airplanemode} eq "off" ); + + readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_done" ); + + $hash->{helper}{infoErrorCounter} = 0; + ### End Response Processing + + readingsBulkUpdate( $hash, "state", "active" ) if( ReadingsVal( $name, "state", 0 ) eq "initialized" ); + readingsEndUpdate( $hash, 1 ); + + $hash->{helper}{deviceStateErrorCounter} = 0 if( $hash->{helper}{deviceStateErrorCounter} > 0 and ReadingsVal( $name, "deviceState", "offline") eq "online" ); + + return undef; +} + +sub AMADDevice_Set($$@) { + + my ( $hash, $name, $cmd, @val ) = @_; + + my $bhash = $modules{AMADDevice}{defptr}{BRIDGE}; + my $bname = $bhash->{NAME}; + + if( $name ne "$bname" ) { + my $apps = AttrVal( $name, "setOpenApp", "none" ); + my $btdev = AttrVal( $name, "setBluetoothDevice", "none" ); + my $activetask = AttrVal( $name, "setActiveTask", "none" ); + + my $list = ""; + $list .= "screenMsg "; + $list .= "ttsMsg "; + $list .= "volume:slider,0,1,15 "; + $list .= "mediaGoogleMusic:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); + $list .= "mediaAmazonMusic:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); + $list .= "mediaSpotifyMusic:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); + $list .= "mediaTuneinRadio:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); + $list .= "mediaAldiMusic:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); + $list .= "mediaYouTube:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); + $list .= "mediaVlcPlayer:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); + $list .= "mediaAudible:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); + $list .= "screenBrightness:slider,0,1,255 "; + $list .= "screen:on,off,lock,unlock "; + $list .= "screenOrientation:auto,landscape,portrait " if( AttrVal( $name, "setScreenOrientation", "0" ) eq "1" ); + $list .= "screenFullscreen:on,off " if( AttrVal( $name, "setFullscreen", "0" ) eq "1" ); + $list .= "openURL "; + $list .= "openApp:$apps " if( AttrVal( $name, "setOpenApp", "none" ) ne "none" ); + $list .= "nextAlarmTime:time "; + $list .= "timer:slider,1,1,60 "; + $list .= "statusRequest:noArg "; + $list .= "system:reboot,shutdown,airplanemodeON " if( AttrVal( $name, "root", "0" ) eq "1" ); + $list .= "bluetooth:on,off "; + $list .= "notifySndFile "; + $list .= "clearNotificationBar:All,Automagic "; + $list .= "changetoBTDevice:$btdev " if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); + $list .= "activateVoiceInput:noArg "; + $list .= "volumeNotification:slider,0,1,7 "; + $list .= "volumeRingSound:slider,0,1,7 "; + $list .= "vibrate:noArg "; + $list .= "sendIntent "; + $list .= "openCall "; + $list .= "closeCall:noArg "; + $list .= "currentFlowsetUpdate:noArg "; + $list .= "installFlowSource "; + $list .= "doNotDisturb:never,always,alarmClockOnly,onlyImportant "; + $list .= "userFlowState "; + $list .= "sendSMS "; + $list .= "startDaydream:noArg "; + + if( lc $cmd eq 'screenmsg' + || lc $cmd eq 'ttsmsg' + || lc $cmd eq 'volume' + || lc $cmd eq 'mediagooglemusic' + || lc $cmd eq 'mediaamazonmusic' + || lc $cmd eq 'mediaspotifymusic' + || lc $cmd eq 'mediatuneinradio' + || lc $cmd eq 'mediaaldimusic' + || lc $cmd eq 'mediayoutube' + || lc $cmd eq 'mediavlcplayer' + || lc $cmd eq 'mediaaudible' + || lc $cmd eq 'screenbrightness' + || lc $cmd eq 'screenorientation' + || lc $cmd eq 'screenfullscreen' + || lc $cmd eq 'screen' + || lc $cmd eq 'openurl' + || lc $cmd eq 'openapp' + || lc $cmd eq 'nextalarmtime' + || lc $cmd eq 'timer' + || lc $cmd eq 'bluetooth' + || lc $cmd eq 'system' + || lc $cmd eq 'notifysndfile' + || lc $cmd eq 'changetobtdevice' + || lc $cmd eq 'clearnotificationbar' + || lc $cmd eq 'activatevoiceinput' + || lc $cmd eq 'volumenotification' + || lc $cmd eq 'volumeringsound' + || lc $cmd eq 'screenlock' + || lc $cmd eq 'statusrequest' + || lc $cmd eq 'sendsms' + || lc $cmd eq 'sendintent' + || lc $cmd eq 'currentflowsetupdate' + || lc $cmd eq 'installflowsource' + || lc $cmd eq 'opencall' + || lc $cmd eq 'closecall' + || lc $cmd eq 'donotdisturb' + || lc $cmd eq 'userflowstate' + || lc $cmd eq 'startdaydream' + || lc $cmd eq 'vibrate') { + + Log3 $name, 5, "AMADDevice ($name) - set $name $cmd ".join(" ", @val); + + return AMADDevice_SelectSetCmd( $hash, $cmd, @val ) if( lc $cmd eq 'statusrequest' ); + return "set command only works if state not equal initialized" if( ReadingsVal( $hash->{NAME}, "state", 0 ) eq "initialized"); + return "Cannot set command, FHEM Device is disabled" if( AttrVal( $name, "disable", "0" ) eq "1" ); + + return "Cannot set command, FHEM Device is unknown" if( ReadingsVal( $name, "deviceState", "online" ) eq "unknown" ); + return "Cannot set command, FHEM Device is offline" if( ReadingsVal( $name, "deviceState", "online" ) eq "offline" ); + + return AMADDevice_SelectSetCmd( $hash, $cmd, @val ) if( (@val) or (lc $cmd eq 'activatevoiceinput') or (lc $cmd eq 'vibrate') or (lc $cmd eq 'currentflowsetupdate') or (lc $cmd eq 'closecall') or (lc $cmd eq 'startdaydream') ); + } + + return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; + + } elsif( $modules{AMADDevice}{defptr}{BRIDGE} ) { + + my $list = ""; + + ## set Befehle für die AMADDevice_CommBridge + $list .= "expertMode:0,1 " if( $modules{AMADDevice}{defptr}{BRIDGE} ); + $list .= "fhemServerIP " if( $modules{AMADDevice}{defptr}{BRIDGE} ); + + if( lc $cmd eq 'expertmode' + || lc $cmd eq 'fhemserverip' ) { + + readingsSingleUpdate( $hash, $cmd, $val[0], 0 ); + + return; + } + + return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; + } +} + +sub AMADDevice_SelectSetCmd($$@) { + + my ( $hash, $cmd, @data ) = @_; + my $name = $hash->{NAME}; + my $host = $hash->{HOST}; + my $port = $hash->{PORT}; + + if( lc $cmd eq 'screenmsg' ) { + my $msg = join( " ", @data ); + + $msg =~ s/%/%25/g; + $msg =~ s/\s/%20/g; + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/screenMsg?message=$msg"; + Log3 $name, 4, "AMADDevice ($name) - Sub AMADDevice_SetScreenMsg"; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'ttsmsg' ) { + + my $msg = join( " ", @data ); + my $speed = AttrVal( $name, "setTtsMsgSpeed", "1.0" ); + my $lang = AttrVal( $name, "setTtsMsgLang","de" ); + + $msg =~ s/%/%25/g; + $msg =~ s/\s/%20/g; + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/ttsMsg?message=".$msg."&msgspeed=".$speed."&msglang=".$lang; + + return AMADDevice_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 AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'volume' ) { + + my $vol = join( " ", @data ); + + if( $vol =~ /^\+(.*)/ or $vol =~ /^-(.*)/ ) { + + if( $vol =~ /^\+(.*)/ ) { + + $vol =~ s/^\+//g; + $vol = ReadingsVal( $name, "volume", 15 ) + $vol; + } + + elsif( $vol =~ /^-(.*)/ ) { + + $vol =~ s/^-//g; + printf $vol; + $vol = ReadingsVal( $name, "volume", 15 ) - $vol; + } + } + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setVolume?volume=$vol"; + + return AMADDevice_HTTP_POST( $hash, $url ); + } + + elsif( lc $cmd eq 'volumenotification' ) { + + my $vol = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setNotifiVolume?notifivolume=$vol"; + + return AMADDevice_HTTP_POST( $hash, $url ); + } + + elsif( lc $cmd eq 'volumeringsound' ) { + + my $vol = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setRingSoundVolume?ringsoundvolume=$vol"; + + return AMADDevice_HTTP_POST( $hash, $url ); + } + + elsif( lc $cmd =~ /^media/ ) { + + my $btn = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/multimediaControl?mplayer=".$cmd."&button=".$btn; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'screenbrightness' ) { + + my $bri = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setBrightness?brightness=$bri"; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'screen' ) { + + my $mod = join( " ", @data ); + my $scot = AttrVal( $name, "setScreenOnForTimer", undef ); + $scot = 60 if( !$scot ); + + if ($mod eq "on" || $mod eq "off") { + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenOnOff?screen=".$mod."&screenontime=".$scot if ($mod eq "on" || $mod eq "off"); + + return AMADDevice_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 = AMADDevice_decrypt($PIN); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/screenlock?lockmod=".$mod."&lockPIN=".$PIN; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + } + + elsif( lc $cmd eq 'screenorientation' ) { + + my $mod = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenOrientation?orientation=$mod"; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'activatevoiceinput' ) { + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setvoicecmd"; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'screenfullscreen' ) { + + my $mod = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenFullscreen?fullscreen=$mod"; + + readingsSingleUpdate( $hash, $cmd, $mod, 1 ); + + return AMADDevice_HTTP_POST( $hash, $url ); + } + + elsif( lc $cmd eq 'openurl' ) { + + my $openurl = join( " ", @data ); + my $browser = AttrVal( $name, "setOpenUrlBrowser", "com.android.chrome|com.google.android.apps.chrome.Main" ); + my @browserapp = split( /\|/, $browser ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/openURL?url=".$openurl."&browserapp=".$browserapp[0]."&browserappclass=".$browserapp[1]; + + return AMADDevice_HTTP_POST( $hash, $url ); + } + + elsif (lc $cmd eq 'nextalarmtime') { + + my $value = join( " ", @data ); + my @alarm = split( ":", $value ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setAlarm?hour=".$alarm[0]."&minute=".$alarm[1]; + + return AMADDevice_HTTP_POST( $hash, $url ); + } + + elsif (lc $cmd eq 'timer') { + + my $timer = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setTimer?minute=$timer"; + + return AMADDevice_HTTP_POST( $hash, $url ); + } + + elsif( lc $cmd eq 'statusrequest' ) { + + AMADDevice_statusRequest( $hash ); + return undef; + } + + elsif( lc $cmd eq 'openapp' ) { + + my $app = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/openApp?app=$app"; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'system' ) { + + my $systemcmd = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/systemcommand?syscmd=$systemcmd"; + + readingsSingleUpdate( $hash, "airplanemode", "on", 1 ) if( $systemcmd eq "airplanemodeON" ); + readingsSingleUpdate( $hash, "deviceState", "offline", 1 ) if( $systemcmd eq "airplanemodeON" || $systemcmd eq "shutdown" ); + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'donotdisturb' ) { + + my $disturbmod = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/donotdisturb?disturbmod=$disturbmod"; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'bluetooth' ) { + + my $mod = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setbluetooth?bluetooth=$mod"; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'notifysndfile' ) { + + my $notify = join( " ", @data ); + my $filepath = AttrVal( $name, "setNotifySndFilePath", "/storage/emulated/0/Notifications/" ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/playnotifysnd?notifyfile=".$notify."¬ifypath=".$filepath; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'changetobtdevice' ) { + + my $swToBtDevice = join( " ", @data ); + my @swToBtMac = split( /\|/, $swToBtDevice ); + my $btDevices = AttrVal( $name, "setBluetoothDevice", "none" ) if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); + my @btDevice = split( ',', $btDevices ); + my @btDeviceOne = split( /\|/, $btDevice[0] ); + my @btDeviceTwo = split( /\|/, $btDevice[1] ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setbtdevice?swToBtDeviceMac=".$swToBtMac[1]."&btDeviceOne=".$btDeviceOne[1]."&btDeviceTwo=".$btDeviceTwo[1]; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'clearnotificationbar' ) { + + my $appname = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/clearnotificationbar?app=$appname"; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'vibrate' ) { + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setvibrate"; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'sendintent' ) { + + my $intentstring = join( " ", @data ); + my ( $action, $exkey1, $exval1, $exkey2, $exval2 ) = split( "[ \t][ \t]*", $intentstring ); + $exkey1 = "" if( !$exkey1 ); + $exval1 = "" if( !$exval1 ); + $exkey2 = "" if( !$exkey2 ); + $exval2 = "" if( !$exval2 ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/sendIntent?action=".$action."&exkey1=".$exkey1."&exval1=".$exval1."&exkey2=".$exkey2."&exval2=".$exval2; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'installflowsource' ) { + + my $flowname = join( " ", @data ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/installFlow?flowname=$flowname"; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'opencall' ) { + + my $string = join( " ", @data ); + my ($callnumber, $time) = split( "[ \t][ \t]*", $string ); + $time = "none" if( !$time ); + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/openCall?callnumber=".$callnumber."&hanguptime=".$time; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'closecall' ) { + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/closeCall"; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'startdaydream' ) { + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/startDaydream"; + + return AMADDevice_HTTP_POST( $hash,$url ); + } + + elsif( lc $cmd eq 'currentflowsetupdate' ) { + + my $url = "http://" . $host . ":" . $port . "/fhem-amad/currentFlowsetUpdate"; + + return AMADDevice_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 AMADDevice_HTTP_POST( $hash,$url ); + } + + return undef; +} + +sub AMADDevice_Parse($$) { + + my ($io_hash,$json) = @_; + my $name = $io_hash->{NAME}; + my $amadDevice; + my $decode_json; + + + $decode_json = eval{decode_json($json)}; + if($@){ + Log3 $name, 3, "AMADDevice ($name) - error while request: $@"; + #readingsSingleUpdate($hash, "state", "error", 1); + return; + } + + Log3 $name, 3, "AMADDevice ($name) - ParseFn was called"; + Log3 $name, 3, "AMADDevice ($name) - ParseFn was called, !!! JSON: $json"; + Log3 $name, 3, "AMADDevice ($name) - ParseFn was called, !!! AMAD: $decode_json->{amad}{AMADDEVICE}"; + + + $amadDevice = $decode_json->{amad}{AMADDEVICE}; + my $code = $io_hash->{NAME} ."-". $amadDevice; + + if( my $hash = $modules{AMADDevice}{defptr}{$code} ) { + my $name = $hash->{NAME}; + + AMADDevice_WriteReadings($hash,$decode_json); + Log3 $name, 4, "AMADDevice ($name) - find logical device: $hash->{NAME}"; + + return $hash->{NAME}; + + } else { + + return "UNDEFINED $amadDevice AMADDevice $decode_json->{payload}{'DEVICE-IP'} IODev=$name"; + } +} + + +################################## +################################## +#### my little helpers ########### +sub AMADDevice_checkDeviceState($) { + + my ( $hash ) = @_; + my $name = $hash->{NAME}; + + Log3 $name, 4, "AMADDevice ($name) - AMADDevice_checkDeviceState: run Check"; + + RemoveInternalTimer( $hash ); + + if( ReadingsAge( $name, "deviceState", 90 ) > 90 ) { + + AMADDevice_statusRequest( $hash ) if( $hash->{helper}{deviceStateErrorCounter} == 0 ); + readingsSingleUpdate( $hash, "deviceState", "offline", 1 ) if( ReadingsAge( $name, "deviceState", 180) > 180 and $hash->{helper}{deviceStateErrorCounter} > 0 ); + $hash->{helper}{deviceStateErrorCounter} = ( $hash->{helper}{deviceStateErrorCounter} + 1 ); + } + + InternalTimer( gettimeofday()+90, "AMADDevice_checkDeviceState", $hash, 0 ); + + Log3 $name, 4, "AMADDevice ($name) - AMADDevice_checkDeviceState: set new Timer"; +} + +sub AMADDevice_encrypt($) { + + my ($decodedPIN) = @_; + my $key = getUniqueId(); + my $encodedPIN; + + return $decodedPIN if( $decodedPIN =~ /^crypt:(.*)/ ); + + for my $char (split //, $decodedPIN) { + my $encode = chop($key); + $encodedPIN .= sprintf("%.2x",ord($char)^ord($encode)); + $key = $encode.$key; + } + + return 'crypt:'. $encodedPIN; +} + +sub AMADDevice_decrypt($) { + + my ($encodedPIN) = @_; + my $key = getUniqueId(); + my $decodedPIN; + + $encodedPIN = $1 if( $encodedPIN =~ /^crypt:(.*)/ ); + + for my $char (map { pack('C', hex($_)) } ($encodedPIN =~ /(..)/g)) { + my $decode = chop($key); + $decodedPIN .= chr(ord($char)^ord($decode)); + $key = $decode.$key; + } + + return $decodedPIN; +} + + + + +1; + +=pod + +=item device +=item summary Integrates Android devices into FHEM and displays several settings. +=item summary_DE Integriert Android-Geräte in FHEM und zeigt verschiedene Einstellungen an. + +=begin html + + +

AMADDevice

+
    + AMADDevice - Automagic Android Device +
    + This module integrates Android devices into FHEM and displays several settings using the Android app "Automagic". + Automagic is comparable to the "Tasker" app for automating tasks and configuration settings. But Automagic is more user-friendly. The "Automagic Premium" app currently costs EUR 2.90. +
    + Any information retrievable by Automagic can be displayed in FHEM by this module. Just define your own Automagic-"flow" and send the data to the AMADDeviceCommBridge. One even can control several actions on Android devices. +
    + To be able to make use of all these functions the Automagic app and additional flows need to be installed on the Android device. The flows can be retrieved from the FHEM directory, the app can be bought in Google Play Store. +

    + How to use AMADDevice? +
      +
    • install the "Automagic Premium" app from the Google Play store.
    • +
    • install the flowset 74_AMADDeviceautomagicFlowset$VERSION.xml from the directory $INSTALLFHEM/FHEM/lib/ on your Android device and activate.
    • +
    +
    + Now you need to define a device in FHEM. +

    + + Define +

      + define <name> AMADDevice <IP-ADDRESS> +

      + Example: +

        + define WandTabletWohnzimmer AMADDevice 192.168.0.23
        +
      +
      + With this command two new AMADDevice devices in a room called AMADDevice are created. The parameter <IP-ADDRESS< defines the IP address of your Android device. The second device created is the AMADDeviceCommBridge which serves as a communication device from each Android device to FHEM.
      + !!!Coming Soon!!! The communication port of each AMADDevice device may be set by the definition of the "port" attribute. One needs background knowledge of Automagic and HTTP requests as this port will be set in the HTTP request trigger of both flows, therefore the port also needs to be set there. +
      + The communication port of the AMADDeviceCommBridge device can easily be changed within the attribut "port".
      +
    +
    + AMADDevice Communication Bridge +
      + Creating your first AMADDevice device automatically creates the AMADDeviceCommBridge device in the room AMADDevice. With the help of the AMADDeviceCommBridge any Android device communicates initially to FHEM.To make the IP addresse of the FHEM server known to the Android device, the FHEM server IP address needs to be configured in the AMADDeviceCommBridge. WITHOUT THIS STEP THE AMADDeviceCommBridge WILL NOT WORK PROPERLY.
      + Please us the following command for configuration of the FHEM server IP address in the AMADDeviceCommBridge: set AMADDeviceCommBridge fhemServerIP <FHEM-IP>.
      + Additionally the expertMode may be configured. By this setting a direct communication with FHEM will be established without the restriction of needing to make use of a notify to execute set commands. +

    +
    + You are finished now! After 15 seconds latest the readings of your AMADDevice Android device should be updated. Consequently each 15 seconds a status request will be sent. If the state of your AMADDevice Android device does not change to "active" over a longer period of time one should take a look into the log file for error messages. +


    + + Readings +
      +
    • airplanemode - on/off, state of the aeroplane mode
    • +
    • androidVersion - currently installed version of Android
    • +
    • automagicState - state of the Automagic App (prerequisite Android >4.3). In case you have Android >4.3 and the reading says "not supported", you need to enable Automagic inside Android / Settings / Sound & notification / Notification access
    • +
    • batteryHealth - the health of the battery (1=unknown, 2=good, 3=overheat, 4=dead, 5=over voltage, 6=unspecified failure, 7=cold)
    • +
    • batterytemperature - the temperature of the battery
    • +
    • bluetooth - on/off, bluetooth state
    • +
    • checkActiveTask - state of an app (needs to be defined beforehand). 0=not active or not active in foreground, 1=active in foreground, see note below
    • +
    • connectedBTdevices - list of all devices connected via bluetooth
    • +
    • connectedBTdevicesMAC - list of MAC addresses of all devices connected via bluetooth
    • +
    • currentMusicAlbum - currently playing album of mediaplayer
    • +
    • currentMusicApp - currently playing player app (Amazon Music, Google Play Music, Google Play Video, Spotify, YouTube, TuneIn Player, Aldi Life Music)
    • +
    • currentMusicArtist - currently playing artist of mediaplayer
    • +
    • currentMusicIcon - cover of currently play albumNoch nicht fertig implementiert
    • +
    • currentMusicState - state of currently/last used mediaplayer
    • +
    • currentMusicTrack - currently playing song title of mediaplayer
    • +
    • daydream - on/off, daydream currently active
    • +
    • deviceState - state of Android devices. unknown, online, offline.
    • +
    • doNotDisturb - state of do not Disturb Mode
    • +
    • dockingState - undocked/docked, Android device in docking station
    • +
    • flow_SetCommands - active/inactive, state of SetCommands flow
    • +
    • flow_informations - active/inactive, state of Informations flow
    • +
    • flowsetVersionAtDevice - currently installed version of the flowsets on the Android device
    • +
    • incomingCallerName - Callername from last Call
    • +
    • incomingCallerNumber - Callernumber from last Call
    • +
    • incommingWhatsAppMessageFrom - last WhatsApp message
    • +
    • incommingWhatsTelegramMessageFrom - last telegram message
    • +
    • intentRadioName - name of the most-recent streamed intent radio
    • +
    • intentRadioState - state of intent radio player
    • +
    • keyguardSet - 0/1 keyguard set, 0=no 1=yes, does not indicate whether it is currently active
    • +
    • lastSetCommandError - last error message of a set command
    • +
    • lastSetCommandState - last state of a set command, command send successful/command send unsuccessful
    • +
    • lastStatusRequestError - last error message of a statusRequest command
    • +
    • lastStatusRequestState - ast state of a statusRequest command, command send successful/command send unsuccessful
    • +
    • nextAlarmDay - currently set day of alarm
    • +
    • nextAlarmState - alert/done, current state of "Clock" stock-app
    • +
    • nextAlarmTime - currently set time of alarm
    • +
    • powerLevel - state of battery in %
    • +
    • powerPlugged - 0=no/1,2=yes, power supply connected
    • +
    • screen - on locked,unlocked/off locked,unlocked, state of display
    • +
    • screenBrightness - 0-255, level of screen-brightness
    • +
    • screenFullscreen - on/off, full screen mode
    • +
    • screenOrientation - Landscape/Portrait, screen orientation (horizontal,vertical)
    • +
    • screenOrientationMode - auto/manual, mode for screen orientation
    • +
    • state - current state of AMADDevice device
    • +
    • userFlowState - current state of a Flow, established under setUserFlowState Attribut
    • +
    • volume - media volume setting
    • +
    • volumeNotification - notification volume setting
    • +
      + Prerequisite for using the reading checkActivTask the package name of the application to be checked needs to be defined in the attribute checkActiveTask. Example: attr Nexus10Wohnzimmer + checkActiveTask com.android.chrome für den Chrome Browser. +

      +
    +

    + + Set +
      +
    • activateVoiceInput - start voice input on Android device
    • +
    • bluetooth - on/off, switch bluetooth on/off
    • +
    • clearNotificationBar - All/Automagic, deletes all or only Automagic notifications in status bar
    • +
    • closeCall - hang up a running call
    • +
    • currentFlowsetUpdate - start flowset update on Android device
    • +
    • installFlowSource - install a Automagic flow on device, XML file must be stored in /tmp/ with extension xml. Example: set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml
    • +
    • doNotDisturb - sets the do not Disturb Mode, always Disturb, never Disturb, alarmClockOnly alarm Clock only, onlyImportant only important Disturbs
    • +
    • mediaAmazonMusic - play/stop/next/back , controlling the amazon music media player
    • +
    • mediaGoogleMusic - play/stop/next/back , controlling the google play music media player
    • +
    • mediaSpotifyMusic - play/stop/next/back , controlling the spotify media player
    • +
    • mediaTuneinRadio - play/stop/next/back , controlling the TuneinRadio media player
    • +
    • mediaAldiMusic - play/stop/next/back , controlling the Aldi music media player
    • +
    • mediaAudible - play/stop/next/back , controlling the Audible media player
    • +
    • mediaYouTube - play/stop/next/back , controlling the YouTube media player
    • +
    • mediaVlcPlayer - play/stop/next/back , controlling the VLC media player
    • +
    • nextAlarmTime - sets the alarm time. Only valid for the next 24 hours.
    • +
    • notifySndFile - plays a media-file which by default needs to be stored in the folder "/storage/emulated/0/Notifications/" of the Android device. You may use the attribute setNotifySndFilePath for defining a different folder.
    • +
    • openCall - initial a call and hang up after optional time / set DEVICE openCall 0176354 10 call this number and hang up after 10s
    • +
    • screenBrightness - 0-255, set screen brighness
    • +
    • screenMsg - display message on screen of Android device
    • +
    • sendintent - send intent string Example: set $AMADDeviceDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio, first parameter contains the action, second parameter contains the extra. At most two extras can be used.
    • +
    • sendSMS - Sends an SMS to a specific phone number. Bsp.: sendSMS Dies ist ein Test|555487263
    • +
    • startDaydream - start Daydream
    • +
    • 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
    • +
    +
    + Set (depending on attribute values) +
      +
    • changetoBtDevice - switch to another bluetooth device. Attribute setBluetoothDevice needs to be set. See note below!
    • +
    • openApp - start an app. attribute setOpenApp
    • +
    • openURL - opens a URLS in the standard browser as long as no other browser is set by the attribute setOpenUrlBrowser.Example: attr Tablet setOpenUrlBrowser de.ozerov.fully|de.ozerov.fully.MainActivity, first parameter: package name, second parameter: Class Name
    • +
    • screen - on/off/lock/unlock, switch screen on/off or lock/unlock screen. In Automagic "Preferences" the "Device admin functions" need to be enabled, otherwise "Screen off" does not work. attribute setScreenOnForTimer changes the time the display remains switched on!
    • +
    • screenFullscreen - on/off, activates/deactivates full screen mode. attribute setFullscreen
    • +
    • screenLock - Locks screen with request for PIN. attribute setScreenlockPIN - enter PIN here. Only use numbers, 4-16 numbers required.
    • +
    • screenOrientation - Auto,Landscape,Portait, set screen orientation (automatic, horizontal, vertical). attribute setScreenOrientation
    • +
    • system - issue system command (only with rooted Android devices). reboot,shutdown,airplanemodeON (can only be switched ON) attribute root, in Automagic "Preferences" "Root functions" need to be enabled.
    • +
    • setAPSSID - set WLAN AccesPoint SSID to prevent WLAN sleeps
    • +
    • setNotifySndFilePath - set systempath to notifyfile (default /storage/emulated/0/Notifications/
    • +
    • setTtsMsgSpeed - set speaking speed for TTS (Value between 0.5 - 4.0, 0.5 Step) default is 1.0
    • +
    • setTtsMsgLang - set speaking language for TTS, de or en (default is de)
    • +
      + To be able to use "openApp" the corresponding attribute "setOpenApp" needs to contain the app package name. +

      + To be able to switch between bluetooth devices the attribute "setBluetoothDevice" needs to contain (a list of) bluetooth devices defined as follows: attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC No spaces are allowed in any BTdeviceName. Defining MAC please make sure to use the character : (colon) after each second digit/character.
      + Example: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76 +
    +

    + + state +
      +
    • initialized - shown after initial define.
    • +
    • active - device is active.
    • +
    • disabled - device is disabled by the attribute "disable".
    • +
    +


    + Further examples and reading: + +


    +
+ +=end html +=begin html_DE + + +

AMADDevice

+
    + AMADDevice - Automagic Android Device +
    + Dieses Modul liefert, in Verbindung mit der Android APP Automagic, diverse Informationen von Android Geräten. + Die AndroidAPP Automagic (welche nicht von mir stammt und 2.90 Euro kostet) funktioniert wie Tasker, ist aber bei weitem User freundlicher. +
    + Mit etwas Einarbeitung können jegliche Informationen welche Automagic bereit stellt in FHEM angezeigt werden. Hierzu bedarf es lediglich eines eigenen Flows welcher seine Daten an die AMADDeviceCommBridge sendet. Das Modul gibt auch die Möglichkeit Androidgeräte zu steuern. +
    + Für all diese Aktionen und Informationen wird auf dem Androidgerät "Automagic" und ein so genannter Flow benötigt. Die App ist über den Google PlayStore zu beziehen. Das benötigte Flowset bekommt man aus dem FHEM Verzeichnis. +

    + Wie genau verwendet man nun AMADDevice? +
      +
    • man installiert die App "Automagic Premium" aus dem PlayStore.
    • +
    • dann installiert man das Flowset 74_AMADDeviceautomagicFlowset$VERSION.xml aus dem Ordner $INSTALLFHEM/FHEM/lib/ auf dem Androidgerät und aktiviert die Flows.
    • +
    +
    + Es muß noch ein Device in FHEM anlegt werden. +

    + + Define +

      + define <name> AMADDevice <IP-ADRESSE> +

      + Beispiel: +

        + define WandTabletWohnzimmer AMADDevice 192.168.0.23
        +
      +
      + Diese Anweisung erstellt zwei neues AMADDevice-Device im Raum AMADDevice.Der Parameter <IP-ADRESSE> legt die IP Adresse des Android Gerätes fest.
      + Das zweite Device ist die AMADDeviceCommBridge welche als Kommunikationsbrücke vom Androidgerät zu FHEM diehnt. !!!Comming Soon!!! Wer den Port ändern möchte, kann dies über das Attribut "port" tun. Ihr solltet aber wissen was Ihr tut, da dieser Port im HTTP Request Trigger der beiden Flows eingestellt ist. Demzufolge muß der Port dort auch geändert werden. Der Port für die Bridge kann ohne Probleme im Bridge Device mittels dem Attribut "port" verändert werden. +
      + Der Port für die Bridge kann ohne Probleme im Bridge Device mittels dem Attribut "port" verändert werden.
      +
    +
    + AMADDevice Communication Bridge +
      + Beim ersten anlegen einer AMADDevice Deviceinstanz wird automatisch ein Gerät Namens AMADDeviceCommBridge im Raum AMADDevice mit angelegt. Dieses Gerät diehnt zur Kommunikation vom Androidgerät zu FHEM ohne das zuvor eine Anfrage von FHEM aus ging. Damit das Androidgerät die IP von FHEM kennt, muss diese sofort nach dem anlegen der Bridge über den set Befehl in ein entsprechendes Reading in die Bridge geschrieben werden. DAS IST SUPER WICHTIG UND FÜR DIE FUNKTION DER BRIDGE NOTWENDIG.
      + Hierfür muß folgender Befehl ausgeführt werden. set AMADDeviceCommBridge fhemServerIP <FHEM-IP>.
      + Als zweites Reading kann expertMode gesetzen werden. Mit diesem Reading wird eine unmittelbare Komminikation mit FHEM erreicht ohne die Einschränkung über ein + Notify gehen zu müssen und nur reine set Befehle ausführen zu können. +

    + NUN bitte die Flows AKTIVIEREN!!!
    +
    + Fertig! Nach anlegen der Geräteinstanz und dem eintragen der fhemServerIP in der CommBridge sollten nach spätestens 15 Sekunden bereits die ersten Readings reinkommen. Nun wird alle 15 Sekunden probiert einen Status Request erfolgreich ab zu schließen. Wenn der Status sich über einen längeren Zeitraum nicht auf "active" ändert, sollte man im Log nach eventuellen Fehlern suchen. +


    + + Readings +
      +
    • airplanemode - Status des Flugmodus
    • +
    • androidVersion - aktuell installierte Androidversion
    • +
    • automagicState - Statusmeldungen von der AutomagicApp (Voraussetzung Android >4.3). Ist Android größer 4.3 vorhanden und im Reading steht "wird nicht unterstützt", muß in den Androideinstellungen unter Ton und Benachrichtigungen -> Benachrichtigungszugriff ein Haken für Automagic gesetzt werden
    • +
    • batteryHealth - Zustand der Battery (1=unbekannt, 2=gut, 3=Überhitzt, 4=tot, 5=Überspannung, 6=unbekannter Fehler, 7=kalt)
    • +
    • batterytemperature - Temperatur der Batterie
    • +
    • bluetooth - on/off, Bluetooth Status an oder aus
    • +
    • checkActiveTask - Zustand einer zuvor definierten APP. 0=nicht aktiv oder nicht aktiv im Vordergrund, 1=aktiv im Vordergrund, siehe Hinweis unten
    • +
    • connectedBTdevices - eine Liste der verbundenen Gerät
    • +
    • connectedBTdevicesMAC - eine Liste der MAC Adressen aller verbundender BT Geräte
    • +
    • currentMusicAlbum - aktuell abgespieltes Musikalbum des verwendeten Mediaplayers
    • +
    • currentMusicApp - aktuell verwendeter Mediaplayer (Amazon Music, Google Play Music, Google Play Video, Spotify, YouTube, TuneIn Player, Aldi Life Music)
    • +
    • currentMusicArtist - aktuell abgespielter Musikinterpret des verwendeten Mediaplayers
    • +
    • currentMusicIcon - Cover vom aktuell abgespielten Album Noch nicht fertig implementiert
    • +
    • currentMusicState - Status des aktuellen/zuletzt verwendeten Mediaplayers
    • +
    • currentMusicTrack - aktuell abgespielter Musiktitel des verwendeten Mediaplayers
    • +
    • daydream - on/off, Daydream gestartet oder nicht
    • +
    • deviceState - Status des Androidgerätes. unknown, online, offline.
    • +
    • doNotDisturb - aktueller Status des nicht stören Modus
    • +
    • dockingState - undocked/docked Status ob sich das Gerät in einer Dockinstation befindet.
    • +
    • flow_SetCommands - active/inactive, Status des SetCommands Flow
    • +
    • flow_informations - active/inactive, Status des Informations Flow
    • +
    • flowsetVersionAtDevice - aktuell installierte Flowsetversion auf dem Device
    • +
    • incomingCallerName - Anrufername des eingehenden Anrufes
    • +
    • incomingCallerNumber - Anrufernummer des eingehenden Anrufes
    • +
    • incommingWhatsAppMessageFrom - letzte WhatsApp Nachricht
    • +
    • incommingWhatsTelegramMessageFrom - letzte Telegram Nachricht
    • +
    • intentRadioName - zuletzt gesrreamter Intent Radio Name
    • +
    • intentRadioState - Status des IntentRadio Players
    • +
    • keyguardSet - 0/1 Displaysperre gesetzt 0=nein 1=ja, bedeutet nicht das sie gerade aktiv ist
    • +
    • lastSetCommandError - letzte Fehlermeldung vom set Befehl
    • +
    • lastSetCommandState - letzter Status vom set Befehl, Befehl erfolgreich/nicht erfolgreich gesendet
    • +
    • lastStatusRequestError - letzte Fehlermeldung vom statusRequest Befehl
    • +
    • lastStatusRequestState - letzter Status vom statusRequest Befehl, Befehl erfolgreich/nicht erfolgreich gesendet
    • +
    • nextAlarmDay - aktiver Alarmtag
    • +
    • nextAlarmState - aktueller Status des "Androidinternen" Weckers
    • +
    • nextAlarmTime - aktive Alarmzeit
    • +
    • powerLevel - Status der Batterie in %
    • +
    • powerPlugged - Netzteil angeschlossen? 0=NEIN, 1|2=JA
    • +
    • screen - on locked/unlocked, off locked/unlocked gibt an ob der Bildschirm an oder aus ist und gleichzeitig gesperrt oder nicht gesperrt
    • +
    • screenBrightness - Bildschirmhelligkeit von 0-255
    • +
    • screenFullscreen - on/off, Vollbildmodus (An,Aus)
    • +
    • 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
    • +
      + Beim Reading checkActivTask muß zuvor der Packagename der zu prüfenden App als Attribut checkActiveTask angegeben werden. Beispiel: attr Nexus10Wohnzimmer + checkActiveTask com.android.chrome für den Chrome Browser. +

      +
    +

    + + Set +
      +
    • activateVoiceInput - aktiviert die Spracheingabe
    • +
    • bluetooth - on/off, aktiviert/deaktiviert Bluetooth
    • +
    • clearNotificationBar - All,Automagic, löscht alle Meldungen oder nur die Automagic Meldungen in der Statusleiste
    • +
    • closeCall - beendet einen laufenden Anruf
    • +
    • currentFlowsetUpdate - fürt ein Flowsetupdate auf dem Device durch
    • +
    • 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
    • +
    • installFlowSource - installiert einen Flow auf dem Device, das XML File muss unter /tmp/ liegen und die Endung xml haben. Bsp: set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml
    • +
    • mediaAmazonMusic - play, stop, next, back ,steuert den Amazon Musik Mediaplayer
    • +
    • mediaGoogleMusic - play, stop, next, back ,steuert den Google Play Musik Mediaplayer
    • +
    • mediaSpotifyMusic - play, stop, next, back ,steuert den Spotify Mediaplayer
    • +
    • mediaTuneinRadio - play, stop, next, back ,steuert den TuneIn Radio Mediaplayer
    • +
    • mediaAldiMusic - play, stop, next, back ,steuert den Aldi Musik Mediaplayer
    • +
    • mediaAudible - play, stop, next, back ,steuert den Audible Mediaplayer
    • +
    • mediaYouTube - play, stop, next, back ,steuert den YouTube Mediaplayer
    • +
    • mediaVlcPlayer - play, stop, next, back ,steuert den VLC Mediaplayer
    • +
    • nextAlarmTime - setzt die Alarmzeit. gilt aber nur innerhalb der nächsten 24Std.
    • +
    • openCall - ruft eine Nummer an und legt optional nach X Sekunden auf / set DEVICE openCall 01736458 10 / ruft die Nummer an und beendet den Anruf nach 10s
    • +
    • screenBrightness - setzt die Bildschirmhelligkeit, von 0-255.
    • +
    • screenMsg - versendet eine Bildschirmnachricht
    • +
    • sendintent - sendet einen Intentstring Bsp: set $AMADDeviceDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio, der erste Befehl ist die Aktion und der zweite das Extra. Es können immer zwei Extras mitgegeben werden.
    • +
    • sendSMS - sendet eine SMS an eine bestimmte Telefonnummer. Bsp.: sendSMS Dies ist ein Test|555487263
    • +
    • startDaydream - startet den Daydream
    • +
    • 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.
    • +
    +
    + Set abhängig von gesetzten Attributen +
      +
    • changetoBtDevice - wechselt zu einem anderen Bluetooth Gerät. Attribut setBluetoothDevice muß gesetzt sein. Siehe Hinweis unten!
    • +
    • notifySndFile - spielt die angegebene Mediadatei auf dem Androidgerät ab. Die aufzurufende Mediadatei sollte sich im Ordner /storage/emulated/0/Notifications/ befinden. Ist dies nicht der Fall kann man über das Attribut setNotifySndFilePath einen Pfad vorgeben.
    • +
    • openApp - öffnet eine ausgewählte App. Attribut setOpenApp
    • +
    • openURL - öffnet eine URL im Standardbrowser, sofern kein anderer Browser über das Attribut setOpenUrlBrowser ausgewählt wurde. Bsp: attr Tablet setOpenUrlBrowser de.ozerov.fully|de.ozerov.fully.MainActivity, das erste ist der Package Name und das zweite der Class Name
    • +
    • setAPSSID - setzt die AccessPoint SSID um ein WLAN sleep zu verhindern
    • +
    • screen - on/off/lock/unlock schaltet den Bildschirm ein/aus oder sperrt/entsperrt ihn, in den Automagic Einstellungen muss "Admin Funktion" gesetzt werden sonst funktioniert "Screen off" nicht. Attribut setScreenOnForTimer ändert die Zeit wie lange das Display an bleiben soll!
    • +
    • screenFullscreen - on/off, (aktiviert/deaktiviert) den Vollbildmodus. Attribut setFullscreen
    • +
    • screenLock - Sperrt den Bildschirm mit Pinabfrage. Attribut setScreenlockPIN - hier die Pin dafür eingeben. Erlaubt sind nur Zahlen. Es müßen mindestens 4, bis max 16 Zeichen verwendet werden.
    • +
    • screenOrientation - Auto,Landscape,Portait, aktiviert die Bildschirmausrichtung (Automatisch,Horizontal,Vertikal). Attribut setScreenOrientation
    • +
    • system - setzt Systembefehle ab (nur bei gerootetet Geräen). reboot,shutdown,airplanemodeON (kann nur aktiviert werden) Attribut root, in den Automagic Einstellungen muss "Root Funktion" gesetzt werden
    • +
    • setNotifySndFilePath - setzt den korrekten Systempfad zur Notifydatei (default ist /storage/emulated/0/Notifications/
    • +
    • setTtsMsgSpeed - setzt die Sprachgeschwindigkeit bei der Sprachausgabe(Werte zwischen 0.5 bis 4.0 in 0.5er Schritten) default ist 1.0
    • +
    • setTtsMsgSpeed - setzt die Sprache bei der Sprachausgabe, de oder en (default ist de)
    • +
      + Um openApp verwenden zu können, muss als Attribut der Package Name der App angegeben werden. +

      + Um zwischen Bluetoothgeräten wechseln zu können, muß das Attribut setBluetoothDevice mit folgender Syntax gesetzt werden. attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC Es muss + zwingend darauf geachtet werden das beim BTdeviceName kein Leerzeichen vorhanden ist. Am besten zusammen oder mit Unterstrich. Achtet bei der MAC darauf das Ihr wirklich nach jeder zweiten Zahl auch + einen : drin habt
      + Beispiel: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76 +
    +

    + + state +
      +
    • initialized - Ist der Status kurz nach einem define.
    • +
    • active - die Geräteinstanz ist im aktiven Status.
    • +
    • disabled - die Geräteinstanz wurde über das Attribut disable deaktiviert
    • +
    +


    + Anwendungsbeispiele: + +


    +
+ +=end html_DE +=cut From 874cdb7bf11c8730d7248d33928a28d30da349f0 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Wed, 24 May 2017 22:59:17 +0200 Subject: [PATCH 04/32] voller Funktionsumfang der Module abgeschlossen --- 73_AMADCommBridge.pm | 641 +++++++++++++++++++++---------------------- 74_AMADDevice.pm | 456 +++++++++++------------------- 2 files changed, 468 insertions(+), 629 deletions(-) diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index 49f0934..0d03b07 100644 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -40,7 +40,13 @@ # ###### Möglicher Aufbau eines JSON Strings für die AMADCommBridge # -# {"amad": {"AMADDEVICE": "nexus7-Wohnzimmer","FHEMCMD": "setreading"},"payload": {"reading0": "value0","reading1": "value1","readingX": "valueX"}} +# first initial String +# {"amad": {"amad_id": "37836534","fhemcmd": "setreading"},"payload": {"fhemdevice": "TabletWohnzimmer","fhemserverip": "192.168.1.25","amaddevice_ip": "192.168.1.123"}} +# +# default String +# {"amad": {"amad_id": "37836534","fhemcmd": "setreading"},"payload": {"reading0": "value0","reading1": "value1","readingX": "valueX"}} +# Aufruf zum testens +# curl --data '{"amad": {"amad_id": "37836534","fhemcmd": "setreading"},"payload": {"reading0": "value0","reading1": "value1","readingX": "valueX"}}' localhost:8090 # # ## @@ -61,7 +67,7 @@ use TcpServerUtils; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3alpha9"; +my $modulversion = "3alpha27"; my $flowsetversion = "2.6.12"; @@ -72,16 +78,14 @@ sub AMADCommBridge_Attr(@); sub AMADCommBridge_Open($); sub AMADCommBridge_Read($); sub AMADCommBridge_Define($$); -sub AMADCommBridge_Header2Hash($); -sub AMADCommBridge_HTTP_POST($$); -sub AMADCommBridge_HTTP_POSTerrorHandling($$$); +sub AMADCommBridge_WriteRequest($$$); sub AMADCommBridge_Initialize($); sub AMADCommBridge_Set($@); -sub AMADCommBridge_statusRequest($); -sub AMADCommBridge_statusRequestErrorHandling($$$); +sub AMADCommBridge_Write($@); sub AMADCommBridge_Undef($$); sub AMADCommBridge_ResponseProcessing($$); sub AMADCommBridge_Close($); +sub AMADCommBridge_ErrorHandling($$$); @@ -124,25 +128,20 @@ sub AMADCommBridge_Define($$) { my @a = split( "[ \t][ \t]*", $def ); - return "too few parameters: define AMADCommBridge'" if( @a != 2); + return "too few parameters: define AMADCommBridge ''" if( @a < 2) and ( @a > 3); return "Cannot define a HEOS device. Perl modul $missingModul is missing." if ( $missingModul ); my $name = $a[0]; - my $host = $a[2]; my $port; - $port = $a[3] if($a[3]); + $port = $a[2] if($a[2]); $port = 8090 if( not defined($port) and (!$port) ); $hash->{BRIDGE} = 1; $hash->{PORT} = $port; $hash->{VERSIONMODUL} = $modulversion; $hash->{VERSIONFLOWSET} = $flowsetversion; - - ### Muss in das logische Modul eingepflegt werden -# $hash->{helper}{infoErrorCounter} = 0 if( $hash->{HOST} ); -# $hash->{helper}{setCmdErrorCounter} = 0 if( $hash->{HOST} ); -# $hash->{helper}{deviceStateErrorCounter} = 0 if( $hash->{HOST} ); + $attr{$name}{room} = "AMAD" if( !defined( $attr{$name}{room} ) ); @@ -221,179 +220,6 @@ sub AMADCommBridge_Attr(@) { return undef; } -sub AMADCommBridge_statusRequest($) { - - my ($hash) = @_; - my $name = $hash->{NAME}; - my $fhemip = $hash->{HOST}; - my $port = $hash->{PORT}; - my $host; - my $activetask = AttrVal( $name, "checkActiveTask", "none" ); - my $userFlowState = AttrVal( $name, "setUserFlowState", "none" ); - my $apssid = "none"; - $apssid = $hash->{APSSID} if( defined($hash->{APSSID}) ); - $apssid = $attr{$name}{setAPSSID} if( defined($attr{$name}{setAPSSID}) ); - - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Pfad muß so im Automagic als http request Trigger drin stehen - - HttpUtils_NonblockingGet( - { - url => $url, - timeout => 5, - hash => $hash, - method => "GET", - header => "Connection: close\r\nfhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $port\r\nuserflowstate: $userFlowState", - doTrigger => 1, - callback => \&AMADCommBridge_statusRequestErrorHandling, - } - ); - - Log3 $name, 5, "AMADCommBridge ($name) - Send statusRequest with URL: \"$url\" and Header: \"fhemIP: $fhemip\r\nfhemDevice: $name\r\nactiveTask: $activetask\r\napSSID: $apssid\""; -} - -sub AMADCommBridge_statusRequestErrorHandling($$$) { - - my ( $param, $err, $data ) = @_; - my $hash = $param->{hash}; - my $doTrigger = $param->{doTrigger}; - my $name = $hash->{NAME}; - my $host = $hash->{HOST}; - - - ### Begin Error Handling - if( $hash->{helper}{infoErrorCounter} > 0 ) { - - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_error" ); - - if( ReadingsVal( $name, "flow_Informations", "active" ) eq "inactive" && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; - - readingsBulkUpdate( $hash, "deviceState", "offline" ); - readingsBulkUpdate ( $hash, "state", "AMAD Flows inactive, device set offline"); - } - - elsif( $hash->{helper}{infoErrorCounter} > 7 && $hash->{helper}{setCmdErrorCounter} > 4 ) { - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; - - $attr{$name}{disable} = 1; - readingsBulkUpdate ( $hash, "state", "Unknown Error, device disabled"); - - $hash->{helper}{infoErrorCounter} = 0; - $hash->{helper}{setCmdErrorCounter} = 0; - - return; - } - - elsif( ReadingsVal( $name, "flow_Informations", "active" ) eq "inactive" ) { - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: Informations Flow on your Device is inactive, will try to reactivate"; - } - - elsif( $hash->{helper}{infoErrorCounter} > 7 ) { - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; - - readingsBulkUpdate( $hash, "deviceState", "offline" ); - readingsBulkUpdate ( $hash, "state", "To many Errors, device set offline"); - $hash->{helper}{infoErrorCounter} = 0; - } - - elsif($hash->{helper}{infoErrorCounter} > 2 && ReadingsVal( $name, "flow_Informations", "active" ) eq "active" ){ - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: Please check the AutomagicAPP on your Device"; - } - - readingsEndUpdate( $hash, 1 ); - } - - if( defined( $err ) ) { - if( $err ne "" ) { - - readingsBeginUpdate( $hash ); - readingsBulkUpdate ( $hash, "state", "$err") if( ReadingsVal( $name, "state", 1 ) ne "initialized" ); - $hash->{helper}{infoErrorCounter} = ( $hash->{helper}{infoErrorCounter} + 1 ); - - readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_error" ); - - if( $err =~ /timed out/ ) { - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: connect to your device is timed out. check network"; - } - - elsif( ( $err =~ /Keine Route zum Zielrechner/ ) && $hash->{helper}{infoErrorCounter} > 1 ) { - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: no route to target. bad network configuration or network is down"; - - } else { - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: $err"; - } - - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: AMADCommBridge_statusRequestErrorHandling: error while requesting AutomagicInfo: $err"; - - return; - } - } - - if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { - - readingsBeginUpdate( $hash ); - readingsBulkUpdate ( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state", 1 ) ne "initialized" ); - $hash->{helper}{infoErrorCounter} = ( $hash->{helper}{infoErrorCounter} + 1 ); - - readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_error" ); - - if( $param->{code} ne 200 ) { - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: ".$param->{code}; - } - - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: received http code ".$param->{code}." without any data after requesting AMAD AutomagicInfo"; - - return; - } - - if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state" ,0) ne "initialized" ); - $hash->{helper}{infoErrorCounter} = ( $hash->{helper}{infoErrorCounter} + 1 ); - - readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_error" ); - - if( $param->{code} eq 404 && ReadingsVal( $name, "flow_Informations", "inactive" ) eq "inactive" ) { - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: check the informations flow on your device"; - } - - elsif( $param->{code} eq 404 && ReadingsVal( $name, "flow_Informations", "active" ) eq "active" ) { - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: check the automagicApp on your device"; - - } else { - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: http error ".$param->{code}; - } - - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 5, "AMADCommBridge ($name) - statusRequestERROR: received http code ".$param->{code}." receive Error after requesting AMAD AutomagicInfo"; - - return; - } - - ### End Error Handling - - $hash->{helper}{infoErrorCounter} = 0; -} - sub AMADCommBridge_Set($@) { my ($hash, $name, $cmd, @args) = @_; @@ -418,163 +244,304 @@ sub AMADCommBridge_Set($@) { } } -sub AMADCommBridge_HTTP_POST($$) { +sub AMADCommBridge_Write($@) { + + my ($hash,$amad_id,$uri,$method) = @_; + my $header = "Connection: close\r\n"; + $header .= shift; + my $name = $hash->{NAME}; + - my ( $hash, $url ) = @_; - my $name = $hash->{NAME}; - - my $state = ReadingsVal( $name, "state", 0 ); - - readingsSingleUpdate( $hash, "state", "Send HTTP POST", 1 ); - HttpUtils_NonblockingGet( { - url => $url, - timeout => 15, - hash => $hash, - method => "POST", - header => "Connection: close", - doTrigger => 1, - callback => \&AMADCommBridge_HTTP_POSTerrorHandling, + url => "http://" . $uri, + timeout => 15, + hash => $hash, + amad_id => $amad_id, + method => $method, + header => $header, + doTrigger => 1, + callback => \&AMADCommBridge_ErrorHandling, } ); - Log3 $name, 4, "AMADCommBridge ($name) - Send HTTP POST with URL $url"; - - readingsSingleUpdate( $hash, "state", $state, 1 ); - - return undef; + Log3 $name, 5, "AMADCommBridge ($name) - Send with URI: $uri, HEADER: $header, METHOD: $method"; } -sub AMADCommBridge_HTTP_POSTerrorHandling($$$) { +sub AMADCommBridge_ErrorHandling($$$) { - my ( $param, $err, $data ) = @_; - my $hash = $param->{hash}; - my $name = $hash->{NAME}; + my ($param,$err,$data) = @_; + my $hash = $param->{hash}; + #my $name = $hash->{NAME}; + my $dhash = $modules{AMADDevice}{defptr}{$param->{'amad_id'}}; + my $dname = $dhash->{NAME}; + - ### Begin Error Handling - if( $hash->{helper}{setCmdErrorCounter} > 2 ) { - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "lastSetCommandState", "statusRequest_error" ); - - if( ReadingsVal( $name, "flow_Informations", "active" ) eq "inactive" && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { - Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; - - readingsBulkUpdate( $hash, "deviceState", "offline" ); - readingsBulkUpdate( $hash, "state", "AMAD Flows inactive, device set offline" ); - } - - elsif( $hash->{helper}{infoErrorCounter} > 7 && $hash->{helper}{setCmdErrorCounter} > 4 ) { + if( $param->{method} eq 'GET' ) { - Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; - - $attr{$name}{disable} = 1; - readingsBulkUpdate( $hash, "state", "Unknown Error, device disabled" ); - $hash->{helper}{infoErrorCounter} = 0; - $hash->{helper}{setCmdErrorCounter} = 0; - - return; - } - - elsif( ReadingsVal( $name, "flow_SetCommands", "active" ) eq "inactive" ) { - - Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: Flow SetCommands on your Device is inactive, will try to reactivate"; - } - - elsif( $hash->{helper}{setCmdErrorCounter} > 9 ) { - - Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; - - readingsBulkUpdate( $hash, "deviceState", "offline" ); - readingsBulkUpdate( $hash, "state", "To many Errors, device set offline" ); - $hash->{helper}{setCmdErrorCounter} = 0; - } - - elsif( $hash->{helper}{setCmdErrorCounter} > 4 && ReadingsVal( $name, "flow_SetCommands", "active" ) eq "active" ){ - - Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: Please check the AutomagicAPP on your Device"; - } - - readingsEndUpdate( $hash, 1 ); - } - - if( defined( $err ) ) { - if( $err ne "" ) { - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "state", $err ) if( ReadingsVal( $name, "state", 0 ) ne "initialized" ); - $hash->{helper}{setCmdErrorCounter} = ($hash->{helper}{setCmdErrorCounter} + 1); - - readingsBulkUpdate( $hash, "lastSetCommandState", "setCmd_error" ); - - if( $err =~ /timed out/ ) { - - Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: connect to your device is timed out. check network"; - } - - elsif( $err =~ /Keine Route zum Zielrechner/ ) { - - Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: no route to target. bad network configuration or network is down"; - - } else { - - Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: $err"; - } - - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: error while POST Command: $err"; - - return; - } - } - - if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { - - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $hash, "state", 0 ) ne "initialized" ); - - $hash->{helper}{setCmdErrorCounter} = ( $hash->{helper}{setCmdErrorCounter} + 1 ); - - readingsBulkUpdate($hash, "lastSetCommandState", "setCmd_error" ); - - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: received http code ".$param->{code}; - - return; - } + ### Begin Error Handling + if( $dhash->{helper}{infoErrorCounter} > 0 ) { - if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { - - readingsBeginUpdate( $hash ); - readingsBulkUpdate( $hash, "state", $param->{code} ) if( ReadingsVal( $name, "state", 0 ) ne "initialized" ); + readingsBeginUpdate( $dhash ); + readingsBulkUpdate( $dhash, "lastStatusRequestState", "statusRequest_error" ); - $hash->{helper}{setCmdErrorCounter} = ( $hash->{helper}{setCmdErrorCounter} + 1 ); + if( ReadingsVal( $dname, "flow_Informations", "active" ) eq "inactive" && ReadingsVal( $dname, "flow_SetCommands", "active" ) eq "inactive" ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; + + readingsBulkUpdate( $dhash, "deviceState", "offline" ); + readingsBulkUpdate ( $dhash, "state", "AMAD Flows inactive, device set offline"); + } - readingsBulkUpdate( $hash, "lastSetCommandState", "setCmd_error" ); - - if( $param->{code} eq 404 ) { - - readingsBulkUpdate( $hash, "lastSetCommandError", "" ); - Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: setCommands flow is inactive on your device!"; - - } else { - - Log3 $name, 5, "AMADCommBridge ($name) - setCommandERROR: http error ".$param->{code}; + elsif( $dhash->{helper}{infoErrorCounter} > 7 && $dhash->{helper}{setCmdErrorCounter} > 4 ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; + + $attr{$dname}{disable} = 1; + readingsBulkUpdate ( $dhash, "state", "Unknown Error, device disabled"); + + $dhash->{helper}{infoErrorCounter} = 0; + $dhash->{helper}{setCmdErrorCounter} = 0; + + return; + } + + elsif( ReadingsVal( $dname, "flow_Informations", "active" ) eq "inactive" ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: Informations Flow on your Device is inactive, will try to reactivate"; + } + + elsif( $dhash->{helper}{infoErrorCounter} > 7 ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; + + readingsBulkUpdate( $dhash, "deviceState", "offline" ); + readingsBulkUpdate ( $dhash, "state", "To many Errors, device set offline"); + $dhash->{helper}{infoErrorCounter} = 0; + } + + elsif($dhash->{helper}{infoErrorCounter} > 2 && ReadingsVal( $dname, "flow_Informations", "active" ) eq "active" ){ + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: Please check the AutomagicAPP on your Device"; + } + + readingsEndUpdate( $dhash, 1 ); + } + + if( defined( $err ) ) { + if( $err ne "" ) { + + readingsBeginUpdate( $dhash ); + readingsBulkUpdate ( $dhash, "state", "$err") if( ReadingsVal( $dname, "state", 1 ) ne "initialized" ); + $dhash->{helper}{infoErrorCounter} = ( $dhash->{helper}{infoErrorCounter} + 1 ); + + readingsBulkUpdate( $dhash, "lastStatusRequestState", "statusRequest_error" ); + + if( $err =~ /timed out/ ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: connect to your device is timed out. check network"; + } + + elsif( ( $err =~ /Keine Route zum Zielrechner/ ) && $dhash->{helper}{infoErrorCounter} > 1 ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: no route to target. bad network configuration or network is down"; + + } else { + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: $err"; + } + + readingsEndUpdate( $dhash, 1 ); + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: AMADCommBridge_statusRequestErrorHandling: error while requesting AutomagicInfo: $err"; + + return; + } } - return; + if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { + + readingsBeginUpdate( $dhash ); + readingsBulkUpdate ( $dhash, "state", $param->{code} ) if( ReadingsVal( $dname, "state", 1 ) ne "initialized" ); + $dhash->{helper}{infoErrorCounter} = ( $dhash->{helper}{infoErrorCounter} + 1 ); + + readingsBulkUpdate( $dhash, "lastStatusRequestState", "statusRequest_error" ); + + if( $param->{code} ne 200 ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: ".$param->{code}; + } + + readingsEndUpdate( $dhash, 1 ); + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: received http code ".$param->{code}." without any data after requesting AMAD AutomagicInfo"; + + return; + } + + if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { + readingsBeginUpdate( $dhash ); + readingsBulkUpdate( $dhash, "state", $param->{code} ) if( ReadingsVal( $dname, "state" ,0) ne "initialized" ); + $dhash->{helper}{infoErrorCounter} = ( $dhash->{helper}{infoErrorCounter} + 1 ); + + readingsBulkUpdate( $dhash, "lastStatusRequestState", "statusRequest_error" ); + + if( $param->{code} eq 404 && ReadingsVal( $dname, "flow_Informations", "inactive" ) eq "inactive" ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: check the informations flow on your device"; + } + + elsif( $param->{code} eq 404 && ReadingsVal( $dname, "flow_Informations", "active" ) eq "active" ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: check the automagicApp on your device"; + + } else { + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: http error ".$param->{code}; + } + + readingsEndUpdate( $dhash, 1 ); + + Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: received http code ".$param->{code}." receive Error after requesting AMAD AutomagicInfo"; + + return; + } + + ### End Error Handling + + $dhash->{helper}{infoErrorCounter} = 0; } - ### End Error Handling + elsif( $param->{method} eq 'POST' ) { + + ### Begin Error Handling + if( $dhash->{helper}{setCmdErrorCounter} > 2 ) { + + readingsBeginUpdate( $dhash ); + readingsBulkUpdate( $dhash, "lastSetCommandState", "statusRequest_error" ); + + if( ReadingsVal( $dname, "flow_Informations", "active" ) eq "inactive" && ReadingsVal( $dname, "flow_SetCommands", "active" ) eq "inactive" ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; + + readingsBulkUpdate( $dhash, "deviceState", "offline" ); + readingsBulkUpdate( $dhash, "state", "AMAD Flows inactive, device set offline" ); + } + + elsif( $dhash->{helper}{infoErrorCounter} > 7 && $dhash->{helper}{setCmdErrorCounter} > 4 ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; + + $attr{$dname}{disable} = 1; + readingsBulkUpdate( $dhash, "state", "Unknown Error, device disabled" ); + $dhash->{helper}{infoErrorCounter} = 0; + $dhash->{helper}{setCmdErrorCounter} = 0; + + return; + } + + elsif( ReadingsVal( $dname, "flow_SetCommands", "active" ) eq "inactive" ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: Flow SetCommands on your Device is inactive, will try to reactivate"; + } + + elsif( $dhash->{helper}{setCmdErrorCounter} > 9 ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; + + readingsBulkUpdate( $dhash, "deviceState", "offline" ); + readingsBulkUpdate( $dhash, "state", "To many Errors, device set offline" ); + $dhash->{helper}{setCmdErrorCounter} = 0; + } + + elsif( $dhash->{helper}{setCmdErrorCounter} > 4 && ReadingsVal( $dname, "flow_SetCommands", "active" ) eq "active" ){ + + Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: Please check the AutomagicAPP on your Device"; + } + + readingsEndUpdate( $dhash, 1 ); + } + + if( defined( $err ) ) { + if( $err ne "" ) { + readingsBeginUpdate( $dhash ); + readingsBulkUpdate( $dhash, "state", $err ) if( ReadingsVal( $dname, "state", 0 ) ne "initialized" ); + $dhash->{helper}{setCmdErrorCounter} = ($dhash->{helper}{setCmdErrorCounter} + 1); + + readingsBulkUpdate( $dhash, "lastSetCommandState", "setCmd_error" ); + + if( $err =~ /timed out/ ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: connect to your device is timed out. check network"; + } + + elsif( $err =~ /Keine Route zum Zielrechner/ ) { + + Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: no route to target. bad network configuration or network is down"; + + } else { + + Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: $err"; + } + + readingsEndUpdate( $dhash, 1 ); + + Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: error while POST Command: $err"; + + return; + } + } + + if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { + + readingsBeginUpdate( $dhash ); + readingsBulkUpdate( $dhash, "state", $param->{code} ) if( ReadingsVal( $dhash, "state", 0 ) ne "initialized" ); + + $dhash->{helper}{setCmdErrorCounter} = ( $dhash->{helper}{setCmdErrorCounter} + 1 ); + + readingsBulkUpdate($dhash, "lastSetCommandState", "setCmd_error" ); + + readingsEndUpdate( $dhash, 1 ); + + Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: received http code ".$param->{code}; + + return; + } + + if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { + + readingsBeginUpdate( $dhash ); + readingsBulkUpdate( $dhash, "state", $param->{code} ) if( ReadingsVal( $dname, "state", 0 ) ne "initialized" ); + + $dhash->{helper}{setCmdErrorCounter} = ( $dhash->{helper}{setCmdErrorCounter} + 1 ); + + readingsBulkUpdate( $dhash, "lastSetCommandState", "setCmd_error" ); + + if( $param->{code} eq 404 ) { + + readingsBulkUpdate( $dhash, "lastSetCommandError", "" ); + Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: setCommands flow is inactive on your device!"; + + } else { + + Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: http error ".$param->{code}; + } + + return; + } + + ### End Error Handling + + readingsSingleUpdate( $dhash, "lastSetCommandState", "setCmd_done", 1 ); + $dhash->{helper}{setCmdErrorCounter} = 0; + + return undef; + } - readingsSingleUpdate( $hash, "lastSetCommandState", "setCmd_done", 1 ); - $hash->{helper}{setCmdErrorCounter} = 0; - return undef; } sub AMADCommBridge_Open($) { @@ -673,8 +640,15 @@ sub AMADCommBridge_ResponseProcessing($$) { return; } - my $amadDevice = $decode_json->{amad}{AMADDEVICE}; - my $fhemcmd = $decode_json->{amad}{FHEMCMD}; + my $amad_id = $decode_json->{amad}{amad_id}; + my $fhemcmd = $decode_json->{amad}{fhemcmd}; + my $fhemDevice; + + if( defined($decode_json->{payload}{fhemdevice}) and ($decode_json->{payload}{fhemdevice}) ) { + $fhemDevice = $decode_json->{payload}{fhemdevice} if( defined($decode_json->{payload}{fhemdevice}) ); + } else { + $fhemDevice = $modules{AMADDevice}{defptr}{$amad_id}->{NAME}; + } @@ -710,7 +684,7 @@ sub AMADCommBridge_ResponseProcessing($$) { - elsif( !defined($amadDevice) ) { + elsif( !defined($amad_id) ) { readingsSingleUpdate( $bhash, "transmitterERROR", $hash->{NAME}." has no device name sends", 1 ) if( AttrVal( $bname, "expertMode", 0 ) eq "1" ); Log3 $bname, 4, "AMADCommBridge ($name) - ERROR - no device name given. please check your global variable in automagic"; @@ -728,16 +702,15 @@ sub AMADCommBridge_ResponseProcessing($$) { if( defined($fhemcmd) and ($fhemcmd) ) { - if ( $fhemcmd =~ /setreading\b/ ) { - my $tv = $data[1]; - return Log3 $bname, 3, "AMADCommBridge ($name) - AMADCommBridge: processing receive no reading values from Device: $amadDevice" - unless( defined($tv) and ($tv) ); + if ( $fhemcmd eq 'setreading' ) { + return Log3 $bname, 3, "AMADCommBridge ($name) - AMADCommBridge: processing receive no reading values from Device: $fhemDevice" + unless( defined($decode_json->{payload}) and ($decode_json->{payload}) ); - Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge: processing receive reading values - Device: $amadDevice Data: $tv"; + Log3 $bname, 4, "AMADCommBridge ($bname) - AMADCommBridge: processing receive reading values - Device: $fhemDevice Data: $decode_json->{payload}"; Dispatch($bhash,$json,undef); - Log3 $name, 4, "AMADCommBridge ($name) - call Dispatcher"; - readingsSingleUpdate($bhash,'fhemServerIP',$decode_json->{payload}{'DEVICE-IP'},1) if( defined($decode_json->{payload}{'DEVICE-IP'})); + Log3 $bname, 4, "AMADCommBridge ($bname) - call Dispatcher"; + readingsSingleUpdate($bhash,'fhemServerIP',$decode_json->{payload}{'fhemserverip'},1) if( defined($decode_json->{payload}{'fhemserverip'})); $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM was processes\r\n"; $c = $hash->{CD}; @@ -773,9 +746,9 @@ sub AMADCommBridge_ResponseProcessing($$) { readingsBeginUpdate( $bhash); readingsBulkUpdate( $bhash, "receiveVoiceCommand", $fhemCmd ); - readingsBulkUpdate( $bhash, "receiveVoiceDevice", $amadDevice ); + readingsBulkUpdate( $bhash, "receiveVoiceDevice", $fhemDevice ); readingsEndUpdate( $bhash, 1 ); - Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: set reading receive voice command: $fhemCmd from Device $amadDevice"; + Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: set reading receive voice command: $fhemCmd from Device $fhemDevice"; $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM was processes\r\n"; $c = $hash->{CD}; diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index 5da3e24..3797ef5 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -38,15 +38,7 @@ # } # # -###### Möglicher Aufbau eines JSON Strings für die AMADCommBridge -# -# {"amad": {"AMADDEVICE": "nexus7-Wohnzimmer","FHEMCMD": "setreading"},"payload": {"reading0": "value0","reading1": "value1","readingX": "valueX"}} -# -# -## -## -## -## + @@ -62,7 +54,7 @@ use Encode qw(encode); eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3alpha9"; +my $modulversion = "3alpha27"; my $flowsetversion = "2.6.12"; @@ -144,19 +136,22 @@ sub AMADDevice_Define($$) { $i++; } - return "too few parameters: define AMADDevice " if( @a < 2 ); - return "Cannot define a HEOS device. Perl modul $missingModul is missing." if ( $missingModul ); + return "too few parameters: define AMADDevice " if( @a != 3 ); + return "Cannot define a AMAD device. Perl modul $missingModul is missing." if ( $missingModul ); - my ($name,$host) = @a; + my ($name,$host,$amad_id) = @a; $hash->{HOST} = $host; + $hash->{AMAD_ID} = $amad_id; $hash->{PORT} = 8090; $hash->{VERSIONMODUL} = $modulversion; $hash->{VERSIONFLOWSET} = $flowsetversion; - $hash->{helper}{infoErrorCounter} = 0 if( $hash->{HOST} ); - $hash->{helper}{setCmdErrorCounter} = 0 if( $hash->{HOST} ); - $hash->{helper}{deviceStateErrorCounter} = 0 if( $hash->{HOST} ); + $hash->{helper}{infoErrorCounter} = 0; + $hash->{helper}{setCmdErrorCounter} = 0; + $hash->{helper}{deviceStateErrorCounter} = 0; + + AssignIoPort($hash,$iodev) if( !$hash->{IODev} ); @@ -173,13 +168,12 @@ sub AMADDevice_Define($$) { $iodev = $hash->{IODev}->{NAME}; - my $code = $iodev ."-". $name if( defined($iodev) ); - my $d = $modules{AMADDevice}{defptr}{$code}; + my $d = $modules{AMADDevice}{defptr}{$amad_id}; return "AMADDevice device $name on AMADCommBridge $iodev already defined." if( defined($d) && $d->{IODev} == $hash->{IODev} && $d->{NAME} ne $name ); - Log3 $name, 3, "AMADDevice ($name) - defined with Code: $code on port $hash->{PORT}"; + Log3 $name, 3, "AMADDevice ($name) - defined with AMAD_ID: $amad_id on port $hash->{PORT}"; $attr{$name}{room} = "AMAD" if( !defined( $attr{$name}{room} ) ); @@ -198,7 +192,7 @@ sub AMADDevice_Define($$) { #InternalTimer( gettimeofday()+30, "AMADDevice_GetUpdate", $hash, 0 ) if( ($hash->{HOST}) ); } - $modules{AMADDevice}{defptr}{$code} = $hash; + $modules{AMADDevice}{defptr}{$amad_id} = $hash; return undef; } @@ -207,11 +201,11 @@ sub AMADDevice_Undef($$) { my ( $hash, $arg ) = @_; my $name = $hash->{NAME}; + my $amad_id = $hash->{AMAD_ID}; - my $code = $hash->{IODev}->{NAME} ."-". $name if( defined($hash->{IODev}->{NAME}) ); RemoveInternalTimer( $hash ); - delete $modules{AMADDevice}{defptr}{$code}; + delete $modules{AMADDevice}{defptr}{$amad_id}; return undef; } @@ -348,12 +342,10 @@ sub AMADDevice_WriteReadings($$) { my ( $hash, $decode_json ) = @_; my $name = $hash->{NAME}; - my $host = $hash->{HOST}; ############################ #### schreiben der Readings - readingsBeginUpdate($hash); Log3 $name, 5, "AMADDevice ($name) - Processing data: $decode_json"; readingsSingleUpdate( $hash, "state", "active", 1) if( ReadingsVal( $name, "state", 0 ) ne "initialized" or ReadingsVal( $name, "state", 0 ) ne "active" ); @@ -363,6 +355,8 @@ sub AMADDevice_WriteReadings($$) { my $v; + readingsBeginUpdate($hash); + while( ( $t, $v ) = each %{$decode_json->{payload}} ) { readingsBulkUpdate( $hash, $t, $v ) if( defined( $v ) ); $v =~ s/\bnull\b/off/g if( ($t eq "nextAlarmDay" || $t eq "nextAlarmTime") && $v eq "null" ); @@ -386,179 +380,55 @@ sub AMADDevice_WriteReadings($$) { } sub AMADDevice_Set($$@) { - - my ( $hash, $name, $cmd, @val ) = @_; - - my $bhash = $modules{AMADDevice}{defptr}{BRIDGE}; - my $bname = $bhash->{NAME}; - - if( $name ne "$bname" ) { - my $apps = AttrVal( $name, "setOpenApp", "none" ); - my $btdev = AttrVal( $name, "setBluetoothDevice", "none" ); - my $activetask = AttrVal( $name, "setActiveTask", "none" ); - - my $list = ""; - $list .= "screenMsg "; - $list .= "ttsMsg "; - $list .= "volume:slider,0,1,15 "; - $list .= "mediaGoogleMusic:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaAmazonMusic:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaSpotifyMusic:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaTuneinRadio:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaAldiMusic:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaYouTube:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaVlcPlayer:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "mediaAudible:play/pause,stop,next,back " if( ReadingsVal( $bname, "fhemServerIP", "none" ) ne "none"); - $list .= "screenBrightness:slider,0,1,255 "; - $list .= "screen:on,off,lock,unlock "; - $list .= "screenOrientation:auto,landscape,portrait " if( AttrVal( $name, "setScreenOrientation", "0" ) eq "1" ); - $list .= "screenFullscreen:on,off " if( AttrVal( $name, "setFullscreen", "0" ) eq "1" ); - $list .= "openURL "; - $list .= "openApp:$apps " if( AttrVal( $name, "setOpenApp", "none" ) ne "none" ); - $list .= "nextAlarmTime:time "; - $list .= "timer:slider,1,1,60 "; - $list .= "statusRequest:noArg "; - $list .= "system:reboot,shutdown,airplanemodeON " if( AttrVal( $name, "root", "0" ) eq "1" ); - $list .= "bluetooth:on,off "; - $list .= "notifySndFile "; - $list .= "clearNotificationBar:All,Automagic "; - $list .= "changetoBTDevice:$btdev " if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); - $list .= "activateVoiceInput:noArg "; - $list .= "volumeNotification:slider,0,1,7 "; - $list .= "volumeRingSound:slider,0,1,7 "; - $list .= "vibrate:noArg "; - $list .= "sendIntent "; - $list .= "openCall "; - $list .= "closeCall:noArg "; - $list .= "currentFlowsetUpdate:noArg "; - $list .= "installFlowSource "; - $list .= "doNotDisturb:never,always,alarmClockOnly,onlyImportant "; - $list .= "userFlowState "; - $list .= "sendSMS "; - $list .= "startDaydream:noArg "; - if( lc $cmd eq 'screenmsg' - || lc $cmd eq 'ttsmsg' - || lc $cmd eq 'volume' - || lc $cmd eq 'mediagooglemusic' - || lc $cmd eq 'mediaamazonmusic' - || lc $cmd eq 'mediaspotifymusic' - || lc $cmd eq 'mediatuneinradio' - || lc $cmd eq 'mediaaldimusic' - || lc $cmd eq 'mediayoutube' - || lc $cmd eq 'mediavlcplayer' - || lc $cmd eq 'mediaaudible' - || lc $cmd eq 'screenbrightness' - || lc $cmd eq 'screenorientation' - || lc $cmd eq 'screenfullscreen' - || lc $cmd eq 'screen' - || lc $cmd eq 'openurl' - || lc $cmd eq 'openapp' - || lc $cmd eq 'nextalarmtime' - || lc $cmd eq 'timer' - || lc $cmd eq 'bluetooth' - || lc $cmd eq 'system' - || lc $cmd eq 'notifysndfile' - || lc $cmd eq 'changetobtdevice' - || lc $cmd eq 'clearnotificationbar' - || lc $cmd eq 'activatevoiceinput' - || lc $cmd eq 'volumenotification' - || lc $cmd eq 'volumeringsound' - || lc $cmd eq 'screenlock' - || lc $cmd eq 'statusrequest' - || lc $cmd eq 'sendsms' - || lc $cmd eq 'sendintent' - || lc $cmd eq 'currentflowsetupdate' - || lc $cmd eq 'installflowsource' - || lc $cmd eq 'opencall' - || lc $cmd eq 'closecall' - || lc $cmd eq 'donotdisturb' - || lc $cmd eq 'userflowstate' - || lc $cmd eq 'startdaydream' - || lc $cmd eq 'vibrate') { + my ($hash, $name, @aa) = @_; + my ($cmd, @args) = @aa; - Log3 $name, 5, "AMADDevice ($name) - set $name $cmd ".join(" ", @val); - - return AMADDevice_SelectSetCmd( $hash, $cmd, @val ) if( lc $cmd eq 'statusrequest' ); - return "set command only works if state not equal initialized" if( ReadingsVal( $hash->{NAME}, "state", 0 ) eq "initialized"); - return "Cannot set command, FHEM Device is disabled" if( AttrVal( $name, "disable", "0" ) eq "1" ); - - return "Cannot set command, FHEM Device is unknown" if( ReadingsVal( $name, "deviceState", "online" ) eq "unknown" ); - return "Cannot set command, FHEM Device is offline" if( ReadingsVal( $name, "deviceState", "online" ) eq "offline" ); - - return AMADDevice_SelectSetCmd( $hash, $cmd, @val ) if( (@val) or (lc $cmd eq 'activatevoiceinput') or (lc $cmd eq 'vibrate') or (lc $cmd eq 'currentflowsetupdate') or (lc $cmd eq 'closecall') or (lc $cmd eq 'startdaydream') ); - } + my $host = $hash->{HOST}; + my $port = $hash->{PORT}; + my $amad_id = $hash->{AMAD_ID}; + my $uri; + my $header; + my $method; - return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; - - } elsif( $modules{AMADDevice}{defptr}{BRIDGE} ) { - - my $list = ""; - - ## set Befehle für die AMADDevice_CommBridge - $list .= "expertMode:0,1 " if( $modules{AMADDevice}{defptr}{BRIDGE} ); - $list .= "fhemServerIP " if( $modules{AMADDevice}{defptr}{BRIDGE} ); - - if( lc $cmd eq 'expertmode' - || lc $cmd eq 'fhemserverip' ) { - - readingsSingleUpdate( $hash, $cmd, $val[0], 0 ); - - return; - } - - return "Unknown argument $cmd, bearword as argument or wrong parameter(s), choose one of $list"; - } -} - -sub AMADDevice_SelectSetCmd($$@) { - - my ( $hash, $cmd, @data ) = @_; - my $name = $hash->{NAME}; - my $host = $hash->{HOST}; - my $port = $hash->{PORT}; if( lc $cmd eq 'screenmsg' ) { - my $msg = join( " ", @data ); + my $msg = join( " ", @args ); - $msg =~ s/%/%25/g; - $msg =~ s/\s/%20/g; + $msg =~ s/%/%25/g; + $msg =~ s/\s/%20/g; - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/screenMsg?message=$msg"; - Log3 $name, 4, "AMADDevice ($name) - Sub AMADDevice_SetScreenMsg"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/screenMsg?message=$msg"; + $method = "POST"; } elsif( lc $cmd eq 'ttsmsg' ) { - my $msg = join( " ", @data ); + my $msg = join( " ", @args ); my $speed = AttrVal( $name, "setTtsMsgSpeed", "1.0" ); my $lang = AttrVal( $name, "setTtsMsgLang","de" ); - $msg =~ s/%/%25/g; - $msg =~ s/\s/%20/g; + $msg =~ s/%/%25/g; + $msg =~ s/\s/%20/g; - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/ttsMsg?message=".$msg."&msgspeed=".$speed."&msglang=".$lang; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/ttsMsg?message=".$msg."&msgspeed=".$speed."&msglang=".$lang; + $method = "POST"; } elsif( lc $cmd eq 'userflowstate' ) { - my $datas = join( " ", @data ); - my ($flow,$state) = split( ":", $datas); + my $datas = join( " ", @args ); + my ($flow,$state) = split( ":", $datas); - $flow =~ s/\s/%20/g; + $flow =~ s/\s/%20/g; - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/flowState?flowstate=".$state."&flowname=".$flow; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/flowState?flowstate=".$state."&flowname=".$flow; + $method = "POST"; } elsif( lc $cmd eq 'volume' ) { - my $vol = join( " ", @data ); + my $vol = join( " ", @args ); if( $vol =~ /^\+(.*)/ or $vol =~ /^-(.*)/ ) { @@ -576,58 +446,52 @@ sub AMADDevice_SelectSetCmd($$@) { } } - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setVolume?volume=$vol"; - - return AMADDevice_HTTP_POST( $hash, $url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setVolume?volume=$vol"; + $method = "POST"; } elsif( lc $cmd eq 'volumenotification' ) { - my $vol = join( " ", @data ); + my $vol = join( " ", @args ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setNotifiVolume?notifivolume=$vol"; - - return AMADDevice_HTTP_POST( $hash, $url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setNotifiVolume?notifivolume=$vol"; + $method = "POST"; } elsif( lc $cmd eq 'volumeringsound' ) { - my $vol = join( " ", @data ); + my $vol = join( " ", @args ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setRingSoundVolume?ringsoundvolume=$vol"; - - return AMADDevice_HTTP_POST( $hash, $url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setRingSoundVolume?ringsoundvolume=$vol"; + $method = "POST"; } elsif( lc $cmd =~ /^media/ ) { - my $btn = join( " ", @data ); + my $btn = join( " ", @args ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/multimediaControl?mplayer=".$cmd."&button=".$btn; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/multimediaControl?mplayer=".$cmd."&button=".$btn; + $method = "POST"; } elsif( lc $cmd eq 'screenbrightness' ) { - my $bri = join( " ", @data ); + my $bri = join( " ", @args ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setBrightness?brightness=$bri"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setBrightness?brightness=$bri"; + $method = "POST"; } elsif( lc $cmd eq 'screen' ) { - my $mod = join( " ", @data ); + my $mod = join( " ", @args ); my $scot = AttrVal( $name, "setScreenOnForTimer", undef ); $scot = 60 if( !$scot ); if ($mod eq "on" || $mod eq "off") { - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenOnOff?screen=".$mod."&screenontime=".$scot if ($mod eq "on" || $mod eq "off"); - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setScreenOnOff?screen=".$mod."&screenontime=".$scot if ($mod eq "on" || $mod eq "off"); + $method = "POST"; } elsif ($mod eq "lock" || $mod eq "unlock") { @@ -636,220 +500,225 @@ sub AMADDevice_SelectSetCmd($$@) { my $PIN = AttrVal( $name, "setScreenlockPIN", undef ); $PIN = AMADDevice_decrypt($PIN); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/screenlock?lockmod=".$mod."&lockPIN=".$PIN; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/screenlock?lockmod=".$mod."&lockPIN=".$PIN; + $method = "POST"; } } elsif( lc $cmd eq 'screenorientation' ) { - my $mod = join( " ", @data ); + my $mod = join( " ", @args ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenOrientation?orientation=$mod"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setScreenOrientation?orientation=$mod"; + $method = "POST"; } elsif( lc $cmd eq 'activatevoiceinput' ) { - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setvoicecmd"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setvoicecmd"; + $method = "POST"; } elsif( lc $cmd eq 'screenfullscreen' ) { - my $mod = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setScreenFullscreen?fullscreen=$mod"; + my $mod = join( " ", @args ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setScreenFullscreen?fullscreen=$mod"; + $method = "POST"; readingsSingleUpdate( $hash, $cmd, $mod, 1 ); - - return AMADDevice_HTTP_POST( $hash, $url ); } elsif( lc $cmd eq 'openurl' ) { - my $openurl = join( " ", @data ); + my $openurl = join( " ", @args ); my $browser = AttrVal( $name, "setOpenUrlBrowser", "com.android.chrome|com.google.android.apps.chrome.Main" ); my @browserapp = split( /\|/, $browser ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/openURL?url=".$openurl."&browserapp=".$browserapp[0]."&browserappclass=".$browserapp[1]; - - return AMADDevice_HTTP_POST( $hash, $url ); + my $uri = $host . ":" . $port . "/fhem-amad/setCommands/openURL?url=".$openurl."&browserapp=".$browserapp[0]."&browserappclass=".$browserapp[1]; + $method = "POST"; } elsif (lc $cmd eq 'nextalarmtime') { - my $value = join( " ", @data ); - my @alarm = split( ":", $value ); + my $value = join( " ", @args ); + my @alarm = split( ":", $value ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setAlarm?hour=".$alarm[0]."&minute=".$alarm[1]; - - return AMADDevice_HTTP_POST( $hash, $url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setAlarm?hour=".$alarm[0]."&minute=".$alarm[1]; + $method = "POST"; } elsif (lc $cmd eq 'timer') { - my $timer = join( " ", @data ); + my $timer = join( " ", @args ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setTimer?minute=$timer"; - - return AMADDevice_HTTP_POST( $hash, $url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setTimer?minute=$timer"; + $method = "POST"; } - + elsif( lc $cmd eq 'statusrequest' ) { - - AMADDevice_statusRequest( $hash ); - return undef; + + my $activetask = AttrVal( $name, "checkActiveTask", "none" ); + my $userFlowState = AttrVal( $name, "setUserFlowState", "none" ); + my $apssid = AttrVal( $name, "setAPSSID", "none" ); + my $fhemip = ReadingsVal($hash->{IODev}->{NAME}, "fhemServerIP", "none"); + my $bport = $hash->{IODev}->{PORT}; + + + $uri = $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Pfad muß so im Automagic als http request Trigger drin stehen + $header = "fhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $bport\r\nuserflowstate: $userFlowState"; + $method = "GET"; } - + elsif( lc $cmd eq 'openapp' ) { - my $app = join( " ", @data ); + my $app = join( " ", @args ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/openApp?app=$app"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/openApp?app=$app"; + $method = "POST"; } elsif( lc $cmd eq 'system' ) { - my $systemcmd = join( " ", @data ); - - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/systemcommand?syscmd=$systemcmd"; + my $systemcmd = join( " ", @args ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/systemcommand?syscmd=$systemcmd"; + $method = "POST"; readingsSingleUpdate( $hash, "airplanemode", "on", 1 ) if( $systemcmd eq "airplanemodeON" ); readingsSingleUpdate( $hash, "deviceState", "offline", 1 ) if( $systemcmd eq "airplanemodeON" || $systemcmd eq "shutdown" ); - - return AMADDevice_HTTP_POST( $hash,$url ); } elsif( lc $cmd eq 'donotdisturb' ) { - my $disturbmod = join( " ", @data ); + my $disturbmod = join( " ", @args ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/donotdisturb?disturbmod=$disturbmod"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/donotdisturb?disturbmod=$disturbmod"; + $method = "POST"; } elsif( lc $cmd eq 'bluetooth' ) { - my $mod = join( " ", @data ); + my $mod = join( " ", @args ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setbluetooth?bluetooth=$mod"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setbluetooth?bluetooth=$mod"; + $method = "POST"; } elsif( lc $cmd eq 'notifysndfile' ) { - my $notify = join( " ", @data ); - my $filepath = AttrVal( $name, "setNotifySndFilePath", "/storage/emulated/0/Notifications/" ); + my $notify = join( " ", @args ); + my $filepath = AttrVal( $name, "setNotifySndFilePath", "/storage/emulated/0/Notifications/" ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/playnotifysnd?notifyfile=".$notify."¬ifypath=".$filepath; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/playnotifysnd?notifyfile=".$notify."¬ifypath=".$filepath; + $method = "POST"; } elsif( lc $cmd eq 'changetobtdevice' ) { - my $swToBtDevice = join( " ", @data ); + my $swToBtDevice = join( " ", @args ); my @swToBtMac = split( /\|/, $swToBtDevice ); my $btDevices = AttrVal( $name, "setBluetoothDevice", "none" ) if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); my @btDevice = split( ',', $btDevices ); my @btDeviceOne = split( /\|/, $btDevice[0] ); my @btDeviceTwo = split( /\|/, $btDevice[1] ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setbtdevice?swToBtDeviceMac=".$swToBtMac[1]."&btDeviceOne=".$btDeviceOne[1]."&btDeviceTwo=".$btDeviceTwo[1]; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setbtdevice?swToBtDeviceMac=".$swToBtMac[1]."&btDeviceOne=".$btDeviceOne[1]."&btDeviceTwo=".$btDeviceTwo[1]; + $method = "POST"; } elsif( lc $cmd eq 'clearnotificationbar' ) { - my $appname = join( " ", @data ); + my $appname = join( " ", @args ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/clearnotificationbar?app=$appname"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/clearnotificationbar?app=$appname"; + $method = "POST"; } elsif( lc $cmd eq 'vibrate' ) { - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/setvibrate"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setvibrate"; + $method = "POST"; } elsif( lc $cmd eq 'sendintent' ) { - my $intentstring = join( " ", @data ); + my $intentstring = join( " ", @args ); my ( $action, $exkey1, $exval1, $exkey2, $exval2 ) = split( "[ \t][ \t]*", $intentstring ); $exkey1 = "" if( !$exkey1 ); $exval1 = "" if( !$exval1 ); $exkey2 = "" if( !$exkey2 ); $exval2 = "" if( !$exval2 ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/sendIntent?action=".$action."&exkey1=".$exkey1."&exval1=".$exval1."&exkey2=".$exkey2."&exval2=".$exval2; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/sendIntent?action=".$action."&exkey1=".$exkey1."&exval1=".$exval1."&exkey2=".$exkey2."&exval2=".$exval2; + $method = "POST"; } elsif( lc $cmd eq 'installflowsource' ) { - my $flowname = join( " ", @data ); + my $flowname = join( " ", @args ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/installFlow?flowname=$flowname"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/installFlow?flowname=$flowname"; + $method = "POST"; } elsif( lc $cmd eq 'opencall' ) { - my $string = join( " ", @data ); + my $string = join( " ", @args ); my ($callnumber, $time) = split( "[ \t][ \t]*", $string ); - $time = "none" if( !$time ); + $time = "none" if( !$time ); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/openCall?callnumber=".$callnumber."&hanguptime=".$time; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/openCall?callnumber=".$callnumber."&hanguptime=".$time; + $method = "POST"; } elsif( lc $cmd eq 'closecall' ) { - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/closeCall"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/closeCall"; + $method = "POST"; } elsif( lc $cmd eq 'startdaydream' ) { - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/startDaydream"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/setCommands/startDaydream"; + $method = "POST"; } elsif( lc $cmd eq 'currentflowsetupdate' ) { - my $url = "http://" . $host . ":" . $port . "/fhem-amad/currentFlowsetUpdate"; - - return AMADDevice_HTTP_POST( $hash,$url ); + $uri = $host . ":" . $port . "/fhem-amad/currentFlowsetUpdate"; + $method = "POST"; } elsif( lc $cmd eq 'sendsms' ) { - my $string = join( " ", @data ); + my $string = join( " ", @args ); 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; + $uri = $host . ":" . $port . "/fhem-amad/setCommands/sendSms?smsmessage=".$smsmessage."&smsnumber=".$smsnumber; + $method = "POST"; + + } else { + + my $apps = AttrVal( $name, "setOpenApp", "none" ); + my $btdev = AttrVal( $name, "setBluetoothDevice", "none" ); + + + my $list = "screenMsg ttsMsg volume:slider,0,1,15 mediaGoogleMusic:play/pause,stop,next,back mediaAmazonMusic:play/pause,stop,next,back mediaSpotifyMusic:play/pause,stop,next,back mediaTuneinRadio:play/pause,stop,next,back mediaAldiMusic:play/pause,stop,next,back mediaYouTube:play/pause,stop,next,back mediaVlcPlayer:play/pause,stop,next,back mediaAudible:play/pause,stop,next,back screenBrightness:slider,0,1,255 screen:on,off,lock,unlock openURL nextAlarmTime:time timer:slider,1,1,60 statusRequest:noArg bluetooth:on,off notifySndFile clearNotificationBar:All,Automagic activateVoiceInput:noArg volumeNotification:slider,0,1,7 volumeRingSound:slider,0,1,7 vibrate:noArg sendIntent openCall closeCall:noArg currentFlowsetUpdate:noArg installFlowSource doNotDisturb:never,always,alarmClockOnly,onlyImportant userFlowState sendSMS startDaydream:noArg"; - return AMADDevice_HTTP_POST( $hash,$url ); + $list .= " screenOrientation:auto,landscape,portrait" if( AttrVal( $name, "setScreenOrientation", "0" ) eq "1" ); + $list .= " screenFullscreen:on,off" if( AttrVal( $name, "setFullscreen", "0" ) eq "1" ); + $list .= " openApp:$apps" if( AttrVal( $name, "setOpenApp", "none" ) ne "none" ); + $list .= " system:reboot,shutdown,airplanemodeON" if( AttrVal( $name, "root", "0" ) eq "1" ); + $list .= " changetoBTDevice:$btdev" if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); + + + return "Unknown argument $cmd, choose one of $list"; } + + $header = undef unless( defined($header) and ($header) ); + IOWrite($hash,$amad_id,$uri,$method,$header); + Log3 $name, 5, "AMADDevice ($name) - IOWrite: $uri $method IODevHash=$hash->{IODev}"; return undef; } @@ -858,11 +727,9 @@ sub AMADDevice_Parse($$) { my ($io_hash,$json) = @_; my $name = $io_hash->{NAME}; - my $amadDevice; - my $decode_json; - $decode_json = eval{decode_json($json)}; + my $decode_json = eval{decode_json($json)}; if($@){ Log3 $name, 3, "AMADDevice ($name) - error while request: $@"; #readingsSingleUpdate($hash, "state", "error", 1); @@ -871,13 +738,13 @@ sub AMADDevice_Parse($$) { Log3 $name, 3, "AMADDevice ($name) - ParseFn was called"; Log3 $name, 3, "AMADDevice ($name) - ParseFn was called, !!! JSON: $json"; - Log3 $name, 3, "AMADDevice ($name) - ParseFn was called, !!! AMAD: $decode_json->{amad}{AMADDEVICE}"; + Log3 $name, 3, "AMADDevice ($name) - ParseFn was called, !!! AMAD_ID: $decode_json->{amad}{amad_id}"; - $amadDevice = $decode_json->{amad}{AMADDEVICE}; - my $code = $io_hash->{NAME} ."-". $amadDevice; + my $fhemDevice = $decode_json->{payload}{fhemdevice} if( defined($decode_json->{payload}{fhemdevice}) ); + my $amad_id = $decode_json->{amad}{amad_id}; - if( my $hash = $modules{AMADDevice}{defptr}{$code} ) { + if( my $hash = $modules{AMADDevice}{defptr}{$amad_id} ) { my $name = $hash->{NAME}; AMADDevice_WriteReadings($hash,$decode_json); @@ -887,11 +754,10 @@ sub AMADDevice_Parse($$) { } else { - return "UNDEFINED $amadDevice AMADDevice $decode_json->{payload}{'DEVICE-IP'} IODev=$name"; + return "UNDEFINED $fhemDevice AMADDevice $decode_json->{payload}{'amaddevice_ip'} $decode_json->{amad}{'amad_id'} IODev=$name"; } } - ################################## ################################## #### my little helpers ########### From 3e2de00594954bf12123ee2487a7c2ee6e4c7254 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sun, 28 May 2017 20:45:59 +0200 Subject: [PATCH 05/32] =?UTF-8?q?Diverse=20JSON=20Strings=20hinzugef=C3=BC?= =?UTF-8?q?gt,=20Codeanpassungen=20und=20Bugfixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 73_AMADCommBridge.pm | 238 ++++++++++++++++++++++++++++++++----------- 74_AMADDevice.pm | 83 +++++++++------ 2 files changed, 228 insertions(+), 93 deletions(-) diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index 0d03b07..63f593f 100644 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -41,7 +41,8 @@ ###### Möglicher Aufbau eines JSON Strings für die AMADCommBridge # # first initial String -# {"amad": {"amad_id": "37836534","fhemcmd": "setreading"},"payload": {"fhemdevice": "TabletWohnzimmer","fhemserverip": "192.168.1.25","amaddevice_ip": "192.168.1.123"}} +# {"amad": {"amad_id": "1495827100156","fhemcmd": "setreading"},"payload": {},"firstrun": {"fhemdevice": "TabletWohnzimmer","fhemserverip": "fhem02.tuxnet.local","amaddevice_ip": "10.6.9.35"}} +# {"amad": {"amad_id": "1495827100156","fhemcmd": "setreading"},"payload": {},"firstrun": {"fhemdevice": "TabletWohnzimmer","fhemserverip": "fhem02.tuxnet.local","amaddevice_ip": "10.6.9.35"}} # # default String # {"amad": {"amad_id": "37836534","fhemcmd": "setreading"},"payload": {"reading0": "value0","reading1": "value1","readingX": "valueX"}} @@ -67,8 +68,8 @@ use TcpServerUtils; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3alpha27"; -my $flowsetversion = "2.6.12"; +my $modulversion = "3.9.48"; +my $flowsetversion = "3.9.48"; @@ -78,7 +79,6 @@ sub AMADCommBridge_Attr(@); sub AMADCommBridge_Open($); sub AMADCommBridge_Read($); sub AMADCommBridge_Define($$); -sub AMADCommBridge_WriteRequest($$$); sub AMADCommBridge_Initialize($); sub AMADCommBridge_Set($@); sub AMADCommBridge_Write($@); @@ -86,6 +86,8 @@ sub AMADCommBridge_Undef($$); sub AMADCommBridge_ResponseProcessing($$); sub AMADCommBridge_Close($); sub AMADCommBridge_ErrorHandling($$$); +sub AMADCommBridge_ProcessRead($$); +sub AMADCommBridge_ParseMsg($$); @@ -99,7 +101,7 @@ sub AMADCommBridge_Initialize($) { $hash->{ReadFn} = "AMADCommBridge_Read"; $hash->{WriteFn} = "AMADCommBridge_Write"; $hash->{Clients} = ":AMADDevice:"; - $hash->{MatchList} = { "1:AMADDevice" => '.*' }; + $hash->{MatchList} = { "1:AMADDevice" => '{"amad": {"amad_id":.+}}' }; # Consumer @@ -246,10 +248,8 @@ sub AMADCommBridge_Set($@) { sub AMADCommBridge_Write($@) { - my ($hash,$amad_id,$uri,$method) = @_; - my $header = "Connection: close\r\n"; - $header .= shift; - my $name = $hash->{NAME}; + my ($hash,$amad_id,$uri,$header,$method) = @_; + my $name = $hash->{NAME}; HttpUtils_NonblockingGet( @@ -589,6 +589,7 @@ sub AMADCommBridge_Close($) { sub AMADCommBridge_Read($) { my $hash = shift; + my $name = $hash->{NAME}; if( $hash->{SERVERSOCKET} ) { # Accept and create a child @@ -598,62 +599,39 @@ sub AMADCommBridge_Read($) { # Read 1024 byte of data my $buf; - my $ret = sysread($hash->{CD}, $buf, 1024); + my $ret = sysread($hash->{CD}, $buf, 2048); + - # When there is an error in connection return if( !defined($ret ) || $ret <= 0 ) { - CommandDelete( undef, $hash->{NAME} ); + CommandDelete( undef, $name ); + Log3 $name, 5, "AMADCommBridge ($name) - Error in connection"; return; } - AMADCommBridge_ResponseProcessing($hash,$buf); + AMADCommBridge_ProcessRead($hash,$buf); } -sub AMADCommBridge_ResponseProcessing($$) { +sub AMADCommBridge_ProcessRead($$) { - my ($hash,$buf) = @_; + my ($hash, $buf) = @_; + my $name = $hash->{NAME}; - my $name = $hash->{NAME}; - my $bhash = $modules{AMADCommBridge}{defptr}{BRIDGE}; - my $bname = $bhash->{NAME}; - - my @data = split( '\R\R', $buf ); + my @data = split( '\R\R', $buf ); + my $data = $data[0]; + my $json = $data[1]; + my $buffer = ''; - #### Verarbeitung der Daten welche über die AMADCommBridge kommen #### + Log3 $name, 4, "AMADCommBridge ($name) - process read"; + - Log3 $bname, 5, "AMADCommBridge ($name) - Receive RAW Message in Debugging Mode: $buf"; - - my $response; my $c; - my $json = $data[1]; - my $decode_json; - - $decode_json = eval{decode_json($json)}; - if($@){ - Log3 $bname, 3, "AMADCommBridge ($name) - error while request: $@"; - readingsSingleUpdate($bhash, "state", "error", 1); - return; - } - - my $amad_id = $decode_json->{amad}{amad_id}; - my $fhemcmd = $decode_json->{amad}{fhemcmd}; - my $fhemDevice; - if( defined($decode_json->{payload}{fhemdevice}) and ($decode_json->{payload}{fhemdevice}) ) { - $fhemDevice = $decode_json->{payload}{fhemdevice} if( defined($decode_json->{payload}{fhemdevice}) ); - } else { - $fhemDevice = $modules{AMADDevice}{defptr}{$amad_id}->{NAME}; - } - - - - - if ( $data[0] =~ /currentFlowsetUpdate.xml/ ) { + if ( $data =~ /currentFlowsetUpdate.xml/ ) { my $fhempath = $attr{global}{modpath}; $response = qx(cat $fhempath/FHEM/lib/74_AMADautomagicFlowset_$flowsetversion.xml); @@ -667,7 +645,7 @@ sub AMADCommBridge_ResponseProcessing($$) { return; } - elsif ( $data[0] =~ /installFlow_([^.]*.xml)/ ) { + elsif ( $data =~ /installFlow_([^.]*.xml)/ ) { if( defined($1) ){ $response = qx(cat /tmp/$1); @@ -683,8 +661,98 @@ sub AMADCommBridge_ResponseProcessing($$) { } + if(defined($hash->{PARTIAL}) and $hash->{PARTIAL}) { + + Log3 $name, 5, "AMADCommBridge ($name) - PARTIAL: " . $hash->{PARTIAL}; + $buffer = $hash->{PARTIAL}; + + } else { + + Log3 $name, 4, "AMADCommBridge ($name) - No PARTIAL buffer"; + } - elsif( !defined($amad_id) ) { + Log3 $name, 5, "AMADCommBridge ($name) - Incoming data: " . $json; + + $buffer = $buffer . $json; + Log3 $name, 5, "AMADCommBridge ($name) - Current processing buffer (PARTIAL + incoming data): " . $buffer; + + my ($correct_json,$tail) = AMADCommBridge_ParseMsg($hash, $buffer); + + + while($correct_json) { + + $hash->{LAST_RECV} = time(); + + Log3 $name, 5, "AMADCommBridge ($name) - Decoding JSON message. Length: " . length($correct_json) . " Content: " . $correct_json; + Log3 $name, 5, "AMADCommBridge ($name) - Vor Sub: Laenge JSON: " . length($correct_json) . " Content: " . $correct_json . " Tail: " . $tail; + + AMADCommBridge_ResponseProcessing($hash,$correct_json) + unless(not defined($tail) and not ($tail)); + + ($correct_json,$tail) = AMADCommBridge_ParseMsg($hash, $tail); + + Log3 $name, 5, "AMADCommBridge ($name) - Nach Sub: Laenge JSON: " . length($correct_json) . " Content: " . $correct_json . " Tail: " . $tail; + } + + + $hash->{PARTIAL} = $tail; + Log3 $name, 4, "AMADCommBridge ($name) - PARTIAL lenght: " . length($tail); + + + Log3 $name, 5, "AMADCommBridge ($name) - Tail: " . $tail; + Log3 $name, 5, "AMADCommBridge ($name) - PARTIAL: " . $hash->{PARTIAL}; + +} + +sub AMADCommBridge_ResponseProcessing($$) { + + my ($hash,$json) = @_; + + my $name = $hash->{NAME}; + my $bhash = $modules{AMADCommBridge}{defptr}{BRIDGE}; + my $bname = $bhash->{NAME}; + + + + + #### Verarbeitung der Daten welche über die AMADCommBridge kommen #### + + Log3 $bname, 4, "AMADCommBridge ($name) - Receive RAW Message in Debugging Mode: $json"; + + + my $response; + my $c; + #my $json = $data[1]; + my $decode_json; + + $decode_json = eval{decode_json($json)}; + if($@){ + Log3 $bname, 3, "AMADCommBridge ($name) - ERROR while request: $@"; + readingsSingleUpdate($bhash, "JSON info", "JSON ERROR", 1); + $response = "header lines: \r\n AMADCommBridge receive a JSON error\r\n AMADCommBridge to do nothing\r\n"; + $c = $hash->{CD}; + print $c "HTTP/1.1 200 OK\r\n", + "Content-Type: text/plain\r\n", + "Connection: close\r\n", + "Content-Length: ".length($response)."\r\n\r\n", + $response; + return; + } + + my $amad_id = $decode_json->{amad}{amad_id}; + my $fhemcmd = $decode_json->{amad}{fhemcmd}; + my $fhemDevice; + + if( defined($decode_json->{firstrun}) and ($decode_json->{firstrun}) ) { + $fhemDevice = $decode_json->{payload}{fhemdevice} if( defined($decode_json->{firstrun}{fhemdevice}) ); + } else { + $fhemDevice = $modules{AMADDevice}{defptr}{$amad_id}->{NAME}; + } + + + + + if( !defined($amad_id) ) { readingsSingleUpdate( $bhash, "transmitterERROR", $hash->{NAME}." has no device name sends", 1 ) if( AttrVal( $bname, "expertMode", 0 ) eq "1" ); Log3 $bname, 4, "AMADCommBridge ($name) - ERROR - no device name given. please check your global variable in automagic"; @@ -699,7 +767,6 @@ sub AMADCommBridge_ResponseProcessing($$) { return; } - if( defined($fhemcmd) and ($fhemcmd) ) { if ( $fhemcmd eq 'setreading' ) { @@ -710,7 +777,7 @@ sub AMADCommBridge_ResponseProcessing($$) { Dispatch($bhash,$json,undef); Log3 $bname, 4, "AMADCommBridge ($bname) - call Dispatcher"; - readingsSingleUpdate($bhash,'fhemServerIP',$decode_json->{payload}{'fhemserverip'},1) if( defined($decode_json->{payload}{'fhemserverip'})); + readingsSingleUpdate($bhash,'fhemServerIP',$decode_json->{firstrun}{'fhemserverip'},1) if( defined($decode_json->{firstrun}{'fhemserverip'})); $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM was processes\r\n"; $c = $hash->{CD}; @@ -723,13 +790,13 @@ sub AMADCommBridge_ResponseProcessing($$) { return; } - elsif ( $fhemcmd =~ /set\b/ ) { - my $fhemCmd = $data[1]; + elsif ( $fhemcmd eq 'set' ) { + my $fhemCmd = $decode_json->{payload}{setcmd}; fhem ("set $fhemCmd") if( ReadingsVal( $bname, "expertMode", 0 ) eq "1" ); readingsSingleUpdate( $bhash, "receiveFhemCommand", "set ".$fhemCmd, 0 ); - Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: set reading receive fhem command"; - + Log3 $bname, 3, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: set reading receive fhem command"; + $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM execute set command now\r\n"; $c = $hash->{CD}; print $c "HTTP/1.1 200 OK\r\n", @@ -737,12 +804,12 @@ sub AMADCommBridge_ResponseProcessing($$) { "Connection: close\r\n", "Content-Length: ".length($response)."\r\n\r\n", $response; - + return; } - elsif ( $fhemcmd =~ /voiceinputvalue\b/ ) { - my $fhemCmd = lc $data[1]; + elsif ( $fhemcmd eq 'voiceinputvalue' ) { + my $fhemCmd = $decode_json->{payload}{voiceinputdata}; readingsBeginUpdate( $bhash); readingsBulkUpdate( $bhash, "receiveVoiceCommand", $fhemCmd ); @@ -761,8 +828,8 @@ sub AMADCommBridge_ResponseProcessing($$) { return; } - elsif ( $fhemcmd =~ /readingsval\b/ ) { - my $fhemCmd = $data[1]; + elsif ( $fhemcmd eq 'readingsval' ) { + my $fhemCmd = $decode_json->{payload}{readingsvalcmd}; my @datavalue = split( ' ', $fhemCmd ); $response = ReadingsVal( $datavalue[0], $datavalue[1], $datavalue[2] ); @@ -772,8 +839,7 @@ sub AMADCommBridge_ResponseProcessing($$) { "Connection: close\r\n", "Content-Length: ".length($response)."\r\n\r\n", $response; - - Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: response ReadingsVal Value to Automagic Device"; + return; } @@ -813,10 +879,58 @@ sub AMADCommBridge_ResponseProcessing($$) { $response; } + ################## ### my little helper ################## +sub AMADCommBridge_ParseMsg($$) { + + my ($hash, $buffer) = @_; + + my $name = $hash->{NAME}; + my $open = 0; + my $close = 0; + my $msg = ''; + my $tail = ''; + + + if($buffer) { + foreach my $c (split //, $buffer) { + if($open == $close && $open > 0) { + $tail .= $c; + Log3 $name, 5, "AMADCommBridge ($name) - $open == $close && $open > 0"; + + } elsif(($open == $close) && ($c ne '{')) { + + Log3 $name, 5, "AMADCommBridge ($name) - Garbage character before message: " . $c; + + } else { + + if($c eq '{') { + + $open++; + + } elsif($c eq '}') { + + $close++; + } + + $msg .= $c; + } + } + + if($open != $close) { + + $tail = $msg; + $msg = ''; + } + } + + Log3 $name, 5, "AMADCommBridge ($name) - return msg: $msg and tail: $tail"; + return ($msg,$tail); +} + ##### bleibt zu Anschauungszwecken erhalten #sub AMADCommBridge_Header2Hash($) { # diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index 3797ef5..dd376a0 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -54,8 +54,8 @@ use Encode qw(encode); eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3alpha27"; -my $flowsetversion = "2.6.12"; +my $modulversion = "3.9.49"; +my $flowsetversion = "3.9.48"; @@ -69,10 +69,10 @@ sub AMADDevice_encrypt($); sub AMADDevice_GetUpdate($); sub AMADDevice_Initialize($); sub AMADDevice_WriteReadings($$); -sub AMADDevice_SelectSetCmd($$@); sub AMADDevice_Set($$@); sub AMADDevice_Undef($$); sub AMADDevice_Parse($$); +sub AMADDevice_statusRequest($); @@ -81,7 +81,7 @@ sub AMADDevice_Initialize($) { my ($hash) = @_; - $hash->{Match} = '.*'; + $hash->{Match} = '{"amad": {"amad_id":.+}}'; $hash->{SetFn} = "AMADDevice_Set"; $hash->{DefFn} = "AMADDevice_Define"; @@ -185,11 +185,11 @@ sub AMADDevice_Define($$) { if( $init_done ) { - #AMADDevice_GetUpdate($hash); + AMADDevice_GetUpdate($hash); } else { - #InternalTimer( gettimeofday()+30, "AMADDevice_GetUpdate", $hash, 0 ) if( ($hash->{HOST}) ); + InternalTimer( gettimeofday()+30, "AMADDevice_GetUpdate", $hash, 0 ) if( ($hash->{HOST}) ); } $modules{AMADDevice}{defptr}{$amad_id} = $hash; @@ -317,15 +317,14 @@ sub AMADDevice_Attr(@) { sub AMADDevice_GetUpdate($) { my ( $hash ) = @_; - my $name = $hash->{NAME}; - my $bhash = $modules{AMADDevice}{defptr}{BRIDGE}; - my $bname = $bhash->{NAME}; + my $name = $hash->{NAME}; + my $bname = $hash->{IODev}->{NAME}; RemoveInternalTimer( $hash ); if( $init_done && ( ReadingsVal( $name, "deviceState", "unknown" ) eq "unknown" or ReadingsVal( $name, "deviceState", "online" ) eq "online" ) && AttrVal( $name, "disable", 0 ) ne "1" && ReadingsVal( $bname, "fhemServerIP", "not set" ) ne "not set" ) { - - AMADDevice_statusRequest( $hash ); + + AMADDevice_statusRequest($hash); AMADDevice_checkDeviceState( $hash ); } else { @@ -337,6 +336,36 @@ sub AMADDevice_GetUpdate($) { } } +sub AMADDevice_statusRequest($) { + + my $hash = shift; + my $name = $hash->{NAME}; + + my $host = $hash->{HOST}; + my $port = $hash->{PORT}; + my $amad_id = $hash->{AMAD_ID}; + my $uri; + my $header = 'Connection: close'; + my $method; + + + my $activetask = AttrVal( $name, "checkActiveTask", "none" ); + my $userFlowState = AttrVal( $name, "setUserFlowState", "none" ); + my $apssid = AttrVal( $name, "setAPSSID", "none" ); + my $fhemip = ReadingsVal($hash->{IODev}->{NAME}, "fhemServerIP", "none"); + my $bport = $hash->{IODev}->{PORT}; + my $amad_id = $hash->{AMAD_ID}; + + + $uri = $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Pfad muß so im Automagic als http request Trigger drin stehen + $header .= "\r\nfhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $bport\r\nuserflowstate: $userFlowState\r\namadid: $amad_id"; + $method = "GET"; + + + IOWrite($hash,$amad_id,$uri,$header,$method); + Log3 $name, 5, "AMADDevice ($name) - IOWrite: $uri $method IODevHash=$hash->{IODev}"; +} + sub AMADDevice_WriteReadings($$) { my ( $hash, $decode_json ) = @_; @@ -359,7 +388,7 @@ sub AMADDevice_WriteReadings($$) { while( ( $t, $v ) = each %{$decode_json->{payload}} ) { readingsBulkUpdate( $hash, $t, $v ) if( defined( $v ) ); - $v =~ s/\bnull\b/off/g if( ($t eq "nextAlarmDay" || $t eq "nextAlarmTime") && $v eq "null" ); + $v =~ s/\bnull\b/off/g if( ($t eq "nextAlarmDay" or $t eq "nextAlarmTime") and $v eq "null" ); $v =~ s/\bnull\b//g; } @@ -388,7 +417,7 @@ sub AMADDevice_Set($$@) { my $port = $hash->{PORT}; my $amad_id = $hash->{AMAD_ID}; my $uri; - my $header; + my $header = 'Connection: close'; my $method; @@ -557,16 +586,8 @@ sub AMADDevice_Set($$@) { elsif( lc $cmd eq 'statusrequest' ) { - my $activetask = AttrVal( $name, "checkActiveTask", "none" ); - my $userFlowState = AttrVal( $name, "setUserFlowState", "none" ); - my $apssid = AttrVal( $name, "setAPSSID", "none" ); - my $fhemip = ReadingsVal($hash->{IODev}->{NAME}, "fhemServerIP", "none"); - my $bport = $hash->{IODev}->{PORT}; - - - $uri = $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Pfad muß so im Automagic als http request Trigger drin stehen - $header = "fhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $bport\r\nuserflowstate: $userFlowState"; - $method = "GET"; + AMADDevice_statusRequest($hash); + return; } elsif( lc $cmd eq 'openapp' ) { @@ -715,9 +736,9 @@ sub AMADDevice_Set($$@) { return "Unknown argument $cmd, choose one of $list"; } - - $header = undef unless( defined($header) and ($header) ); - IOWrite($hash,$amad_id,$uri,$method,$header); + + + IOWrite($hash,$amad_id,$uri,$header,$method); Log3 $name, 5, "AMADDevice ($name) - IOWrite: $uri $method IODevHash=$hash->{IODev}"; return undef; @@ -736,12 +757,12 @@ sub AMADDevice_Parse($$) { return; } - Log3 $name, 3, "AMADDevice ($name) - ParseFn was called"; - Log3 $name, 3, "AMADDevice ($name) - ParseFn was called, !!! JSON: $json"; - Log3 $name, 3, "AMADDevice ($name) - ParseFn was called, !!! AMAD_ID: $decode_json->{amad}{amad_id}"; + Log3 $name, 4, "AMADDevice ($name) - ParseFn was called"; + Log3 $name, 4, "AMADDevice ($name) - ParseFn was called, !!! JSON: $json"; + Log3 $name, 4, "AMADDevice ($name) - ParseFn was called, !!! AMAD_ID: $decode_json->{amad}{amad_id}"; - my $fhemDevice = $decode_json->{payload}{fhemdevice} if( defined($decode_json->{payload}{fhemdevice}) ); + my $fhemDevice = $decode_json->{firstrun}{fhemdevice} if( defined($decode_json->{firstrun}) and defined($decode_json->{firstrun}{fhemdevice}) ); my $amad_id = $decode_json->{amad}{amad_id}; if( my $hash = $modules{AMADDevice}{defptr}{$amad_id} ) { @@ -754,7 +775,7 @@ sub AMADDevice_Parse($$) { } else { - return "UNDEFINED $fhemDevice AMADDevice $decode_json->{payload}{'amaddevice_ip'} $decode_json->{amad}{'amad_id'} IODev=$name"; + return "UNDEFINED $fhemDevice AMADDevice $decode_json->{firstrun}{'amaddevice_ip'} $decode_json->{amad}{'amad_id'} IODev=$name"; } } From 7af196bada12f98ece1f17e86311ea57c51c718a Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 30 May 2017 00:14:39 +0200 Subject: [PATCH 06/32] Installationsassistent verbessert, diverse Bugfixes in den Modulen, ready for betausertest --- 73_AMADCommBridge.pm | 31 +- 74_AMADDevice.pm | 13 +- 74_AMADautomagicFlowset_3.9.52.xml | 4434 ++++++++++++++++++++++++++++ 3 files changed, 4458 insertions(+), 20 deletions(-) create mode 100644 74_AMADautomagicFlowset_3.9.52.xml diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index 63f593f..549e4c4 100644 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -41,8 +41,8 @@ ###### Möglicher Aufbau eines JSON Strings für die AMADCommBridge # # first initial String -# {"amad": {"amad_id": "1495827100156","fhemcmd": "setreading"},"payload": {},"firstrun": {"fhemdevice": "TabletWohnzimmer","fhemserverip": "fhem02.tuxnet.local","amaddevice_ip": "10.6.9.35"}} -# {"amad": {"amad_id": "1495827100156","fhemcmd": "setreading"},"payload": {},"firstrun": {"fhemdevice": "TabletWohnzimmer","fhemserverip": "fhem02.tuxnet.local","amaddevice_ip": "10.6.9.35"}} +# {"amad": {"amad_id": "1495827100156","fhemcmd": "setreading"},"firstrun": {"fhemdevice": "TabletWohnzimmer","fhemserverip": "fhem02.tuxnet.local","amaddevice_ip": "10.6.9.35"}} +# {"amad": {"amad_id": "1495827100156","fhemcmd": "setreading"},"firstrun": {"fhemdevice": "TabletWohnzimmer","fhemserverip": "fhem02.tuxnet.local","amaddevice_ip": "10.6.9.35"}} # # default String # {"amad": {"amad_id": "37836534","fhemcmd": "setreading"},"payload": {"reading0": "value0","reading1": "value1","readingX": "valueX"}} @@ -68,8 +68,8 @@ use TcpServerUtils; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.48"; -my $flowsetversion = "3.9.48"; +my $modulversion = "3.9.52"; +my $flowsetversion = "3.9.52"; @@ -563,7 +563,7 @@ sub AMADCommBridge_Open($) { readingsSingleUpdate ( $hash, "state", "opened", 1 ) if( defined($hash->{FD}) ); Log3 $name, 3, "AMADCommBridge ($name) - Socket opened."; - return; + return $ret; } sub AMADCommBridge_Close($) { @@ -603,9 +603,9 @@ sub AMADCommBridge_Read($) { # When there is an error in connection return - if( !defined($ret ) || $ret <= 0 ) { + if( !defined($ret ) or $ret <= 0 ) { CommandDelete( undef, $name ); - Log3 $name, 5, "AMADCommBridge ($name) - Error in connection"; + Log3 $name, 5, "AMADCommBridge ($name) - Connection closed for $name"; return; } @@ -674,7 +674,7 @@ sub AMADCommBridge_ProcessRead($$) { Log3 $name, 5, "AMADCommBridge ($name) - Incoming data: " . $json; $buffer = $buffer . $json; - Log3 $name, 5, "AMADCommBridge ($name) - Current processing buffer (PARTIAL + incoming data): " . $buffer; + Log3 $name, 4, "AMADCommBridge ($name) - Current processing buffer (PARTIAL + incoming data): " . $buffer; my ($correct_json,$tail) = AMADCommBridge_ParseMsg($hash, $buffer); @@ -722,10 +722,11 @@ sub AMADCommBridge_ResponseProcessing($$) { my $response; my $c; - #my $json = $data[1]; my $decode_json; + $decode_json = eval{decode_json($json)}; + if($@){ Log3 $bname, 3, "AMADCommBridge ($name) - ERROR while request: $@"; readingsSingleUpdate($bhash, "JSON info", "JSON ERROR", 1); @@ -744,8 +745,11 @@ sub AMADCommBridge_ResponseProcessing($$) { my $fhemDevice; if( defined($decode_json->{firstrun}) and ($decode_json->{firstrun}) ) { - $fhemDevice = $decode_json->{payload}{fhemdevice} if( defined($decode_json->{firstrun}{fhemdevice}) ); + + $fhemDevice = $decode_json->{firstrun}{fhemdevice} if( defined($decode_json->{firstrun}{fhemdevice}) ); + } else { + $fhemDevice = $modules{AMADDevice}{defptr}{$amad_id}->{NAME}; } @@ -771,7 +775,7 @@ sub AMADCommBridge_ResponseProcessing($$) { if( defined($fhemcmd) and ($fhemcmd) ) { if ( $fhemcmd eq 'setreading' ) { return Log3 $bname, 3, "AMADCommBridge ($name) - AMADCommBridge: processing receive no reading values from Device: $fhemDevice" - unless( defined($decode_json->{payload}) and ($decode_json->{payload}) ); + unless( (defined($decode_json->{payload}) and ($decode_json->{payload})) or (defined($decode_json->{firstrun}) and ($decode_json->{firstrun})) ); Log3 $bname, 4, "AMADCommBridge ($bname) - AMADCommBridge: processing receive reading values - Device: $fhemDevice Data: $decode_json->{payload}"; @@ -795,7 +799,7 @@ sub AMADCommBridge_ResponseProcessing($$) { fhem ("set $fhemCmd") if( ReadingsVal( $bname, "expertMode", 0 ) eq "1" ); readingsSingleUpdate( $bhash, "receiveFhemCommand", "set ".$fhemCmd, 0 ); - Log3 $bname, 3, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: set reading receive fhem command"; + Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: set reading receive fhem command"; $response = "header lines: \r\n AMADCommBridge receive Data complete\r\n FHEM execute set command now\r\n"; $c = $hash->{CD}; @@ -842,7 +846,8 @@ sub AMADCommBridge_ResponseProcessing($$) { return; } - + + # elsif ( $fhemcmd =~ /fhemfunc\b/ ) { # my $fhemCmd = $data[1]; # diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index dd376a0..2b78ec1 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -54,8 +54,8 @@ use Encode qw(encode); eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.49"; -my $flowsetversion = "3.9.48"; +my $modulversion = "3.9.52"; +my $flowsetversion = "3.9.52"; @@ -185,11 +185,11 @@ sub AMADDevice_Define($$) { if( $init_done ) { - AMADDevice_GetUpdate($hash); + InternalTimer( gettimeofday()+3, "AMADDevice_GetUpdate", $hash, 0 ) if( ($hash->{HOST}) ); } else { - InternalTimer( gettimeofday()+30, "AMADDevice_GetUpdate", $hash, 0 ) if( ($hash->{HOST}) ); + InternalTimer( gettimeofday()+15, "AMADDevice_GetUpdate", $hash, 0 ) if( ($hash->{HOST}) ); } $modules{AMADDevice}{defptr}{$amad_id} = $hash; @@ -354,7 +354,6 @@ sub AMADDevice_statusRequest($) { my $apssid = AttrVal( $name, "setAPSSID", "none" ); my $fhemip = ReadingsVal($hash->{IODev}->{NAME}, "fhemServerIP", "none"); my $bport = $hash->{IODev}->{PORT}; - my $amad_id = $hash->{AMAD_ID}; $uri = $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Pfad muß so im Automagic als http request Trigger drin stehen @@ -758,8 +757,7 @@ sub AMADDevice_Parse($$) { } Log3 $name, 4, "AMADDevice ($name) - ParseFn was called"; - Log3 $name, 4, "AMADDevice ($name) - ParseFn was called, !!! JSON: $json"; - Log3 $name, 4, "AMADDevice ($name) - ParseFn was called, !!! AMAD_ID: $decode_json->{amad}{amad_id}"; + Log3 $name, 5, "AMADDevice ($name) - ParseFn was called, !!! AMAD_ID: $decode_json->{amad}{amad_id}"; my $fhemDevice = $decode_json->{firstrun}{fhemdevice} if( defined($decode_json->{firstrun}) and defined($decode_json->{firstrun}{fhemdevice}) ); @@ -782,6 +780,7 @@ sub AMADDevice_Parse($$) { ################################## ################################## #### my little helpers ########### + sub AMADDevice_checkDeviceState($) { my ( $hash ) = @_; diff --git a/74_AMADautomagicFlowset_3.9.52.xml b/74_AMADautomagicFlowset_3.9.52.xml new file mode 100644 index 0000000..514dd17 --- /dev/null +++ b/74_AMADautomagicFlowset_3.9.52.xml @@ -0,0 +1,4434 @@ + + + + true + Akku Ladestand: grösser als 0% + true + 0 + HIGHER_THAN + false + true + + + false + App Task Beendet + true + CLASSIC + * + + + true + App Task Beendet: ch.gridvision.ppam.androidautomagic + false + CLASSIC + ch.gridvision.ppam.androidautomagic + + + true + Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic + true + ch.gridvision.ppam.androidautomagic + TEXT + CONTAINS_TEXT + + false + false + + + true + Benachrichtigung in Statusbar angezeigt: com.whatsapp + true + com.whatsapp + TEXT + CONTAINS_TEXT + + false + true + + + true + Benachrichtigung in Statusbar angezeigt: org.telegram.messenger + true + org.telegram.messenger + TEXT + CONTAINS_TEXT + + false + true + + + true + Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic + true + ch.gridvision.ppam.androidautomagic + TEXT + CONTAINS_TEXT + + false + false + + + true + Bluetooth Status: Schaltet aus, Aus + true + false + false + true + true + + + true + Bluetooth Status: Schaltet ein, Ein + true + true + true + false + false + + + true + Daydream Status: Gestartet + true + true + + + true + Daydream Status: Gestoppt + true + false + + + true + Display Orientierung: Landscape + true + false + + + true + Display Orientierung: Portrait + true + true + + + true + Display Status: Aus + true + false + + + true + Display Status: Ein + true + true + + + true + Dock Event: Docked + true + true + + + true + Dock Event: Undocked + true + false + + + true + Eingehender Anruf. Status: Klingelt, Nummern: Alle + true + true + + true + true + false + false + false + + + true + Flugmodus: Aus + true + false + + + true + Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT + true + com.android.deskclock.ALARM_ALERT + + + + + + + + + false + + + true + Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS + true + com.android.deskclock.ALARM_DISMISS + + + + + + + + + false + + + true + Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE + true + com.android.deskclock.ALARM_DONE + + + + + + + + + false + + + true + Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE + true + com.android.deskclock.ALARM_SNOOZE + + + + + + + + + false + + + true + Genereller Broadcast: wenn org.smblott.intentradio.STATE + true + org.smblott.intentradio.STATE + + + + + + + + irstate=getString("state"); +irname=getString("name") + false + + + false + HTTP Request: /fhem-amad/currentFlowsetUpdate + true + /fhem-amad/currentFlowsetUpdate + 8090 + true + + + false + HTTP Request: /fhem-amad/deviceInfo/ + true + /fhem-amad/deviceInfo/ + 8090 + true + + + false + HTTP Request: /fhem-amad/setCommands/* + true + /fhem-amad/setCommands/* + 8090 + true + + + false + Medien Session verändert + true + com.amazon.mp3,com.amazon.avod.thirdpartyclient,com.audible.application,com.rhapsody.alditalk,com.spotify.music,com.google.android.videos,com.google.android.music,org.smblott.intentradioio,de.maxdome.app.android,tunein.player,org.videolan.vlc,com.google.android.youtube + + + false + Periodischer Timer: alle 30s + true + 30000 + true + false + false + Mon + Tue + Wed + Thu + Fri + Sat + Sun + 8 + 0 + 17 + 0 + true + false + + + true + Sprachbefehl angefordert + true + + + true + Stromversorgung: Angeschlossen + true + true + true + true + true + + + true + Stromversorgung: Entfernt + true + false + true + true + true + + + false + Systemeinstellung verändert: System next_alarm + true + SYSTEM + next_alarm_formatted + setting + + + true + Systemeinstellung verändert: System screen_brightness + true + SYSTEM + screen_brightness + screenBrightness + + + true + Systemeinstellung verändert: System volume_music_bt_a2dp + true + SYSTEM + volume_music_bt_a2dp + volume + + + true + Systemeinstellung verändert: System volume_music_headphone + true + SYSTEM + volume_music_headphone + volume + + + false + Systemeinstellung verändert: System volume_music_headset + true + SYSTEM + volume_music_headset + volume + + + true + Systemeinstellung verändert: System volume_music_speaker + true + SYSTEM + volume_music_speaker + volume + + + true + Systemeinstellung verändert: System volume_ring + true + SYSTEM + volume_ring + volumeRingSound + + + true + Systemeinstellung verändert: System volume_ring_speaker + true + SYSTEM + volume_ring_speaker + volumeNotification + + + true + Unterbrechnungen-Modus: Alle / Immer unterbrechen + true + OFF + + + true + Unterbrechnungen-Modus: Keine / Nicht unterbrechen + true + NO_INTERRUPTIONS + + + true + Unterbrechnungen-Modus: Nur Wecker (Android 6+) + true + ALARMS_ONLY + + + true + Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + true + IMPORTANT_INTERRUPTIONS + + + false + App Task läuft: App (neuster) + CLASSIC + {param_app} + true + + + true + App Task läuft: {global_activetask} (neuster) + CLASSIC + {global_activetask} + true + + + false + Benachrichtigung in Statusbar angezeigt: Automagic + ch.gridvision.ppam.androidautomagic + true + 1 + TEXT + CONTAINS_TEXT + + false + false + + + false + Benachrichtigung in Statusbar angezeigt: Telegram Messenger + org.telegram.messenger + true + 1 + TEXT + CONTAINS_TEXT + + false + false + + + false + Benachrichtigung in Statusbar angezeigt: WhatsApp + com.whatsapp + true + 1 + TEXT + CONTAINS_TEXT + + false + false + + + true + Bluetooth eingeschaltet + + + true + Bluetooth Gerät verbunden: Beliebiges Geräte + true + + + ANY + + + true + Bluetooth Gerät verbunden: Beliebiges Geräte (Advanced Audio Distribution) + true + + + A2DP + + + true + Display automatisch drehen eingeschaltet + + + true + Display eingeschaltet + + + true + Display Orientierung: Portrait + true + + + true + Dock Status: Docked + true + true + true + true + true + false + + + true + Expression: airpcount < 11 + airpcount < 11 + + + false + Expression: Airplanemode + param_syscmd == "airplanemodeON" + + + false + Expression: All + param_app == "All" + + + true + Expression: amadcmd == "firstrun" + amadcmd == "firstrun" + + + false + Expression: Automagic + param_app == "Automagic" + + + false + Expression: Clear Automagic Meldungen" + request_path == "/fhem-amad/setCommands/clearnotificationbar" + + + false + Expression: closeCall" + request_path == "/fhem-amad/setCommands/closeCall" + + + true + Expression: contains(value, " und ") + contains(value, " und ") + + + false + Expression: do not Disturb" + request_path == "/fhem-amad/setCommands/donotdisturb" + + + true + Expression: fhemcmd == "readingsval" + fhemcmd == "readingsval" + + + true + Expression: fhemcmd == "set" + fhemcmd == "set" + + + true + Expression: fhemcmd == "setreading" + fhemcmd == "setreading" + + + true + Expression: fhemcmd == "voiceinputvalue" + fhemcmd == "voiceinputvalue" + + + false + Expression: flowState" + request_path == "/fhem-amad/setCommands/flowState" + + + true + Expression: getAndroidSDKVersion() >= "16" + getAndroidSDKVersion() >= "16" + + + true + Expression: getAndroidSDKVersion() >= "19" + getAndroidSDKVersion() >= "19" + + + true + Expression: getAndroidSDKVersion() >= "21" + getAndroidSDKVersion() >= "21" + + + true + Expression: global_activetask != null + global_activetask != null + + + true + Expression: global_fhemip != null or global_bridgeport != null + global_fhemip != null or global_bridgeport != null + + + true + Expression: global_userflowstate != "none" + global_userflowstate != "none" + + + false + Expression: installFlow" + request_path == "/fhem-amad/setCommands/installFlow" + + + true + Expression: keyguard == "locked" + keyguard == "locked" + + + true + Expression: Leon == "Gaultier" + Leon == "Gaultier" + + + false + Expression: multimediaControl" + request_path == "/fhem-amad/setCommands/multimediaControl" + + + false + Expression: notifysnd" + request_path == "/fhem-amad/setCommands/playnotifysnd" + + + false + Expression: openApp" + request_path == "/fhem-amad/setCommands/openApp" + + + false + Expression: openCall" + request_path == "/fhem-amad/setCommands/openCall" + + + false + Expression: openURL" + request_path == "/fhem-amad/setCommands/openURL" + + + true + Expression: package_name == {global_activetask} + package_name == {global_activetask} + + + true + Expression: param_bluetooth == "off" + param_bluetooth == "off" + + + true + Expression: param_bluetooth == "on" + param_bluetooth == "on" + + + true + Expression: param_button == "back" + param_button == "back" + + + true + Expression: param_button == "next" + param_button == "next" + + + true + Expression: param_button == "play/pause" + param_button == "play/pause" + + + true + Expression: param_button == "stop" + param_button == "stop" + + + true + Expression: param_disturbmod == "alarmClockOnly" + param_disturbmod == "alarmClockOnly" + + + true + Expression: param_disturbmod == "always" + param_disturbmod == "always" + + + true + Expression: param_disturbmod == "never" + param_disturbmod == "never" + + + true + 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" + param_fullscreen == "off" + + + true + Expression: param_fullscreen == "on" + param_fullscreen == "on" + + + true + Expression: param_lockmod == "lock" + param_lockmod == "lock" + + + true + Expression: param_notifyfile == "RedAlert.mp3" + param_notifyfile == "RedAlert.mp3" + + + false + Expression: param_option + param_hanguptime != "none" + + + true + Expression: param_orientation == "auto" + param_orientation == "auto" + + + true + Expression: param_orientation == "landscape" + param_orientation == "landscape" + + + true + Expression: param_orientation == "portrait" + param_orientation == "portrait" + + + true + Expression: param_screen=="off" + param_screen=="off" + + + true + Expression: param_screen=="on" + param_screen=="on" + + + false + Expression: Reboot + param_syscmd == "reboot" + + + true + Expression: respreadingsval != "kaputt" and respreadingsval != "none" + respreadingsval != "kaputt" and respreadingsval != "none" + + + true + Expression: respreadingsval == "online" + respreadingsval == "online" + + + true + Expression: scrcount < 5 + scrcount < 5 + + + false + Expression: screenMsg" + request_path == "/fhem-amad/setCommands/screenMsg" + + + false + Expression: sendIntent" + request_path == "/fhem-amad/setCommands/sendIntent" + + + false + Expression: sendSms" + request_path == "/fhem-amad/setCommands/sendSms" + + + false + Expression: setAlarm" + request_path == "/fhem-amad/setCommands/setAlarm" + + + false + Expression: setBluetooth" + request_path == "/fhem-amad/setCommands/setbluetooth" + + + false + Expression: setBrightness" + request_path == "/fhem-amad/setCommands/setBrightness" + + + false + Expression: setBTDevice" + request_path == "/fhem-amad/setCommands/setbtdevice" + + + false + Expression: setNotifiVolume" + request_path == "/fhem-amad/setCommands/setNotifiVolume" + + + false + Expression: setRingSoundVolume" + request_path == "/fhem-amad/setCommands/setRingSoundVolume" + + + false + Expression: setScreenFullscreen" + request_path == "/fhem-amad/setCommands/setScreenFullscreen" + + + false + Expression: setScreenlock" + request_path == "/fhem-amad/setCommands/screenlock" + + + false + Expression: setScreenOnOff" + request_path == "/fhem-amad/setCommands/setScreenOnOff" + + + false + Expression: setScreenOrientation" + request_path == "/fhem-amad/setCommands/setScreenOrientation" + + + false + Expression: setTimer" + request_path == "/fhem-amad/setCommands/setTimer" + + + false + Expression: setVibrate" + request_path == "/fhem-amad/setCommands/setvibrate" + + + false + Expression: setVoiceCommand" + request_path == "/fhem-amad/setCommands/setvoicecmd" + + + false + Expression: setVolume" + request_path == "/fhem-amad/setCommands/setVolume" + + + false + Expression: Shutdown + param_syscmd == "shutdown" + + + false + Expression: startDaydream" + request_path == "/fhem-amad/setCommands/startDaydream" + + + false + Expression: System Command" + request_path == "/fhem-amad/setCommands/systemcommand" + + + true + Expression: trigger == "Akku Ladestand: grösser als 0%" + trigger == "Akku Ladestand: grösser als 0%" + + + true + Expression: trigger == "App Task Beendet" + trigger == "App Task Beendet" + + + true + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" + or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" + trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" + + + true + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" + trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" + + + true + Expression: trigger == "Bluetooth Status: Schaltet aus, Aus" or trigger == "Bluetooth Status: Schaltet ein, Ein" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Bluetooth Status: Schaltet aus, Aus" + or trigger == "Bluetooth Status: Schaltet ein, Ein" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Daydream Status: Gestartet" + trigger == "Daydream Status: Gestartet" + + + true + Expression: trigger == "Daydream Status: Gestartet" or trigger == "Daydream Status: Gestoppt" + trigger == "Daydream Status: Gestartet" + or trigger == "Daydream Status: Gestoppt" + + + true + Expression: trigger == "Display Orientierung: Landscape" or trigger == "Display Orientierung: Portrait" or trigger == "Display Status: Ein" or trigger == "Display Status: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Display Orientierung: Landscape" + or trigger == "Display Orientierung: Portrait" + or trigger == "Display Status: Ein" + or trigger == "Display Status: Aus" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Display Status: Aus" or trigger == "Display Status: Ein" or udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Display Status: Aus" + or trigger == "Display Status: Ein" + or udef_trigger == "setLockPin" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Dock Event: Docked" or trigger == "Dock Event: Undocked" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Dock Event: Docked" + or trigger == "Dock Event: Undocked" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" + trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" + + + true + Expression: trigger == "Flugmodus: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Flugmodus: Aus" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" +or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" +or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" +or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" +or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" + trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" + + + true + Expression: trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + trigger == "HTTP Request: /fhem-amad/setCommands/*" + + + true + Expression: trigger == "Medien Session verändert" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Medien Session verändert" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Periodischer Timer: alle 30s" + trigger == "Periodischer Timer: alle 30s" + + + true + Expression: trigger == "Periodischer Timer: alle 30s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Periodischer Timer: alle 30s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Sprachbefehl angefordert" + trigger == "Sprachbefehl angefordert" + + + true + Expression: trigger == "Systemeinstellung verändert: System next_alarm" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Systemeinstellung verändert: System next_alarm" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Systemeinstellung verändert: System screen_brightness" + trigger == "Systemeinstellung verändert: System screen_brightness" + + + true + Expression: trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" or trigger == "Systemeinstellung verändert: System volume_music_speaker" or trigger == "Systemeinstellung verändert: System volume_music_headphone" or trigger == "Systemeinstellung verändert: System volume_music_headset" + trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" + or trigger == "Systemeinstellung verändert: System volume_music_speaker" + or trigger == "Systemeinstellung verändert: System volume_music_headphone" + or trigger == "Systemeinstellung verändert: System volume_music_headset" + + + true + Expression: trigger == "Systemeinstellung verändert: System volume_ring" + trigger == "Systemeinstellung verändert: System volume_ring" + + + true + Expression: trigger == "Systemeinstellung verändert: System volume_ring_speaker" + trigger == "Systemeinstellung verändert: System volume_ring_speaker" + + + true + Expression: trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" +or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" +or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" +or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" +or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + false + Expression: ttsMsg" + request_path == "/fhem-amad/setCommands/ttsMsg" + + + false + Expression: ttsMsgLang" + param_msglang == "en" + + + true + Expression: udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + udef_trigger == "setLockPin" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: value != "" + value != "" + + + true + Expression: value == "ja" + value == "ja" + + + true + Expression: value == "nein" + value == "nein" + + + true + Flow Aktiv: Informations + Informations + + + true + Flow Aktiv: SetCommands + SetCommands + + + true + Flow Aktiv: {global_userflowstate} + {global_userflowstate} + + + true + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/sdcard) + /sdcard + true + true + 1024 + + + true + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) + /storage/emulated/0 + true + true + 1024 + + + true + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/sdcard0) + /storage/sdcard0 + true + true + 1024 + + + true + Host erreichbar: {global_fhemip}:{global_bridgeport} + SOCKET + {global_fhemip} + {global_bridgeport} + + + true + Keyguard gesperrt + + + true + Keyguard mit Sicherheit + + + true + Musik Aktiv + + + true + Stromversorgung: Angeschlossen + true + true + true + true + + + true + Unterbrechnungen-Modus: Alle / Immer unterbrechen + OFF + + + true + Unterbrechnungen-Modus: Keine / Nicht unterbrechen + NO_INTERRUPTIONS + + + true + Unterbrechnungen-Modus: Nur Wecker (Android 6+) + ALARMS_ONLY + + + true + Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + IMPORTANT_INTERRUPTIONS + + + true + WLAN verfügbar: {global_apssid} + {global_apssid} + + + false + Abfrage + Send Data to AMADCommBridge + + false + true + true + + + false + AMAD First Run Assistent Begrüßung + MUSIC + Hallo und herzlich willkommen beim Einrichtungs Assistenten von Fhem Amaad. Wenn Du fortfahren möchtest antworte einfach mit ja. Wenn nicht mit nein. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + false + AMAD Voice Control + true + + true + de-DE + false + + + true + Anruf beenden + + + false + App Starten: App + {param_app} + + + + true + Audio Player steuern: Medienknopf Play/Pause (/{kname}) + true + TOGGLE_PAUSE + KEYCODE_MEDIA_PLAY_PAUSE + true + {pname} + {kname} + + + + true + Audio Player steuern: Medienknopf Stopp ({pname}/{kname}) + true + STOP + KEYCODE_MEDIA_STOP + true + {pname} + {kname} + + + + true + Audio Player steuern: Medienknopf Weiter ({pname}/{kname}) + true + NEXT + KEYCODE_MEDIA_NEXT + true + {pname} + {kname} + + + + true + Audio Player steuern: Medienknopf Zurück ({pname}/{kname}) + true + PREVIOUS + KEYCODE_MEDIA_PREVIOUS + true + {pname} + {kname} + + + + true + Benachrichtigung auf Bildschirm: [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! (lange) + true + [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! + + 200 + 250 + false + 1.0 + true + false + TOP_LEFT + 0 + 0 + + + true + Benachrichtigung auf Bildschirm: {param_message} (lange) + true + {param_message} + + 200 + 250 + false + 1.0 + true + false + TOP_LEFT + 0 + 0 + + + true + Benachrichtigung auf Bildschirm: {value} (lange) + true + {value} + + 200 + 250 + false + 1.0 + true + false + TOP_LEFT + 0 + 0 + + + true + Benachrichtigung aus Statusbar entfernen: Alle + false + true + 1 + true + + true + {id} + TEXT + CONTAINS_TEXT + + + + true + Benachrichtigung aus Statusbar entfernen: Alle (Automagic) + true + true + 1 + false + + true + {id} + TEXT + CONTAINS_TEXT + + + + true + Bluetooth ein-/ausschalten: Aus + false + + + true + Bluetooth ein-/ausschalten: Ein + true + + + true + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} + A2DP + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} + A2DP + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} + INPUT_DEVICE + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} + INPUT_DEVICE + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} + HEADSET + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} + HEADSET + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} + PAN + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} + PAN + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} + A2DP + {param_swtobtdevicemac} + + 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 + Dateien löschen: /sdcard/Download/currentFlowsetUpdate.xml + /sdcard/Download/currentFlowsetUpdate.xml + true + + + true + Dateien löschen: /storage/emulated/0/Download/currentFlowsetUpdate.xml + /storage/emulated/0/Download/currentFlowsetUpdate.xml + true + + + true + Dateien löschen: /storage/emulated/0/Download/installFlow_{param_flowname} + /storage/emulated/0/Download/installFlow_{param_flowname} + true + + + true + Dateien löschen: /storage/sdcard0/Download/currentFlowsetUpdate.xml + /storage/sdcard0/Download/currentFlowsetUpdate.xml + true + + + true + Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} + /storage/sdcard0/Download/installFlow_{param_flowname} + true + + + true + Display automatisch drehen ein-/ausschalten: Aus + false + + + true + Display automatisch drehen ein-/ausschalten: Ein + true + + + true + Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /sdcard/Download + http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml + /sdcard/Download + true + + + true + Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /storage/emulated/0/Download + http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml + /storage/emulated/0/Download + true + + + true + Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /storage/sdcard0/Download + http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml + /storage/sdcard0/Download + true + + + true + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/emulated/0/Download + http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} + /storage/emulated/0/Download + true + + + true + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download + http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} + /storage/sdcard0/Download + true + + + true + Eingabedialog: AMADCommBridge Port Einzeiliger Text Bitte gebe den Port der AMADCommBridge vom FHEM Server an. + AMADCommBridge Port + SINGLE_LINE_TEXT + Bitte gebe den Port der AMADCommBridge vom FHEM Server an. + + 8090 + false + 60000 + + false + false + false + + + true + Eingabedialog: Android Device IP Adresse Einzeiliger Text Bitte gebe die IP Adresse Deines Androidgerätes an. NUR IP kein FQDN!!! + Android Device IP Adresse + SINGLE_LINE_TEXT + Bitte gebe die IP Adresse Deines Androidgerätes an. NUR IP kein FQDN!!! + + 192.168.x.x + false + 60000 + + false + false + false + + + true + Eingabedialog: FHEM Devicename Einzeiliger Text Wie soll das Device in FHEM heißen? + FHEM Devicename + SINGLE_LINE_TEXT + Wie soll das Device in FHEM heißen? + + TabletWohnzimmer + false + 60000 + + false + false + false + + + true + Eingabedialog: FHEM Server IP Einzeiliger Text Bitte gebe die IP Adresse oder den FQDN Deines FHEM Servers an. + FHEM Server IP + SINGLE_LINE_TEXT + Bitte gebe die IP Adresse oder den FQDN Deines FHEM Servers an. + + 192.168.x.x + false + 60000 + + false + false + false + + + true + Flows ausführen: Send Data to AMADCommBridge + Send Data to AMADCommBridge + + false + false + false + + + false + Flows ausführen: Send Data to AMADCommBridge mit warten + Send Data to AMADCommBridge + + false + true + false + + + false + Flows ausführen: udef_trigger setLockPin + Informations test + + false + true + false + + + true + Flows ausführen: VoiceControl + VoiceControl + + false + false + false + + + true + Flows löschen: First Run Assistant + First Run Assistant + true + + + true + Flows löschen: MultimediaControl + MultimediaControl + true + + + true + Flows/Widgets importieren: /sdcard/Download/currentFlowsetUpdate.xml + /sdcard/Download/currentFlowsetUpdate.xml + true + + + true + Flows/Widgets importieren: /storage/emulated/0/Download/currentFlowsetUpdate.xml + /storage/emulated/0/Download/currentFlowsetUpdate.xml + true + + + true + Flows/Widgets importieren: /storage/emulated/0/Download/installFlow_{param_flowname} + /storage/emulated/0/Download/installFlow_{param_flowname} + true + + + true + Flows/Widgets importieren: /storage/sdcard0/Download/currentFlowsetUpdate.xml + /storage/sdcard0/Download/currentFlowsetUpdate.xml + true + + + true + Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} + /storage/sdcard0/Download/installFlow_{param_flowname} + true + + + true + Flugmodus ein-/ausschalten: Ein + SYSTEM_SETTING + true + + + true + Gerät sperren + + + false + Get Android Version + + + + true + Herunterfahren + + + false + HTTP Request: send FIRSTRUN data to AMADCommBridge JSON + http://{global_fhemip}:{global_bridgeport} + false + false + + false + + POST + GENERAL_TEXT + text/plain + {firstrundata} + @@@@readingsNameXYZ@@readingsValueABC + 60000 + true + Connection: close + true + respfirstrun + /storage/emulated/0/Download/file.bin + false + + + false + HTTP Request: send READINGS data to AMADCommBridge JSON + http://{global_fhemip}:{global_bridgeport} + false + false + + false + + POST + GENERAL_TEXT + text/plain + {fhemdata} + @@@@readingsNameXYZ@@readingsValueABC + 60000 + true + Connection: close + true + respsetreading + /storage/emulated/0/Download/file.bin + false + + + false + HTTP Request: send READINGSVAL data to AMADCommBridge JSON + http://{global_fhemip}:{global_bridgeport} + false + false + + false + + POST + GENERAL_TEXT + text/plain + {readingsvalcmd} + @@@@readingsNameXYZ@@readingsValueABC + 60000 + true + Connection: close + true + respreadingsval + /storage/emulated/0/Download/file.bin + false + + + false + HTTP Request: send SET data to AMADCommBridge JSON + http://{global_fhemip}:{global_bridgeport} + false + false + + false + + POST + GENERAL_TEXT + text/plain + {setcmd} + @@@@readingsNameXYZ@@readingsValueABC + 60000 + true + Connection: close + true + respset + /storage/emulated/0/Download/file.bin + false + + + false + HTTP Request: send VOICEINPUTVALUE data to AMADCommBridge + http://{global_fhemip}:{global_bridgeport} + false + false + + false + + POST + GENERAL_TEXT + text/plain + {voiceinputdata} + @@@@readingsNameXYZ@@readingsValueABC + 60000 + true + FHEMDEVICE: {global_fhemdevice} +FHEMCMD: voiceinputvalue +Connection: close + true + respvoiceinputvalue + /storage/emulated/0/Download/file.bin + true + + + false + Initialisiere Variable Nächster Alarm: next_alarm + next_alarm + + + false + Initialisiere Variable Systemeinstellung: screenBrightness + SYSTEM + screen_brightness + screenBrightness + + + false + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth.2 + SYSTEM + volume_music_bt_a2dp + volumeBT + + + false + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker.2 + SYSTEM + volume_music_speaker + volumeSP + + + false + Initialisiere Variable Systemeinstellung: volumeNotification + SYSTEM + volume_ring_speaker + volumeNotification + + + false + Initialisiere Variable Systemeinstellung: volumeRingSound + SYSTEM + volume_ring + volumeRingSound + + + true + Lautstärke einstellen: Medien auf Level 8 + MUSIC + ADJUST_SET_ABSOLUTE + 8 + false + false + + + false + Lautstärken setzen param_notifivolume + false + global_volume_alarm + false + global_volume_dtmf + false + param_volume + true + param_notifivolume + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + Lautstärken setzen param_ringsoundvolume + false + global_volume_alarm + false + global_volume_dtmf + false + param_volume + false + param_notifivolume + true + param_ringsoundvolume + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + Lautstärken setzen param_volume + false + global_volume_alarm + false + global_volume_dtmf + true + param_volume + false + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + Medianlautstärken Speichern + false + global_volume_alarm + false + global_volume_dtmf + true + global_volume_music + false + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + Medienlautstärke Wiederherstellen + false + global_volume_alarm + false + global_volume_dtmf + true + global_volume_music + false + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + true + Neustart + + + + false + Notification Lautstärke Speichern + false + global_volume_alarm + false + global_volume_dtmf + false + global_volume_music + true + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + Notification Lautstärke Wiederherstellen + false + global_volume_alarm + false + global_volume_dtmf + false + param_volume + true + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + NotificationLautstärke auf Level 7 + NOTIFICATION + ADJUST_SET_ABSOLUTE + 7 + false + false + + + true + Nummer anrufen: {param_callnumber} + + {param_callnumber} + true + + + true + Pause: 2s (Gerät wach halten) + 2s + true + false + + + true + Pause: 3s (Gerät wach halten) + 3s + true + false + + + true + Pause: {param_hanguptime}s (Gerät wach halten) + {param_hanguptime}s + true + false + + + false + Prüfe und setze Bridgeport Variable + + + + false + Prüfe und setze globale Variable + + + + false + Schalte Display ein + false + 5s + true + + + true + Schalte Display ein: Hell für {param_screenontime}s + true + {param_screenontime}s + true + + + true + Script: airpcount = 0 + + + + true + Script: airpcount = airpcount + 1 + + + + true + Script: airplanemode = "\"airplanemode\":" + " \"" + {airplanemode} + "\""; fhemcmd = "setreading"; + + + + true + Script: airplanemode = "airplanemode@@on"; fhemcmd = "setreading"; + + + + true + Script: airplanemode = "off" + + + + true + Script: amadcmd = "firstrun" + + + + true + Script: amaddevice_ip = {value} + + + + true + Script: androidVersion = "\"androidVersion\":" + " \"" + {androidVersion} + "\""; fhemcmd = "setreading"; + + + + true + Script: androidVersion = "not supported funktion" + + + + true + Script: automagicState = "\"automagicState\":" + " \"" + {content_title} + "\""; fhemcmd = "setreading"; + + + + true + Script: bluetooth = "\"bluetooth\":" + " \"" + {bluetooth_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: bluetooth_state = "off" + + + + true + Script: bluetooth_state = "on" + + + + true + Script: btdeviceinfo = "\"connectedBTdevices\":" + " \"" + {connected_devices_names} + "\"" + "," + "\"connectedBTdevicesMAC\":" + " \"" + {connected_devices_addresses} + "\""; fhemcmd = "setreading"; + + + + true + Script: checkActiveTask = "\"checkActiveTask\":" + " \"" + {runTask} + "\""; fhemcmd = "setreading"; + + + + true + Script: connected_devices_names = "none"; connected_devices_addresses = "none" + + + + true + Script: currentMusic = "\"currentMusicTrack\":" + " \"" + {title} + "\"" + "," + "\"currentMusicAlbum\":" + " \"" + {description} + "\"" + "," + "\"currentMusicArtist\":" + " \"" + {subtitle} + "\"" + "," + "\"currentMusicApp\":" + " \"" + {musicapp} + "\"" + "," + "\"currentMusicIcon\":" + " \"" + {icon} + "\"" + "," + "\"currentMusicState\":" + " \"" + {playback_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: daydream = "\"daydream\":" + " \"" + {daydream_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: daydream_state = "off" + + + + true + Script: daydream_state = "on" + + + + true + Script: deviceState = "\"deviceState\": \"online\""; fhemcmd = "setreading"; + + + + true + Script: dndValue = "alarmClockOnly" + + + + true + Script: dndValue = "always" + + + + true + Script: dndValue = "never" + + + + true + Script: dndValue = "onlyImportant" + + + + true + Script: dock_state = "docked" + + + + true + Script: dock_state = "undocked" + + + + true + Script: dockingState = "\"dockingState\":" + " \"" + {dock_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: doNotDisturb = "\"doNotDisturb\":" + " \"" + {dndValue} + "\""; fhemcmd = "setreading"; + + + + true + Script: flow_informations = "\"flow_informations\":" + " \"" + {informationFlow_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: flow_informations = "\"userFlowState\":" + " \"" + {flowState} + "\""; fhemcmd = "setreading"; + + + + true + Script: flow_SetCommands = "\"flow_SetCommands\":" + " \"" + {setCommandFlow_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: flowState = "active" + + + + true + Script: flowState = "inactive" + + + + true + Script: global_activetask = "none"; global_apssid = "none"; global_userflowstate = "none"; + + + + true + Script: global_amadid = getDate(); + + + + true + Script: global_bridgeport = {value} + + + + true + Script: global_fhemdevice = {value} + + + + true + Script: global_fhemip = {value} + + + + 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } + + + + true + Script: if(playback_state == 0) { playback_state = "keiner" } if(playback_state == 1) { playback_state = "gestoppt" } if(playback_state == 2) { playback_state = "pausiert" } if(playback_state == 3) { playback_state = "spielt ab" } if(playback_state == 4) { playback_state = "spult vorwärts" } if(playback_state == 5) { playback_state = "spült rückwärts" } if(playback_state == 6) { playback_state = "buffert" } if(playback_state == 7) { playback_state = "Fehler" } if(playback_state == 8) { playback_state = "verbindet" } if(playback_state == 9) { playback_state = "springt zum vorherigen" } if(playback_state == 10) { playback_state = "springt zum nächsten" } if(playback_state == 11) { playback_state = "springt zu Position in Wiedergabeliste" } + + + + true + Script: if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT") { nextalarmstate = "alert" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS") { nextalarmstate = "dismiss" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE") { nextalarmstate = "done" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE") { nextalarmstate = "snooze" } + + + + true + Script: incomingCaller = "\"incomingCallerName\":" + " \"" + {contact_name} + "\"" + "," + "\"incomingCallerNumber\":" + " \"" + {incoming_number} + "\""; fhemcmd = "setreading"; + + + + true + Script: incommingTelegramMessage = "\"incommingTelegramMessageFrom\":" + " \"" + {notification_text} + "\""; fhemcmd = "setreading"; + + + + true + Script: incommingWhatsAppMessage = "\"incommingWhatsAppMessageFrom\":" + " \"" + {notification_text} + "\""; fhemcmd = "setreading"; + + + + true + Script: informationFlow_state = "aktiv" + + + + true + Script: informationFlow_state = "inaktiv" + + + + true + Script: intentRadioState = "\"intentRadioState\":" + " \"" + {irstate} + "\"" + "," + "\"intentRadioName\":" + " \"" + {irname} + "\""; fhemcmd = "setreading"; + + + + true + Script: keyguard = "locked" + + + + true + Script: keyguard = "unlocked" + + + + true + Script: keyguardSet = "0" + + + + true + Script: keyguardSet = "1" + + + + true + Script: keyguardSet = "\"keyguardSet\":" + " \"" + {keyguardSet} + "\""; fhemcmd = "setreading"; + + + + true + Script: keyguardSet = "not supported from your device" + + + + true + Script: next_alarmday = "{next_alarm,dateformat,c}" + + + + true + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + + + + true + Script: nextAlarm = "\"nextAlarmTime\":" + " \"" + {next_alarmtime} + "\"" + "," + "\"nextAlarmDay\":" + " \"" + {next_alarmday} + "\""; fhemcmd = "setreading"; + + + + true + Script: nextAlarmState = "\"nextAlarmState\":" + " \"" + {nextalarmstate} + "\""; fhemcmd = "setreading"; + + + + true + 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" + + + + true + Script: notification_text = "Flowset Update: path for download not exist" + + + + true + Script: notification_text = "not supported from your device" + + + + true + Script: powerinfo = "\"powerLevel\":" + " \"" + "{battery_percentage,numberformat,0}" + "\"" + "," + "\"powerPlugged\":" + " \"" + {battery_plugged} + "\"" + "," + "\"batteryTemperature\":" + " \"" + "{battery_temperature/10.0,numberformat.0.0}" + "\"" + "," + "\"batteryHealth\":" + " \"" + {battery_health} + "\""; fhemcmd = "setreading"; + + + + true + Script: readingsvalcmd = "{global_fhemdevice} deviceState kaputt"; fhemcmd = "readingsval"; respfirstrun = "none"; + + + + true + Script: runTask = "0" + + + + true + Script: runTask = "1" + + + + true + Script: runTask = "not supported android version" + + + + true + Script: runTask = "null" + + + + true + Script: scrcount = 0 + + + + true + Script: scrcount = scrcount + 1 + + + + true + Script: screen = "\"screen\":" + " \"" + {screen_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: screen_orientation = "landscape" + + + + true + Script: screen_orientation = "portrait" + + + + true + Script: screen_orientation_mode = "auto" + + + + true + Script: screen_orientation_mode = "manual" + + + + true + Script: screen_state = "off {keyguard}" + + + + true + Script: screen_state = "off" + + + + true + Script: screen_state = "on {keyguard}" + + + + true + Script: screen_state = "on" + + + + true + Script: screenBrightness = "\"screenBrightness\":" + " \"" + {screenBrightness} + "\""; fhemcmd = "setreading"; + + + + true + Script: screenOrientation = "\"screenOrientation\":" + " \"" + {screen_orientation} + "\"" + "," + "\"screenOrientationMode\":" + " \"" + {screen_orientation_mode} + "\""; fhemcmd = "setreading"; + + + + false + Script: Set FHEMDATA JSON + + + + false + Script: Set FHEMDATA JSON First Run Assistant + + + + false + Script: Set FHEMREADINGSVALCMD JSON + + + + false + Script: Set FHEMSETCMD JSON + + + + false + Script: Set FHEMVOICEINPUTDATA JSON + + + + true + Script: setCommandFlow_state = "aktiv" + + + + true + Script: setCommandFlow_state = "inaktiv" + + + + true + Script: subtitle = "no player active"; title = "no player active"; description = "no player active"; musicapp = "no player active"; icon = "no player active" + + + + true + Script: udef_trigger = "setLockPin" + + + + true + Script: voiceinputdata = value; fhemcmd = "voiceinputvalue"; + + + + true + Script: voiceinputdata = {left(value, (indexOf(value, " und ")))}; fhemcmd = "voiceinputvalue"; + + + + true + Script: volume = {volumeBT} + + + + true + Script: volume = {volumeSP} + + + + true + Script: volumeNotification = "\"volumeNotification\":" + " \"" + {volumeNotification} + "\""; fhemcmd = "setreading"; + + + + true + Script: volumeRingSound = "\"volumeRingSound\":" + " \"" + {volumeRingSound} + "\""; fhemcmd = "setreading"; + + + + true + Script: volumevalue = "\"volume\":" + " \"" + {volume} + "\""; fhemcmd = "setreading"; + + + + false + Script: Zuordnung Mediaplayer + + + + true + Setze Alarm: um {param_hour}:{param_minute} + + {param_hour} + {param_minute} + + + false + true + + + true + Setze Display Helligkeit: {param_brightness} + false + {param_brightness} + false + 50 + true + + + true + Setze Display Orientierung: Auf Default zurücksetzen + UNSPECIFIED + false + + + true + Setze Display Orientierung: Landscape + LANDSCAPE + false + + + true + Setze Display Orientierung: Portrait + PORTRAIT + false + + + true + Setze Flow Status: Aktivieren Informations + true + Informations + + + + true + Setze Flow Status: Aktivieren Send Data to AMADCommBridge + true + Send Data to AMADCommBridge + + + + true + Setze Flow Status: Aktivieren SetCommands + true + SetCommands + + + + true + Setze Flow Status: Aktivieren SetCommands,Update AMAD Flowset,VoiceControl + true + SetCommands,Update AMAD Flowset,VoiceControl + + + + true + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + true + {imported_flow_names,listformat,comma} + + + + true + Setze Flow Status: Aktivieren {param_flowname} + true + {param_flowname} + + + + true + Setze Flow Status: Deaktivieren First Run Assistant + false + First Run Assistant + + + + true + Setze Flow Status: Deaktivieren {param_flowname} + false + {param_flowname} + + + + true + Setze Lock PIN/Passwort: PIN/Passwort zurücksetzen + true + PIN + false + param_lockPIN + + + true + Setze Lock PIN/Passwort: Setze PIN von Variable param_lockpin + false + PIN + false + param_lockpin + + + false + Setze Timer + + {param_minute}m + true + + + true + Setze Unterbrechnungen-Modus: Alle / Immer unterbrechen + NOTIFICATION_LISTENER + OFF + + + true + Setze Unterbrechnungen-Modus: Keine / Nicht unterbrechen + NOTIFICATION_LISTENER + NO_INTERRUPTIONS + + + true + Setze Unterbrechnungen-Modus: Nur Wecker (Android 6+) + NOTIFICATION_LISTENER + ALARMS_ONLY + + + true + Setze Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + NOTIFICATION_LISTENER + IMPORTANT_INTERRUPTIONS + + + false + Setze voice Variablen + + + + true + Setze Vollbild Modus: Auf Default zurücksetzen + UNSPECIFIED + false + + + true + Setze Vollbild Modus: Navigation nicht anzeigen + HIDE_NAVIGATION + false + + + true + SMS senden an: an {param_smsnumber} '{param_smsmessage}' (10 in 12h) + + {param_smsnumber} + {param_smsmessage} + true + true + 10 + 43200000 + false + false + true + 600000 + + + true + Sound: {param_notifypath}{param_notifyfile} als Benachrichtigung + FILE + Lautlos + {param_notifypath}{param_notifyfile} + NOTIFICATION + + false + true + true + TRANSIENT + + + true + Sprachausgabe: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + MUSIC + Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + false + Sprachausgabe: Deutsch + MUSIC + {param_message} + de_DE + true + 1.0 + true + {param_msgspeed} + true + false + false + true + TRANSIENT + + + true + Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device online. +Soll der Assistent gelöscht werden? + MUSIC + Die Einrichtung ist nun abgeschlossen und das Amaad Device online. +Soll der Assistent gelöscht werden? + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + true + Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Amaad, Flows aktiv sind. +Soll der Assistent gelöscht werden? + MUSIC + Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Amaad, Flows aktiv sind. +Soll der Assistent gelöscht werden? + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + true + Sprachausgabe: Du möchtest also nicht fortfahren. Das ist schade. Bitte bedenke das dieses Android Gerät somit nicht als Amaad Device in Fhem angelegt ist. Du kannst jeder Zeit den Assistenten Flow neu aktivieren und von vorn beginnen. +Auf Wiedersehen. + MUSIC + Du möchtest also nicht fortfahren. Das ist schade. Bitte bedenke das dieses Android Gerät somit nicht als Amaad Device in Fhem angelegt ist. Du kannst jeder Zeit den Assistenten Flow neu aktivieren und von vorn beginnen. +Auf Wiedersehen. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + false + Sprachausgabe: Englisch + MUSIC + {param_message} + en_US + true + 1.0 + true + {param_msgspeed} + true + false + false + true + TRANSIENT + + + true + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + MUSIC + In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + true + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + MUSIC + In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + true + Sprachausgabe: Leider scheint es ein Problem beim einrichten des Fhem Devices gegeben zu haben. Hast Du die Amaad Comm Bridge definiert? Und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an Cooltux alias Leon, im Fhem Forum. +Soll der Assistent gelöscht werden? + MUSIC + Leider scheint es ein Problem beim einrichten des Fhem Devices gegeben zu haben. Hast Du die Amaad Comm Bridge definiert? Und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an Cooltux alias Leon, im Fhem Forum. +Soll der Assistent gelöscht werden? + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + true + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + MUSIC + Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + true + Sprachausgabe: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + MUSIC + Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + false + Spracheingabe wurde nicht erkannt + NOTIFICATION + Ihre Eingabe wurde nicht verstanden + de_DE + true + 1.0 + true + 1.0 + true + false + false + true + TRANSIENT + + + true + Starte Daydream + + + true + URL in Browser öffnen: {param_url} (mit {param_browserapp}/{param_browserappclass}) + {param_url} + true + {param_browserapp} + {param_browserappclass} + + + + true + Vibrieren: Pattern 2 (-- --) + false + vibrate_pattern_2 + 0,500 + + + true + WLAN Reassoziieren + + + First Run Assistant + AMADNG Info/Control Flowset v3.9.52 + false + PARALLEL + + App Task Beendet: ch.gridvision.ppam.androidautomagic + + Medianlautstärken Speichern + Lautstärke einstellen: Medien auf Level 8 + Medienlautstärke Wiederherstellen + Medianlautstärken Speichern + Lautstärke einstellen: Medien auf Level 8 + AMAD Voice Control + Expression: value != "" + Expression: value == "ja" + Expression: value == "nein" + Medianlautstärken Speichern + Medianlautstärken Speichern + Lautstärke einstellen: Medien auf Level 8 + Lautstärke einstellen: Medien auf Level 8 + Flows löschen: First Run Assistant + Medienlautstärke Wiederherstellen + Lautstärke einstellen: Medien auf Level 8 + Medianlautstärken Speichern + Medianlautstärken Speichern + Lautstärke einstellen: Medien auf Level 8 + Expression: value == "nein" + Medianlautstärken Speichern + Expression: value != "" + Flows löschen: First Run Assistant + Lautstärke einstellen: Medien auf Level 8 + Medianlautstärken Speichern + Medienlautstärke Wiederherstellen + Lautstärke einstellen: Medien auf Level 8 + Expression: value == "ja" + AMAD Voice Control + Medienlautstärke Wiederherstellen + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device online. +Soll der Assistent gelöscht werden? + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + Medianlautstärken Speichern + Lautstärke einstellen: Medien auf Level 8 + Sprachausgabe: Leider scheint es ein Problem beim einrichten des Fhem Devices gegeben zu haben. Hast Du die Amaad Comm Bridge definiert? Und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an Cooltux alias Leon, im Fhem Forum. +Soll der Assistent gelöscht werden? + Medienlautstärke Wiederherstellen + AMAD Voice Control + Expression: value != "" + Expression: value == "ja" + Expression: value == "nein" + Medianlautstärken Speichern + Lautstärke einstellen: Medien auf Level 8 + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Medienlautstärke Wiederherstellen + Medienlautstärke Wiederherstellen + Lautstärke einstellen: Medien auf Level 8 + Medianlautstärken Speichern + Medianlautstärken Speichern + Lautstärke einstellen: Medien auf Level 8 + Medienlautstärke Wiederherstellen + Flows löschen: First Run Assistant + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Amaad, Flows aktiv sind. +Soll der Assistent gelöscht werden? + Abfrage + Medienlautstärke Wiederherstellen + Medienlautstärke Wiederherstellen + Script: amadcmd = "firstrun" + Script: amaddevice_ip = {value} + Eingabedialog: Android Device IP Adresse Einzeiliger Text Bitte gebe die IP Adresse Deines Androidgerätes an. NUR IP kein FQDN!!! + Script: global_fhemip = {value} + Eingabedialog: FHEM Server IP Einzeiliger Text Bitte gebe die IP Adresse oder den FQDN Deines FHEM Servers an. + Script: global_fhemdevice = {value} + Eingabedialog: FHEM Devicename Einzeiliger Text Wie soll das Device in FHEM heißen? + Script: global_bridgeport = {value} + Eingabedialog: AMADCommBridge Port Einzeiliger Text Bitte gebe den Port der AMADCommBridge vom FHEM Server an. + Medienlautstärke Wiederherstellen + Sprachausgabe: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + Lautstärke einstellen: Medien auf Level 8 + Medianlautstärken Speichern + Medienlautstärke Wiederherstellen + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Lautstärke einstellen: Medien auf Level 8 + Medianlautstärken Speichern + Expression: value == "nein" + Expression: value == "ja" + Medianlautstärken Speichern + Lautstärke einstellen: Medien auf Level 8 + Sprachausgabe: Du möchtest also nicht fortfahren. Das ist schade. Bitte bedenke das dieses Android Gerät somit nicht als Amaad Device in Fhem angelegt ist. Du kannst jeder Zeit den Assistenten Flow neu aktivieren und von vorn beginnen. +Auf Wiedersehen. + Medienlautstärke Wiederherstellen + Expression: value != "" + AMAD Voice Control + Medienlautstärke Wiederherstellen + AMAD First Run Assistent Begrüßung + Lautstärke einstellen: Medien auf Level 8 + Medianlautstärken Speichern + Setze Flow Status: Aktivieren Send Data to AMADCommBridge + Setze Flow Status: Deaktivieren First Run Assistant + Script: global_amadid = getDate(); + Script: global_activetask = "none"; global_apssid = "none"; global_userflowstate = "none"; + Setze Flow Status: Aktivieren Informations + Medienlautstärke Wiederherstellen + Medienlautstärke Wiederherstellen + Setze Flow Status: Aktivieren SetCommands,Update AMAD Flowset,VoiceControl + Pause: 2s (Gerät wach halten) + Script: readingsvalcmd = "{global_fhemdevice} deviceState kaputt"; fhemcmd = "readingsval"; respfirstrun = "none"; + Expression: respreadingsval != "kaputt" and respreadingsval != "none" + Expression: respreadingsval == "online" + Flows ausführen: Send Data to AMADCommBridge + Sprachausgabe: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + Lautstärke einstellen: Medien auf Level 8 + Medianlautstärken Speichern + Medienlautstärke Wiederherstellen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Informations + AMADNG Info/Control Flowset v3.9.52 + true + QUEUE + 900 + + Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE + Genereller Broadcast: wenn org.smblott.intentradio.STATE + Systemeinstellung verändert: System volume_music_headphone + Systemeinstellung verändert: System volume_music_headset + Stromversorgung: Angeschlossen + Bluetooth Status: Schaltet ein, Ein + Display Status: Aus + Display Orientierung: Portrait + Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE + Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS + Bluetooth Status: Schaltet aus, Aus + Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + Benachrichtigung in Statusbar angezeigt: com.whatsapp + Daydream Status: Gestoppt + Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic + Akku Ladestand: grösser als 0% + Eingehender Anruf. Status: Klingelt, Nummern: Alle + Display Status: Ein + Systemeinstellung verändert: System volume_music_speaker + Systemeinstellung verändert: System screen_brightness + Daydream Status: Gestartet + Dock Event: Docked + Systemeinstellung verändert: System volume_music_bt_a2dp + Unterbrechnungen-Modus: Alle / Immer unterbrechen + HTTP Request: /fhem-amad/deviceInfo/ + Periodischer Timer: alle 30s + Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT + Benachrichtigung in Statusbar angezeigt: org.telegram.messenger + Stromversorgung: Entfernt + Systemeinstellung verändert: System next_alarm + Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic + App Task Beendet + Unterbrechnungen-Modus: Keine / Nicht unterbrechen + Dock Event: Undocked + Display Orientierung: Landscape + Unterbrechnungen-Modus: Nur Wecker (Android 6+) + Flugmodus: Aus + Systemeinstellung verändert: System volume_ring_speaker + Systemeinstellung verändert: System volume_ring + Medien Session verändert + + Script: daydream_state = "on" + Script: daydream_state = "off" + Expression: airpcount < 11 + Script: keyguard = "unlocked" + Display Orientierung: Portrait + Script: screen_orientation = "portrait" + Script: screen_orientation = "landscape" + Script: dock_state = "docked" + Script: dock_state = "undocked" + Script: keyguardSet = "0" + Script: screen_orientation_mode = "manual" + Script: scrcount = 0 + Script: keyguard = "locked" + Expression: scrcount < 5 + Script: scrcount = scrcount + 1 + Pause: 2s (Gerät wach halten) + Script: airpcount = airpcount + 1 + Dock Status: Docked + Display automatisch drehen eingeschaltet + Expression: trigger == "Daydream Status: Gestartet" + Bluetooth eingeschaltet + Expression: trigger == "App Task Beendet" + Keyguard gesperrt + Expression: keyguard == "locked" + Expression: getAndroidSDKVersion() >= "16" + Script: keyguardSet = "not supported from your device" + Display eingeschaltet + Display eingeschaltet + Expression: getAndroidSDKVersion() >= "16" + Unterbrechnungen-Modus: Nur Wecker (Android 6+) + Unterbrechnungen-Modus: Keine / Nicht unterbrechen + Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + Unterbrechnungen-Modus: Alle / Immer unterbrechen + Script: dndValue = "always" + Script: dndValue = "onlyImportant" + Script: dndValue = "never" + Script: dndValue = "alarmClockOnly" + Script: screen_state = "on" + Script: screen_state = "off" + Script: screen_state = "on {keyguard}" + Script: screen_state = "off {keyguard}" + Script: airplanemode = "off" + Script: bluetooth_state = "on" + Script: androidVersion = "not supported funktion" + Expression: package_name == {global_activetask} + App Task läuft: {global_activetask} (neuster) + Script: runTask = "1" + Script: runTask = "0" + Expression: getAndroidSDKVersion() >= "19" + Script: runTask = "not supported android version" + Script: runTask = "null" + Expression: trigger == "Periodischer Timer: alle 30s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Periodischer Timer: alle 30s" + Expression: global_activetask != null + Expression: trigger == "Display Status: Aus" or trigger == "Display Status: Ein" or udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Daydream Status: Gestartet" or trigger == "Daydream Status: Gestoppt" + Expression: trigger == "Display Orientierung: Landscape" or trigger == "Display Orientierung: Portrait" or trigger == "Display Status: Ein" or trigger == "Display Status: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Dock Event: Docked" or trigger == "Dock Event: Undocked" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Akku Ladestand: grösser als 0%" + Stromversorgung: Angeschlossen + Script: screen_orientation_mode = "auto" + Script: bluetooth_state = "off" + Script: if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT") { nextalarmstate = "alert" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS") { nextalarmstate = "dismiss" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE") { nextalarmstate = "done" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE") { nextalarmstate = "snooze" } + Bluetooth Gerät verbunden: Beliebiges Geräte + Script: connected_devices_names = "none"; connected_devices_addresses = "none" + Expression: trigger == "Bluetooth Status: Schaltet aus, Aus" or trigger == "Bluetooth Status: Schaltet ein, Ein" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Keyguard mit Sicherheit + Script: keyguardSet = "1" + Expression: udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" + Expression: trigger == "Flugmodus: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Systemeinstellung verändert: System screen_brightness" + Bluetooth Gerät verbunden: Beliebiges Geräte (Advanced Audio Distribution) + Script: volume = {volumeBT} + Pause: 2s (Gerät wach halten) + Musik Aktiv + Benachrichtigung auf Bildschirm: [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! (lange) + Expression: trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" or trigger == "Systemeinstellung verändert: System volume_music_speaker" or trigger == "Systemeinstellung verändert: System volume_music_headphone" or trigger == "Systemeinstellung verändert: System volume_music_headset" + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth.2 + Script: volume = {volumeSP} + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker.2 + Expression: trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: getAndroidSDKVersion() >= "21" + Flow Aktiv: SetCommands + Script: setCommandFlow_state = "aktiv" + Script: setCommandFlow_state = "inaktiv" + Setze Flow Status: Aktivieren SetCommands + Script: flowState = "active" + Expression: global_userflowstate != "none" + Flow Aktiv: {global_userflowstate} + Expression: trigger == "Periodischer Timer: alle 30s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Periodischer Timer: alle 30s" + Script: flowState = "inactive" + Script: airpcount = 0 + Host erreichbar: {global_fhemip}:{global_bridgeport} + Pause: 2s (Gerät wach halten) + WLAN Reassoziieren + Expression: trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Systemeinstellung verändert: System next_alarm" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Initialisiere Variable Nächster Alarm: next_alarm + Script: next_alarmday = "{next_alarm,dateformat,c}" + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + Expression: global_fhemip != null or global_bridgeport != null + Expression: getAndroidSDKVersion() >= "19" + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + Script: notification_text = "not supported from your device" + Expression: getAndroidSDKVersion() >= "19" + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + Expression: trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" + Benachrichtigung in Statusbar angezeigt: WhatsApp + Script: notification_text = "not supported from your device" + Benachrichtigung in Statusbar angezeigt: Telegram Messenger + Host erreichbar: {global_fhemip}:{global_bridgeport} + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" + Initialisiere Variable Systemeinstellung: screenBrightness + Expression: trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Systemeinstellung verändert: System volume_ring_speaker" + Initialisiere Variable Systemeinstellung: volumeNotification + Expression: trigger == "Systemeinstellung verändert: System volume_ring" + Initialisiere Variable Systemeinstellung: volumeRingSound + Script: subtitle = "no player active"; title = "no player active"; description = "no player active"; musicapp = "no player active"; icon = "no player active" + Script: if(playback_state == 0) { playback_state = "keiner" } if(playback_state == 1) { playback_state = "gestoppt" } if(playback_state == 2) { playback_state = "pausiert" } if(playback_state == 3) { playback_state = "spielt ab" } if(playback_state == 4) { playback_state = "spult vorwärts" } if(playback_state == 5) { playback_state = "spült rückwärts" } if(playback_state == 6) { playback_state = "buffert" } if(playback_state == 7) { playback_state = "Fehler" } if(playback_state == 8) { playback_state = "verbindet" } if(playback_state == 9) { playback_state = "springt zum vorherigen" } if(playback_state == 10) { playback_state = "springt zum nächsten" } if(playback_state == 11) { playback_state = "springt zu Position in Wiedergabeliste" } + Expression: trigger == "Medien Session verändert" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } + Get Android Version + WLAN verfügbar: {global_apssid} + Script: volumeRingSound = "\"volumeRingSound\":" + " \"" + {volumeRingSound} + "\""; fhemcmd = "setreading"; + Script: intentRadioState = "\"intentRadioState\":" + " \"" + {irstate} + "\"" + "," + "\"intentRadioName\":" + " \"" + {irname} + "\""; fhemcmd = "setreading"; + Script: incommingTelegramMessage = "\"incommingTelegramMessageFrom\":" + " \"" + {notification_text} + "\""; fhemcmd = "setreading"; + Script: incommingWhatsAppMessage = "\"incommingWhatsAppMessageFrom\":" + " \"" + {notification_text} + "\""; fhemcmd = "setreading"; + Script: incomingCaller = "\"incomingCallerName\":" + " \"" + {contact_name} + "\"" + "," + "\"incomingCallerNumber\":" + " \"" + {incoming_number} + "\""; fhemcmd = "setreading"; + Script: keyguardSet = "\"keyguardSet\":" + " \"" + {keyguardSet} + "\""; fhemcmd = "setreading"; + Script: dockingState = "\"dockingState\":" + " \"" + {dock_state} + "\""; fhemcmd = "setreading"; + Script: screenOrientation = "\"screenOrientation\":" + " \"" + {screen_orientation} + "\"" + "," + "\"screenOrientationMode\":" + " \"" + {screen_orientation_mode} + "\""; fhemcmd = "setreading"; + Script: screenBrightness = "\"screenBrightness\":" + " \"" + {screenBrightness} + "\""; fhemcmd = "setreading"; + Script: daydream = "\"daydream\":" + " \"" + {daydream_state} + "\""; fhemcmd = "setreading"; + Script: nextAlarm = "\"nextAlarmTime\":" + " \"" + {next_alarmtime} + "\"" + "," + "\"nextAlarmDay\":" + " \"" + {next_alarmday} + "\""; fhemcmd = "setreading"; + Script: volumevalue = "\"volume\":" + " \"" + {volume} + "\""; fhemcmd = "setreading"; + Script: volumeNotification = "\"volumeNotification\":" + " \"" + {volumeNotification} + "\""; fhemcmd = "setreading"; + Script: btdeviceinfo = "\"connectedBTdevices\":" + " \"" + {connected_devices_names} + "\"" + "," + "\"connectedBTdevicesMAC\":" + " \"" + {connected_devices_addresses} + "\""; fhemcmd = "setreading"; + Script: bluetooth = "\"bluetooth\":" + " \"" + {bluetooth_state} + "\""; fhemcmd = "setreading"; + Script: airplanemode = "\"airplanemode\":" + " \"" + {airplanemode} + "\""; fhemcmd = "setreading"; + Script: screen = "\"screen\":" + " \"" + {screen_state} + "\""; fhemcmd = "setreading"; + Script: nextAlarmState = "\"nextAlarmState\":" + " \"" + {nextalarmstate} + "\""; fhemcmd = "setreading"; + Script: doNotDisturb = "\"doNotDisturb\":" + " \"" + {dndValue} + "\""; fhemcmd = "setreading"; + Script: flow_informations = "\"userFlowState\":" + " \"" + {flowState} + "\""; fhemcmd = "setreading"; + Script: flow_SetCommands = "\"flow_SetCommands\":" + " \"" + {setCommandFlow_state} + "\""; fhemcmd = "setreading"; + Script: checkActiveTask = "\"checkActiveTask\":" + " \"" + {runTask} + "\""; fhemcmd = "setreading"; + Script: deviceState = "\"deviceState\": \"online\""; fhemcmd = "setreading"; + Expression: Leon == "Gaultier" + Flows löschen: MultimediaControl + Script: androidVersion = "\"androidVersion\":" + " \"" + {androidVersion} + "\""; fhemcmd = "setreading"; + Script: powerinfo = "\"powerLevel\":" + " \"" + "{battery_percentage,numberformat,0}" + "\"" + "," + "\"powerPlugged\":" + " \"" + {battery_plugged} + "\"" + "," + "\"batteryTemperature\":" + " \"" + "{battery_temperature/10.0,numberformat.0.0}" + "\"" + "," + "\"batteryHealth\":" + " \"" + {battery_health} + "\""; fhemcmd = "setreading"; + Prüfe und setze globale Variable + Flows ausführen: Send Data to AMADCommBridge + Script: currentMusic = "\"currentMusicTrack\":" + " \"" + {title} + "\"" + "," + "\"currentMusicAlbum\":" + " \"" + {description} + "\"" + "," + "\"currentMusicArtist\":" + " \"" + {subtitle} + "\"" + "," + "\"currentMusicApp\":" + " \"" + {musicapp} + "\"" + "," + "\"currentMusicIcon\":" + " \"" + {icon} + "\"" + "," + "\"currentMusicState\":" + " \"" + {playback_state} + "\""; fhemcmd = "setreading"; + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: getAndroidSDKVersion() >= "19" + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + Benachrichtigung in Statusbar angezeigt: Automagic + Script: notification_text = "not supported from your device" + Script: automagicState = "\"automagicState\":" + " \"" + {content_title} + "\""; fhemcmd = "setreading"; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Send Data to AMADCommBridge + AMADNG Info/Control Flowset v3.9.52 + true + PARALLEL + 900 + + Expression: fhemcmd == "set" + Expression: fhemcmd == "voiceinputvalue" + Expression: amadcmd == "firstrun" + Expression: fhemcmd == "readingsval" + Host erreichbar: {global_fhemip}:{global_bridgeport} + Script: Set FHEMSETCMD JSON + Script: Set FHEMVOICEINPUTDATA JSON + Script: Set FHEMREADINGSVALCMD JSON + HTTP Request: send READINGS data to AMADCommBridge JSON + HTTP Request: send VOICEINPUTVALUE data to AMADCommBridge + Expression: fhemcmd == "setreading" + Script: Set FHEMDATA JSON First Run Assistant + HTTP Request: send FIRSTRUN data to AMADCommBridge JSON + HTTP Request: send SET data to AMADCommBridge JSON + HTTP Request: send READINGSVAL data to AMADCommBridge JSON + Script: Set FHEMDATA JSON + + + + + + + + + + + + + + + + + + + SetCommands + AMADNG Info/Control Flowset v3.9.52 + true + QUEUE + 900 + + Periodischer Timer: alle 30s + HTTP Request: /fhem-amad/deviceInfo/ + Sprachbefehl angefordert + HTTP Request: /fhem-amad/setCommands/* + + Expression: setBrightness" + Expression: setScreenFullscreen" + Expression: param_orientation == "auto" + Setze Display Orientierung: Portrait + Setze Display Orientierung: Landscape + Expression: param_orientation == "landscape" + Setze Vollbild Modus: Navigation nicht anzeigen + Setze Vollbild Modus: Auf Default zurücksetzen + Setze Display Orientierung: Auf Default zurücksetzen + Display automatisch drehen ein-/ausschalten: Aus + Display automatisch drehen ein-/ausschalten: Ein + Expression: setScreenOrientation" + Expression: param_fullscreen == "off" + Expression: param_bluetooth == "off" + Expression: param_bluetooth == "on" + Bluetooth ein-/ausschalten: Ein + Bluetooth eingeschaltet + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} + Pause: 3s (Gerät wach halten) + Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} + Pause: 2s (Gerät wach halten) + Expression: setBTDevice" + Bluetooth ein-/ausschalten: Aus + Expression: param_orientation == "portrait" + Expression: setVoiceCommand" + Setze Display Helligkeit: {param_brightness} + Expression: setScreenlock" + Expression: sendIntent" + Expression: param_lockmod == "lock" + Setze Lock PIN/Passwort: PIN/Passwort zurücksetzen + Setze Lock PIN/Passwort: Setze PIN von Variable param_lockpin + Expression: trigger == "Sprachbefehl angefordert" + Expression: setAlarm" + Setze Timer + Expression: screenMsg" + Benachrichtigung auf Bildschirm: {param_message} (lange) + Script: udef_trigger = "setLockPin" + Flows ausführen: udef_trigger setLockPin + Display eingeschaltet + Gerät sperren + Schalte Display ein + Gerät sperren + Expression: setTimer" + Expression: param_option + Pause: {param_hanguptime}s (Gerät wach halten) + Anruf beenden + Broadcast senden: {param_action} + URL in Browser öffnen: {param_url} (mit {param_browserapp}/{param_browserappclass}) + Setze Unterbrechnungen-Modus: Alle / Immer unterbrechen + Setze Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + Setze Unterbrechnungen-Modus: Keine / Nicht unterbrechen + Setze Unterbrechnungen-Modus: Nur Wecker (Android 6+) + Expression: openURL" + Expression: param_fullscreen == "on" + Expression: do not Disturb" + Expression: param_disturbmod == "always" + Expression: param_disturbmod == "onlyImportant" + Expression: param_disturbmod == "never" + Expression: param_disturbmod == "alarmClockOnly" + Expression: setBluetooth" + Script: informationFlow_state = "aktiv" + Script: informationFlow_state = "inaktiv" + Host erreichbar: {global_fhemip}:{global_bridgeport} + Expression: ttsMsg" + Expression: param_screen=="on" + Expression: setScreenOnOff" + Gerät sperren + Expression: param_screen=="off" + Expression: openApp" + App Task läuft: App (neuster) + Expression: setVolume" + App Starten: App + Dateien löschen: /storage/emulated/0/Download/installFlow_{param_flowname} + Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} + Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} + Script: notification_text = "Flow install: path for download not exist" + Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download + Flows/Widgets importieren: /storage/emulated/0/Download/installFlow_{param_flowname} + Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/sdcard0) + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/sdcard) + Expression: installFlow" + Neustart + Expression: Reboot + Expression: System Command" + Expression: Shutdown + Expression: Airplanemode + Script: airplanemode = "airplanemode@@on"; fhemcmd = "setreading"; + Flows ausführen: Send Data to AMADCommBridge mit warten + Flugmodus ein-/ausschalten: Ein + Herunterfahren + Notification Lautstärke Wiederherstellen + Expression: param_notifyfile == "RedAlert.mp3" + Benachrichtigung aus Statusbar entfernen: Alle + Benachrichtigung aus Statusbar entfernen: Alle (Automagic) + Expression: Automagic + Expression: All + Expression: notifysnd" + NotificationLautstärke auf Level 7 + Notification Lautstärke Speichern + Expression: param_notifyfile == "RedAlert.mp3" + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Expression: Clear Automagic Meldungen" + Expression: setVibrate" + Vibrieren: Pattern 2 (-- --) + Audio Player steuern: Medienknopf Zurück ({pname}/{kname}) + Expression: param_button == "stop" + Expression: param_button == "next" + Expression: param_button == "back" + Schalte Display ein: Hell für {param_screenontime}s + Expression: ttsMsgLang" + Expression: global_fhemip != null or global_bridgeport != null + Setze Alarm: um {param_hour}:{param_minute} + Audio Player steuern: Medienknopf Weiter ({pname}/{kname}) + Expression: openCall" + Nummer anrufen: {param_callnumber} + Expression: sendSms" + Expression: param_flowstate == "active" or param_flowstate == "inactive" + Expression: param_flowstate == "active" + SMS senden an: an {param_smsnumber} '{param_smsmessage}' (10 in 12h) + Setze Flow Status: Deaktivieren {param_flowname} + Setze Flow Status: Aktivieren {param_flowname} + Script: notification_text = "Flow '{param_flowname}' has been set {param_flowstate}" + Expression: flowState" + Expression: closeCall" + Audio Player steuern: Medienknopf Stopp ({pname}/{kname}) + Expression: multimediaControl" + Starte Daydream + Expression: startDaydream" + Lautstärken setzen param_volume + Expression: setNotifiVolume" + Lautstärken setzen param_notifivolume + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + Expression: setRingSoundVolume" + Lautstärken setzen param_ringsoundvolume + Expression: param_button == "play/pause" + Audio Player steuern: Medienknopf Play/Pause (/{kname}) + Script: Zuordnung Mediaplayer + Sound: {param_notifypath}{param_notifyfile} als Benachrichtigung + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/emulated/0/Download + Script: flow_informations = "\"flow_informations\":" + " \"" + {informationFlow_state} + "\""; fhemcmd = "setreading"; + Script: automagicState = "\"automagicState\":" + " \"" + {content_title} + "\""; fhemcmd = "setreading"; + Script: automagicState = "\"automagicState\":" + " \"" + {content_title} + "\""; fhemcmd = "setreading"; + Flows ausführen: Send Data to AMADCommBridge + Sprachausgabe: Englisch + Sprachausgabe: Deutsch + Flow Aktiv: Informations + Setze Flow Status: Aktivieren Informations + Flows ausführen: VoiceControl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Update AMAD Flowset + AMADNG Info/Control Flowset v3.9.52 + true + QUEUE + + HTTP Request: /fhem-amad/currentFlowsetUpdate + + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Dateien löschen: /storage/emulated/0/Download/currentFlowsetUpdate.xml + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Dateien löschen: /storage/sdcard0/Download/currentFlowsetUpdate.xml + Flows/Widgets importieren: /storage/sdcard0/Download/currentFlowsetUpdate.xml + Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /storage/sdcard0/Download + Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /sdcard/Download + Flows/Widgets importieren: /sdcard/Download/currentFlowsetUpdate.xml + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Dateien löschen: /sdcard/Download/currentFlowsetUpdate.xml + Script: notification_text = "Flowset Update: path for download not exist" + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/sdcard0) + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/sdcard) + Flows ausführen: Send Data to AMADCommBridge + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) + Script: automagicState = "\"automagicState\":" + " \"" + {content_title} + "\""; fhemcmd = "setreading"; + Prüfe und setze Bridgeport Variable + Flows/Widgets importieren: /storage/emulated/0/Download/currentFlowsetUpdate.xml + Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /storage/emulated/0/Download + + + + + + + + + + + + + + + + + + + + + + + + + VoiceControl + AMADNG Info/Control Flowset v3.9.52 + true + QUEUE + + Flows ausführen: Send Data to AMADCommBridge + Benachrichtigung auf Bildschirm: {value} (lange) + Spracheingabe wurde nicht erkannt + Flows ausführen: Send Data to AMADCommBridge + Setze voice Variablen + Script: voiceinputdata = value; fhemcmd = "voiceinputvalue"; + Script: voiceinputdata = {left(value, (indexOf(value, " und ")))}; fhemcmd = "voiceinputvalue"; + Expression: contains(value, " und ") + AMAD Voice Control + Expression: value != "" + + + + + + + + + + + + + \ No newline at end of file From 04e73fd3c2d8958054c2951364ba5528aa72d7cb Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 1 Jun 2017 21:25:07 +0200 Subject: [PATCH 07/32] =?UTF-8?q?diverse=20Flowanpassungen,=20Bugfixes=20f?= =?UTF-8?q?=C3=BCr=20null=20Values?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 73_AMADCommBridge.pm | 84 +- 74_AMADDevice.pm | 28 +- ....xml => 74_AMADautomagicFlowset_3.9.55.xml | 1492 +++++++++-------- 3 files changed, 793 insertions(+), 811 deletions(-) rename 74_AMADautomagicFlowset_3.9.52.xml => 74_AMADautomagicFlowset_3.9.55.xml (81%) diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index 549e4c4..78ebed3 100644 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -68,8 +68,8 @@ use TcpServerUtils; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.52"; -my $flowsetversion = "3.9.52"; +my $modulversion = "3.9.55"; +my $flowsetversion = "3.9.55"; @@ -111,7 +111,6 @@ sub AMADCommBridge_Initialize($) { $hash->{AttrFn} = "AMADCommBridge_Attr"; $hash->{AttrList} = "expertMode:1 ". - "port ". "disable:1 ". $readingFnAttributes; @@ -196,29 +195,6 @@ sub AMADCommBridge_Attr(@) { } } - elsif( $attrName eq "port" ) { - if( $cmd eq "set" ) { - - $hash->{PORT} = $attrVal; - - delete $modules{AMADCommBridge}{defptr}{BRIDGE}; - TcpServer_Close( $hash ); - Log3 $name, 3, "AMADCommBridge ($name) - CommBridge Port changed. CommBridge are closed and new open!"; - - AMADCommBridge_CommBridge_Open( $hash ); - - } else { - - $hash->{PORT} = 8090; - - delete $modules{AMADCommBridge}{defptr}{BRIDGE}; - TcpServer_Close( $hash ); - Log3 $name, 3, "AMADCommBridge ($name) - CommBridge Port changed. CommBridge are closed and new open!"; - - AMADCommBridge_Open( $hash ); - } - } - return undef; } @@ -286,14 +262,14 @@ sub AMADCommBridge_ErrorHandling($$$) { if( $dhash->{helper}{infoErrorCounter} > 0 ) { readingsBeginUpdate( $dhash ); - readingsBulkUpdate( $dhash, "lastStatusRequestState", "statusRequest_error" ); + readingsBulkUpdateIfChanged( $dhash, "lastStatusRequestState", "statusRequest_error", 1 ); if( ReadingsVal( $dname, "flow_Informations", "active" ) eq "inactive" && ReadingsVal( $dname, "flow_SetCommands", "active" ) eq "inactive" ) { Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; - readingsBulkUpdate( $dhash, "deviceState", "offline" ); - readingsBulkUpdate ( $dhash, "state", "AMAD Flows inactive, device set offline"); + readingsBulkUpdateIfChanged( $dhash, "deviceState", "offline", 1 ); + readingsBulkUpdateIfChanged ( $dhash, "state", "AMAD Flows inactive, device set offline",1); } elsif( $dhash->{helper}{infoErrorCounter} > 7 && $dhash->{helper}{setCmdErrorCounter} > 4 ) { @@ -301,7 +277,7 @@ sub AMADCommBridge_ErrorHandling($$$) { Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; $attr{$dname}{disable} = 1; - readingsBulkUpdate ( $dhash, "state", "Unknown Error, device disabled"); + readingsBulkUpdateIfChanged ( $dhash, "state", "Unknown Error, device disabled", 1); $dhash->{helper}{infoErrorCounter} = 0; $dhash->{helper}{setCmdErrorCounter} = 0; @@ -318,8 +294,8 @@ sub AMADCommBridge_ErrorHandling($$$) { Log3 $dname, 5, "AMADCommBridge ($dname) - statusRequestERROR: To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; - readingsBulkUpdate( $dhash, "deviceState", "offline" ); - readingsBulkUpdate ( $dhash, "state", "To many Errors, device set offline"); + readingsBulkUpdateIfChanged( $dhash, "deviceState", "offline", 1 ); + readingsBulkUpdateIfChanged ( $dhash, "state", "To many Errors, device set offline", 1); $dhash->{helper}{infoErrorCounter} = 0; } @@ -335,10 +311,10 @@ sub AMADCommBridge_ErrorHandling($$$) { if( $err ne "" ) { readingsBeginUpdate( $dhash ); - readingsBulkUpdate ( $dhash, "state", "$err") if( ReadingsVal( $dname, "state", 1 ) ne "initialized" ); + readingsBulkUpdateIfChanged ( $dhash, "state", "$err") if( ReadingsVal( $dname, "state", 1 ) ne "initialized" ); $dhash->{helper}{infoErrorCounter} = ( $dhash->{helper}{infoErrorCounter} + 1 ); - readingsBulkUpdate( $dhash, "lastStatusRequestState", "statusRequest_error" ); + readingsBulkUpdateIfChanged( $dhash, "lastStatusRequestState", "statusRequest_error", 1 ); if( $err =~ /timed out/ ) { @@ -365,10 +341,10 @@ sub AMADCommBridge_ErrorHandling($$$) { if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { readingsBeginUpdate( $dhash ); - readingsBulkUpdate ( $dhash, "state", $param->{code} ) if( ReadingsVal( $dname, "state", 1 ) ne "initialized" ); + readingsBulkUpdateIfChanged ( $dhash, "state", $param->{code}, 1 ) if( ReadingsVal( $dname, "state", 1 ) ne "initialized" ); $dhash->{helper}{infoErrorCounter} = ( $dhash->{helper}{infoErrorCounter} + 1 ); - readingsBulkUpdate( $dhash, "lastStatusRequestState", "statusRequest_error" ); + readingsBulkUpdateIfChanged( $dhash, "lastStatusRequestState", "statusRequest_error", 1 ); if( $param->{code} ne 200 ) { @@ -384,10 +360,10 @@ sub AMADCommBridge_ErrorHandling($$$) { if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { readingsBeginUpdate( $dhash ); - readingsBulkUpdate( $dhash, "state", $param->{code} ) if( ReadingsVal( $dname, "state" ,0) ne "initialized" ); + readingsBulkUpdateIfChanged( $dhash, "state", $param->{code}, 1 ) if( ReadingsVal( $dname, "state" ,0) ne "initialized" ); $dhash->{helper}{infoErrorCounter} = ( $dhash->{helper}{infoErrorCounter} + 1 ); - readingsBulkUpdate( $dhash, "lastStatusRequestState", "statusRequest_error" ); + readingsBulkUpdateIfChanged( $dhash, "lastStatusRequestState", "statusRequest_error", 1 ); if( $param->{code} eq 404 && ReadingsVal( $dname, "flow_Informations", "inactive" ) eq "inactive" ) { @@ -421,14 +397,14 @@ sub AMADCommBridge_ErrorHandling($$$) { if( $dhash->{helper}{setCmdErrorCounter} > 2 ) { readingsBeginUpdate( $dhash ); - readingsBulkUpdate( $dhash, "lastSetCommandState", "statusRequest_error" ); + readingsBulkUpdateIfChanged( $dhash, "lastSetCommandState", "statusRequest_error", 1 ); if( ReadingsVal( $dname, "flow_Informations", "active" ) eq "inactive" && ReadingsVal( $dname, "flow_SetCommands", "active" ) eq "inactive" ) { Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: CHECK THE LAST ERROR READINGS FOR MORE INFO, DEVICE IS SET OFFLINE"; - readingsBulkUpdate( $dhash, "deviceState", "offline" ); - readingsBulkUpdate( $dhash, "state", "AMAD Flows inactive, device set offline" ); + readingsBulkUpdateIfChanged( $dhash, "deviceState", "offline", 1 ); + readingsBulkUpdateIfChanged( $dhash, "state", "AMAD Flows inactive, device set offline", 1 ); } elsif( $dhash->{helper}{infoErrorCounter} > 7 && $dhash->{helper}{setCmdErrorCounter} > 4 ) { @@ -436,7 +412,7 @@ sub AMADCommBridge_ErrorHandling($$$) { Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: UNKNOWN ERROR, PLEASE CONTACT THE DEVELOPER, DEVICE DISABLED"; $attr{$dname}{disable} = 1; - readingsBulkUpdate( $dhash, "state", "Unknown Error, device disabled" ); + readingsBulkUpdateIfChanged( $dhash, "state", "Unknown Error, device disabled", 1 ); $dhash->{helper}{infoErrorCounter} = 0; $dhash->{helper}{setCmdErrorCounter} = 0; @@ -452,8 +428,8 @@ sub AMADCommBridge_ErrorHandling($$$) { Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: To many Errors please check your Network or Device Configuration, DEVICE IS SET OFFLINE"; - readingsBulkUpdate( $dhash, "deviceState", "offline" ); - readingsBulkUpdate( $dhash, "state", "To many Errors, device set offline" ); + readingsBulkUpdateIfChanged( $dhash, "deviceState", "offline", 1 ); + readingsBulkUpdateIfChanged( $dhash, "state", "To many Errors, device set offline", 1 ); $dhash->{helper}{setCmdErrorCounter} = 0; } @@ -468,10 +444,10 @@ sub AMADCommBridge_ErrorHandling($$$) { if( defined( $err ) ) { if( $err ne "" ) { readingsBeginUpdate( $dhash ); - readingsBulkUpdate( $dhash, "state", $err ) if( ReadingsVal( $dname, "state", 0 ) ne "initialized" ); + readingsBulkUpdateIfChanged( $dhash, "state", $err, 1 ) if( ReadingsVal( $dname, "state", 0 ) ne "initialized" ); $dhash->{helper}{setCmdErrorCounter} = ($dhash->{helper}{setCmdErrorCounter} + 1); - readingsBulkUpdate( $dhash, "lastSetCommandState", "setCmd_error" ); + readingsBulkUpdateIfChanged( $dhash, "lastSetCommandState", "setCmd_error", 1 ); if( $err =~ /timed out/ ) { @@ -498,11 +474,11 @@ sub AMADCommBridge_ErrorHandling($$$) { if( $data eq "" and exists( $param->{code} ) && $param->{code} ne 200 ) { readingsBeginUpdate( $dhash ); - readingsBulkUpdate( $dhash, "state", $param->{code} ) if( ReadingsVal( $dhash, "state", 0 ) ne "initialized" ); + readingsBulkUpdateIfChanged( $dhash, "state", $param->{code}, 1 ) if( ReadingsVal( $dhash, "state", 0 ) ne "initialized" ); $dhash->{helper}{setCmdErrorCounter} = ( $dhash->{helper}{setCmdErrorCounter} + 1 ); - readingsBulkUpdate($dhash, "lastSetCommandState", "setCmd_error" ); + readingsBulkUpdateIfChanged($dhash, "lastSetCommandState", "setCmd_error", 1 ); readingsEndUpdate( $dhash, 1 ); @@ -514,15 +490,15 @@ sub AMADCommBridge_ErrorHandling($$$) { if( ( $data =~ /Error/i ) and exists( $param->{code} ) ) { readingsBeginUpdate( $dhash ); - readingsBulkUpdate( $dhash, "state", $param->{code} ) if( ReadingsVal( $dname, "state", 0 ) ne "initialized" ); + readingsBulkUpdateIfChanged( $dhash, "state", $param->{code}, 1 ) if( ReadingsVal( $dname, "state", 0 ) ne "initialized" ); $dhash->{helper}{setCmdErrorCounter} = ( $dhash->{helper}{setCmdErrorCounter} + 1 ); - readingsBulkUpdate( $dhash, "lastSetCommandState", "setCmd_error" ); + readingsBulkUpdateIfChanged( $dhash, "lastSetCommandState", "setCmd_error", 1 ); if( $param->{code} eq 404 ) { - readingsBulkUpdate( $dhash, "lastSetCommandError", "" ); + readingsBulkUpdateIfChanged( $dhash, "lastSetCommandError", "", 1 ); Log3 $dname, 5, "AMADCommBridge ($dname) - setCommandERROR: setCommands flow is inactive on your device!"; } else { @@ -728,7 +704,7 @@ sub AMADCommBridge_ResponseProcessing($$) { $decode_json = eval{decode_json($json)}; if($@){ - Log3 $bname, 3, "AMADCommBridge ($name) - ERROR while request: $@"; + Log3 $bname, 4, "AMADCommBridge ($name) - ERROR while request: $@"; readingsSingleUpdate($bhash, "JSON info", "JSON ERROR", 1); $response = "header lines: \r\n AMADCommBridge receive a JSON error\r\n AMADCommBridge to do nothing\r\n"; $c = $hash->{CD}; @@ -816,8 +792,8 @@ sub AMADCommBridge_ResponseProcessing($$) { my $fhemCmd = $decode_json->{payload}{voiceinputdata}; readingsBeginUpdate( $bhash); - readingsBulkUpdate( $bhash, "receiveVoiceCommand", $fhemCmd ); - readingsBulkUpdate( $bhash, "receiveVoiceDevice", $fhemDevice ); + readingsBulkUpdateIfChanged( $bhash, "receiveVoiceCommand", $fhemCmd, 1 ); + readingsBulkUpdateIfChanged( $bhash, "receiveVoiceDevice", $fhemDevice, 1 ); readingsEndUpdate( $bhash, 1 ); Log3 $bname, 4, "AMADCommBridge ($name) - AMADCommBridge_CommBridge: set reading receive voice command: $fhemCmd from Device $fhemDevice"; diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index 2b78ec1..9ae21e4 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -54,8 +54,8 @@ use Encode qw(encode); eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.52"; -my $flowsetversion = "3.9.52"; +my $modulversion = "3.9.55"; +my $flowsetversion = "3.9.55"; @@ -178,8 +178,8 @@ sub AMADDevice_Define($$) { $attr{$name}{room} = "AMAD" if( !defined( $attr{$name}{room} ) ); readingsBeginUpdate($hash); - readingsBulkUpdate( $hash, "state", "initialized"); - readingsBulkUpdate( $hash, "deviceState", "unknown"); + readingsBulkUpdateIfChanged( $hash, "state", "initialized",1); + readingsBulkUpdateIfChanged( $hash, "deviceState", "unknown",1); readingsEndUpdate($hash,1); @@ -376,7 +376,7 @@ sub AMADDevice_WriteReadings($$) { #### schreiben der Readings Log3 $name, 5, "AMADDevice ($name) - Processing data: $decode_json"; - readingsSingleUpdate( $hash, "state", "active", 1) if( ReadingsVal( $name, "state", 0 ) ne "initialized" or ReadingsVal( $name, "state", 0 ) ne "active" ); + readingsSingleUpdate( $hash, "state", "active", 1) if( ReadingsVal( $name, "state", 0 ) ne "initialized" and ReadingsVal( $name, "state", 0 ) ne "active" ); ### Event Readings my $t; @@ -386,20 +386,22 @@ sub AMADDevice_WriteReadings($$) { readingsBeginUpdate($hash); while( ( $t, $v ) = each %{$decode_json->{payload}} ) { - readingsBulkUpdate( $hash, $t, $v ) if( defined( $v ) ); + $v =~ s/\bnull\b/off/g if( ($t eq "nextAlarmDay" or $t eq "nextAlarmTime") and $v eq "null" ); $v =~ s/\bnull\b//g; + + readingsBulkUpdateIfChanged( $hash, $t, $v, 1 ) if( defined( $v ) ); } - readingsBulkUpdate( $hash, "deviceState", "offline" ) if( $decode_json->{payload}{airplanemode} && $decode_json->{payload}{airplanemode} eq "on" ); - readingsBulkUpdate( $hash, "deviceState", "online" ) if( $decode_json->{payload}{airplanemode} && $decode_json->{payload}{airplanemode} eq "off" ); + readingsBulkUpdateIfChanged( $hash, "deviceState", "offline", 1 ) if( $decode_json->{payload}{airplanemode} && $decode_json->{payload}{airplanemode} eq "on" ); + readingsBulkUpdateIfChanged( $hash, "deviceState", "online", 1 ) if( $decode_json->{payload}{airplanemode} && $decode_json->{payload}{airplanemode} eq "off" ); - readingsBulkUpdate( $hash, "lastStatusRequestState", "statusRequest_done" ); + readingsBulkUpdateIfChanged( $hash, "lastStatusRequestState", "statusRequest_done", 1 ); $hash->{helper}{infoErrorCounter} = 0; ### End Response Processing - readingsBulkUpdate( $hash, "state", "active" ) if( ReadingsVal( $name, "state", 0 ) eq "initialized" ); + readingsBulkUpdateIfChanged( $hash, "state", "active", 1 ) if( ReadingsVal( $name, "state", 0 ) eq "initialized" ); readingsEndUpdate( $hash, 1 ); $hash->{helper}{deviceStateErrorCounter} = 0 if( $hash->{helper}{deviceStateErrorCounter} > 0 and ReadingsVal( $name, "deviceState", "offline") eq "online" ); @@ -790,14 +792,14 @@ sub AMADDevice_checkDeviceState($) { RemoveInternalTimer( $hash ); - if( ReadingsAge( $name, "deviceState", 90 ) > 90 ) { + if( ReadingsAge( $name, "deviceState", 240 ) > 240 ) { AMADDevice_statusRequest( $hash ) if( $hash->{helper}{deviceStateErrorCounter} == 0 ); - readingsSingleUpdate( $hash, "deviceState", "offline", 1 ) if( ReadingsAge( $name, "deviceState", 180) > 180 and $hash->{helper}{deviceStateErrorCounter} > 0 ); + readingsSingleUpdate( $hash, "deviceState", "offline", 1 ) if( ReadingsAge( $name, "deviceState", 300) > 300 and $hash->{helper}{deviceStateErrorCounter} > 0 ); $hash->{helper}{deviceStateErrorCounter} = ( $hash->{helper}{deviceStateErrorCounter} + 1 ); } - InternalTimer( gettimeofday()+90, "AMADDevice_checkDeviceState", $hash, 0 ); + InternalTimer( gettimeofday()+240, "AMADDevice_checkDeviceState", $hash, 0 ); Log3 $name, 4, "AMADDevice ($name) - AMADDevice_checkDeviceState: set new Timer"; } diff --git a/74_AMADautomagicFlowset_3.9.52.xml b/74_AMADautomagicFlowset_3.9.55.xml similarity index 81% rename from 74_AMADautomagicFlowset_3.9.52.xml rename to 74_AMADautomagicFlowset_3.9.55.xml index 514dd17..6f5e390 100644 --- a/74_AMADautomagicFlowset_3.9.52.xml +++ b/74_AMADautomagicFlowset_3.9.55.xml @@ -259,9 +259,9 @@ irname=getString("name") false - Periodischer Timer: alle 30s + Periodischer Timer: alle 120s true - 30000 + 120000 true false false @@ -970,13 +970,13 @@ or trigger == "HTTP Request: /fhem-amad/deviceInfo/" true - Expression: trigger == "Periodischer Timer: alle 30s" - trigger == "Periodischer Timer: alle 30s" + Expression: trigger == "Periodischer Timer: alle 120s" + trigger == "Periodischer Timer: alle 120s" true - Expression: trigger == "Periodischer Timer: alle 30s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - trigger == "Periodischer Timer: alle 30s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" true @@ -2646,10 +2646,14 @@ fhemcmd = "setreading"; false Script: Set FHEMDATA JSON - false Script: Set FHEMDATA JSON - false Script: Set FHEMDATA JSON - false Script: Set FHEMDATA JSON - false Script: Set FHEMDATA JSON - false Script: Set FHEMDATA JSON - false Script: Set FHEMDATA JSON - false Script: Set FHEMDATA JSON - false Script: Set FHEMDATA JSON - true - Script: automagicState = "\"automagicState\":" + " \"" + {content_title} + "\""; fhemcmd = "setreading"; - @@ -2506,14 +2506,14 @@ fhemcmd = "setreading"; true - Script: incommingTelegramMessage = "\"incommingTelegramMessageFrom\":" + " \"" + {notification_text} + "\""; fhemcmd = "setreading"; - true - Script: incommingWhatsAppMessage = "\"incommingWhatsAppMessageFrom\":" + " \"" + {notification_text} + "\""; fhemcmd = "setreading"; - @@ -2720,7 +2720,7 @@ fhemcmd = "setreading"; false Script: Set FHEMDATA JSON - false Script: Set FHEMDATA JSON - + + true + Script: togocount = togocount + 1 + + true Script: udef_trigger = "setLockPin" @@ -3124,7 +3126,6 @@ if(param_mplayer == "mediaAudible") true SMS senden an: an {param_smsnumber} '{param_smsmessage}' (10 in 12h) - {param_smsnumber} {param_smsmessage} true @@ -3143,7 +3144,6 @@ if(param_mplayer == "mediaAudible") Lautlos {param_notifypath}{param_notifyfile} NOTIFICATION - false true true @@ -3375,7 +3375,7 @@ Soll der Assistent gelöscht werden? First Run Assistant - AMADNG Info/Control Flowset v3.9.72 + AMADNG Info/Control Flowset v3.9.73 false PARALLEL @@ -3615,7 +3615,7 @@ Auf Wiedersehen. Informations - AMADNG Info/Control Flowset v3.9.72 + AMADNG Info/Control Flowset v3.9.73 true QUEUE 900 @@ -3665,412 +3665,412 @@ Auf Wiedersehen. Script: daydream_state = "on" Script: daydream_state = "off" - Expression: airpcount < 11 - Script: keyguard = "unlocked" - Display Orientierung: Portrait - Script: screen_orientation = "portrait" - Script: screen_orientation = "landscape" - Script: dock_state = "docked" - Script: dock_state = "undocked" - Script: keyguardSet = "0" - Script: screen_orientation_mode = "manual" - Script: scrcount = 0 - Script: keyguard = "locked" - Expression: scrcount < 5 - Script: scrcount = scrcount + 1 - Pause: 2s (Gerät wach halten) - Script: airpcount = airpcount + 1 - Dock Status: Docked - Display automatisch drehen eingeschaltet - Expression: trigger == "Daydream Status: Gestartet" - Bluetooth eingeschaltet - Expression: trigger == "App Task Beendet" - Keyguard gesperrt - Expression: keyguard == "locked" - Expression: getAndroidSDKVersion() >= "16" - Script: keyguardSet = "not supported from your device" - Display eingeschaltet - Display eingeschaltet - Expression: getAndroidSDKVersion() >= "16" - Unterbrechnungen-Modus: Nur Wecker (Android 6+) - Unterbrechnungen-Modus: Keine / Nicht unterbrechen - Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen - Unterbrechnungen-Modus: Alle / Immer unterbrechen - Script: dndValue = "always" - Script: dndValue = "onlyImportant" - Script: dndValue = "never" - Script: dndValue = "alarmClockOnly" - Script: screen_state = "on" - Script: screen_state = "off" - Script: screen_state = "on {keyguard}" - Script: screen_state = "off {keyguard}" - Script: airplanemode = "off" - Script: bluetooth_state = "on" - Script: androidVersion = "not supported funktion" - App Task läuft: {global_activetask} (neuster) - Script: runTask = "1" - Script: runTask = "0" - Expression: getAndroidSDKVersion() >= "19" - Script: runTask = "not supported android version" - Script: runTask = "null" - Expression: trigger == "Periodischer Timer: alle 120s" - Expression: global_activetask != null - Expression: trigger == "Display Status: Aus" or trigger == "Display Status: Ein" or udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Daydream Status: Gestartet" or trigger == "Daydream Status: Gestoppt" - Expression: trigger == "Display Orientierung: Landscape" or trigger == "Display Orientierung: Portrait" or trigger == "Display Status: Ein" or trigger == "Display Status: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Akku Ladestand: grösser als 0%" - Stromversorgung: Angeschlossen - Script: screen_orientation_mode = "auto" - Script: bluetooth_state = "off" - Script: if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT") { nextalarmstate = "alert" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS") { nextalarmstate = "dismiss" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE") { nextalarmstate = "done" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE") { nextalarmstate = "snooze" } - Keyguard mit Sicherheit - Script: keyguardSet = "1" - Expression: udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" - Expression: trigger == "Flugmodus: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Systemeinstellung verändert: System screen_brightness" - Bluetooth Gerät verbunden: Beliebiges Geräte (Advanced Audio Distribution) - Script: volume = {volumeBT} - Pause: 2s (Gerät wach halten) - Musik Aktiv - Benachrichtigung auf Bildschirm: [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! (lange) - Expression: trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" or trigger == "Systemeinstellung verändert: System volume_music_speaker" or trigger == "Systemeinstellung verändert: System volume_music_headphone" or trigger == "Systemeinstellung verändert: System volume_music_headset" - Initialisiere Variable Systemeinstellung: volumeMusikBluetooth.2 - Script: volume = {volumeSP} - Initialisiere Variable Systemeinstellung: volumeMusikSpeaker.2 - Expression: trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: getAndroidSDKVersion() >= "21" - Script: airpcount = 0 - Host erreichbar: {global_fhemip}:{global_bridgeport} - Pause: 2s (Gerät wach halten) - WLAN Reassoziieren - Expression: trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Systemeinstellung verändert: System next_alarm" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Initialisiere Variable Nächster Alarm: next_alarm - Script: next_alarmday = "{next_alarm,dateformat,c}" - Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" - Expression: global_fhemip != null or global_bridgeport != null - Expression: getAndroidSDKVersion() >= "19" - Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" - Script: notification_text = "not supported from your device" - Expression: getAndroidSDKVersion() >= "19" - Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" - Expression: trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" - Expression: trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" - Benachrichtigung in Statusbar angezeigt: WhatsApp - Script: notification_text = "not supported from your device" - Benachrichtigung in Statusbar angezeigt: Telegram Messenger - Expression: trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" - Initialisiere Variable Systemeinstellung: screenBrightness - Expression: trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Systemeinstellung verändert: System volume_ring_speaker" - Initialisiere Variable Systemeinstellung: volumeNotification - Expression: trigger == "Systemeinstellung verändert: System volume_ring" - Initialisiere Variable Systemeinstellung: volumeRingSound - Script: subtitle = "no player active"; title = "no player active"; description = "no player active"; musicapp = "no player active"; icon = "no player active" - Script: if(playback_state == 0) { playback_state = "keiner" } if(playback_state == 1) { playback_state = "gestoppt" } if(playback_state == 2) { playback_state = "pausiert" } if(playback_state == 3) { playback_state = "spielt ab" } if(playback_state == 4) { playback_state = "spult vorwärts" } if(playback_state == 5) { playback_state = "spült rückwärts" } if(playback_state == 6) { playback_state = "buffert" } if(playback_state == 7) { playback_state = "Fehler" } if(playback_state == 8) { playback_state = "verbindet" } if(playback_state == 9) { playback_state = "springt zum vorherigen" } if(playback_state == 10) { playback_state = "springt zum nächsten" } if(playback_state == 11) { playback_state = "springt zu Position in Wiedergabeliste" } - Expression: trigger == "Medien Session verändert" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } - Get Android Version - WLAN verfügbar: {global_apssid} - Script: volumeRingSound = "\"volumeRingSound\":" + " \"" + {volumeRingSound} + "\""; fhemcmd = "setreading"; - Script: intentRadioState = "\"intentRadioState\":" + " \"" + {irstate} + "\"" + "," + "\"intentRadioName\":" + " \"" + {irname} + "\""; fhemcmd = "setreading"; - Script: keyguardSet = "\"keyguardSet\":" + " \"" + {keyguardSet} + "\""; fhemcmd = "setreading"; - Script: dockingState = "\"dockingState\":" + " \"" + {dock_state} + "\""; fhemcmd = "setreading"; - Script: screenOrientation = "\"screenOrientation\":" + " \"" + {screen_orientation} + "\"" + "," + "\"screenOrientationMode\":" + " \"" + {screen_orientation_mode} + "\""; fhemcmd = "setreading"; - Script: screenBrightness = "\"screenBrightness\":" + " \"" + {screenBrightness} + "\""; fhemcmd = "setreading"; - Script: daydream = "\"daydream\":" + " \"" + {daydream_state} + "\""; fhemcmd = "setreading"; - Script: nextAlarm = "\"nextAlarmTime\":" + " \"" + {next_alarmtime} + "\"" + "," + "\"nextAlarmDay\":" + " \"" + {next_alarmday} + "\""; fhemcmd = "setreading"; - Script: volumevalue = "\"volume\":" + " \"" + {volume} + "\""; fhemcmd = "setreading"; - Script: volumeNotification = "\"volumeNotification\":" + " \"" + {volumeNotification} + "\""; fhemcmd = "setreading"; - Script: airplanemode = "\"airplanemode\":" + " \"" + {airplanemode} + "\""; fhemcmd = "setreading"; - Script: screen = "\"screen\":" + " \"" + {screen_state} + "\""; fhemcmd = "setreading"; - Script: nextAlarmState = "\"nextAlarmState\":" + " \"" + {nextalarmstate} + "\""; fhemcmd = "setreading"; - Script: doNotDisturb = "\"doNotDisturb\":" + " \"" + {dndValue} + "\""; fhemcmd = "setreading"; - Script: checkActiveTask = "\"checkActiveTask\":" + " \"" + {runTask} + "\""; fhemcmd = "setreading"; - Expression: Leon == "Gaultier" - Flows löschen: MultimediaControl - Script: androidVersion = "\"androidVersion\":" + " \"" + {androidVersion} + "\""; fhemcmd = "setreading"; - Script: powerinfo = "\"powerLevel\":" + " \"" + "{battery_percentage,numberformat,0}" + "\"" + "," + "\"powerPlugged\":" + " \"" + {battery_plugged} + "\"" + "," + "\"batteryTemperature\":" + " \"" + "{battery_temperature/10.0,numberformat.0.0}" + "\"" + "," + "\"batteryHealth\":" + " \"" + {battery_health} + "\""; fhemcmd = "setreading"; - Script: currentMusic = "\"currentMusicTrack\":" + " \"" + {title} + "\"" + "," + "\"currentMusicAlbum\":" + " \"" + {description} + "\"" + "," + "\"currentMusicArtist\":" + " \"" + {subtitle} + "\"" + "," + "\"currentMusicApp\":" + " \"" + {musicapp} + "\"" + "," + "\"currentMusicIcon\":" + " \"" + {icon} + "\"" + "," + "\"currentMusicState\":" + " \"" + {playback_state} + "\""; fhemcmd = "setreading"; - Expression: trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: getAndroidSDKVersion() >= "19" - Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" - Benachrichtigung in Statusbar angezeigt: Automagic - Script: notification_text = "not supported from your device" - Expression: package_name == {global_activetask} - Script: deviceState = "\"deviceState\": \"online\""; fhemcmd = "setreading"; - Expression: trigger == "Dock Event: Docked" or trigger == "Dock Event: Undocked" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Flows ausführen: Send Data to AMADCommBridge - Prüfe und setze globale Variable - Script: bluetooth = "\"bluetooth\":" + " \"" + {bluetooth_state} + "\""; fhemcmd = "setreading"; - Script: connected_devices_names = "none"; connected_devices_addresses = "none" - Script: btdeviceinfo = "\"connectedBTdevices\":" + " \"" + {connected_devices_names} + "\"" + "," + "\"connectedBTdevicesMAC\":" + " \"" + {connected_devices_addresses} + "\""; fhemcmd = "setreading"; - Bluetooth Gerät verbunden: Beliebiges Geräte - Expression: trigger == "Bluetooth Status: Schaltet aus, Aus" or trigger == "Bluetooth Gerät verbunden: Alle Geräte" or trigger == "Bluetooth Gerät getrennt: Alle Geräte" or trigger == "Bluetooth Status: Schaltet ein, Ein" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Host erreichbar: {global_fhemip}:{global_bridgeport} - Script: flow_SetCommands = "\"flow_SetCommands\":" + " \"" + {setCommandFlow_state} + "\""; fhemcmd = "setreading"; - Setze Flow Status: Aktivieren SetCommands - Script: setCommandFlow_state = "aktiv" - Script: setCommandFlow_state = "inaktiv" - Flow Aktiv: SetCommands - Expression: trigger == "Periodischer Timer: alle 120s" - Expression: global_userflowstate != "none" - Flow Aktiv: {global_userflowstate} - Script: flowState = "inactive" - Script: flowState = "active" - Script: flow_informations = "\"userFlowState\":" + " \"" + {flowState} + "\""; fhemcmd = "setreading"; - Expression: trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Flow Aktiv: Send Data to AMADCommBridge - Setze Flow Status: Aktivieren Send Data to AMADCommBridge - Expression: trigger == "Periodischer Timer: alle 120s" - Script: incomingCaller = "\"incomingCallerName\":" + " \"" + {contact_name} + "\"" + "," + "\"incomingCallerNumber\":" + " \"" + {incoming_number} + "\""; fhemcmd = "setreading"; - Script: incommingTelegramMessage = "\"incommingTelegramMessageFrom\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; - Script: incommingWhatsAppMessage = "\"incommingWhatsAppMessageFrom\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; - Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Script: keyguard = "unlocked" + Display Orientierung: Portrait + Script: screen_orientation = "portrait" + Script: screen_orientation = "landscape" + Script: dock_state = "docked" + Script: dock_state = "undocked" + Script: keyguardSet = "0" + Script: screen_orientation_mode = "manual" + Script: scrcount = 0 + Script: keyguard = "locked" + Expression: scrcount < 5 + Script: scrcount = scrcount + 1 + Pause: 2s (Gerät wach halten) + Dock Status: Docked + Display automatisch drehen eingeschaltet + Expression: trigger == "Daydream Status: Gestartet" + Bluetooth eingeschaltet + Expression: trigger == "App Task Beendet" + Keyguard gesperrt + Expression: keyguard == "locked" + Expression: getAndroidSDKVersion() >= "16" + Script: keyguardSet = "not supported from your device" + Display eingeschaltet + Display eingeschaltet + Expression: getAndroidSDKVersion() >= "16" + Unterbrechnungen-Modus: Nur Wecker (Android 6+) + Unterbrechnungen-Modus: Keine / Nicht unterbrechen + Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + Unterbrechnungen-Modus: Alle / Immer unterbrechen + Script: dndValue = "always" + Script: dndValue = "onlyImportant" + Script: dndValue = "never" + Script: dndValue = "alarmClockOnly" + Script: screen_state = "on" + Script: screen_state = "off" + Script: screen_state = "on {keyguard}" + Script: screen_state = "off {keyguard}" + Script: airplanemode = "off" + Script: bluetooth_state = "on" + Script: androidVersion = "not supported funktion" + App Task läuft: {global_activetask} (neuster) + Script: runTask = "1" + Script: runTask = "0" + Expression: getAndroidSDKVersion() >= "19" + Script: runTask = "not supported android version" + Script: runTask = "null" + Expression: trigger == "Periodischer Timer: alle 120s" + Expression: global_activetask != null + Expression: trigger == "Display Status: Aus" or trigger == "Display Status: Ein" or udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Daydream Status: Gestartet" or trigger == "Daydream Status: Gestoppt" + Expression: trigger == "Display Orientierung: Landscape" or trigger == "Display Orientierung: Portrait" or trigger == "Display Status: Ein" or trigger == "Display Status: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Akku Ladestand: grösser als 0%" + Stromversorgung: Angeschlossen + Script: screen_orientation_mode = "auto" + Script: bluetooth_state = "off" + Script: if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT") { nextalarmstate = "alert" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS") { nextalarmstate = "dismiss" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE") { nextalarmstate = "done" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE") { nextalarmstate = "snooze" } + Keyguard mit Sicherheit + Script: keyguardSet = "1" + Expression: udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" + Expression: trigger == "Flugmodus: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Systemeinstellung verändert: System screen_brightness" + Bluetooth Gerät verbunden: Beliebiges Geräte (Advanced Audio Distribution) + Script: volume = {volumeBT} + Pause: 2s (Gerät wach halten) + Musik Aktiv + Benachrichtigung auf Bildschirm: [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! (lange) + Expression: trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" or trigger == "Systemeinstellung verändert: System volume_music_speaker" or trigger == "Systemeinstellung verändert: System volume_music_headphone" or trigger == "Systemeinstellung verändert: System volume_music_headset" + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth.2 + Script: volume = {volumeSP} + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker.2 + Expression: trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: getAndroidSDKVersion() >= "21" + Script: airpcount = 0 + Host erreichbar: {global_fhemip}:{global_bridgeport} + WLAN Reassoziieren + Expression: trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Systemeinstellung verändert: System next_alarm" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Initialisiere Variable Nächster Alarm: next_alarm + Script: next_alarmday = "{next_alarm,dateformat,c}" + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + Expression: global_fhemip != null or global_bridgeport != null + Expression: getAndroidSDKVersion() >= "19" + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + Script: notification_text = "not supported from your device" + Expression: getAndroidSDKVersion() >= "19" + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + Expression: trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" + Benachrichtigung in Statusbar angezeigt: WhatsApp + Script: notification_text = "not supported from your device" + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" + Initialisiere Variable Systemeinstellung: screenBrightness + Expression: trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Systemeinstellung verändert: System volume_ring_speaker" + Initialisiere Variable Systemeinstellung: volumeNotification + Expression: trigger == "Systemeinstellung verändert: System volume_ring" + Initialisiere Variable Systemeinstellung: volumeRingSound + Script: subtitle = "no player active"; title = "no player active"; description = "no player active"; musicapp = "no player active"; icon = "no player active" + Script: if(playback_state == 0) { playback_state = "keiner" } if(playback_state == 1) { playback_state = "gestoppt" } if(playback_state == 2) { playback_state = "pausiert" } if(playback_state == 3) { playback_state = "spielt ab" } if(playback_state == 4) { playback_state = "spult vorwärts" } if(playback_state == 5) { playback_state = "spült rückwärts" } if(playback_state == 6) { playback_state = "buffert" } if(playback_state == 7) { playback_state = "Fehler" } if(playback_state == 8) { playback_state = "verbindet" } if(playback_state == 9) { playback_state = "springt zum vorherigen" } if(playback_state == 10) { playback_state = "springt zum nächsten" } if(playback_state == 11) { playback_state = "springt zu Position in Wiedergabeliste" } + Expression: trigger == "Medien Session verändert" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } + Get Android Version + WLAN verfügbar: {global_apssid} + Script: volumeRingSound = "\"volumeRingSound\":" + " \"" + {volumeRingSound} + "\""; fhemcmd = "setreading"; + Script: intentRadioState = "\"intentRadioState\":" + " \"" + {irstate} + "\"" + "," + "\"intentRadioName\":" + " \"" + {irname} + "\""; fhemcmd = "setreading"; + Script: keyguardSet = "\"keyguardSet\":" + " \"" + {keyguardSet} + "\""; fhemcmd = "setreading"; + Script: dockingState = "\"dockingState\":" + " \"" + {dock_state} + "\""; fhemcmd = "setreading"; + Script: screenOrientation = "\"screenOrientation\":" + " \"" + {screen_orientation} + "\"" + "," + "\"screenOrientationMode\":" + " \"" + {screen_orientation_mode} + "\""; fhemcmd = "setreading"; + Script: screenBrightness = "\"screenBrightness\":" + " \"" + {screenBrightness} + "\""; fhemcmd = "setreading"; + Script: daydream = "\"daydream\":" + " \"" + {daydream_state} + "\""; fhemcmd = "setreading"; + Script: nextAlarm = "\"nextAlarmTime\":" + " \"" + {next_alarmtime} + "\"" + "," + "\"nextAlarmDay\":" + " \"" + {next_alarmday} + "\""; fhemcmd = "setreading"; + Script: volumevalue = "\"volume\":" + " \"" + {volume} + "\""; fhemcmd = "setreading"; + Script: volumeNotification = "\"volumeNotification\":" + " \"" + {volumeNotification} + "\""; fhemcmd = "setreading"; + Script: airplanemode = "\"airplanemode\":" + " \"" + {airplanemode} + "\""; fhemcmd = "setreading"; + Script: screen = "\"screen\":" + " \"" + {screen_state} + "\""; fhemcmd = "setreading"; + Script: nextAlarmState = "\"nextAlarmState\":" + " \"" + {nextalarmstate} + "\""; fhemcmd = "setreading"; + Script: doNotDisturb = "\"doNotDisturb\":" + " \"" + {dndValue} + "\""; fhemcmd = "setreading"; + Script: checkActiveTask = "\"checkActiveTask\":" + " \"" + {runTask} + "\""; fhemcmd = "setreading"; + Expression: Leon == "Gaultier" + Flows löschen: MultimediaControl + Script: androidVersion = "\"androidVersion\":" + " \"" + {androidVersion} + "\""; fhemcmd = "setreading"; + Script: powerinfo = "\"powerLevel\":" + " \"" + "{battery_percentage,numberformat,0}" + "\"" + "," + "\"powerPlugged\":" + " \"" + {battery_plugged} + "\"" + "," + "\"batteryTemperature\":" + " \"" + "{battery_temperature/10.0,numberformat.0.0}" + "\"" + "," + "\"batteryHealth\":" + " \"" + {battery_health} + "\""; fhemcmd = "setreading"; + Script: currentMusic = "\"currentMusicTrack\":" + " \"" + {title} + "\"" + "," + "\"currentMusicAlbum\":" + " \"" + {description} + "\"" + "," + "\"currentMusicArtist\":" + " \"" + {subtitle} + "\"" + "," + "\"currentMusicApp\":" + " \"" + {musicapp} + "\"" + "," + "\"currentMusicIcon\":" + " \"" + {icon} + "\"" + "," + "\"currentMusicState\":" + " \"" + {playback_state} + "\""; fhemcmd = "setreading"; + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: getAndroidSDKVersion() >= "19" + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + Benachrichtigung in Statusbar angezeigt: Automagic + Script: notification_text = "not supported from your device" + Expression: package_name == {global_activetask} + Script: deviceState = "\"deviceState\": \"online\""; fhemcmd = "setreading"; + Expression: trigger == "Dock Event: Docked" or trigger == "Dock Event: Undocked" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Flows ausführen: Send Data to AMADCommBridge + Prüfe und setze globale Variable + Script: bluetooth = "\"bluetooth\":" + " \"" + {bluetooth_state} + "\""; fhemcmd = "setreading"; + Script: connected_devices_names = "none"; connected_devices_addresses = "none" + Script: btdeviceinfo = "\"connectedBTdevices\":" + " \"" + {connected_devices_names} + "\"" + "," + "\"connectedBTdevicesMAC\":" + " \"" + {connected_devices_addresses} + "\""; fhemcmd = "setreading"; + Bluetooth Gerät verbunden: Beliebiges Geräte + Expression: trigger == "Bluetooth Status: Schaltet aus, Aus" or trigger == "Bluetooth Gerät verbunden: Alle Geräte" or trigger == "Bluetooth Gerät getrennt: Alle Geräte" or trigger == "Bluetooth Status: Schaltet ein, Ein" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Host erreichbar: {global_fhemip}:{global_bridgeport} + Script: flow_SetCommands = "\"flow_SetCommands\":" + " \"" + {setCommandFlow_state} + "\""; fhemcmd = "setreading"; + Setze Flow Status: Aktivieren SetCommands + Script: setCommandFlow_state = "aktiv" + Script: setCommandFlow_state = "inaktiv" + Flow Aktiv: SetCommands + Expression: trigger == "Periodischer Timer: alle 120s" + Expression: global_userflowstate != "none" + Flow Aktiv: {global_userflowstate} + Script: flowState = "inactive" + Script: flowState = "active" + Script: flow_informations = "\"userFlowState\":" + " \"" + {flowState} + "\""; fhemcmd = "setreading"; + Expression: trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Flow Aktiv: Send Data to AMADCommBridge + Setze Flow Status: Aktivieren Send Data to AMADCommBridge + Expression: trigger == "Periodischer Timer: alle 120s" + Script: incomingCaller = "\"incomingCallerName\":" + " \"" + {contact_name} + "\"" + "," + "\"incomingCallerNumber\":" + " \"" + {incoming_number} + "\""; fhemcmd = "setreading"; + Script: incommingWhatsAppMessage = "\"incommingWhatsAppMessageFrom\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Script: incommingTelegramMessage = "\"incommingTelegramMessageFrom\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Benachrichtigung in Statusbar angezeigt: Telegram Messenger + Pause: 2s (Gerät wach halten) + Script: airpcount = airpcount + 1 + Expression: airpcount < 11 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Send Data to AMADCommBridge - AMADNG Info/Control Flowset v3.9.72 + AMADNG Info/Control Flowset v3.9.73 true PARALLEL 900 @@ -4088,406 +4088,410 @@ Auf Wiedersehen. Expression: fhemcmd == "setreading" Script: Set FHEMDATA JSON First Run Assistant Host erreichbar: {global_fhemip}:{global_bridgeport} - Flow Aktiv: SetCommands - Expression: trigger == "WLAN Getrennt: toGo" - Flow Aktiv: SetCommands - Expression: trigger == "WLAN Verbunden: toGo" - In Datei Schreiben: Aktiviere Flows in /storage/emulated/0/file.txt (anhängen) - In Datei Schreiben: Deaktiviere Flows in /storage/emulated/0/file.txt (anhängen) - Flow Aktiv: Informations - Flow Aktiv: Informations - Setze Flow Status: Deaktivieren Informations,SetCommands - Setze Flow Status: Aktivieren Informations,SetCommands - Script: Set FHEMDATA JSON - HTTP Request: send READINGSVAL data to AMADCommBridge JSON - HTTP Request: send VOICEINPUTVALUE data to AMADCommBridge - HTTP Request: send SET data to AMADCommBridge JSON - HTTP Request: send READINGS data to AMADCommBridge JSON - HTTP Request: send FIRSTRUN data to AMADCommBridge JSON + In Datei Schreiben: Deaktiviere Flows in /storage/emulated/0/file.txt (anhängen) + Setze Flow Status: Deaktivieren Informations,SetCommands + HTTP Request: send VOICEINPUTVALUE data to AMADCommBridge + HTTP Request: send SET data to AMADCommBridge JSON + HTTP Request: send READINGS data to AMADCommBridge JSON + HTTP Request: send FIRSTRUN data to AMADCommBridge JSON + HTTP Request: send READINGSVAL data to AMADCommBridge JSON + Flow Aktiv: Informations + Flow Aktiv: SetCommands + Expression: trigger == "WLAN Getrennt: toGo" + Script: togocount = togocount + 1 + Expression: togocount < 6 + Pause: 1s (Gerät wach halten) + Setze Flow Status: Aktivieren Informations,SetCommands + Flow Aktiv: Informations + Flow Aktiv: SetCommands + Expression: trigger == "WLAN Verbunden: toGo" + In Datei Schreiben: Aktiviere Flows in /storage/emulated/0/file.txt (anhängen) + Script: Set FHEMDATA JSON - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + SetCommands - AMADNG Info/Control Flowset v3.9.72 + AMADNG Info/Control Flowset v3.9.73 true QUEUE 900 - Expression: setBrightness" - Expression: setScreenFullscreen" - Expression: param_orientation == "auto" - Setze Display Orientierung: Portrait - Setze Display Orientierung: Landscape - Expression: param_orientation == "landscape" - Setze Vollbild Modus: Navigation nicht anzeigen - Setze Vollbild Modus: Auf Default zurücksetzen - Setze Display Orientierung: Auf Default zurücksetzen - Display automatisch drehen ein-/ausschalten: Aus - Display automatisch drehen ein-/ausschalten: Ein - Expression: setScreenOrientation" - Expression: param_fullscreen == "off" - Expression: param_bluetooth == "off" - Expression: param_bluetooth == "on" - Bluetooth ein-/ausschalten: Ein - Bluetooth eingeschaltet - Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} - Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} - Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} - Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} - Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} - Pause: 3s (Gerät wach halten) - Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} - Pause: 2s (Gerät wach halten) - Expression: setBTDevice" - Bluetooth ein-/ausschalten: Aus - Expression: param_orientation == "portrait" - Expression: setVoiceCommand" - Setze Display Helligkeit: {param_brightness} - Expression: setScreenlock" - Expression: sendIntent" - Expression: param_lockmod == "lock" - Setze Lock PIN/Passwort: PIN/Passwort zurücksetzen - Setze Lock PIN/Passwort: Setze PIN von Variable param_lockpin - Expression: trigger == "Sprachbefehl angefordert" - Expression: setAlarm" - Setze Timer - Expression: screenMsg" - Benachrichtigung auf Bildschirm: {param_message} (lange) - Script: udef_trigger = "setLockPin" - Display eingeschaltet - Gerät sperren - Schalte Display ein - Gerät sperren - Expression: setTimer" - Expression: param_option - Pause: {param_hanguptime}s (Gerät wach halten) - Anruf beenden - Broadcast senden: {param_action} - URL in Browser öffnen: {param_url} (mit {param_browserapp}/{param_browserappclass}) - Setze Unterbrechnungen-Modus: Alle / Immer unterbrechen - Setze Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen - Setze Unterbrechnungen-Modus: Keine / Nicht unterbrechen - Setze Unterbrechnungen-Modus: Nur Wecker (Android 6+) - Expression: openURL" - Expression: param_fullscreen == "on" - Expression: do not Disturb" - Expression: param_disturbmod == "always" - Expression: param_disturbmod == "onlyImportant" - Expression: param_disturbmod == "never" - Expression: param_disturbmod == "alarmClockOnly" - Expression: setBluetooth" - Expression: ttsMsg" - Expression: param_screen=="on" - Expression: setScreenOnOff" - Gerät sperren - Expression: param_screen=="off" - Expression: openApp" - App Task läuft: App (neuster) - Expression: setVolume" - App Starten: App - Dateien löschen: /storage/emulated/0/Download/installFlow_{param_flowname} - Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} - Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} - Script: notification_text = "Flow install: path for download not exist" - Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} - Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} - Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download - Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download - Flows/Widgets importieren: /storage/emulated/0/Download/installFlow_{param_flowname} - Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} - Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/sdcard0) - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/sdcard) - Expression: installFlow" - Neustart - Expression: Reboot - Expression: System Command" - Expression: Shutdown - Expression: Airplanemode - Script: airplanemode = "airplanemode@@on"; fhemcmd = "setreading"; - Flows ausführen: Send Data to AMADCommBridge mit warten - Flugmodus ein-/ausschalten: Ein - Herunterfahren - Notification Lautstärke Wiederherstellen - Expression: param_notifyfile == "RedAlert.mp3" - Benachrichtigung aus Statusbar entfernen: Alle - Benachrichtigung aus Statusbar entfernen: Alle (Automagic) - Expression: Automagic - Expression: All - Expression: notifysnd" - NotificationLautstärke auf Level 7 - Notification Lautstärke Speichern - Expression: param_notifyfile == "RedAlert.mp3" - Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} - Expression: Clear Automagic Meldungen" - Expression: setVibrate" - Vibrieren: Pattern 2 (-- --) - Audio Player steuern: Medienknopf Zurück ({pname}/{kname}) - Expression: param_button == "stop" - Expression: param_button == "next" - Expression: param_button == "back" - Schalte Display ein: Hell für {param_screenontime}s - Expression: ttsMsgLang" - Expression: global_fhemip != null or global_bridgeport != null - Setze Alarm: um {param_hour}:{param_minute} - Audio Player steuern: Medienknopf Weiter ({pname}/{kname}) - Expression: openCall" - Nummer anrufen: {param_callnumber} - Expression: sendSms" - Expression: param_flowstate == "active" or param_flowstate == "inactive" - Expression: param_flowstate == "active" - SMS senden an: an {param_smsnumber} '{param_smsmessage}' (10 in 12h) - Setze Flow Status: Deaktivieren {param_flowname} - Script: notification_text = "Flow '{param_flowname}' has been set {param_flowstate}" - Expression: flowState" - Expression: closeCall" - Audio Player steuern: Medienknopf Stopp ({pname}/{kname}) - Expression: multimediaControl" - Starte Daydream - Expression: startDaydream" - Lautstärken setzen param_volume - Expression: setNotifiVolume" - Lautstärken setzen param_notifivolume - Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" - Expression: setRingSoundVolume" - Lautstärken setzen param_ringsoundvolume - Expression: param_button == "play/pause" - Audio Player steuern: Medienknopf Play/Pause (/{kname}) - Script: Zuordnung Mediaplayer - Sound: {param_notifypath}{param_notifyfile} als Benachrichtigung - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) - Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/emulated/0/Download - Script: flow_informations = "\"flow_informations\":" + " \"" + {informationFlow_state} + "\""; fhemcmd = "setreading"; - Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; - Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; - Flows ausführen: Send Data to AMADCommBridge - Sprachausgabe: Englisch - Sprachausgabe: Deutsch - Flows ausführen: VoiceControl - Flows ausführen: udef_trigger setLockPin - Setze Flow Status: Aktivieren {param_flowname} - Flow Aktiv: Informations - Script: informationFlow_state = "aktiv" - Script: informationFlow_state = "inaktiv" - Setze Flow Status: Aktivieren Informations - Host erreichbar: {global_fhemip}:{global_bridgeport} - Flow Aktiv: Send Data to AMADCommBridge - Setze Flow Status: Aktivieren Send Data to AMADCommBridge - + HTTP Request: /fhem-amad/deviceInfo/ Sprachbefehl angefordert HTTP Request: /fhem-amad/setCommands/* Periodischer Timer: alle 120s - - - - - - - - - - - - - - - - - + Expression: setBrightness" + Expression: setScreenFullscreen" + Expression: param_orientation == "auto" + Setze Display Orientierung: Portrait + Setze Display Orientierung: Landscape + Expression: param_orientation == "landscape" + Setze Vollbild Modus: Navigation nicht anzeigen + Setze Vollbild Modus: Auf Default zurücksetzen + Setze Display Orientierung: Auf Default zurücksetzen + Display automatisch drehen ein-/ausschalten: Aus + Display automatisch drehen ein-/ausschalten: Ein + Expression: setScreenOrientation" + Expression: param_fullscreen == "off" + Expression: param_bluetooth == "off" + Expression: param_bluetooth == "on" + Bluetooth ein-/ausschalten: Ein + Bluetooth eingeschaltet + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} + Pause: 3s (Gerät wach halten) + Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} + Pause: 2s (Gerät wach halten) + Expression: setBTDevice" + Bluetooth ein-/ausschalten: Aus + Expression: param_orientation == "portrait" + Expression: setVoiceCommand" + Setze Display Helligkeit: {param_brightness} + Expression: setScreenlock" + Expression: sendIntent" + Expression: param_lockmod == "lock" + Setze Lock PIN/Passwort: PIN/Passwort zurücksetzen + Setze Lock PIN/Passwort: Setze PIN von Variable param_lockpin + Expression: trigger == "Sprachbefehl angefordert" + Expression: setAlarm" + Setze Timer + Expression: screenMsg" + Benachrichtigung auf Bildschirm: {param_message} (lange) + Script: udef_trigger = "setLockPin" + Display eingeschaltet + Gerät sperren + Schalte Display ein + Gerät sperren + Expression: setTimer" + Expression: param_option + Pause: {param_hanguptime}s (Gerät wach halten) + Anruf beenden + Broadcast senden: {param_action} + URL in Browser öffnen: {param_url} (mit {param_browserapp}/{param_browserappclass}) + Setze Unterbrechnungen-Modus: Alle / Immer unterbrechen + Setze Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + Setze Unterbrechnungen-Modus: Keine / Nicht unterbrechen + Setze Unterbrechnungen-Modus: Nur Wecker (Android 6+) + Expression: openURL" + Expression: param_fullscreen == "on" + Expression: do not Disturb" + Expression: param_disturbmod == "always" + Expression: param_disturbmod == "onlyImportant" + Expression: param_disturbmod == "never" + Expression: param_disturbmod == "alarmClockOnly" + Expression: setBluetooth" + Expression: ttsMsg" + Expression: param_screen=="on" + Expression: setScreenOnOff" + Gerät sperren + Expression: param_screen=="off" + Expression: openApp" + App Task läuft: App (neuster) + Expression: setVolume" + App Starten: App + Dateien löschen: /storage/emulated/0/Download/installFlow_{param_flowname} + Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} + Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} + Script: notification_text = "Flow install: path for download not exist" + Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download + Flows/Widgets importieren: /storage/emulated/0/Download/installFlow_{param_flowname} + Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/sdcard0) + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/sdcard) + Expression: installFlow" + Neustart + Expression: Reboot + Expression: System Command" + Expression: Shutdown + Expression: Airplanemode + Script: airplanemode = "airplanemode@@on"; fhemcmd = "setreading"; + Flows ausführen: Send Data to AMADCommBridge mit warten + Flugmodus ein-/ausschalten: Ein + Herunterfahren + Notification Lautstärke Wiederherstellen + Expression: param_notifyfile == "RedAlert.mp3" + Benachrichtigung aus Statusbar entfernen: Alle + Benachrichtigung aus Statusbar entfernen: Alle (Automagic) + Expression: Automagic + Expression: All + Expression: notifysnd" + NotificationLautstärke auf Level 7 + Notification Lautstärke Speichern + Expression: param_notifyfile == "RedAlert.mp3" + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Expression: Clear Automagic Meldungen" + Expression: setVibrate" + Vibrieren: Pattern 2 (-- --) + Audio Player steuern: Medienknopf Zurück ({pname}/{kname}) + Expression: param_button == "stop" + Expression: param_button == "next" + Expression: param_button == "back" + Schalte Display ein: Hell für {param_screenontime}s + Expression: ttsMsgLang" + Expression: global_fhemip != null or global_bridgeport != null + Setze Alarm: um {param_hour}:{param_minute} + Audio Player steuern: Medienknopf Weiter ({pname}/{kname}) + Expression: openCall" + Nummer anrufen: {param_callnumber} + Expression: sendSms" + Expression: param_flowstate == "active" or param_flowstate == "inactive" + Expression: param_flowstate == "active" + SMS senden an: an {param_smsnumber} '{param_smsmessage}' (10 in 12h) + Setze Flow Status: Deaktivieren {param_flowname} + Script: notification_text = "Flow '{param_flowname}' has been set {param_flowstate}" + Expression: flowState" + Expression: closeCall" + Audio Player steuern: Medienknopf Stopp ({pname}/{kname}) + Expression: multimediaControl" + Starte Daydream + Expression: startDaydream" + Lautstärken setzen param_volume + Expression: setNotifiVolume" + Lautstärken setzen param_notifivolume + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + Expression: setRingSoundVolume" + Lautstärken setzen param_ringsoundvolume + Expression: param_button == "play/pause" + Audio Player steuern: Medienknopf Play/Pause (/{kname}) + Script: Zuordnung Mediaplayer + Sound: {param_notifypath}{param_notifyfile} als Benachrichtigung + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/emulated/0/Download + Script: flow_informations = "\"flow_informations\":" + " \"" + {informationFlow_state} + "\""; fhemcmd = "setreading"; + Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Flows ausführen: Send Data to AMADCommBridge + Sprachausgabe: Englisch + Sprachausgabe: Deutsch + Flows ausführen: VoiceControl + Flows ausführen: udef_trigger setLockPin + Setze Flow Status: Aktivieren {param_flowname} + Flow Aktiv: Informations + Script: informationFlow_state = "aktiv" + Script: informationFlow_state = "inaktiv" + Setze Flow Status: Aktivieren Informations + Host erreichbar: {global_fhemip}:{global_bridgeport} + Flow Aktiv: Send Data to AMADCommBridge + Setze Flow Status: Aktivieren Send Data to AMADCommBridge + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + + Update AMAD Flowset - AMADNG Info/Control Flowset v3.9.72 + AMADNG Info/Control Flowset v3.9.73 true QUEUE @@ -4543,7 +4547,7 @@ Auf Wiedersehen. VoiceControl - AMADNG Info/Control Flowset v3.9.72 + AMADNG Info/Control Flowset v3.9.73 true QUEUE From 9e2e5119cab3563cb7d119e6b785331c4f5f7962 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Mon, 12 Jun 2017 19:50:01 +0200 Subject: [PATCH 21/32] fix voiceInput Reading lower cap only, new Flow setup --- 73_AMADCommBridge.pm | 6 +- 74_AMADDevice.pm | 2 +- ....xml => 74_AMADautomagicFlowset_3.9.74.xml | 88 +++++++++---------- 3 files changed, 48 insertions(+), 48 deletions(-) rename 74_AMADautomagicFlowset_3.9.73.xml => 74_AMADautomagicFlowset_3.9.74.xml (97%) diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index b2d3d3d..880b346 100644 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -68,8 +68,8 @@ use TcpServerUtils; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.72"; -my $flowsetversion = "3.9.73"; +my $modulversion = "3.9.73"; +my $flowsetversion = "3.9.74"; @@ -811,7 +811,7 @@ sub AMADCommBridge_ResponseProcessing($$) { } elsif ( $fhemcmd eq 'voiceinputvalue' ) { - my $fhemCmd = $decode_json->{payload}{voiceinputdata}; + my $fhemCmd = lc($decode_json->{payload}{voiceinputdata}); readingsBeginUpdate( $bhash); readingsBulkUpdate( $bhash, "receiveVoiceCommand", $fhemCmd, 1 ); diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index ddfcbb9..19ed54e 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -55,7 +55,7 @@ eval "use JSON;1" or $missingModul .= "JSON "; my $modulversion = "3.9.72"; -my $flowsetversion = "3.9.73"; +my $flowsetversion = "3.9.74"; diff --git a/74_AMADautomagicFlowset_3.9.73.xml b/74_AMADautomagicFlowset_3.9.74.xml similarity index 97% rename from 74_AMADautomagicFlowset_3.9.73.xml rename to 74_AMADautomagicFlowset_3.9.74.xml index 2bb2aec..cde1660 100644 --- a/74_AMADautomagicFlowset_3.9.73.xml +++ b/74_AMADautomagicFlowset_3.9.74.xml @@ -1763,7 +1763,7 @@ androidVersion = "4.0 - 4.0.2 Ice Cream Sandwich" text/json {firstrundata} @@@@readingsNameXYZ@@readingsValueABC - 5000 + 15000 true Connection: close true @@ -1783,7 +1783,7 @@ androidVersion = "4.0 - 4.0.2 Ice Cream Sandwich" text/json {fhemdata} @@@@readingsNameXYZ@@readingsValueABC - 5000 + 15000 true Connection: close true @@ -1823,7 +1823,7 @@ androidVersion = "4.0 - 4.0.2 Ice Cream Sandwich" text/json {setcmd} @@@@readingsNameXYZ@@readingsValueABC - 5000 + 15000 true Connection: close true @@ -1843,7 +1843,7 @@ androidVersion = "4.0 - 4.0.2 Ice Cream Sandwich" text/json {voiceinputdata} @@@@readingsNameXYZ@@readingsValueABC - 5000 + 15000 true FHEMDEVICE: {global_fhemdevice} FHEMCMD: voiceinputvalue @@ -2717,7 +2717,7 @@ fhemcmd = "setreading"; false Script: Set FHEMDATA JSON - Script: global_fhemip = {value} + + true + Script: if(index == 0) { sprachassi = "ja"; } else { sprachassi = "nein"; } + + 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } @@ -2473,6 +2541,18 @@ playback_state = "springt zum nächsten" if(playback_state == 11) { playback_state = "springt zu Position in Wiedergabeliste" +} + + + true + Script: if(togocount > 0) { togocount = togocount + 1; } else { togocount = 0; togocount = togocount + 1; } + @@ -2717,7 +2797,7 @@ fhemcmd = "setreading"; false Script: Set FHEMDATA JSON - - - true - Script: togocount = togocount + 1 - - true Script: udef_trigger = "setLockPin" @@ -3375,247 +3450,179 @@ Soll der Assistent gelöscht werden? First Run Assistant - AMADNG Info/Control Flowset v3.9.74 + AMADNG Info/Control Flowset v3.9.75 false PARALLEL - + AMAD Voice Control + Flows löschen: First Run Assistant + AMAD Voice Control + AMAD Voice Control + Flows löschen: First Run Assistant + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + Abfrage + Script: amadcmd = "firstrun" + Script: amaddevice_ip = {value} + Eingabedialog: Android Device IP Adresse Einzeiliger Text Bitte gebe die IP Adresse Deines Androidgerätes an. NUR IP kein FQDN!!! + Script: global_fhemip = {value} + Eingabedialog: FHEM Server IP Einzeiliger Text Bitte gebe die IP Adresse oder den FQDN Deines FHEM Servers an. + Script: global_fhemdevice = {value} + Eingabedialog: FHEM Devicename Einzeiliger Text Wie soll das Device in FHEM heißen? + Script: global_bridgeport = {value} + Eingabedialog: AMADCommBridge Port Einzeiliger Text Bitte gebe den Port der AMADCommBridge vom FHEM Server an. + Sprachausgabe: Du möchtest also nicht fortfahren. Das ist schade. Bitte bedenke das dieses Android Gerät somit nicht als Amaad Device in Fhem angelegt ist. Du kannst jeder Zeit den Assistenten Flow neu aktivieren und von vorn beginnen. +Auf Wiedersehen. + AMAD Voice Control + Medienlautstärke Wiederherstellen + Lautstärke einstellen: Medien auf Level 8 + Medianlautstärken Speichern + Setze Flow Status: Aktivieren Informations + Setze Flow Status: Aktivieren SetCommands,Update AMAD Flowset,VoiceControl + Pause: 2s (Gerät wach halten) + Script: readingsvalcmd = "{global_fhemdevice} deviceState kaputt"; fhemcmd = "readingsval"; respfirstrun = "none"; + Expression: value != "" + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Expression: value == "nein" + Expression: value == "ja" + Expression: value == "ja" + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Expression: value != "" + Expression: value == "nein" + Expression: value != "" + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Expression: value == "nein" + Expression: value == "ja" + Flows löschen: First Run Assistant + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + Expression: value != "" + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + Expression: value == "ja" + Expression: value == "nein" + Script: if(index == 0) { sprachassi = "ja"; } else { sprachassi = "nein"; } + AMAD First Run Assistent Begrüßung + Eingabedialog: Wünschst Du einen sprachgestützten oder dialoggestützten Installationsassistanten? Einfachauswahl Menü Sprache,Dialog (15s) + Script: global_amadid = getDate(); + Setze Flow Status: Deaktivieren First Run Assistant + Setze Flow Status: Aktivieren Send Data to AMADCommBridge + Script: global_activetask = "none"; global_apssid = "none"; global_userflowstate = "none"; + Sprachausgabe: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + Meldungsdialog: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + Expression: sprachassi == "ja" + Flows ausführen: Send Data to AMADCommBridge + Sprachausgabe: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + Expression: sprachassi == "ja" + Meldungsdialog: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + Expression: respreadingsval != "kaputt" and respreadingsval != "none" + Expression: sprachassi == "ja" + Sprachausgabe: Leider scheint es ein Problem beim einrichten des Fhem Devices gegeben zu haben. Hast Du die Amaad Comm Bridge definiert? Und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an Cooltux alias Leon, im Fhem Forum. +Soll der Assistent gelöscht werden? + Meldungsdialog: Leider scheint es ein Problem beim Einrichten des FHEM Devices gegeben zu haben. Hast Du die AMADCommBridge definiert, und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an CoolTux alias Leon, im FHEM Forum. + Expression: sprachassi == "ja" + Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Amaad, Flows aktiv sind. +Soll der Assistent gelöscht werden? + Meldungsdialog: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Am + Expression: respreadingsval == "online" + Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device online. +Soll der Assistent gelöscht werden? + Expression: sprachassi == "ja" + Meldungsdialog: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + App Task Beendet: ch.gridvision.ppam.androidautomagic - Medianlautstärken Speichern - Lautstärke einstellen: Medien auf Level 8 - Medienlautstärke Wiederherstellen - Medianlautstärken Speichern - Lautstärke einstellen: Medien auf Level 8 - AMAD Voice Control - Expression: value != "" - Expression: value == "ja" - Expression: value == "nein" - Medianlautstärken Speichern - Medianlautstärken Speichern - Lautstärke einstellen: Medien auf Level 8 - Lautstärke einstellen: Medien auf Level 8 - Flows löschen: First Run Assistant - Medienlautstärke Wiederherstellen - Lautstärke einstellen: Medien auf Level 8 - Medianlautstärken Speichern - Medianlautstärken Speichern - Lautstärke einstellen: Medien auf Level 8 - Expression: value == "nein" - Medianlautstärken Speichern - Expression: value != "" - Flows löschen: First Run Assistant - Lautstärke einstellen: Medien auf Level 8 - Medianlautstärken Speichern - Medienlautstärke Wiederherstellen - Lautstärke einstellen: Medien auf Level 8 - Expression: value == "ja" - AMAD Voice Control - Medienlautstärke Wiederherstellen - Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. - Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. - Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. - Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device online. -Soll der Assistent gelöscht werden? - Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. - Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. - Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. - Medianlautstärken Speichern - Lautstärke einstellen: Medien auf Level 8 - Sprachausgabe: Leider scheint es ein Problem beim einrichten des Fhem Devices gegeben zu haben. Hast Du die Amaad Comm Bridge definiert? Und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an Cooltux alias Leon, im Fhem Forum. -Soll der Assistent gelöscht werden? - Medienlautstärke Wiederherstellen - AMAD Voice Control - Expression: value != "" - Expression: value == "ja" - Expression: value == "nein" - Medianlautstärken Speichern - Lautstärke einstellen: Medien auf Level 8 - Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. - Medienlautstärke Wiederherstellen - Medienlautstärke Wiederherstellen - Lautstärke einstellen: Medien auf Level 8 - Medianlautstärken Speichern - Medianlautstärken Speichern - Lautstärke einstellen: Medien auf Level 8 - Medienlautstärke Wiederherstellen - Flows löschen: First Run Assistant - Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. - Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. - Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Amaad, Flows aktiv sind. -Soll der Assistent gelöscht werden? - Abfrage - Medienlautstärke Wiederherstellen - Medienlautstärke Wiederherstellen - Script: amadcmd = "firstrun" - Script: amaddevice_ip = {value} - Eingabedialog: Android Device IP Adresse Einzeiliger Text Bitte gebe die IP Adresse Deines Androidgerätes an. NUR IP kein FQDN!!! - Script: global_fhemip = {value} - Eingabedialog: FHEM Server IP Einzeiliger Text Bitte gebe die IP Adresse oder den FQDN Deines FHEM Servers an. - Script: global_fhemdevice = {value} - Eingabedialog: FHEM Devicename Einzeiliger Text Wie soll das Device in FHEM heißen? - Script: global_bridgeport = {value} - Eingabedialog: AMADCommBridge Port Einzeiliger Text Bitte gebe den Port der AMADCommBridge vom FHEM Server an. - Medienlautstärke Wiederherstellen - Sprachausgabe: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. - Lautstärke einstellen: Medien auf Level 8 - Medianlautstärken Speichern - Medienlautstärke Wiederherstellen - Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. - Lautstärke einstellen: Medien auf Level 8 - Medianlautstärken Speichern - Expression: value == "nein" - Expression: value == "ja" - Medianlautstärken Speichern - Lautstärke einstellen: Medien auf Level 8 - Sprachausgabe: Du möchtest also nicht fortfahren. Das ist schade. Bitte bedenke das dieses Android Gerät somit nicht als Amaad Device in Fhem angelegt ist. Du kannst jeder Zeit den Assistenten Flow neu aktivieren und von vorn beginnen. -Auf Wiedersehen. - Medienlautstärke Wiederherstellen - Expression: value != "" - AMAD Voice Control - Medienlautstärke Wiederherstellen - AMAD First Run Assistent Begrüßung - Lautstärke einstellen: Medien auf Level 8 - Medianlautstärken Speichern - Setze Flow Status: Aktivieren Send Data to AMADCommBridge - Setze Flow Status: Deaktivieren First Run Assistant - Script: global_amadid = getDate(); - Script: global_activetask = "none"; global_apssid = "none"; global_userflowstate = "none"; - Setze Flow Status: Aktivieren Informations - Medienlautstärke Wiederherstellen - Medienlautstärke Wiederherstellen - Setze Flow Status: Aktivieren SetCommands,Update AMAD Flowset,VoiceControl - Pause: 2s (Gerät wach halten) - Script: readingsvalcmd = "{global_fhemdevice} deviceState kaputt"; fhemcmd = "readingsval"; respfirstrun = "none"; - Expression: respreadingsval != "kaputt" and respreadingsval != "none" - Expression: respreadingsval == "online" - Flows ausführen: Send Data to AMADCommBridge - Sprachausgabe: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. - Lautstärke einstellen: Medien auf Level 8 - Medianlautstärken Speichern - Medienlautstärke Wiederherstellen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + Informations - AMADNG Info/Control Flowset v3.9.74 + AMADNG Info/Control Flowset v3.9.75 true QUEUE 900 @@ -4070,7 +4077,7 @@ Auf Wiedersehen. Send Data to AMADCommBridge - AMADNG Info/Control Flowset v3.9.74 + AMADNG Info/Control Flowset v3.9.75 true PARALLEL 900 @@ -4093,52 +4100,52 @@ Auf Wiedersehen. Flow Aktiv: Informations Flow Aktiv: SetCommands Expression: trigger == "WLAN Getrennt: toGo" - Script: togocount = togocount + 1 - Expression: togocount < 6 - Pause: 1s (Gerät wach halten) - Setze Flow Status: Aktivieren Informations,SetCommands - Flow Aktiv: Informations - Flow Aktiv: SetCommands - Expression: trigger == "WLAN Verbunden: toGo" - In Datei Schreiben: Aktiviere Flows in /storage/emulated/0/file.txt (anhängen) - HTTP Request: send FIRSTRUN data to AMADCommBridge JSON - HTTP Request: send READINGS data to AMADCommBridge JSON - HTTP Request: send SET data to AMADCommBridge JSON - HTTP Request: send READINGSVAL data to AMADCommBridge JSON - HTTP Request: send VOICEINPUTVALUE data to AMADCommBridge - Script: Set FHEMDATA JSON + Expression: togocount < 6 + Pause: 1s (Gerät wach halten) + Setze Flow Status: Aktivieren Informations,SetCommands + Flow Aktiv: Informations + Flow Aktiv: SetCommands + Expression: trigger == "WLAN Verbunden: toGo" + In Datei Schreiben: Aktiviere Flows in /storage/emulated/0/file.txt (anhängen) + HTTP Request: send FIRSTRUN data to AMADCommBridge JSON + HTTP Request: send READINGS data to AMADCommBridge JSON + HTTP Request: send SET data to AMADCommBridge JSON + HTTP Request: send READINGSVAL data to AMADCommBridge JSON + HTTP Request: send VOICEINPUTVALUE data to AMADCommBridge + Script: Set FHEMDATA JSON + Script: if(togocount > 0) { togocount = togocount + 1; } else { togocount = 0; togocount = togocount + 1; } - - - - - + + + + + - + - - - - - - - - + + + + + + + + SetCommands - AMADNG Info/Control Flowset v3.9.74 + AMADNG Info/Control Flowset v3.9.75 true QUEUE 900 @@ -4491,7 +4498,7 @@ Auf Wiedersehen. Update AMAD Flowset - AMADNG Info/Control Flowset v3.9.74 + AMADNG Info/Control Flowset v3.9.75 true QUEUE @@ -4547,7 +4554,7 @@ Auf Wiedersehen. VoiceControl - AMADNG Info/Control Flowset v3.9.74 + AMADNG Info/Control Flowset v3.9.75 true QUEUE From bb8902ea5226516b930947e8dcaa66b64d023eff Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 23 Jun 2017 14:35:15 +0200 Subject: [PATCH 23/32] add Media Support vor Samung Music --- 73_AMADCommBridge.pm | 12 +- 74_AMADDevice.pm | 6 +- ....xml => 74_AMADautomagicFlowset_3.9.76.xml | 1475 +++++++++-------- 3 files changed, 760 insertions(+), 733 deletions(-) rename 74_AMADautomagicFlowset_3.9.75.xml => 74_AMADautomagicFlowset_3.9.76.xml (82%) diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index b90a6f1..b947e46 100644 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -68,8 +68,8 @@ use TcpServerUtils; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.73"; -my $flowsetversion = "3.9.75"; +my $modulversion = "3.9.75"; +my $flowsetversion = "3.9.76"; @@ -969,8 +969,8 @@ sub AMADCommBridge_ParseMsg($$) { =begin html - -

AMAD

+ +

AMADCommBridge

    AMAD - Automagic Android Device
    @@ -1144,8 +1144,8 @@ sub AMADCommBridge_ParseMsg($$) { =end html =begin html_DE - -

    AMAD

    + +

    AMADCommBridge

      AMAD - Automagic Android Device
      diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index a770570..bb27e43 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -54,8 +54,8 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode "; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.72"; -my $flowsetversion = "3.9.75"; +my $modulversion = "3.9.73"; +my $flowsetversion = "3.9.76"; @@ -737,7 +737,7 @@ sub AMADDevice_Set($$@) { my $btdev = AttrVal( $name, "setBluetoothDevice", "none" ); - my $list = "screenMsg ttsMsg volume:slider,0,1,15 mediaGoogleMusic:play/pause,stop,next,back mediaAmazonMusic:play/pause,stop,next,back mediaSpotifyMusic:play/pause,stop,next,back mediaTuneinRadio:play/pause,stop,next,back mediaAldiMusic:play/pause,stop,next,back mediaYouTube:play/pause,stop,next,back mediaVlcPlayer:play/pause,stop,next,back mediaAudible:play/pause,stop,next,back screenBrightness:slider,0,1,255 screen:on,off,lock,unlock openURL nextAlarmTime:time timer:slider,1,1,60 statusRequest:noArg bluetooth:on,off notifySndFile clearNotificationBar:All,Automagic activateVoiceInput:noArg volumeNotification:slider,0,1,7 volumeRingSound:slider,0,1,7 vibrate:noArg sendIntent openCall closeCall:noArg currentFlowsetUpdate:noArg installFlowSource doNotDisturb:never,always,alarmClockOnly,onlyImportant userFlowState sendSMS startDaydream:noArg volumeUp:noArg volumeDown:noArg mute:on,off"; + my $list = "screenMsg ttsMsg volume:slider,0,1,15 mediaGoogleMusic:play/pause,stop,next,back mediaSamsungMusic:play/pause,stop,next,back mediaAmazonMusic:play/pause,stop,next,back mediaSpotifyMusic:play/pause,stop,next,back mediaTuneinRadio:play/pause,stop,next,back mediaAldiMusic:play/pause,stop,next,back mediaYouTube:play/pause,stop,next,back mediaVlcPlayer:play/pause,stop,next,back mediaAudible:play/pause,stop,next,back screenBrightness:slider,0,1,255 screen:on,off,lock,unlock openURL nextAlarmTime:time timer:slider,1,1,60 statusRequest:noArg bluetooth:on,off notifySndFile clearNotificationBar:All,Automagic activateVoiceInput:noArg volumeNotification:slider,0,1,7 volumeRingSound:slider,0,1,7 vibrate:noArg sendIntent openCall closeCall:noArg currentFlowsetUpdate:noArg installFlowSource doNotDisturb:never,always,alarmClockOnly,onlyImportant userFlowState sendSMS startDaydream:noArg volumeUp:noArg volumeDown:noArg mute:on,off"; $list .= " screenOrientation:auto,landscape,portrait" if( AttrVal( $name, "setScreenOrientation", "0" ) eq "1" ); $list .= " screenFullscreen:on,off" if( AttrVal( $name, "setFullscreen", "0" ) eq "1" ); diff --git a/74_AMADautomagicFlowset_3.9.75.xml b/74_AMADautomagicFlowset_3.9.76.xml similarity index 82% rename from 74_AMADautomagicFlowset_3.9.75.xml rename to 74_AMADautomagicFlowset_3.9.76.xml index 6f9160e..6f7c46b 100644 --- a/74_AMADautomagicFlowset_3.9.75.xml +++ b/74_AMADautomagicFlowset_3.9.76.xml @@ -1,9 +1,9 @@ - + true Akku Ladestand: grösser als 0% - true + false 0 HIGHER_THAN true @@ -12,19 +12,21 @@ false App Task Beendet - true + false + CLASSIC * true App Task Beendet: ch.gridvision.ppam.androidautomagic false + CLASSIC ch.gridvision.ppam.androidautomagic true Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic - true + false ch.gridvision.ppam.androidautomagic TEXT CONTAINS_TEXT @@ -35,7 +37,7 @@ true Benachrichtigung in Statusbar angezeigt: com.whatsapp - true + false com.whatsapp TEXT CONTAINS_TEXT @@ -46,7 +48,7 @@ true Benachrichtigung in Statusbar angezeigt: org.telegram.messenger - true + false org.telegram.messenger TEXT CONTAINS_TEXT @@ -57,7 +59,7 @@ true Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic - true + false ch.gridvision.ppam.androidautomagic TEXT CONTAINS_TEXT @@ -68,7 +70,7 @@ true Bluetooth Gerät getrennt: Alle Geräte - true + false true @@ -76,7 +78,7 @@ true Bluetooth Gerät verbunden: Alle Geräte - true + false true @@ -84,7 +86,7 @@ true Bluetooth Status: Schaltet aus, Aus - true + false false false true @@ -93,7 +95,7 @@ true Bluetooth Status: Schaltet ein, Ein - true + false true true false @@ -102,55 +104,55 @@ true Daydream Status: Gestartet - true + false true true Daydream Status: Gestoppt - true + false false true Display Orientierung: Landscape - true + false false true Display Orientierung: Portrait - true + false true true Display Status: Aus - true + false false true Display Status: Ein - true + false true true Dock Event: Docked - true + false true true Dock Event: Undocked - true + false false true Eingehender Anruf. Status: Klingelt, Nummern: Alle - true + false true true @@ -162,13 +164,13 @@ true Flugmodus: Aus - true + false false true Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT - true + false com.android.deskclock.ALARM_ALERT @@ -183,7 +185,7 @@ true Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS - true + false com.android.deskclock.ALARM_DISMISS @@ -198,7 +200,7 @@ true Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE - true + false com.android.deskclock.ALARM_DONE @@ -213,7 +215,7 @@ true Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE - true + false com.android.deskclock.ALARM_SNOOZE @@ -228,7 +230,7 @@ true Genereller Broadcast: wenn org.smblott.intentradio.STATE - true + false org.smblott.intentradio.STATE @@ -252,7 +254,7 @@ irname=getString("name") false HTTP Request: /fhem-amad/deviceInfo/ - true + false /fhem-amad/deviceInfo/ 8090 true @@ -260,7 +262,7 @@ irname=getString("name") false HTTP Request: /fhem-amad/setCommands/* - true + false /fhem-amad/setCommands/* 8090 true @@ -268,13 +270,13 @@ irname=getString("name") false Medien Session verändert - true - com.amazon.mp3,com.amazon.avod.thirdpartyclient,com.audible.application,com.rhapsody.alditalk,com.spotify.music,com.google.android.videos,com.google.android.music,org.smblott.intentradioio,de.maxdome.app.android,tunein.player,org.videolan.vlc,com.google.android.youtube + false + com.amazon.mp3,com.amazon.avod.thirdpartyclient,com.audible.application,com.rhapsody.alditalk,com.spotify.music,com.google.android.videos,com.google.android.music,org.smblott.intentradioio,de.maxdome.app.android,tunein.player,org.videolan.vlc,com.google.android.youtube,com.sec.android.app.music false Periodischer Timer: alle 120s - true + false 120000 true false @@ -296,12 +298,12 @@ irname=getString("name") true Sprachbefehl angefordert - true + false true Stromversorgung: Angeschlossen - true + false true true true @@ -310,7 +312,7 @@ irname=getString("name") true Stromversorgung: Entfernt - true + false false true true @@ -319,7 +321,7 @@ irname=getString("name") false Systemeinstellung verändert: System next_alarm - true + false SYSTEM next_alarm_formatted setting @@ -327,7 +329,7 @@ irname=getString("name") true Systemeinstellung verändert: System screen_brightness - true + false SYSTEM screen_brightness screenBrightness @@ -335,7 +337,7 @@ irname=getString("name") true Systemeinstellung verändert: System volume_music_bt_a2dp - true + false SYSTEM volume_music_bt_a2dp volume @@ -343,7 +345,7 @@ irname=getString("name") true Systemeinstellung verändert: System volume_music_headphone - true + false SYSTEM volume_music_headphone volume @@ -351,7 +353,7 @@ irname=getString("name") false Systemeinstellung verändert: System volume_music_headset - true + false SYSTEM volume_music_headset volume @@ -359,7 +361,7 @@ irname=getString("name") true Systemeinstellung verändert: System volume_music_speaker - true + false SYSTEM volume_music_speaker volume @@ -367,7 +369,7 @@ irname=getString("name") true Systemeinstellung verändert: System volume_ring - true + false SYSTEM volume_ring volumeRingSound @@ -375,7 +377,7 @@ irname=getString("name") true Systemeinstellung verändert: System volume_ring_speaker - true + false SYSTEM volume_ring_speaker volumeNotification @@ -383,25 +385,25 @@ irname=getString("name") true Unterbrechnungen-Modus: Alle / Immer unterbrechen - true + false OFF true Unterbrechnungen-Modus: Keine / Nicht unterbrechen - true + false NO_INTERRUPTIONS true Unterbrechnungen-Modus: Nur Wecker (Android 6+) - true + false ALARMS_ONLY true Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen - true + false IMPORTANT_INTERRUPTIONS @@ -421,12 +423,14 @@ irname=getString("name") false App Task läuft: App (neuster) + CLASSIC {param_app} true true App Task läuft: {global_activetask} (neuster) + CLASSIC {global_activetask} true @@ -1778,6 +1782,8 @@ androidVersion = "4.0 - 4.0.2 Ice Cream Sandwich" false false + false + POST GENERAL_TEXT text/json @@ -1798,6 +1804,8 @@ androidVersion = "4.0 - 4.0.2 Ice Cream Sandwich" false false + false + POST GENERAL_TEXT text/json @@ -1818,6 +1826,8 @@ androidVersion = "4.0 - 4.0.2 Ice Cream Sandwich" false false + false + POST GENERAL_TEXT text/json @@ -1838,6 +1848,8 @@ androidVersion = "4.0 - 4.0.2 Ice Cream Sandwich" false false + false + POST GENERAL_TEXT text/json @@ -1858,6 +1870,8 @@ androidVersion = "4.0 - 4.0.2 Ice Cream Sandwich" false false + false + POST GENERAL_TEXT text/json @@ -2143,6 +2157,7 @@ Connection: close true Nummer anrufen: {param_callnumber} + {param_callnumber} true @@ -2459,7 +2474,7 @@ else 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } + 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } if(package_name == "com.sec.android.app.music") { musicapp = "Samsung Music Player" } @@ -2797,7 +2816,7 @@ fhemcmd = "setreading"; false Script: Set FHEMDATA JSON - @@ -3201,6 +3226,7 @@ if(param_mplayer == "mediaAudible") true SMS senden an: an {param_smsnumber} '{param_smsmessage}' (10 in 12h) + {param_smsnumber} {param_smsmessage} true @@ -3219,6 +3245,7 @@ if(param_mplayer == "mediaAudible") Lautlos {param_notifypath}{param_notifyfile} NOTIFICATION + false true true @@ -3450,94 +3477,95 @@ Soll der Assistent gelöscht werden? First Run Assistant - AMADNG Info/Control Flowset v3.9.75 + AMADNG Info/Control Flowset v3.9.76 false PARALLEL - AMAD Voice Control - Flows löschen: First Run Assistant - AMAD Voice Control - AMAD Voice Control - Flows löschen: First Run Assistant - Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. - Abfrage - Script: amadcmd = "firstrun" - Script: amaddevice_ip = {value} - Eingabedialog: Android Device IP Adresse Einzeiliger Text Bitte gebe die IP Adresse Deines Androidgerätes an. NUR IP kein FQDN!!! - Script: global_fhemip = {value} - Eingabedialog: FHEM Server IP Einzeiliger Text Bitte gebe die IP Adresse oder den FQDN Deines FHEM Servers an. - Script: global_fhemdevice = {value} - Eingabedialog: FHEM Devicename Einzeiliger Text Wie soll das Device in FHEM heißen? - Script: global_bridgeport = {value} - Eingabedialog: AMADCommBridge Port Einzeiliger Text Bitte gebe den Port der AMADCommBridge vom FHEM Server an. - Sprachausgabe: Du möchtest also nicht fortfahren. Das ist schade. Bitte bedenke das dieses Android Gerät somit nicht als Amaad Device in Fhem angelegt ist. Du kannst jeder Zeit den Assistenten Flow neu aktivieren und von vorn beginnen. -Auf Wiedersehen. - AMAD Voice Control - Medienlautstärke Wiederherstellen - Lautstärke einstellen: Medien auf Level 8 - Medianlautstärken Speichern - Setze Flow Status: Aktivieren Informations - Setze Flow Status: Aktivieren SetCommands,Update AMAD Flowset,VoiceControl - Pause: 2s (Gerät wach halten) - Script: readingsvalcmd = "{global_fhemdevice} deviceState kaputt"; fhemcmd = "readingsval"; respfirstrun = "none"; - Expression: value != "" - Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. - Expression: value == "nein" - Expression: value == "ja" - Expression: value == "ja" - Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. - Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. - Expression: value != "" - Expression: value == "nein" - Expression: value != "" - Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. - Expression: value == "nein" - Expression: value == "ja" - Flows löschen: First Run Assistant - Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. - Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. - Expression: value != "" - Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. - Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. - Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. - Expression: value == "ja" - Expression: value == "nein" - Script: if(index == 0) { sprachassi = "ja"; } else { sprachassi = "nein"; } - AMAD First Run Assistent Begrüßung - Eingabedialog: Wünschst Du einen sprachgestützten oder dialoggestützten Installationsassistanten? Einfachauswahl Menü Sprache,Dialog (15s) - Script: global_amadid = getDate(); - Setze Flow Status: Deaktivieren First Run Assistant - Setze Flow Status: Aktivieren Send Data to AMADCommBridge - Script: global_activetask = "none"; global_apssid = "none"; global_userflowstate = "none"; - Sprachausgabe: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. - Meldungsdialog: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. - Expression: sprachassi == "ja" - Flows ausführen: Send Data to AMADCommBridge - Sprachausgabe: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. - Expression: sprachassi == "ja" - Meldungsdialog: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. - Expression: respreadingsval != "kaputt" and respreadingsval != "none" - Expression: sprachassi == "ja" - Sprachausgabe: Leider scheint es ein Problem beim einrichten des Fhem Devices gegeben zu haben. Hast Du die Amaad Comm Bridge definiert? Und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an Cooltux alias Leon, im Fhem Forum. -Soll der Assistent gelöscht werden? - Meldungsdialog: Leider scheint es ein Problem beim Einrichten des FHEM Devices gegeben zu haben. Hast Du die AMADCommBridge definiert, und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an CoolTux alias Leon, im FHEM Forum. - Expression: sprachassi == "ja" - Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Amaad, Flows aktiv sind. -Soll der Assistent gelöscht werden? - Meldungsdialog: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Am - Expression: respreadingsval == "online" - Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device online. -Soll der Assistent gelöscht werden? - Expression: sprachassi == "ja" - Meldungsdialog: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. - + App Task Beendet: ch.gridvision.ppam.androidautomagic - - - - - - + AMAD Voice Control + Flows löschen: First Run Assistant + AMAD Voice Control + AMAD Voice Control + Flows löschen: First Run Assistant + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + Abfrage + Script: amadcmd = "firstrun" + Script: amaddevice_ip = {value} + Eingabedialog: Android Device IP Adresse Einzeiliger Text Bitte gebe die IP Adresse Deines Androidgerätes an. NUR IP kein FQDN!!! + Script: global_fhemip = {value} + Eingabedialog: FHEM Server IP Einzeiliger Text Bitte gebe die IP Adresse oder den FQDN Deines FHEM Servers an. + Script: global_fhemdevice = {value} + Eingabedialog: FHEM Devicename Einzeiliger Text Wie soll das Device in FHEM heißen? + Script: global_bridgeport = {value} + Eingabedialog: AMADCommBridge Port Einzeiliger Text Bitte gebe den Port der AMADCommBridge vom FHEM Server an. + Sprachausgabe: Du möchtest also nicht fortfahren. Das ist schade. Bitte bedenke das dieses Android Gerät somit nicht als Amaad Device in Fhem angelegt ist. Du kannst jeder Zeit den Assistenten Flow neu aktivieren und von vorn beginnen. +Auf Wiedersehen. + AMAD Voice Control + Medienlautstärke Wiederherstellen + Lautstärke einstellen: Medien auf Level 8 + Medianlautstärken Speichern + Setze Flow Status: Aktivieren Informations + Setze Flow Status: Aktivieren SetCommands,Update AMAD Flowset,VoiceControl + Pause: 2s (Gerät wach halten) + Script: readingsvalcmd = "{global_fhemdevice} deviceState kaputt"; fhemcmd = "readingsval"; respfirstrun = "none"; + Expression: value != "" + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Expression: value == "nein" + Expression: value == "ja" + Expression: value == "ja" + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Expression: value != "" + Expression: value == "nein" + Expression: value != "" + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Expression: value == "nein" + Expression: value == "ja" + Flows löschen: First Run Assistant + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + Expression: value != "" + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + Expression: value == "ja" + Expression: value == "nein" + Script: if(index == 0) { sprachassi = "ja"; } else { sprachassi = "nein"; } + AMAD First Run Assistent Begrüßung + Eingabedialog: Wünschst Du einen sprachgestützten oder dialoggestützten Installationsassistanten? Einfachauswahl Menü Sprache,Dialog (15s) + Script: global_amadid = getDate(); + Setze Flow Status: Deaktivieren First Run Assistant + Setze Flow Status: Aktivieren Send Data to AMADCommBridge + Script: global_activetask = "none"; global_apssid = "none"; global_userflowstate = "none"; + Sprachausgabe: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + Meldungsdialog: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + Expression: sprachassi == "ja" + Flows ausführen: Send Data to AMADCommBridge + Sprachausgabe: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + Expression: sprachassi == "ja" + Meldungsdialog: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + Expression: respreadingsval != "kaputt" and respreadingsval != "none" + Expression: sprachassi == "ja" + Sprachausgabe: Leider scheint es ein Problem beim einrichten des Fhem Devices gegeben zu haben. Hast Du die Amaad Comm Bridge definiert? Und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an Cooltux alias Leon, im Fhem Forum. +Soll der Assistent gelöscht werden? + Meldungsdialog: Leider scheint es ein Problem beim Einrichten des FHEM Devices gegeben zu haben. Hast Du die AMADCommBridge definiert, und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an CoolTux alias Leon, im FHEM Forum. + Expression: sprachassi == "ja" + Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Amaad, Flows aktiv sind. +Soll der Assistent gelöscht werden? + Meldungsdialog: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Am + Expression: respreadingsval == "online" + Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device online. +Soll der Assistent gelöscht werden? + Expression: sprachassi == "ja" + Meldungsdialog: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + + + + + + + @@ -3545,88 +3573,249 @@ Soll der Assistent gelöscht werden? - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - + + + + + + - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + Informations - AMADNG Info/Control Flowset v3.9.75 - true + AMADNG Info/Control Flowset v3.9.76 + false QUEUE 900 - + Script: daydream_state = "on" + Script: daydream_state = "off" + Script: keyguard = "unlocked" + Display Orientierung: Portrait + Script: screen_orientation = "portrait" + Script: screen_orientation = "landscape" + Script: dock_state = "docked" + Script: dock_state = "undocked" + Script: keyguardSet = "0" + Script: screen_orientation_mode = "manual" + Script: scrcount = 0 + Script: keyguard = "locked" + Expression: scrcount < 5 + Script: scrcount = scrcount + 1 + Pause: 2s (Gerät wach halten) + Dock Status: Docked + Display automatisch drehen eingeschaltet + Expression: trigger == "Daydream Status: Gestartet" + Bluetooth eingeschaltet + Expression: trigger == "App Task Beendet" + Keyguard gesperrt + Expression: keyguard == "locked" + Expression: getAndroidSDKVersion() >= "16" + Script: keyguardSet = "not supported from your device" + Display eingeschaltet + Display eingeschaltet + Expression: getAndroidSDKVersion() >= "16" + Unterbrechnungen-Modus: Nur Wecker (Android 6+) + Unterbrechnungen-Modus: Keine / Nicht unterbrechen + Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + Unterbrechnungen-Modus: Alle / Immer unterbrechen + Script: dndValue = "always" + Script: dndValue = "onlyImportant" + Script: dndValue = "never" + Script: dndValue = "alarmClockOnly" + Script: screen_state = "on" + Script: screen_state = "off" + Script: screen_state = "on {keyguard}" + Script: screen_state = "off {keyguard}" + Script: airplanemode = "off" + Script: bluetooth_state = "on" + Script: androidVersion = "not supported funktion" + App Task läuft: {global_activetask} (neuster) + Script: runTask = "1" + Script: runTask = "0" + Expression: getAndroidSDKVersion() >= "19" + Script: runTask = "not supported android version" + Script: runTask = "null" + Expression: trigger == "Periodischer Timer: alle 120s" + Expression: global_activetask != null + Expression: trigger == "Display Status: Aus" or trigger == "Display Status: Ein" or udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Daydream Status: Gestartet" or trigger == "Daydream Status: Gestoppt" + Expression: trigger == "Display Orientierung: Landscape" or trigger == "Display Orientierung: Portrait" or trigger == "Display Status: Ein" or trigger == "Display Status: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Akku Ladestand: grösser als 0%" + Stromversorgung: Angeschlossen + Script: screen_orientation_mode = "auto" + Script: bluetooth_state = "off" + Script: if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT") { nextalarmstate = "alert" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS") { nextalarmstate = "dismiss" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE") { nextalarmstate = "done" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE") { nextalarmstate = "snooze" } + Keyguard mit Sicherheit + Script: keyguardSet = "1" + Expression: udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" + Expression: trigger == "Flugmodus: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Systemeinstellung verändert: System screen_brightness" + Bluetooth Gerät verbunden: Beliebiges Geräte (Advanced Audio Distribution) + Script: volume = {volumeBT} + Pause: 2s (Gerät wach halten) + Musik Aktiv + Benachrichtigung auf Bildschirm: [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! (lange) + Expression: trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" or trigger == "Systemeinstellung verändert: System volume_music_speaker" or trigger == "Systemeinstellung verändert: System volume_music_headphone" or trigger == "Systemeinstellung verändert: System volume_music_headset" + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth.2 + Script: volume = {volumeSP} + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker.2 + Expression: trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: getAndroidSDKVersion() >= "21" + Script: airpcount = 0 + Host erreichbar: {global_fhemip}:{global_bridgeport} + WLAN Reassoziieren + Expression: trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Systemeinstellung verändert: System next_alarm" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Initialisiere Variable Nächster Alarm: next_alarm + Script: next_alarmday = "{next_alarm,dateformat,c}" + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + Expression: global_fhemip != null or global_bridgeport != null + Expression: getAndroidSDKVersion() >= "19" + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + Script: notification_text = "not supported from your device" + Expression: getAndroidSDKVersion() >= "19" + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + Expression: trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" + Benachrichtigung in Statusbar angezeigt: WhatsApp + Script: notification_text = "not supported from your device" + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" + Initialisiere Variable Systemeinstellung: screenBrightness + Expression: trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Systemeinstellung verändert: System volume_ring_speaker" + Initialisiere Variable Systemeinstellung: volumeNotification + Expression: trigger == "Systemeinstellung verändert: System volume_ring" + Initialisiere Variable Systemeinstellung: volumeRingSound + Expression: trigger == "Medien Session verändert" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Get Android Version + WLAN verfügbar: {global_apssid} + Script: volumeRingSound = "\"volumeRingSound\":" + " \"" + {volumeRingSound} + "\""; fhemcmd = "setreading"; + Script: intentRadioState = "\"intentRadioState\":" + " \"" + {irstate} + "\"" + "," + "\"intentRadioName\":" + " \"" + {irname} + "\""; fhemcmd = "setreading"; + Script: keyguardSet = "\"keyguardSet\":" + " \"" + {keyguardSet} + "\""; fhemcmd = "setreading"; + Script: dockingState = "\"dockingState\":" + " \"" + {dock_state} + "\""; fhemcmd = "setreading"; + Script: screenOrientation = "\"screenOrientation\":" + " \"" + {screen_orientation} + "\"" + "," + "\"screenOrientationMode\":" + " \"" + {screen_orientation_mode} + "\""; fhemcmd = "setreading"; + Script: screenBrightness = "\"screenBrightness\":" + " \"" + {screenBrightness} + "\""; fhemcmd = "setreading"; + Script: daydream = "\"daydream\":" + " \"" + {daydream_state} + "\""; fhemcmd = "setreading"; + Script: nextAlarm = "\"nextAlarmTime\":" + " \"" + {next_alarmtime} + "\"" + "," + "\"nextAlarmDay\":" + " \"" + {next_alarmday} + "\""; fhemcmd = "setreading"; + Script: volumevalue = "\"volume\":" + " \"" + {volume} + "\""; fhemcmd = "setreading"; + Script: volumeNotification = "\"volumeNotification\":" + " \"" + {volumeNotification} + "\""; fhemcmd = "setreading"; + Script: airplanemode = "\"airplanemode\":" + " \"" + {airplanemode} + "\""; fhemcmd = "setreading"; + Script: screen = "\"screen\":" + " \"" + {screen_state} + "\""; fhemcmd = "setreading"; + Script: nextAlarmState = "\"nextAlarmState\":" + " \"" + {nextalarmstate} + "\""; fhemcmd = "setreading"; + Script: doNotDisturb = "\"doNotDisturb\":" + " \"" + {dndValue} + "\""; fhemcmd = "setreading"; + Script: checkActiveTask = "\"checkActiveTask\":" + " \"" + {runTask} + "\""; fhemcmd = "setreading"; + Expression: Leon == "Gaultier" + Flows löschen: MultimediaControl + Script: androidVersion = "\"androidVersion\":" + " \"" + {androidVersion} + "\""; fhemcmd = "setreading"; + Script: powerinfo = "\"powerLevel\":" + " \"" + "{battery_percentage,numberformat,0}" + "\"" + "," + "\"powerPlugged\":" + " \"" + {battery_plugged} + "\"" + "," + "\"batteryTemperature\":" + " \"" + "{battery_temperature/10.0,numberformat.0.0}" + "\"" + "," + "\"batteryHealth\":" + " \"" + {battery_health} + "\""; fhemcmd = "setreading"; + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: getAndroidSDKVersion() >= "19" + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + Benachrichtigung in Statusbar angezeigt: Automagic + Expression: package_name == {global_activetask} + Script: deviceState = "\"deviceState\": \"online\""; fhemcmd = "setreading"; + Expression: trigger == "Dock Event: Docked" or trigger == "Dock Event: Undocked" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Flows ausführen: Send Data to AMADCommBridge + Prüfe und setze globale Variable + Script: bluetooth = "\"bluetooth\":" + " \"" + {bluetooth_state} + "\""; fhemcmd = "setreading"; + Script: connected_devices_names = "none"; connected_devices_addresses = "none" + Script: btdeviceinfo = "\"connectedBTdevices\":" + " \"" + {connected_devices_names} + "\"" + "," + "\"connectedBTdevicesMAC\":" + " \"" + {connected_devices_addresses} + "\""; fhemcmd = "setreading"; + Bluetooth Gerät verbunden: Beliebiges Geräte + Expression: trigger == "Bluetooth Status: Schaltet aus, Aus" or trigger == "Bluetooth Gerät verbunden: Alle Geräte" or trigger == "Bluetooth Gerät getrennt: Alle Geräte" or trigger == "Bluetooth Status: Schaltet ein, Ein" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Host erreichbar: {global_fhemip}:{global_bridgeport} + Script: flow_SetCommands = "\"flow_SetCommands\":" + " \"" + {setCommandFlow_state} + "\""; fhemcmd = "setreading"; + Setze Flow Status: Aktivieren SetCommands + Script: setCommandFlow_state = "aktiv" + Script: setCommandFlow_state = "inaktiv" + Flow Aktiv: SetCommands + Expression: trigger == "Periodischer Timer: alle 120s" + Expression: global_userflowstate != "none" + Flow Aktiv: {global_userflowstate} + Script: flowState = "inactive" + Script: flowState = "active" + Script: flow_informations = "\"userFlowState\":" + " \"" + {flowState} + "\""; fhemcmd = "setreading"; + Expression: trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Flow Aktiv: Send Data to AMADCommBridge + Setze Flow Status: Aktivieren Send Data to AMADCommBridge + Expression: trigger == "Periodischer Timer: alle 120s" + Script: incomingCaller = "\"incomingCallerName\":" + " \"" + {contact_name} + "\"" + "," + "\"incomingCallerNumber\":" + " \"" + {incoming_number} + "\""; fhemcmd = "setreading"; + Script: incommingWhatsAppMessage = "\"incommingWhatsAppMessageFrom\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Script: incommingTelegramMessage = "\"incommingTelegramMessageFrom\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Benachrichtigung in Statusbar angezeigt: Telegram Messenger + Pause: 2s (Gerät wach halten) + Script: airpcount = airpcount + 1 + Expression: airpcount < 11 + Script: notification_text = "not supported from your device" + Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE Genereller Broadcast: wenn org.smblott.intentradio.STATE Systemeinstellung verändert: System volume_music_headphone @@ -3640,7 +3829,6 @@ Soll der Assistent gelöscht werden? Bluetooth Status: Schaltet aus, Aus Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen Benachrichtigung in Statusbar angezeigt: com.whatsapp - Medien Session verändert Daydream Status: Gestoppt Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic Eingehender Anruf. Status: Klingelt, Nummern: Alle @@ -3669,415 +3857,254 @@ Soll der Assistent gelöscht werden? Systemeinstellung verändert: System volume_ring Flugmodus: Aus Systemeinstellung verändert: System volume_ring_speaker + Medien Session verändert - Script: daydream_state = "on" - Script: daydream_state = "off" - Script: keyguard = "unlocked" - Display Orientierung: Portrait - Script: screen_orientation = "portrait" - Script: screen_orientation = "landscape" - Script: dock_state = "docked" - Script: dock_state = "undocked" - Script: keyguardSet = "0" - Script: screen_orientation_mode = "manual" - Script: scrcount = 0 - Script: keyguard = "locked" - Expression: scrcount < 5 - Script: scrcount = scrcount + 1 - Pause: 2s (Gerät wach halten) - Dock Status: Docked - Display automatisch drehen eingeschaltet - Expression: trigger == "Daydream Status: Gestartet" - Bluetooth eingeschaltet - Expression: trigger == "App Task Beendet" - Keyguard gesperrt - Expression: keyguard == "locked" - Expression: getAndroidSDKVersion() >= "16" - Script: keyguardSet = "not supported from your device" - Display eingeschaltet - Display eingeschaltet - Expression: getAndroidSDKVersion() >= "16" - Unterbrechnungen-Modus: Nur Wecker (Android 6+) - Unterbrechnungen-Modus: Keine / Nicht unterbrechen - Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen - Unterbrechnungen-Modus: Alle / Immer unterbrechen - Script: dndValue = "always" - Script: dndValue = "onlyImportant" - Script: dndValue = "never" - Script: dndValue = "alarmClockOnly" - Script: screen_state = "on" - Script: screen_state = "off" - Script: screen_state = "on {keyguard}" - Script: screen_state = "off {keyguard}" - Script: airplanemode = "off" - Script: bluetooth_state = "on" - Script: androidVersion = "not supported funktion" - App Task läuft: {global_activetask} (neuster) - Script: runTask = "1" - Script: runTask = "0" - Expression: getAndroidSDKVersion() >= "19" - Script: runTask = "not supported android version" - Script: runTask = "null" - Expression: trigger == "Periodischer Timer: alle 120s" - Expression: global_activetask != null - Expression: trigger == "Display Status: Aus" or trigger == "Display Status: Ein" or udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Daydream Status: Gestartet" or trigger == "Daydream Status: Gestoppt" - Expression: trigger == "Display Orientierung: Landscape" or trigger == "Display Orientierung: Portrait" or trigger == "Display Status: Ein" or trigger == "Display Status: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Akku Ladestand: grösser als 0%" - Stromversorgung: Angeschlossen - Script: screen_orientation_mode = "auto" - Script: bluetooth_state = "off" - Script: if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT") { nextalarmstate = "alert" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS") { nextalarmstate = "dismiss" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE") { nextalarmstate = "done" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE") { nextalarmstate = "snooze" } - Keyguard mit Sicherheit - Script: keyguardSet = "1" - Expression: udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" - Expression: trigger == "Flugmodus: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Systemeinstellung verändert: System screen_brightness" - Bluetooth Gerät verbunden: Beliebiges Geräte (Advanced Audio Distribution) - Script: volume = {volumeBT} - Pause: 2s (Gerät wach halten) - Musik Aktiv - Benachrichtigung auf Bildschirm: [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! (lange) - Expression: trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" or trigger == "Systemeinstellung verändert: System volume_music_speaker" or trigger == "Systemeinstellung verändert: System volume_music_headphone" or trigger == "Systemeinstellung verändert: System volume_music_headset" - Initialisiere Variable Systemeinstellung: volumeMusikBluetooth.2 - Script: volume = {volumeSP} - Initialisiere Variable Systemeinstellung: volumeMusikSpeaker.2 - Expression: trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: getAndroidSDKVersion() >= "21" - Script: airpcount = 0 - Host erreichbar: {global_fhemip}:{global_bridgeport} - WLAN Reassoziieren - Expression: trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Systemeinstellung verändert: System next_alarm" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Initialisiere Variable Nächster Alarm: next_alarm - Script: next_alarmday = "{next_alarm,dateformat,c}" - Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" - Expression: global_fhemip != null or global_bridgeport != null - Expression: getAndroidSDKVersion() >= "19" - Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" - Script: notification_text = "not supported from your device" - Expression: getAndroidSDKVersion() >= "19" - Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" - Expression: trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" - Expression: trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" - Benachrichtigung in Statusbar angezeigt: WhatsApp - Script: notification_text = "not supported from your device" - Expression: trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" - Initialisiere Variable Systemeinstellung: screenBrightness - Expression: trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Systemeinstellung verändert: System volume_ring_speaker" - Initialisiere Variable Systemeinstellung: volumeNotification - Expression: trigger == "Systemeinstellung verändert: System volume_ring" - Initialisiere Variable Systemeinstellung: volumeRingSound - Script: subtitle = "no player active"; title = "no player active"; description = "no player active"; musicapp = "no player active"; icon = "no player active" - Script: if(playback_state == 0) { playback_state = "keiner" } if(playback_state == 1) { playback_state = "gestoppt" } if(playback_state == 2) { playback_state = "pausiert" } if(playback_state == 3) { playback_state = "spielt ab" } if(playback_state == 4) { playback_state = "spult vorwärts" } if(playback_state == 5) { playback_state = "spült rückwärts" } if(playback_state == 6) { playback_state = "buffert" } if(playback_state == 7) { playback_state = "Fehler" } if(playback_state == 8) { playback_state = "verbindet" } if(playback_state == 9) { playback_state = "springt zum vorherigen" } if(playback_state == 10) { playback_state = "springt zum nächsten" } if(playback_state == 11) { playback_state = "springt zu Position in Wiedergabeliste" } - Expression: trigger == "Medien Session verändert" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } - Get Android Version - WLAN verfügbar: {global_apssid} - Script: volumeRingSound = "\"volumeRingSound\":" + " \"" + {volumeRingSound} + "\""; fhemcmd = "setreading"; - Script: intentRadioState = "\"intentRadioState\":" + " \"" + {irstate} + "\"" + "," + "\"intentRadioName\":" + " \"" + {irname} + "\""; fhemcmd = "setreading"; - Script: keyguardSet = "\"keyguardSet\":" + " \"" + {keyguardSet} + "\""; fhemcmd = "setreading"; - Script: dockingState = "\"dockingState\":" + " \"" + {dock_state} + "\""; fhemcmd = "setreading"; - Script: screenOrientation = "\"screenOrientation\":" + " \"" + {screen_orientation} + "\"" + "," + "\"screenOrientationMode\":" + " \"" + {screen_orientation_mode} + "\""; fhemcmd = "setreading"; - Script: screenBrightness = "\"screenBrightness\":" + " \"" + {screenBrightness} + "\""; fhemcmd = "setreading"; - Script: daydream = "\"daydream\":" + " \"" + {daydream_state} + "\""; fhemcmd = "setreading"; - Script: nextAlarm = "\"nextAlarmTime\":" + " \"" + {next_alarmtime} + "\"" + "," + "\"nextAlarmDay\":" + " \"" + {next_alarmday} + "\""; fhemcmd = "setreading"; - Script: volumevalue = "\"volume\":" + " \"" + {volume} + "\""; fhemcmd = "setreading"; - Script: volumeNotification = "\"volumeNotification\":" + " \"" + {volumeNotification} + "\""; fhemcmd = "setreading"; - Script: airplanemode = "\"airplanemode\":" + " \"" + {airplanemode} + "\""; fhemcmd = "setreading"; - Script: screen = "\"screen\":" + " \"" + {screen_state} + "\""; fhemcmd = "setreading"; - Script: nextAlarmState = "\"nextAlarmState\":" + " \"" + {nextalarmstate} + "\""; fhemcmd = "setreading"; - Script: doNotDisturb = "\"doNotDisturb\":" + " \"" + {dndValue} + "\""; fhemcmd = "setreading"; - Script: checkActiveTask = "\"checkActiveTask\":" + " \"" + {runTask} + "\""; fhemcmd = "setreading"; - Expression: Leon == "Gaultier" - Flows löschen: MultimediaControl - Script: androidVersion = "\"androidVersion\":" + " \"" + {androidVersion} + "\""; fhemcmd = "setreading"; - Script: powerinfo = "\"powerLevel\":" + " \"" + "{battery_percentage,numberformat,0}" + "\"" + "," + "\"powerPlugged\":" + " \"" + {battery_plugged} + "\"" + "," + "\"batteryTemperature\":" + " \"" + "{battery_temperature/10.0,numberformat.0.0}" + "\"" + "," + "\"batteryHealth\":" + " \"" + {battery_health} + "\""; fhemcmd = "setreading"; - Script: currentMusic = "\"currentMusicTrack\":" + " \"" + {title} + "\"" + "," + "\"currentMusicAlbum\":" + " \"" + {description} + "\"" + "," + "\"currentMusicArtist\":" + " \"" + {subtitle} + "\"" + "," + "\"currentMusicApp\":" + " \"" + {musicapp} + "\"" + "," + "\"currentMusicIcon\":" + " \"" + {icon} + "\"" + "," + "\"currentMusicState\":" + " \"" + {playback_state} + "\""; fhemcmd = "setreading"; - Expression: trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: getAndroidSDKVersion() >= "19" - Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" - Benachrichtigung in Statusbar angezeigt: Automagic - Script: notification_text = "not supported from your device" - Expression: package_name == {global_activetask} - Script: deviceState = "\"deviceState\": \"online\""; fhemcmd = "setreading"; - Expression: trigger == "Dock Event: Docked" or trigger == "Dock Event: Undocked" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Expression: trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Flows ausführen: Send Data to AMADCommBridge - Prüfe und setze globale Variable - Script: bluetooth = "\"bluetooth\":" + " \"" + {bluetooth_state} + "\""; fhemcmd = "setreading"; - Script: connected_devices_names = "none"; connected_devices_addresses = "none" - Script: btdeviceinfo = "\"connectedBTdevices\":" + " \"" + {connected_devices_names} + "\"" + "," + "\"connectedBTdevicesMAC\":" + " \"" + {connected_devices_addresses} + "\""; fhemcmd = "setreading"; - Bluetooth Gerät verbunden: Beliebiges Geräte - Expression: trigger == "Bluetooth Status: Schaltet aus, Aus" or trigger == "Bluetooth Gerät verbunden: Alle Geräte" or trigger == "Bluetooth Gerät getrennt: Alle Geräte" or trigger == "Bluetooth Status: Schaltet ein, Ein" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Host erreichbar: {global_fhemip}:{global_bridgeport} - Script: flow_SetCommands = "\"flow_SetCommands\":" + " \"" + {setCommandFlow_state} + "\""; fhemcmd = "setreading"; - Setze Flow Status: Aktivieren SetCommands - Script: setCommandFlow_state = "aktiv" - Script: setCommandFlow_state = "inaktiv" - Flow Aktiv: SetCommands - Expression: trigger == "Periodischer Timer: alle 120s" - Expression: global_userflowstate != "none" - Flow Aktiv: {global_userflowstate} - Script: flowState = "inactive" - Script: flowState = "active" - Script: flow_informations = "\"userFlowState\":" + " \"" + {flowState} + "\""; fhemcmd = "setreading"; - Expression: trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" - Flow Aktiv: Send Data to AMADCommBridge - Setze Flow Status: Aktivieren Send Data to AMADCommBridge - Expression: trigger == "Periodischer Timer: alle 120s" - Script: incomingCaller = "\"incomingCallerName\":" + " \"" + {contact_name} + "\"" + "," + "\"incomingCallerNumber\":" + " \"" + {incoming_number} + "\""; fhemcmd = "setreading"; - Script: incommingWhatsAppMessage = "\"incommingWhatsAppMessageFrom\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; - Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; - Script: incommingTelegramMessage = "\"incommingTelegramMessageFrom\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; - Benachrichtigung in Statusbar angezeigt: Telegram Messenger - Pause: 2s (Gerät wach halten) - Script: airpcount = airpcount + 1 - Expression: airpcount < 11 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Script: subtitle = "no player active"; title = "no player active"; description = "no player active"; musicapp = "no player active"; icon = "no player active" + Script: if(playback_state == 0) { playback_state = "keiner" } if(playback_state == 1) { playback_state = "gestoppt" } if(playback_state == 2) { playback_state = "pausiert" } if(playback_state == 3) { playback_state = "spielt ab" } if(playback_state == 4) { playback_state = "spult vorwärts" } if(playback_state == 5) { playback_state = "spült rückwärts" } if(playback_state == 6) { playback_state = "buffert" } if(playback_state == 7) { playback_state = "Fehler" } if(playback_state == 8) { playback_state = "verbindet" } if(playback_state == 9) { playback_state = "springt zum vorherigen" } if(playback_state == 10) { playback_state = "springt zum nächsten" } if(playback_state == 11) { playback_state = "springt zu Position in Wiedergabeliste" } + Script: currentMusic = "\"currentMusicTrack\":" + " \"" + {title} + "\"" + "," + "\"currentMusicAlbum\":" + " \"" + {description} + "\"" + "," + "\"currentMusicArtist\":" + " \"" + {subtitle} + "\"" + "," + "\"currentMusicApp\":" + " \"" + {musicapp} + "\"" + "," + "\"currentMusicIcon\":" + " \"" + {icon} + "\"" + "," + "\"currentMusicState\":" + " \"" + {playback_state} + "\""; fhemcmd = "setreading"; + 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } if(package_name == "com.sec.android.app.music") { musicapp = "Samsung Music Player" } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + Send Data to AMADCommBridge - AMADNG Info/Control Flowset v3.9.75 + AMADNG Info/Control Flowset v3.9.76 true PARALLEL 900 @@ -4112,8 +4139,8 @@ Soll der Assistent gelöscht werden? HTTP Request: send SET data to AMADCommBridge JSON HTTP Request: send READINGSVAL data to AMADCommBridge JSON HTTP Request: send VOICEINPUTVALUE data to AMADCommBridge - Script: Set FHEMDATA JSON - Script: if(togocount > 0) { togocount = togocount + 1; } else { togocount = 0; togocount = togocount + 1; } + Script: if(togocount > 0) { togocount = togocount + 1; } else { togocount = 0; togocount = togocount + 1; } + Script: Set FHEMDATA JSON @@ -4122,7 +4149,7 @@ Soll der Assistent gelöscht werden? - + @@ -4135,18 +4162,18 @@ Soll der Assistent gelöscht werden? - + - - + + SetCommands - AMADNG Info/Control Flowset v3.9.75 - true + AMADNG Info/Control Flowset v3.9.76 + false QUEUE 900 @@ -4286,38 +4313,38 @@ Soll der Assistent gelöscht werden? Script: notification_text = "Flow '{param_flowname}' has been set {param_flowstate}" Expression: flowState" Expression: closeCall" - Audio Player steuern: Medienknopf Stopp ({pname}/{kname}) - Expression: multimediaControl" - Starte Daydream - Expression: startDaydream" - Lautstärken setzen param_volume - Expression: setNotifiVolume" - Lautstärken setzen param_notifivolume - Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" - Expression: setRingSoundVolume" - Lautstärken setzen param_ringsoundvolume - Expression: param_button == "play/pause" - Audio Player steuern: Medienknopf Play/Pause (/{kname}) - Script: Zuordnung Mediaplayer - Sound: {param_notifypath}{param_notifyfile} als Benachrichtigung - Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) - Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/emulated/0/Download - Script: flow_informations = "\"flow_informations\":" + " \"" + {informationFlow_state} + "\""; fhemcmd = "setreading"; - Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; - Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; - Flows ausführen: Send Data to AMADCommBridge - Sprachausgabe: Englisch - Sprachausgabe: Deutsch - Flows ausführen: VoiceControl - Flows ausführen: udef_trigger setLockPin - Setze Flow Status: Aktivieren {param_flowname} - Flow Aktiv: Informations - Script: informationFlow_state = "aktiv" - Script: informationFlow_state = "inaktiv" - Setze Flow Status: Aktivieren Informations - Host erreichbar: {global_fhemip}:{global_bridgeport} - Flow Aktiv: Send Data to AMADCommBridge - Setze Flow Status: Aktivieren Send Data to AMADCommBridge + Expression: multimediaControl" + Starte Daydream + Expression: startDaydream" + Lautstärken setzen param_volume + Expression: setNotifiVolume" + Lautstärken setzen param_notifivolume + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + Expression: setRingSoundVolume" + Lautstärken setzen param_ringsoundvolume + Expression: param_button == "play/pause" + Audio Player steuern: Medienknopf Play/Pause (/{kname}) + Sound: {param_notifypath}{param_notifyfile} als Benachrichtigung + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/emulated/0/Download + Script: flow_informations = "\"flow_informations\":" + " \"" + {informationFlow_state} + "\""; fhemcmd = "setreading"; + Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Flows ausführen: Send Data to AMADCommBridge + Sprachausgabe: Englisch + Sprachausgabe: Deutsch + Flows ausführen: VoiceControl + Flows ausführen: udef_trigger setLockPin + Setze Flow Status: Aktivieren {param_flowname} + Flow Aktiv: Informations + Script: informationFlow_state = "aktiv" + Script: informationFlow_state = "inaktiv" + Setze Flow Status: Aktivieren Informations + Host erreichbar: {global_fhemip}:{global_bridgeport} + Flow Aktiv: Send Data to AMADCommBridge + Setze Flow Status: Aktivieren Send Data to AMADCommBridge + Audio Player steuern: Medienknopf Stopp ({pname}/{kname}) + Script: Zuordnung Mediaplayer @@ -4347,18 +4374,18 @@ Soll der Assistent gelöscht werden? - + - + - + @@ -4384,8 +4411,8 @@ Soll der Assistent gelöscht werden? - - + + @@ -4399,7 +4426,7 @@ Soll der Assistent gelöscht werden? - + @@ -4411,94 +4438,94 @@ Soll der Assistent gelöscht werden? - + - + - + - - - + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + Update AMAD Flowset - AMADNG Info/Control Flowset v3.9.75 + AMADNG Info/Control Flowset v3.9.76 true QUEUE @@ -4554,7 +4581,7 @@ Soll der Assistent gelöscht werden? VoiceControl - AMADNG Info/Control Flowset v3.9.75 + AMADNG Info/Control Flowset v3.9.76 true QUEUE From 222379d54e3defd3479d56996f77208e5e344b97 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Mon, 3 Jul 2017 18:37:22 +0200 Subject: [PATCH 24/32] fix Umlaute Problem bei voiceInput --- 73_AMADCommBridge.pm | 382 ++++++------------------------------------- 74_AMADDevice.pm | 4 +- 2 files changed, 50 insertions(+), 336 deletions(-) diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index b947e46..54ff1eb 100644 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -65,10 +65,12 @@ use warnings; use HttpUtils; use TcpServerUtils; + +eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode "; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.75"; +my $modulversion = "3.9.77"; my $flowsetversion = "3.9.76"; @@ -713,11 +715,9 @@ sub AMADCommBridge_ResponseProcessing($$) { my $response; my $c; - my $decode_json; - - $decode_json = eval{decode_json($json)}; - + + my $decode_json = eval{decode_json($json)}; if($@){ Log3 $bname, 4, "AMADCommBridge ($name) - ERROR while request: $@"; @@ -811,7 +811,7 @@ sub AMADCommBridge_ResponseProcessing($$) { } elsif ( $fhemcmd eq 'voiceinputvalue' ) { - my $fhemCmd = lc($decode_json->{payload}{voiceinputdata}); + my $fhemCmd = lc(encode_utf8($decode_json->{payload}{voiceinputdata})); readingsBeginUpdate( $bhash); readingsBulkUpdate( $bhash, "receiveVoiceCommand", $fhemCmd, 1 ); @@ -971,175 +971,7 @@ sub AMADCommBridge_ParseMsg($$) {

      AMADCommBridge

      -
        - AMAD - Automagic Android Device -
        - This module integrates Android devices into FHEM and displays several settings using the Android app "Automagic". - Automagic is comparable to the "Tasker" app for automating tasks and configuration settings. But Automagic is more user-friendly. The "Automagic Premium" app currently costs EUR 2.90. -
        - Any information retrievable by Automagic can be displayed in FHEM by this module. Just define your own Automagic-"flow" and send the data to the AMADCommBridge. One even can control several actions on Android devices. -
        - To be able to make use of all these functions the Automagic app and additional flows need to be installed on the Android device. The flows can be retrieved from the FHEM directory, the app can be bought in Google Play Store. -

        - How to use AMAD? -
          -
        • install the "Automagic Premium" app from the Google Play store.
        • -
        • install the flowset 74_AMADautomagicFlowset$VERSION.xml from the directory $INSTALLFHEM/FHEM/lib/ on your Android device and activate.
        • -
        -
        - Now you need to define a device in FHEM. -

        - - Define -

          - define <name> AMAD <IP-ADDRESS> -

          - Example: -

            - define WandTabletWohnzimmer AMAD 192.168.0.23
            -
          -
          - With this command two new AMAD devices in a room called AMAD are created. The parameter <IP-ADDRESS< defines the IP address of your Android device. The second device created is the AMADCommBridge which serves as a communication device from each Android device to FHEM.
          - !!!Coming Soon!!! The communication port of each AMAD device may be set by the definition of the "port" attribute. One needs background knowledge of Automagic and HTTP requests as this port will be set in the HTTP request trigger of both flows, therefore the port also needs to be set there. -
          - The communication port of the AMADCommBridge device can easily be changed within the attribut "port".
          -
        -
        - AMAD Communication Bridge -
          - Creating your first AMAD device automatically creates the AMADCommBridge device in the room AMAD. With the help of the AMADCommBridge any Android device communicates initially to FHEM.To make the IP addresse of the FHEM server known to the Android device, the FHEM server IP address needs to be configured in the AMADCommBridge. WITHOUT THIS STEP THE AMADCommBridge WILL NOT WORK PROPERLY.
          - Please us the following command for configuration of the FHEM server IP address in the AMADCommBridge: set AMADCommBridge fhemServerIP <FHEM-IP>.
          - Additionally the expertMode may be configured. By this setting a direct communication with FHEM will be established without the restriction of needing to make use of a notify to execute set commands. -

        -
        - You are finished now! After 15 seconds latest the readings of your AMAD Android device should be updated. Consequently each 15 seconds a status request will be sent. If the state of your AMAD Android device does not change to "active" over a longer period of time one should take a look into the log file for error messages. -


        - - Readings -
          -
        • airplanemode - on/off, state of the aeroplane mode
        • -
        • androidVersion - currently installed version of Android
        • -
        • automagicState - state of the Automagic App (prerequisite Android >4.3). In case you have Android >4.3 and the reading says "not supported", you need to enable Automagic inside Android / Settings / Sound & notification / Notification access
        • -
        • batteryHealth - the health of the battery (1=unknown, 2=good, 3=overheat, 4=dead, 5=over voltage, 6=unspecified failure, 7=cold)
        • -
        • batterytemperature - the temperature of the battery
        • -
        • bluetooth - on/off, bluetooth state
        • -
        • checkActiveTask - state of an app (needs to be defined beforehand). 0=not active or not active in foreground, 1=active in foreground, see note below
        • -
        • connectedBTdevices - list of all devices connected via bluetooth
        • -
        • connectedBTdevicesMAC - list of MAC addresses of all devices connected via bluetooth
        • -
        • currentMusicAlbum - currently playing album of mediaplayer
        • -
        • currentMusicApp - currently playing player app (Amazon Music, Google Play Music, Google Play Video, Spotify, YouTube, TuneIn Player, Aldi Life Music)
        • -
        • currentMusicArtist - currently playing artist of mediaplayer
        • -
        • currentMusicIcon - cover of currently play albumNoch nicht fertig implementiert
        • -
        • currentMusicState - state of currently/last used mediaplayer
        • -
        • currentMusicTrack - currently playing song title of mediaplayer
        • -
        • daydream - on/off, daydream currently active
        • -
        • deviceState - state of Android devices. unknown, online, offline.
        • -
        • doNotDisturb - state of do not Disturb Mode
        • -
        • dockingState - undocked/docked, Android device in docking station
        • -
        • flow_SetCommands - active/inactive, state of SetCommands flow
        • -
        • flow_informations - active/inactive, state of Informations flow
        • -
        • flowsetVersionAtDevice - currently installed version of the flowsets on the Android device
        • -
        • incomingCallerName - Callername from last Call
        • -
        • incomingCallerNumber - Callernumber from last Call
        • -
        • incommingWhatsAppMessageFrom - last WhatsApp message
        • -
        • incommingWhatsTelegramMessageFrom - last telegram message
        • -
        • intentRadioName - name of the most-recent streamed intent radio
        • -
        • intentRadioState - state of intent radio player
        • -
        • keyguardSet - 0/1 keyguard set, 0=no 1=yes, does not indicate whether it is currently active
        • -
        • lastSetCommandError - last error message of a set command
        • -
        • lastSetCommandState - last state of a set command, command send successful/command send unsuccessful
        • -
        • lastStatusRequestError - last error message of a statusRequest command
        • -
        • lastStatusRequestState - ast state of a statusRequest command, command send successful/command send unsuccessful
        • -
        • nextAlarmDay - currently set day of alarm
        • -
        • nextAlarmState - alert/done, current state of "Clock" stock-app
        • -
        • nextAlarmTime - currently set time of alarm
        • -
        • powerLevel - state of battery in %
        • -
        • powerPlugged - 0=no/1,2=yes, power supply connected
        • -
        • screen - on locked,unlocked/off locked,unlocked, state of display
        • -
        • screenBrightness - 0-255, level of screen-brightness
        • -
        • screenFullscreen - on/off, full screen mode
        • -
        • 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
        • -
          - Prerequisite for using the reading checkActivTask the package name of the application to be checked needs to be defined in the attribute checkActiveTask. Example: attr Nexus10Wohnzimmer - checkActiveTask com.android.chrome für den Chrome Browser. -

          -
        -

        - - Set -
          -
        • activateVoiceInput - start voice input on Android device
        • -
        • bluetooth - on/off, switch bluetooth on/off
        • -
        • clearNotificationBar - All/Automagic, deletes all or only Automagic notifications in status bar
        • -
        • closeCall - hang up a running call
        • -
        • currentFlowsetUpdate - start flowset update on Android device
        • -
        • installFlowSource - install a Automagic flow on device, XML file must be stored in /tmp/ with extension xml. Example: set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml
        • -
        • doNotDisturb - sets the do not Disturb Mode, always Disturb, never Disturb, alarmClockOnly alarm Clock only, onlyImportant only important Disturbs
        • -
        • mediaAmazonMusic - play/stop/next/back , controlling the amazon music media player
        • -
        • mediaGoogleMusic - play/stop/next/back , controlling the google play music media player
        • -
        • mediaSpotifyMusic - play/stop/next/back , controlling the spotify media player
        • -
        • mediaTuneinRadio - play/stop/next/back , controlling the TuneinRadio media player
        • -
        • mediaAldiMusic - play/stop/next/back , controlling the Aldi music media player
        • -
        • mediaAudible - play/stop/next/back , controlling the Audible media player
        • -
        • mediaYouTube - play/stop/next/back , controlling the YouTube media player
        • -
        • mediaVlcPlayer - play/stop/next/back , controlling the VLC media player
        • -
        • nextAlarmTime - sets the alarm time. Only valid for the next 24 hours.
        • -
        • notifySndFile - plays a media-file which by default needs to be stored in the folder "/storage/emulated/0/Notifications/" of the Android device. You may use the attribute setNotifySndFilePath for defining a different folder.
        • -
        • openCall - initial a call and hang up after optional time / set DEVICE openCall 0176354 10 call this number and hang up after 10s
        • -
        • screenBrightness - 0-255, set screen brighness
        • -
        • screenMsg - display message on screen of Android device
        • -
        • sendintent - send intent string Example: set $AMADDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio, first parameter contains the action, second parameter contains the extra. At most two extras can be used.
        • -
        • sendSMS - Sends an SMS to a specific phone number. Bsp.: sendSMS Dies ist ein Test|555487263
        • -
        • startDaydream - start Daydream
        • -
        • 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
        • -
        -
        - Set (depending on attribute values) -
          -
        • changetoBtDevice - switch to another bluetooth device. Attribute setBluetoothDevice needs to be set. See note below!
        • -
        • openApp - start an app. attribute setOpenApp
        • -
        • openURL - opens a URLS in the standard browser as long as no other browser is set by the attribute setOpenUrlBrowser.Example: attr Tablet setOpenUrlBrowser de.ozerov.fully|de.ozerov.fully.MainActivity, first parameter: package name, second parameter: Class Name
        • -
        • screen - on/off/lock/unlock, switch screen on/off or lock/unlock screen. In Automagic "Preferences" the "Device admin functions" need to be enabled, otherwise "Screen off" does not work. attribute setScreenOnForTimer changes the time the display remains switched on!
        • -
        • screenFullscreen - on/off, activates/deactivates full screen mode. attribute setFullscreen
        • -
        • screenLock - Locks screen with request for PIN. attribute setScreenlockPIN - enter PIN here. Only use numbers, 4-16 numbers required.
        • -
        • screenOrientation - Auto,Landscape,Portait, set screen orientation (automatic, horizontal, vertical). attribute setScreenOrientation
        • -
        • system - issue system command (only with rooted Android devices). reboot,shutdown,airplanemodeON (can only be switched ON) attribute root, in Automagic "Preferences" "Root functions" need to be enabled.
        • -
        • setAPSSID - set WLAN AccesPoint SSID to prevent WLAN sleeps
        • -
        • setNotifySndFilePath - set systempath to notifyfile (default /storage/emulated/0/Notifications/
        • -
        • setTtsMsgSpeed - set speaking speed for TTS (Value between 0.5 - 4.0, 0.5 Step) default is 1.0
        • -
        • setTtsMsgLang - set speaking language for TTS, de or en (default is de)
        • -
          - To be able to use "openApp" the corresponding attribute "setOpenApp" needs to contain the app package name. -

          - To be able to switch between bluetooth devices the attribute "setBluetoothDevice" needs to contain (a list of) bluetooth devices defined as follows: attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC No spaces are allowed in any BTdeviceName. Defining MAC please make sure to use the character : (colon) after each second digit/character.
          - Example: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76 -
        -

        - - state -
          -
        • initialized - shown after initial define.
        • -
        • active - device is active.
        • -
        • disabled - device is disabled by the attribute "disable".
        • -
        -


        - Further examples and reading: - -


        -
      +comming soon =end html =begin html_DE @@ -1147,177 +979,59 @@ sub AMADCommBridge_ParseMsg($$) {

      AMADCommBridge

        - AMAD - Automagic Android Device -
        - Dieses Modul liefert, in Verbindung mit der Android APP Automagic, diverse Informationen von Android Geräten. - Die AndroidAPP Automagic (welche nicht von mir stammt und 2.90 Euro kostet) funktioniert wie Tasker, ist aber bei weitem User freundlicher. -
        - Mit etwas Einarbeitung können jegliche Informationen welche Automagic bereit stellt in FHEM angezeigt werden. Hierzu bedarf es lediglich eines eigenen Flows welcher seine Daten an die AMADCommBridge sendet. Das Modul gibt auch die Möglichkeit Androidgeräte zu steuern. -
        - Für all diese Aktionen und Informationen wird auf dem Androidgerät "Automagic" und ein so genannter Flow benötigt. Die App ist über den Google PlayStore zu beziehen. Das benötigte Flowset bekommt man aus dem FHEM Verzeichnis. + AMAD - Automagic Android Device

        + AMADCommBridge - Kommunikationsbrücke für alle AMAD Geräte +
        + Dieses Modul ist das Ausgangsmodul zur erfolgreichen Integration von Androidgeräten in FHEM. Es stellt ferner eine Verbindungsebene zwischen AMAD unterstützten Geräten und FHEM zur Verfügung. Alle Kommunikation zwischen AMAD Android und FHEM läuft über diese Schnittstelle.
        + Daher erfolgt die Ersteinrichtung eines AMAD Devices auch genau über diese Modulinstanz. +

        + Damit erfolgreich ein Androidgerät in FHEM eingerichtet werden kann, muss im ersten Schritt ein AMADCommBridge Device angelegt werden.

        - Wie genau verwendet man nun AMAD? -
          -
        • man installiert die App "Automagic Premium" aus dem PlayStore.
        • -
        • dann installiert man das Flowset 74_AMADautomagicFlowset$VERSION.xml aus dem Ordner $INSTALLFHEM/FHEM/lib/ auf dem Androidgerät und aktiviert die Flows.
        • -
        -
        - Es muß noch ein Device in FHEM anlegt werden. -

        - + Define

          - define <name> AMAD <IP-ADRESSE> + define <name> AMADCommBridge

          Beispiel:

            - define WandTabletWohnzimmer AMAD 192.168.0.23
            + define AMADBridge AMADCommBridge

          - Diese Anweisung erstellt zwei neues AMAD-Device im Raum AMAD.Der Parameter <IP-ADRESSE> legt die IP Adresse des Android Gerätes fest.
          - Das zweite Device ist die AMADCommBridge welche als Kommunikationsbrücke vom Androidgerät zu FHEM diehnt. !!!Comming Soon!!! Wer den Port ändern möchte, kann dies über das Attribut "port" tun. Ihr solltet aber wissen was Ihr tut, da dieser Port im HTTP Request Trigger der beiden Flows eingestellt ist. Demzufolge muß der Port dort auch geändert werden. Der Port für die Bridge kann ohne Probleme im Bridge Device mittels dem Attribut "port" verändert werden. -
          - Der Port für die Bridge kann ohne Probleme im Bridge Device mittels dem Attribut "port" verändert werden.
          + Diese Anweisung erstellt ein neues AMADCommBridge Device Namens AMADBridge. +

        + Im folgenden muß lediglich das Flowset auf dem Android Gerät installiert werden und der Flow 'First Run Assistant' ausgeführt werden. (einfach den Homebutton drücken)
        + Der Assistant geleitet Dich dann durch die Einrichtung Deines AMAD Gerätes und sorgt dafür das am Ende des Installationsprozess das Androidgerät als AMAD Device in FHEM angelegt wird.
      -
      - AMAD Communication Bridge -
        - Beim ersten anlegen einer AMAD Deviceinstanz wird automatisch ein Gerät Namens AMADCommBridge im Raum AMAD mit angelegt. Dieses Gerät diehnt zur Kommunikation vom Androidgerät zu FHEM ohne das zuvor eine Anfrage von FHEM aus ging. Damit das Androidgerät die IP von FHEM kennt, muss diese sofort nach dem anlegen der Bridge über den set Befehl in ein entsprechendes Reading in die Bridge geschrieben werden. DAS IST SUPER WICHTIG UND FÜR DIE FUNKTION DER BRIDGE NOTWENDIG.
        - Hierfür muß folgender Befehl ausgeführt werden. set AMADCommBridge fhemServerIP <FHEM-IP>.
        - Als zweites Reading kann expertMode gesetzen werden. Mit diesem Reading wird eine unmittelbare Komminikation mit FHEM erreicht ohne die Einschränkung über ein - Notify gehen zu müssen und nur reine set Befehle ausführen zu können. -

      - NUN bitte die Flows AKTIVIEREN!!!
      -
      - Fertig! Nach anlegen der Geräteinstanz und dem eintragen der fhemServerIP in der CommBridge sollten nach spätestens 15 Sekunden bereits die ersten Readings reinkommen. Nun wird alle 15 Sekunden probiert einen Status Request erfolgreich ab zu schließen. Wenn der Status sich über einen längeren Zeitraum nicht auf "active" ändert, sollte man im Log nach eventuellen Fehlern suchen. -


      - +

      + Readings -
        -
      • airplanemode - Status des Flugmodus
      • -
      • androidVersion - aktuell installierte Androidversion
      • -
      • automagicState - Statusmeldungen von der AutomagicApp (Voraussetzung Android >4.3). Ist Android größer 4.3 vorhanden und im Reading steht "wird nicht unterstützt", muß in den Androideinstellungen unter Ton und Benachrichtigungen -> Benachrichtigungszugriff ein Haken für Automagic gesetzt werden
      • -
      • batteryHealth - Zustand der Battery (1=unbekannt, 2=gut, 3=Überhitzt, 4=tot, 5=Überspannung, 6=unbekannter Fehler, 7=kalt)
      • -
      • batterytemperature - Temperatur der Batterie
      • -
      • bluetooth - on/off, Bluetooth Status an oder aus
      • -
      • checkActiveTask - Zustand einer zuvor definierten APP. 0=nicht aktiv oder nicht aktiv im Vordergrund, 1=aktiv im Vordergrund, siehe Hinweis unten
      • -
      • connectedBTdevices - eine Liste der verbundenen Gerät
      • -
      • connectedBTdevicesMAC - eine Liste der MAC Adressen aller verbundender BT Geräte
      • -
      • currentMusicAlbum - aktuell abgespieltes Musikalbum des verwendeten Mediaplayers
      • -
      • currentMusicApp - aktuell verwendeter Mediaplayer (Amazon Music, Google Play Music, Google Play Video, Spotify, YouTube, TuneIn Player, Aldi Life Music)
      • -
      • currentMusicArtist - aktuell abgespielter Musikinterpret des verwendeten Mediaplayers
      • -
      • currentMusicIcon - Cover vom aktuell abgespielten Album Noch nicht fertig implementiert
      • -
      • currentMusicState - Status des aktuellen/zuletzt verwendeten Mediaplayers
      • -
      • currentMusicTrack - aktuell abgespielter Musiktitel des verwendeten Mediaplayers
      • -
      • daydream - on/off, Daydream gestartet oder nicht
      • -
      • deviceState - Status des Androidgerätes. unknown, online, offline.
      • -
      • doNotDisturb - aktueller Status des nicht stören Modus
      • -
      • dockingState - undocked/docked Status ob sich das Gerät in einer Dockinstation befindet.
      • -
      • flow_SetCommands - active/inactive, Status des SetCommands Flow
      • -
      • flow_informations - active/inactive, Status des Informations Flow
      • -
      • flowsetVersionAtDevice - aktuell installierte Flowsetversion auf dem Device
      • -
      • incomingCallerName - Anrufername des eingehenden Anrufes
      • -
      • incomingCallerNumber - Anrufernummer des eingehenden Anrufes
      • -
      • incommingWhatsAppMessageFrom - letzte WhatsApp Nachricht
      • -
      • incommingWhatsTelegramMessageFrom - letzte Telegram Nachricht
      • -
      • intentRadioName - zuletzt gesrreamter Intent Radio Name
      • -
      • intentRadioState - Status des IntentRadio Players
      • -
      • keyguardSet - 0/1 Displaysperre gesetzt 0=nein 1=ja, bedeutet nicht das sie gerade aktiv ist
      • -
      • lastSetCommandError - letzte Fehlermeldung vom set Befehl
      • -
      • lastSetCommandState - letzter Status vom set Befehl, Befehl erfolgreich/nicht erfolgreich gesendet
      • -
      • lastStatusRequestError - letzte Fehlermeldung vom statusRequest Befehl
      • -
      • lastStatusRequestState - letzter Status vom statusRequest Befehl, Befehl erfolgreich/nicht erfolgreich gesendet
      • -
      • nextAlarmDay - aktiver Alarmtag
      • -
      • nextAlarmState - aktueller Status des "Androidinternen" Weckers
      • -
      • nextAlarmTime - aktive Alarmzeit
      • -
      • powerLevel - Status der Batterie in %
      • -
      • powerPlugged - Netzteil angeschlossen? 0=NEIN, 1|2=JA
      • -
      • screen - on locked/unlocked, off locked/unlocked gibt an ob der Bildschirm an oder aus ist und gleichzeitig gesperrt oder nicht gesperrt
      • -
      • screenBrightness - Bildschirmhelligkeit von 0-255
      • -
      • screenFullscreen - on/off, Vollbildmodus (An,Aus)
      • -
      • 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
      • -
        - Beim Reading checkActivTask muß zuvor der Packagename der zu prüfenden App als Attribut checkActiveTask angegeben werden. Beispiel: attr Nexus10Wohnzimmer - checkActiveTask com.android.chrome für den Chrome Browser. -

        -
      -

      - - Set -
        -
      • activateVoiceInput - aktiviert die Spracheingabe
      • -
      • bluetooth - on/off, aktiviert/deaktiviert Bluetooth
      • -
      • clearNotificationBar - All,Automagic, löscht alle Meldungen oder nur die Automagic Meldungen in der Statusleiste
      • -
      • closeCall - beendet einen laufenden Anruf
      • -
      • currentFlowsetUpdate - fürt ein Flowsetupdate auf dem Device durch
      • -
      • 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
      • -
      • installFlowSource - installiert einen Flow auf dem Device, das XML File muss unter /tmp/ liegen und die Endung xml haben. Bsp: set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml
      • -
      • mediaAmazonMusic - play, stop, next, back ,steuert den Amazon Musik Mediaplayer
      • -
      • mediaGoogleMusic - play, stop, next, back ,steuert den Google Play Musik Mediaplayer
      • -
      • mediaSpotifyMusic - play, stop, next, back ,steuert den Spotify Mediaplayer
      • -
      • mediaTuneinRadio - play, stop, next, back ,steuert den TuneIn Radio Mediaplayer
      • -
      • mediaAldiMusic - play, stop, next, back ,steuert den Aldi Musik Mediaplayer
      • -
      • mediaAudible - play, stop, next, back ,steuert den Audible Mediaplayer
      • -
      • mediaYouTube - play, stop, next, back ,steuert den YouTube Mediaplayer
      • -
      • mediaVlcPlayer - play, stop, next, back ,steuert den VLC Mediaplayer
      • -
      • nextAlarmTime - setzt die Alarmzeit. gilt aber nur innerhalb der nächsten 24Std.
      • -
      • openCall - ruft eine Nummer an und legt optional nach X Sekunden auf / set DEVICE openCall 01736458 10 / ruft die Nummer an und beendet den Anruf nach 10s
      • -
      • screenBrightness - setzt die Bildschirmhelligkeit, von 0-255.
      • -
      • screenMsg - versendet eine Bildschirmnachricht
      • -
      • sendintent - sendet einen Intentstring Bsp: set $AMADDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio, der erste Befehl ist die Aktion und der zweite das Extra. Es können immer zwei Extras mitgegeben werden.
      • -
      • sendSMS - sendet eine SMS an eine bestimmte Telefonnummer. Bsp.: sendSMS Dies ist ein Test|555487263
      • -
      • startDaydream - startet den Daydream
      • -
      • 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.
      • -
      -
      - Set abhängig von gesetzten Attributen -
        -
      • changetoBtDevice - wechselt zu einem anderen Bluetooth Gerät. Attribut setBluetoothDevice muß gesetzt sein. Siehe Hinweis unten!
      • -
      • notifySndFile - spielt die angegebene Mediadatei auf dem Androidgerät ab. Die aufzurufende Mediadatei sollte sich im Ordner /storage/emulated/0/Notifications/ befinden. Ist dies nicht der Fall kann man über das Attribut setNotifySndFilePath einen Pfad vorgeben.
      • -
      • openApp - öffnet eine ausgewählte App. Attribut setOpenApp
      • -
      • openURL - öffnet eine URL im Standardbrowser, sofern kein anderer Browser über das Attribut setOpenUrlBrowser ausgewählt wurde. Bsp: attr Tablet setOpenUrlBrowser de.ozerov.fully|de.ozerov.fully.MainActivity, das erste ist der Package Name und das zweite der Class Name
      • -
      • setAPSSID - setzt die AccessPoint SSID um ein WLAN sleep zu verhindern
      • -
      • screen - on/off/lock/unlock schaltet den Bildschirm ein/aus oder sperrt/entsperrt ihn, in den Automagic Einstellungen muss "Admin Funktion" gesetzt werden sonst funktioniert "Screen off" nicht. Attribut setScreenOnForTimer ändert die Zeit wie lange das Display an bleiben soll!
      • -
      • screenFullscreen - on/off, (aktiviert/deaktiviert) den Vollbildmodus. Attribut setFullscreen
      • -
      • screenLock - Sperrt den Bildschirm mit Pinabfrage. Attribut setScreenlockPIN - hier die Pin dafür eingeben. Erlaubt sind nur Zahlen. Es müßen mindestens 4, bis max 16 Zeichen verwendet werden.
      • -
      • screenOrientation - Auto,Landscape,Portait, aktiviert die Bildschirmausrichtung (Automatisch,Horizontal,Vertikal). Attribut setScreenOrientation
      • -
      • system - setzt Systembefehle ab (nur bei gerootetet Geräen). reboot,shutdown,airplanemodeON (kann nur aktiviert werden) Attribut root, in den Automagic Einstellungen muss "Root Funktion" gesetzt werden
      • -
      • setNotifySndFilePath - setzt den korrekten Systempfad zur Notifydatei (default ist /storage/emulated/0/Notifications/
      • -
      • setTtsMsgSpeed - setzt die Sprachgeschwindigkeit bei der Sprachausgabe(Werte zwischen 0.5 bis 4.0 in 0.5er Schritten) default ist 1.0
      • -
      • setTtsMsgSpeed - setzt die Sprache bei der Sprachausgabe, de oder en (default ist de)
      • -
        - Um openApp verwenden zu können, muss als Attribut der Package Name der App angegeben werden. -

        - Um zwischen Bluetoothgeräten wechseln zu können, muß das Attribut setBluetoothDevice mit folgender Syntax gesetzt werden. attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC Es muss - zwingend darauf geachtet werden das beim BTdeviceName kein Leerzeichen vorhanden ist. Am besten zusammen oder mit Unterstrich. Achtet bei der MAC darauf das Ihr wirklich nach jeder zweiten Zahl auch - einen : drin habt
        - Beispiel: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76 -
      -

      - - state -
        -
      • initialized - Ist der Status kurz nach einem define.
      • -
      • active - die Geräteinstanz ist im aktiven Status.
      • -
      • disabled - die Geräteinstanz wurde über das Attribut disable deaktiviert
      • -
      -


      - Anwendungsbeispiele:

        - Hier verweise ich auf den gut gepflegten Wikieintrag +
      • JSON_ERROR - JSON Fehlermeldung welche von Perl gemeldet wird
      • +
      • JSON_ERROR_STRING - der String welcher die JSON Fehlermeldung verursacht hat
      • +
      • fhemServerIP - die Ip-Adresse des FHEM Servers, wird vom Modul auf Basis des JSON Strings vom Installationsassistenten gesetzt. Kann aber auch mittels set Befehles vom User gesetzt werden
      • +
      • receiveFhemCommand - ist das Attribut fhemControlMode auf trigger gestellt, wird das Reading gesetzt sobald ein FHEM Befehl übersendet wird. Hierauf kann dann ein Notify triggern.
        + Wird anstelle von trigger setControl als Wert für fhemControlMode eingestellt, wird das Reading nicht gestzt sondern der set Behel sofort ausgeführt.
      • +
      • receiveVoiceCommand - wird die Sprachsteuerung von AMAD aktiviert (set DEVICE activateVoiceInput) so wird der letzte erkannten Sprachbefehle in dieses Reading geschrieben.
      • +
      • receiveVoiceDevice - Name des Devices von wo aus der letzte erkannte Sprachbefehl gesendet wurde
      • +
      • state - Status der Bridge, open, closed
      -


      +

      + + Attribute +

        +
      • allowFrom - Regexp der erlaubten IP-Adressen oder Hostnamen. Wenn dieses Attribut gesetzt wurde, werden ausschließlich Verbindungen von diesen Adressen akzeptiert.
        + Achtung: falls allowfrom nicht gesetzt ist, und keine gütige allowed Instanz definiert ist, und die Gegenstelle eine nicht lokale Adresse hat, dann wird die Verbindung abgewiesen. Folgende Adressen werden als local betrachtet:
        + IPV4: 127/8, 10/8, 192.168/16, 172.16/10, 169.254/16
        + IPV6: ::1, fe80/10
      • +
      • debugJSON - wenn auf 1 gesetzt, werden JSON Fehlermeldungen in Readings geschrieben. Siehe hierzu JSON_ERROR* unter Readings
      • +
      • fhemControlMode - steuert die zulässige Art der Kontrolle von FHEM Devices. Du kannst über die Bridge auf 2 Arten FHEM Devices steuern. Entweder per direktem FHEM Befehl aus einem Flow heraus, oder als Sprachbefehl mittels Sprachsteuerung (set DEVICE activateVoiceInput) +
        • trigger - ist der Wert trigger gesetzt, werden alle an die Bridge gesendeten FHEM set Befehle in das Reading receiveFhemCommand geschrieben und können so mittels notify ausgeführt werden. Sprachsteuerung ist möglich, es werden Readings receiveVoice* gesetzt. Auf dem Androidgerät können bei Sprachsteuerung mehrere Sprachbefehle mittels "und" verknüpft/aneinander gereiht werden. Bsp: schalte die Lichtszene Abends an und schalte den Fernsehr an
        • +
        • setControl - alle set Befehle welche mittels eines Flows über die Bridge gesendet werden, werden automatisch ausgeführt. Das triggern eines Readings ist nicht nötig. Die Steuerung mittels Sprache verhält sich wie beim Wert trigger
        • +
        • thirdPartControl - verhält sich wie trigger, bei der Sprachsteuerung ist jedoch ein anreihen von Sprachbefehlen mittels "und" nicht möglich. Dient der Sprachsteuerung über Module anderer Modulautoren ((z.B. 39_TEERKO.pm)
        +
      • +
      +

      + Wie man bei Problemen mit dem Assistenten ein Androidgerät auch von Hand anlegen kann, erfärst Du in der Commandref zum AMADDevice Modul.
    =end html_DE diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index bb27e43..7c44f89 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -54,7 +54,7 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode "; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.73"; +my $modulversion = "3.9.76"; my $flowsetversion = "3.9.76"; @@ -762,7 +762,7 @@ sub AMADDevice_Parse($$) { my $name = $io_hash->{NAME}; - my $decode_json = eval{decode_json(encode_utf8($json))}; + my $decode_json = eval{decode_json(encode_utf8($json))}; if($@){ Log3 $name, 3, "AMADDevice ($name) - error while request: $@"; #readingsSingleUpdate($hash, "state", "error", 1); From cd2eb08f3c2a2cf787624c3cbef58580f709ea66 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 6 Jul 2017 10:05:01 +0200 Subject: [PATCH 25/32] new Attribut for max volume --- 73_AMADCommBridge.pm | 4 ++-- 74_AMADDevice.pm | 31 ++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index 54ff1eb..2587a65 100644 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -719,7 +719,7 @@ sub AMADCommBridge_ResponseProcessing($$) { my $decode_json = eval{decode_json($json)}; if($@){ - Log3 $bname, 4, "AMADCommBridge ($name) - ERROR while request: $@"; + Log3 $bname, 4, "AMADCommBridge ($name) - JSON error while request: $@"; if( AttrVal( $bname, 'debugJSON', 0 ) == 1 ) { readingsBeginUpdate($bhash); @@ -775,7 +775,7 @@ sub AMADCommBridge_ResponseProcessing($$) { return Log3 $bname, 3, "AMADCommBridge ($name) - AMADCommBridge: processing receive no reading values from Device: $fhemDevice" unless( (defined($decode_json->{payload}) and ($decode_json->{payload})) or (defined($decode_json->{firstrun}) and ($decode_json->{firstrun})) ); - Log3 $bname, 4, "AMADCommBridge ($bname) - AMADCommBridge: processing receive reading values - Device: $fhemDevice Data: $decode_json->{payload}"; + Log3 $bname, 4, "AMADCommBridge ($bname) - AMADCommBridge: processing receive reading values - Device: $fhemDevice Data: $decode_json->{payload}" unless( defined($decode_json->{payload}) and ($decode_json->{payload}) ); Dispatch($bhash,$json,undef); Log3 $bname, 4, "AMADCommBridge ($bname) - call Dispatcher"; diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index 7c44f89..7808de8 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -54,7 +54,7 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode "; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.76"; +my $modulversion = "3.9.77"; my $flowsetversion = "3.9.76"; @@ -104,6 +104,7 @@ sub AMADDevice_Initialize($) { "setUserFlowState ". "setTtsMsgLang:de,en ". "setVolUpDownStep:1,2,4,5 ". + "setVolMax ". "setAPSSID ". "root:0,1 ". "disable:1 ". @@ -376,6 +377,8 @@ sub AMADDevice_WriteReadings($$) { readingsBulkUpdateIfChanged($hash, $t, $v, 1) if( defined( $v ) ); readingsBulkUpdate($hash, '.'.$t, $v) if( $t eq 'deviceState' ); + readingsBulkUpdate($hash, $t, $v) if( $t eq 'incomingCallerName' ); + readingsBulkUpdate($hash, $t, $v) if( $t eq 'incomingCallerNumber' ); } readingsBulkUpdateIfChanged( $hash, "deviceState", "offline", 1 ) if( $decode_json->{payload}{airplanemode} && $decode_json->{payload}{airplanemode} eq "on" ); @@ -411,6 +414,8 @@ sub AMADDevice_Set($$@) { my $uri; my $header = 'Connection: close'; my $method; + + my $volMax = AttrVal($name,'setVolMax',15); if( lc $cmd eq 'screenmsg' ) { @@ -737,13 +742,14 @@ sub AMADDevice_Set($$@) { my $btdev = AttrVal( $name, "setBluetoothDevice", "none" ); - my $list = "screenMsg ttsMsg volume:slider,0,1,15 mediaGoogleMusic:play/pause,stop,next,back mediaSamsungMusic:play/pause,stop,next,back mediaAmazonMusic:play/pause,stop,next,back mediaSpotifyMusic:play/pause,stop,next,back mediaTuneinRadio:play/pause,stop,next,back mediaAldiMusic:play/pause,stop,next,back mediaYouTube:play/pause,stop,next,back mediaVlcPlayer:play/pause,stop,next,back mediaAudible:play/pause,stop,next,back screenBrightness:slider,0,1,255 screen:on,off,lock,unlock openURL nextAlarmTime:time timer:slider,1,1,60 statusRequest:noArg bluetooth:on,off notifySndFile clearNotificationBar:All,Automagic activateVoiceInput:noArg volumeNotification:slider,0,1,7 volumeRingSound:slider,0,1,7 vibrate:noArg sendIntent openCall closeCall:noArg currentFlowsetUpdate:noArg installFlowSource doNotDisturb:never,always,alarmClockOnly,onlyImportant userFlowState sendSMS startDaydream:noArg volumeUp:noArg volumeDown:noArg mute:on,off"; + my $list = "screenMsg ttsMsg mediaGoogleMusic:play/pause,stop,next,back mediaSamsungMusic:play/pause,stop,next,back mediaAmazonMusic:play/pause,stop,next,back mediaSpotifyMusic:play/pause,stop,next,back mediaTuneinRadio:play/pause,stop,next,back mediaAldiMusic:play/pause,stop,next,back mediaYouTube:play/pause,stop,next,back mediaVlcPlayer:play/pause,stop,next,back mediaAudible:play/pause,stop,next,back screenBrightness:slider,0,1,255 screen:on,off,lock,unlock openURL nextAlarmTime:time timer:slider,1,1,60 statusRequest:noArg bluetooth:on,off notifySndFile clearNotificationBar:All,Automagic activateVoiceInput:noArg volumeNotification:slider,0,1,7 volumeRingSound:slider,0,1,7 vibrate:noArg sendIntent openCall closeCall:noArg currentFlowsetUpdate:noArg installFlowSource doNotDisturb:never,always,alarmClockOnly,onlyImportant userFlowState sendSMS startDaydream:noArg volumeUp:noArg volumeDown:noArg mute:on,off"; $list .= " screenOrientation:auto,landscape,portrait" if( AttrVal( $name, "setScreenOrientation", "0" ) eq "1" ); $list .= " screenFullscreen:on,off" if( AttrVal( $name, "setFullscreen", "0" ) eq "1" ); $list .= " openApp:$apps" if( AttrVal( $name, "setOpenApp", "none" ) ne "none" ); $list .= " system:reboot,shutdown,airplanemodeON" if( AttrVal( $name, "root", "0" ) eq "1" ); $list .= " changetoBTDevice:$btdev" if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); + $list .= " volume:slider,0,1,$volMax"; return "Unknown argument $cmd, choose one of $list"; @@ -764,8 +770,7 @@ sub AMADDevice_Parse($$) { my $decode_json = eval{decode_json(encode_utf8($json))}; if($@){ - Log3 $name, 3, "AMADDevice ($name) - error while request: $@"; - #readingsSingleUpdate($hash, "state", "error", 1); + Log3 $name, 3, "AMADDevice ($name) - JSON error while request: $@"; return; } @@ -994,6 +999,8 @@ sub AMADDevice_decrypt($) {
  • 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
  • +
  • volumeUp - Increases the volume by the value from the attribute. Is no Attribut set, the default is 2
  • +
  • volumeDown - Decreases the volume by the value from the attribute. Is no Attribut set, the default is 2.
  • volumeNotification - set notifications volume

@@ -1007,10 +1014,12 @@ sub AMADDevice_decrypt($) {
  • screenLock - Locks screen with request for PIN. attribute setScreenlockPIN - enter PIN here. Only use numbers, 4-16 numbers required.
  • screenOrientation - Auto,Landscape,Portait, set screen orientation (automatic, horizontal, vertical). attribute setScreenOrientation
  • system - issue system command (only with rooted Android devices). reboot,shutdown,airplanemodeON (can only be switched ON) attribute root, in Automagic "Preferences" "Root functions" need to be enabled.
  • -
  • setAPSSID - set WLAN AccesPoint SSID to prevent WLAN sleeps
  • -
  • setNotifySndFilePath - set systempath to notifyfile (default /storage/emulated/0/Notifications/
  • -
  • setTtsMsgSpeed - set speaking speed for TTS (Value between 0.5 - 4.0, 0.5 Step) default is 1.0
  • -
  • setTtsMsgLang - set speaking language for TTS, de or en (default is de)
  • +
  • setAPSSID - Sets WLAN AccesPoint SSID to prevent WLAN sleeps
  • +
  • setNotifySndFilePath - Sets systempath to notifyfile (default /storage/emulated/0/Notifications/
  • +
  • setTtsMsgSpeed - Sets speaking speed for TTS (Value between 0.5 - 4.0, 0.5 Step) default is 1.0
  • +
  • setTtsMsgLang - Sets speaking language for TTS, de or en (default is de)
  • +
  • setVolMax - Sets the maximum volume for the volume Slider
  • +
  • setVolUpDownStep - Sets the Stepvalue for volumeUp/Down

  • To be able to use "openApp" the corresponding attribute "setOpenApp" needs to contain the app package name.

    @@ -1169,7 +1178,9 @@ sub AMADDevice_decrypt($) {
  • 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
  • +
  • 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. Der maximale Sliderwert kann über das Attribut setVolMax geregelt werden.
  • +
  • volumeUp - erhöt die Lautstärke um den angegeben Wert im entsprechenden Attribut. Ist kein Attribut angegeben wird per default 2 genommen.
  • +
  • volumeDown - reduziert die Lautstärke um den angegeben Wert im entsprechenden Attribut. Ist kein Attribut angegeben wird per default 2 genommen.
  • volumeNotification - setzt die Benachrichtigungslautstärke.

  • @@ -1188,6 +1199,8 @@ sub AMADDevice_decrypt($) {
  • setNotifySndFilePath - setzt den korrekten Systempfad zur Notifydatei (default ist /storage/emulated/0/Notifications/
  • setTtsMsgSpeed - setzt die Sprachgeschwindigkeit bei der Sprachausgabe(Werte zwischen 0.5 bis 4.0 in 0.5er Schritten) default ist 1.0
  • setTtsMsgSpeed - setzt die Sprache bei der Sprachausgabe, de oder en (default ist de)
  • +
  • setVolUpDownStep - setzt den Step für volumeUp und volumeDown
  • +
  • setVolMax - setzt die maximale Volume Gr&uoml;e

  • Um openApp verwenden zu können, muss als Attribut der Package Name der App angegeben werden.

    From dd5e47241963db22360c4ee33401f33447010c49 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 6 Jul 2017 10:25:21 +0200 Subject: [PATCH 26/32] commandref angepasst --- 74_AMADDevice.pm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index 7808de8..9cfbe5b 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -105,6 +105,8 @@ sub AMADDevice_Initialize($) { "setTtsMsgLang:de,en ". "setVolUpDownStep:1,2,4,5 ". "setVolMax ". + "setNotifyVolMax ". + "setRingSoundVolMax ". "setAPSSID ". "root:0,1 ". "disable:1 ". @@ -416,6 +418,8 @@ sub AMADDevice_Set($$@) { my $method; my $volMax = AttrVal($name,'setVolMax',15); + my $notifyVolMax = AttrVal($name,'setNotifyVolMax',7); + my $ringSoundVolMax = AttrVal($name,'setRingSoundVolMax',7); if( lc $cmd eq 'screenmsg' ) { @@ -742,7 +746,7 @@ sub AMADDevice_Set($$@) { my $btdev = AttrVal( $name, "setBluetoothDevice", "none" ); - my $list = "screenMsg ttsMsg mediaGoogleMusic:play/pause,stop,next,back mediaSamsungMusic:play/pause,stop,next,back mediaAmazonMusic:play/pause,stop,next,back mediaSpotifyMusic:play/pause,stop,next,back mediaTuneinRadio:play/pause,stop,next,back mediaAldiMusic:play/pause,stop,next,back mediaYouTube:play/pause,stop,next,back mediaVlcPlayer:play/pause,stop,next,back mediaAudible:play/pause,stop,next,back screenBrightness:slider,0,1,255 screen:on,off,lock,unlock openURL nextAlarmTime:time timer:slider,1,1,60 statusRequest:noArg bluetooth:on,off notifySndFile clearNotificationBar:All,Automagic activateVoiceInput:noArg volumeNotification:slider,0,1,7 volumeRingSound:slider,0,1,7 vibrate:noArg sendIntent openCall closeCall:noArg currentFlowsetUpdate:noArg installFlowSource doNotDisturb:never,always,alarmClockOnly,onlyImportant userFlowState sendSMS startDaydream:noArg volumeUp:noArg volumeDown:noArg mute:on,off"; + my $list = "screenMsg ttsMsg mediaGoogleMusic:play/pause,stop,next,back mediaSamsungMusic:play/pause,stop,next,back mediaAmazonMusic:play/pause,stop,next,back mediaSpotifyMusic:play/pause,stop,next,back mediaTuneinRadio:play/pause,stop,next,back mediaAldiMusic:play/pause,stop,next,back mediaYouTube:play/pause,stop,next,back mediaVlcPlayer:play/pause,stop,next,back mediaAudible:play/pause,stop,next,back screenBrightness:slider,0,1,255 screen:on,off,lock,unlock openURL nextAlarmTime:time timer:slider,1,1,60 statusRequest:noArg bluetooth:on,off notifySndFile clearNotificationBar:All,Automagic activateVoiceInput:noArg vibrate:noArg sendIntent openCall closeCall:noArg currentFlowsetUpdate:noArg installFlowSource doNotDisturb:never,always,alarmClockOnly,onlyImportant userFlowState sendSMS startDaydream:noArg volumeUp:noArg volumeDown:noArg mute:on,off"; $list .= " screenOrientation:auto,landscape,portrait" if( AttrVal( $name, "setScreenOrientation", "0" ) eq "1" ); $list .= " screenFullscreen:on,off" if( AttrVal( $name, "setFullscreen", "0" ) eq "1" ); @@ -750,6 +754,9 @@ sub AMADDevice_Set($$@) { $list .= " system:reboot,shutdown,airplanemodeON" if( AttrVal( $name, "root", "0" ) eq "1" ); $list .= " changetoBTDevice:$btdev" if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); $list .= " volume:slider,0,1,$volMax"; + $list .= " volumeNotification:slider,0,1,$notifyVolMax"; + $list .= " volumeRingSound:slider,0,1,$ringSoundVolMax"; + return "Unknown argument $cmd, choose one of $list"; @@ -1019,6 +1026,8 @@ sub AMADDevice_decrypt($) {
  • setTtsMsgSpeed - Sets speaking speed for TTS (Value between 0.5 - 4.0, 0.5 Step) default is 1.0
  • setTtsMsgLang - Sets speaking language for TTS, de or en (default is de)
  • setVolMax - Sets the maximum volume for the volume Slider
  • +
  • setNotifyVolMax - Sets the maximum volume for the notify volume Slider
  • +
  • setRingSoundVolMax - Sets the maximum volume for the ring sound volume Slider
  • setVolUpDownStep - Sets the Stepvalue for volumeUp/Down

  • To be able to use "openApp" the corresponding attribute "setOpenApp" needs to contain the app package name. @@ -1179,7 +1188,7 @@ sub AMADDevice_decrypt($) {
  • 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. Der maximale Sliderwert kann über das Attribut setVolMax geregelt werden.
  • -
  • volumeUp - erhöt die Lautstärke um den angegeben Wert im entsprechenden Attribut. Ist kein Attribut angegeben wird per default 2 genommen.
  • +
  • volumeUp - erhöh;t die Lautstärke um den angegeben Wert im entsprechenden Attribut. Ist kein Attribut angegeben wird per default 2 genommen.
  • volumeDown - reduziert die Lautstärke um den angegeben Wert im entsprechenden Attribut. Ist kein Attribut angegeben wird per default 2 genommen.
  • volumeNotification - setzt die Benachrichtigungslautstärke.
  • @@ -1200,7 +1209,9 @@ sub AMADDevice_decrypt($) {
  • setTtsMsgSpeed - setzt die Sprachgeschwindigkeit bei der Sprachausgabe(Werte zwischen 0.5 bis 4.0 in 0.5er Schritten) default ist 1.0
  • setTtsMsgSpeed - setzt die Sprache bei der Sprachausgabe, de oder en (default ist de)
  • setVolUpDownStep - setzt den Step für volumeUp und volumeDown
  • -
  • setVolMax - setzt die maximale Volume Gr&uoml;e
  • +
  • setVolMax - setzt die maximale Volume Gr&uoml;e für den Slider
  • +
  • setNotifyVolMax - setzt den maximalen Lautstärkewert für Benachrichtigungslautstärke für den Slider
  • +
  • setRingSoundVolMax - setzt den maximalen Lautstärkewert für Klingellautstärke für den Slider

  • Um openApp verwenden zu können, muss als Attribut der Package Name der App angegeben werden.

    From 106e948f9d7cab565efd0f5d0c9e4db8ba0a3266 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 7 Jul 2017 21:39:10 +0200 Subject: [PATCH 27/32] add Attribut setVolStep --- 74_AMADDevice.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index 9cfbe5b..8695a04 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -54,7 +54,7 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode "; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.77"; +my $modulversion = "3.9.78"; my $flowsetversion = "3.9.76"; @@ -105,6 +105,7 @@ sub AMADDevice_Initialize($) { "setTtsMsgLang:de,en ". "setVolUpDownStep:1,2,4,5 ". "setVolMax ". + "setVolStep:2,3,4,5 ". "setNotifyVolMax ". "setRingSoundVolMax ". "setAPSSID ". @@ -377,7 +378,11 @@ sub AMADDevice_WriteReadings($$) { $v =~ s/\bnull\b/off/g if( ($t eq "nextAlarmDay" or $t eq "nextAlarmTime") and $v eq "null" ); $v =~ s/\bnull\b//g; - readingsBulkUpdateIfChanged($hash, $t, $v, 1) if( defined( $v ) ); + readingsBulkUpdateIfChanged($hash, $t, $v, 1) if( defined( $v ) and ($t ne 'deviceState' + or $t ne 'incomingCallerName' + or $t ne 'incomingCallerNumber') + ); + readingsBulkUpdate($hash, '.'.$t, $v) if( $t eq 'deviceState' ); readingsBulkUpdate($hash, $t, $v) if( $t eq 'incomingCallerName' ); readingsBulkUpdate($hash, $t, $v) if( $t eq 'incomingCallerNumber' ); @@ -418,6 +423,7 @@ sub AMADDevice_Set($$@) { my $method; my $volMax = AttrVal($name,'setVolMax',15); + my $volStep = AttrVal($name,'setVolStep',1); my $notifyVolMax = AttrVal($name,'setNotifyVolMax',7); my $ringSoundVolMax = AttrVal($name,'setRingSoundVolMax',7); @@ -753,7 +759,7 @@ sub AMADDevice_Set($$@) { $list .= " openApp:$apps" if( AttrVal( $name, "setOpenApp", "none" ) ne "none" ); $list .= " system:reboot,shutdown,airplanemodeON" if( AttrVal( $name, "root", "0" ) eq "1" ); $list .= " changetoBTDevice:$btdev" if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); - $list .= " volume:slider,0,1,$volMax"; + $list .= " volume:slider,0,$volStep,$volMax"; $list .= " volumeNotification:slider,0,1,$notifyVolMax"; $list .= " volumeRingSound:slider,0,1,$ringSoundVolMax"; From 6cea66ba36be2f17206550db76e5cc169379b829 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sun, 9 Jul 2017 07:39:59 +0200 Subject: [PATCH 28/32] remove setVolStep and add setVolFactor --- 74_AMADDevice.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index 8695a04..42f7bb4 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -54,7 +54,7 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode "; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.78"; +my $modulversion = "3.9.79"; my $flowsetversion = "3.9.76"; @@ -105,7 +105,7 @@ sub AMADDevice_Initialize($) { "setTtsMsgLang:de,en ". "setVolUpDownStep:1,2,4,5 ". "setVolMax ". - "setVolStep:2,3,4,5 ". + "setVolFactor:2,3,4,5 ". "setNotifyVolMax ". "setRingSoundVolMax ". "setAPSSID ". @@ -382,10 +382,11 @@ sub AMADDevice_WriteReadings($$) { or $t ne 'incomingCallerName' or $t ne 'incomingCallerNumber') ); - - readingsBulkUpdate($hash, '.'.$t, $v) if( $t eq 'deviceState' ); - readingsBulkUpdate($hash, $t, $v) if( $t eq 'incomingCallerName' ); - readingsBulkUpdate($hash, $t, $v) if( $t eq 'incomingCallerNumber' ); + + readingsBulkUpdateIfChanged( $hash, $t, ($v / AttrVal($name,'setVolFactor',1)) ) if( $t eq 'volume' and AttrVal($name,'setVolFactor',1) > 1 ); + readingsBulkUpdate( $hash, '.'.$t, $v ) if( $t eq 'deviceState' ); + readingsBulkUpdate( $hash, $t, $v ) if( $t eq 'incomingCallerName' ); + readingsBulkUpdate( $hash, $t, $v ) if( $t eq 'incomingCallerNumber' ); } readingsBulkUpdateIfChanged( $hash, "deviceState", "offline", 1 ) if( $decode_json->{payload}{airplanemode} && $decode_json->{payload}{airplanemode} eq "on" ); @@ -423,7 +424,6 @@ sub AMADDevice_Set($$@) { my $method; my $volMax = AttrVal($name,'setVolMax',15); - my $volStep = AttrVal($name,'setVolStep',1); my $notifyVolMax = AttrVal($name,'setNotifyVolMax',7); my $ringSoundVolMax = AttrVal($name,'setRingSoundVolMax',7); @@ -759,7 +759,7 @@ sub AMADDevice_Set($$@) { $list .= " openApp:$apps" if( AttrVal( $name, "setOpenApp", "none" ) ne "none" ); $list .= " system:reboot,shutdown,airplanemodeON" if( AttrVal( $name, "root", "0" ) eq "1" ); $list .= " changetoBTDevice:$btdev" if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); - $list .= " volume:slider,0,$volStep,$volMax"; + $list .= " volume:slider,0,1,$volMax"; $list .= " volumeNotification:slider,0,1,$notifyVolMax"; $list .= " volumeRingSound:slider,0,1,$ringSoundVolMax"; From a091b7087970bfabf6f80685c7dd202b2797dc04 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 18 Jul 2017 11:44:54 +0200 Subject: [PATCH 29/32] begin change commandref, add escaped } in MatchList Regex --- 73_AMADCommBridge.pm | 6 +- 74_AMADDevice.pm | 180 +------------------------------------------ 2 files changed, 6 insertions(+), 180 deletions(-) diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index 2587a65..4ea7e1e 100644 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -70,7 +70,7 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode "; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.77"; +my $modulversion = "3.9.80"; my $flowsetversion = "3.9.76"; @@ -103,7 +103,7 @@ sub AMADCommBridge_Initialize($) { $hash->{ReadFn} = "AMADCommBridge_Read"; $hash->{WriteFn} = "AMADCommBridge_Write"; $hash->{Clients} = ":AMADDevice:"; - $hash->{MatchList} = { "1:AMADDevice" => '{"amad": {"amad_id":.+}}' }; + $hash->{MatchList} = { "1:AMADDevice" => '{"amad": \{"amad_id":.+}}' }; # Consumer @@ -133,7 +133,7 @@ sub AMADCommBridge_Define($$) { my @a = split( "[ \t][ \t]*", $def ); - return "too few parameters: define AMADCommBridge ''" if( @a < 2) and ( @a > 3); + return "too few parameters: define AMADCommBridge ''" if( @a < 2 and @a > 3 ); return "Cannot define a HEOS device. Perl modul $missingModul is missing." if ( $missingModul ); my $name = $a[0]; diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index 42f7bb4..1072068 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -54,7 +54,7 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode "; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.79"; +my $modulversion = "3.9.80"; my $flowsetversion = "3.9.76"; @@ -81,7 +81,7 @@ sub AMADDevice_Initialize($) { my ($hash) = @_; - $hash->{Match} = '{"amad": {"amad_id":.+}}'; + $hash->{Match} = '{"amad": \{"amad_id":.+}}'; $hash->{SetFn} = "AMADDevice_Set"; @@ -881,181 +881,7 @@ sub AMADDevice_decrypt($) {

    AMADDevice

    -
      - AMADDevice - Automagic Android Device -
      - This module integrates Android devices into FHEM and displays several settings using the Android app "Automagic". - Automagic is comparable to the "Tasker" app for automating tasks and configuration settings. But Automagic is more user-friendly. The "Automagic Premium" app currently costs EUR 2.90. -
      - Any information retrievable by Automagic can be displayed in FHEM by this module. Just define your own Automagic-"flow" and send the data to the AMADDeviceCommBridge. One even can control several actions on Android devices. -
      - To be able to make use of all these functions the Automagic app and additional flows need to be installed on the Android device. The flows can be retrieved from the FHEM directory, the app can be bought in Google Play Store. -

      - How to use AMADDevice? -
        -
      • install the "Automagic Premium" app from the Google Play store.
      • -
      • install the flowset 74_AMADDeviceautomagicFlowset$VERSION.xml from the directory $INSTALLFHEM/FHEM/lib/ on your Android device and activate.
      • -
      -
      - Now you need to define a device in FHEM. -

      - - Define -

        - define <name> AMADDevice <IP-ADDRESS> -

        - Example: -

          - define WandTabletWohnzimmer AMADDevice 192.168.0.23
          -
        -
        - With this command two new AMADDevice devices in a room called AMADDevice are created. The parameter <IP-ADDRESS< defines the IP address of your Android device. The second device created is the AMADDeviceCommBridge which serves as a communication device from each Android device to FHEM.
        - !!!Coming Soon!!! The communication port of each AMADDevice device may be set by the definition of the "port" attribute. One needs background knowledge of Automagic and HTTP requests as this port will be set in the HTTP request trigger of both flows, therefore the port also needs to be set there. -
        - The communication port of the AMADDeviceCommBridge device can easily be changed within the attribut "port".
        -
      -
      - AMADDevice Communication Bridge -
        - Creating your first AMADDevice device automatically creates the AMADDeviceCommBridge device in the room AMADDevice. With the help of the AMADDeviceCommBridge any Android device communicates initially to FHEM.To make the IP addresse of the FHEM server known to the Android device, the FHEM server IP address needs to be configured in the AMADDeviceCommBridge. WITHOUT THIS STEP THE AMADDeviceCommBridge WILL NOT WORK PROPERLY.
        - Please us the following command for configuration of the FHEM server IP address in the AMADDeviceCommBridge: set AMADDeviceCommBridge fhemServerIP <FHEM-IP>.
        - Additionally the expertMode may be configured. By this setting a direct communication with FHEM will be established without the restriction of needing to make use of a notify to execute set commands. -

      -
      - You are finished now! After 15 seconds latest the readings of your AMADDevice Android device should be updated. Consequently each 15 seconds a status request will be sent. If the state of your AMADDevice Android device does not change to "active" over a longer period of time one should take a look into the log file for error messages. -


      - - Readings -
        -
      • airplanemode - on/off, state of the aeroplane mode
      • -
      • androidVersion - currently installed version of Android
      • -
      • automagicState - state of the Automagic App (prerequisite Android >4.3). In case you have Android >4.3 and the reading says "not supported", you need to enable Automagic inside Android / Settings / Sound & notification / Notification access
      • -
      • batteryHealth - the health of the battery (1=unknown, 2=good, 3=overheat, 4=dead, 5=over voltage, 6=unspecified failure, 7=cold)
      • -
      • batterytemperature - the temperature of the battery
      • -
      • bluetooth - on/off, bluetooth state
      • -
      • checkActiveTask - state of an app (needs to be defined beforehand). 0=not active or not active in foreground, 1=active in foreground, see note below
      • -
      • connectedBTdevices - list of all devices connected via bluetooth
      • -
      • connectedBTdevicesMAC - list of MAC addresses of all devices connected via bluetooth
      • -
      • currentMusicAlbum - currently playing album of mediaplayer
      • -
      • currentMusicApp - currently playing player app (Amazon Music, Google Play Music, Google Play Video, Spotify, YouTube, TuneIn Player, Aldi Life Music)
      • -
      • currentMusicArtist - currently playing artist of mediaplayer
      • -
      • currentMusicIcon - cover of currently play albumNoch nicht fertig implementiert
      • -
      • currentMusicState - state of currently/last used mediaplayer
      • -
      • currentMusicTrack - currently playing song title of mediaplayer
      • -
      • daydream - on/off, daydream currently active
      • -
      • deviceState - state of Android devices. unknown, online, offline.
      • -
      • doNotDisturb - state of do not Disturb Mode
      • -
      • dockingState - undocked/docked, Android device in docking station
      • -
      • flow_SetCommands - active/inactive, state of SetCommands flow
      • -
      • flow_informations - active/inactive, state of Informations flow
      • -
      • flowsetVersionAtDevice - currently installed version of the flowsets on the Android device
      • -
      • incomingCallerName - Callername from last Call
      • -
      • incomingCallerNumber - Callernumber from last Call
      • -
      • incommingWhatsAppMessageFrom - last WhatsApp message
      • -
      • incommingWhatsTelegramMessageFrom - last telegram message
      • -
      • intentRadioName - name of the most-recent streamed intent radio
      • -
      • intentRadioState - state of intent radio player
      • -
      • keyguardSet - 0/1 keyguard set, 0=no 1=yes, does not indicate whether it is currently active
      • -
      • lastSetCommandError - last error message of a set command
      • -
      • lastSetCommandState - last state of a set command, command send successful/command send unsuccessful
      • -
      • lastStatusRequestError - last error message of a statusRequest command
      • -
      • lastStatusRequestState - ast state of a statusRequest command, command send successful/command send unsuccessful
      • -
      • nextAlarmDay - currently set day of alarm
      • -
      • nextAlarmState - alert/done, current state of "Clock" stock-app
      • -
      • nextAlarmTime - currently set time of alarm
      • -
      • powerLevel - state of battery in %
      • -
      • powerPlugged - 0=no/1,2=yes, power supply connected
      • -
      • screen - on locked,unlocked/off locked,unlocked, state of display
      • -
      • screenBrightness - 0-255, level of screen-brightness
      • -
      • screenFullscreen - on/off, full screen mode
      • -
      • screenOrientation - Landscape/Portrait, screen orientation (horizontal,vertical)
      • -
      • screenOrientationMode - auto/manual, mode for screen orientation
      • -
      • state - current state of AMADDevice device
      • -
      • userFlowState - current state of a Flow, established under setUserFlowState Attribut
      • -
      • volume - media volume setting
      • -
      • volumeNotification - notification volume setting
      • -
        - Prerequisite for using the reading checkActivTask the package name of the application to be checked needs to be defined in the attribute checkActiveTask. Example: attr Nexus10Wohnzimmer - checkActiveTask com.android.chrome für den Chrome Browser. -

        -
      -

      - - Set -
        -
      • activateVoiceInput - start voice input on Android device
      • -
      • bluetooth - on/off, switch bluetooth on/off
      • -
      • clearNotificationBar - All/Automagic, deletes all or only Automagic notifications in status bar
      • -
      • closeCall - hang up a running call
      • -
      • currentFlowsetUpdate - start flowset update on Android device
      • -
      • installFlowSource - install a Automagic flow on device, XML file must be stored in /tmp/ with extension xml. Example: set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml
      • -
      • doNotDisturb - sets the do not Disturb Mode, always Disturb, never Disturb, alarmClockOnly alarm Clock only, onlyImportant only important Disturbs
      • -
      • mediaAmazonMusic - play/stop/next/back , controlling the amazon music media player
      • -
      • mediaGoogleMusic - play/stop/next/back , controlling the google play music media player
      • -
      • mediaSpotifyMusic - play/stop/next/back , controlling the spotify media player
      • -
      • mediaTuneinRadio - play/stop/next/back , controlling the TuneinRadio media player
      • -
      • mediaAldiMusic - play/stop/next/back , controlling the Aldi music media player
      • -
      • mediaAudible - play/stop/next/back , controlling the Audible media player
      • -
      • mediaYouTube - play/stop/next/back , controlling the YouTube media player
      • -
      • mediaVlcPlayer - play/stop/next/back , controlling the VLC media player
      • -
      • nextAlarmTime - sets the alarm time. Only valid for the next 24 hours.
      • -
      • notifySndFile - plays a media-file which by default needs to be stored in the folder "/storage/emulated/0/Notifications/" of the Android device. You may use the attribute setNotifySndFilePath for defining a different folder.
      • -
      • openCall - initial a call and hang up after optional time / set DEVICE openCall 0176354 10 call this number and hang up after 10s
      • -
      • screenBrightness - 0-255, set screen brighness
      • -
      • screenMsg - display message on screen of Android device
      • -
      • sendintent - send intent string Example: set $AMADDeviceDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio, first parameter contains the action, second parameter contains the extra. At most two extras can be used.
      • -
      • sendSMS - Sends an SMS to a specific phone number. Bsp.: sendSMS Dies ist ein Test|555487263
      • -
      • startDaydream - start Daydream
      • -
      • 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
      • -
      • volumeUp - Increases the volume by the value from the attribute. Is no Attribut set, the default is 2
      • -
      • volumeDown - Decreases the volume by the value from the attribute. Is no Attribut set, the default is 2.
      • -
      • volumeNotification - set notifications volume
      • -
      -
      - Set (depending on attribute values) -
        -
      • changetoBtDevice - switch to another bluetooth device. Attribute setBluetoothDevice needs to be set. See note below!
      • -
      • openApp - start an app. attribute setOpenApp
      • -
      • openURL - opens a URLS in the standard browser as long as no other browser is set by the attribute setOpenUrlBrowser.Example: attr Tablet setOpenUrlBrowser de.ozerov.fully|de.ozerov.fully.MainActivity, first parameter: package name, second parameter: Class Name
      • -
      • screen - on/off/lock/unlock, switch screen on/off or lock/unlock screen. In Automagic "Preferences" the "Device admin functions" need to be enabled, otherwise "Screen off" does not work. attribute setScreenOnForTimer changes the time the display remains switched on!
      • -
      • screenFullscreen - on/off, activates/deactivates full screen mode. attribute setFullscreen
      • -
      • screenLock - Locks screen with request for PIN. attribute setScreenlockPIN - enter PIN here. Only use numbers, 4-16 numbers required.
      • -
      • screenOrientation - Auto,Landscape,Portait, set screen orientation (automatic, horizontal, vertical). attribute setScreenOrientation
      • -
      • system - issue system command (only with rooted Android devices). reboot,shutdown,airplanemodeON (can only be switched ON) attribute root, in Automagic "Preferences" "Root functions" need to be enabled.
      • -
      • setAPSSID - Sets WLAN AccesPoint SSID to prevent WLAN sleeps
      • -
      • setNotifySndFilePath - Sets systempath to notifyfile (default /storage/emulated/0/Notifications/
      • -
      • setTtsMsgSpeed - Sets speaking speed for TTS (Value between 0.5 - 4.0, 0.5 Step) default is 1.0
      • -
      • setTtsMsgLang - Sets speaking language for TTS, de or en (default is de)
      • -
      • setVolMax - Sets the maximum volume for the volume Slider
      • -
      • setNotifyVolMax - Sets the maximum volume for the notify volume Slider
      • -
      • setRingSoundVolMax - Sets the maximum volume for the ring sound volume Slider
      • -
      • setVolUpDownStep - Sets the Stepvalue for volumeUp/Down
      • -
        - To be able to use "openApp" the corresponding attribute "setOpenApp" needs to contain the app package name. -

        - To be able to switch between bluetooth devices the attribute "setBluetoothDevice" needs to contain (a list of) bluetooth devices defined as follows: attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC No spaces are allowed in any BTdeviceName. Defining MAC please make sure to use the character : (colon) after each second digit/character.
        - Example: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76 -
      -

      - - state -
        -
      • initialized - shown after initial define.
      • -
      • active - device is active.
      • -
      • disabled - device is disabled by the attribute "disable".
      • -
      -


      - Further examples and reading: - -


      -
    + =end html =begin html_DE From 2ee63abc053081c3923b628451d2cdd594fea389 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 21 Jul 2017 09:59:35 +0200 Subject: [PATCH 30/32] =?UTF-8?q?Commandref=20f=C3=BCr=20AMADDevice=20ange?= =?UTF-8?q?passt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMADDevice.pm | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index 1072068..7f33100 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -900,38 +900,27 @@ sub AMADDevice_decrypt($) {

    Wie genau verwendet man nun AMADDevice?
      -
    • man installiert die App "Automagic Premium" aus dem PlayStore.
    • -
    • dann installiert man das Flowset 74_AMADDeviceautomagicFlowset$VERSION.xml aus dem Ordner $INSTALLFHEM/FHEM/lib/ auf dem Androidgerät und aktiviert die Flows.
    • +
    • stelle sicher das als aller erstes die AMADCommBridge in FHEM definiert wurde
    • +
    • installiere die App "Automagic Premium" aus dem PlayStore.
    • +
    • installiere das Flowset 74_AMADDeviceautomagicFlowset$VERSION.xml aus dem Ordner $INSTALLFHEM/FHEM/lib/ auf dem Androidgerät +
    • aktiviere den Installationsassistanten Flow in Automagic. Wenn man nun Automagic in den Hintergrund schickt, z.B. Hometaste drücken, startet der Assistant und legt automatisch ein Device für das Androidgerät an.
    -
    - Es muß noch ein Device in FHEM anlegt werden. +

    + Ein AMADDevice Gerät von Hand anlegen.

    Define

      - define <name> AMADDevice <IP-ADRESSE> + 10.6.9.10 1496497380000 IODev=AMADBridge + define <name> AMADDevice <IP-ADRESSE> <AMAD_ID> IODev=<IODEVICE>

      Beispiel:

        - define WandTabletWohnzimmer AMADDevice 192.168.0.23
        + define WandTabletWohnzimmer AMADDevice 192.168.0.23 123456 IODev=NAME_des_AMADCommBridge_Devices

      - Diese Anweisung erstellt zwei neues AMADDevice-Device im Raum AMADDevice.Der Parameter <IP-ADRESSE> legt die IP Adresse des Android Gerätes fest.
      - Das zweite Device ist die AMADDeviceCommBridge welche als Kommunikationsbrücke vom Androidgerät zu FHEM diehnt. !!!Comming Soon!!! Wer den Port ändern möchte, kann dies über das Attribut "port" tun. Ihr solltet aber wissen was Ihr tut, da dieser Port im HTTP Request Trigger der beiden Flows eingestellt ist. Demzufolge muß der Port dort auch geändert werden. Der Port für die Bridge kann ohne Probleme im Bridge Device mittels dem Attribut "port" verändert werden. -
      - Der Port für die Bridge kann ohne Probleme im Bridge Device mittels dem Attribut "port" verändert werden.
      + In diesem Fall wird ein AMADDevice von Hand angelegt. Die AMAD_ID, hier 123456, muß auch exakt so als globale Variable in Automagic eingetragen sein.
    -
    - AMADDevice Communication Bridge -
      - Beim ersten anlegen einer AMADDevice Deviceinstanz wird automatisch ein Gerät Namens AMADDeviceCommBridge im Raum AMADDevice mit angelegt. Dieses Gerät diehnt zur Kommunikation vom Androidgerät zu FHEM ohne das zuvor eine Anfrage von FHEM aus ging. Damit das Androidgerät die IP von FHEM kennt, muss diese sofort nach dem anlegen der Bridge über den set Befehl in ein entsprechendes Reading in die Bridge geschrieben werden. DAS IST SUPER WICHTIG UND FÜR DIE FUNKTION DER BRIDGE NOTWENDIG.
      - Hierfür muß folgender Befehl ausgeführt werden. set AMADDeviceCommBridge fhemServerIP <FHEM-IP>.
      - Als zweites Reading kann expertMode gesetzen werden. Mit diesem Reading wird eine unmittelbare Komminikation mit FHEM erreicht ohne die Einschränkung über ein - Notify gehen zu müssen und nur reine set Befehle ausführen zu können. -

    - NUN bitte die Flows AKTIVIEREN!!!
    -
    - Fertig! Nach anlegen der Geräteinstanz und dem eintragen der fhemServerIP in der CommBridge sollten nach spätestens 15 Sekunden bereits die ersten Readings reinkommen. Nun wird alle 15 Sekunden probiert einen Status Request erfolgreich ab zu schließen. Wenn der Status sich über einen längeren Zeitraum nicht auf "active" ändert, sollte man im Log nach eventuellen Fehlern suchen.


    Readings From 3a17f698c5ccf9c173d6aad35c05cdd39d1de99c Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 21 Jul 2017 11:06:27 +0200 Subject: [PATCH 31/32] =?UTF-8?q?Bugfix=20in=20der=20Commandref=20und=20ei?= =?UTF-8?q?nige=20Codeanpassungen=20f=C3=BCr=20das=20=C3=B6ffnen=20der=20B?= =?UTF-8?q?ridge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 73_AMADCommBridge.pm | 26 +++++++++++++++++--------- 74_AMADDevice.pm | 4 ++-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index 4ea7e1e..29d1778 100644 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -544,19 +544,27 @@ sub AMADCommBridge_Open($) { my $port = $hash->{PORT}; - # Oeffnen des TCP Sockets - my $ret = TcpServer_Open( $hash, $port, "global" ); + if( not defined($hash->{FD}) and (! $hash->{FD}) ) { + # Oeffnen des TCP Sockets + my $ret = TcpServer_Open( $hash, $port, "global" ); - if( $ret && !$init_done ) { + if( $ret && !$init_done ) { - Log3 $name, 3, "AMADCommBridge ($name) - $ret. Exiting."; - exit(1); + Log3 $name, 3, "AMADCommBridge ($name) - $ret. Exiting."; + exit(1); + } + + readingsSingleUpdate ( $hash, "state", "opened", 1 ) if( defined($hash->{FD}) ); + Log3 $name, 3, "AMADCommBridge ($name) - Socket opened."; + + return $ret; + + } else { + + Log3 $name, 3, "AMADCommBridge ($name) - Socket already opened"; } - readingsSingleUpdate ( $hash, "state", "opened", 1 ) if( defined($hash->{FD}) ); - Log3 $name, 3, "AMADCommBridge ($name) - Socket opened."; - - return $ret; + return; } sub AMADCommBridge_Close($) { diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index 7f33100..b73f9f6 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -902,7 +902,7 @@ sub AMADDevice_decrypt($) {
    • stelle sicher das als aller erstes die AMADCommBridge in FHEM definiert wurde
    • installiere die App "Automagic Premium" aus dem PlayStore.
    • -
    • installiere das Flowset 74_AMADDeviceautomagicFlowset$VERSION.xml aus dem Ordner $INSTALLFHEM/FHEM/lib/ auf dem Androidgerät +
    • installiere das Flowset 74_AMADDeviceautomagicFlowset$VERSION.xml aus dem Ordner $INSTALLFHEM/FHEM/lib/ auf dem Androidgerät
    • aktiviere den Installationsassistanten Flow in Automagic. Wenn man nun Automagic in den Hintergrund schickt, z.B. Hometaste drücken, startet der Assistant und legt automatisch ein Device für das Androidgerät an.


    @@ -916,7 +916,7 @@ sub AMADDevice_decrypt($) {

    Beispiel:

      - define WandTabletWohnzimmer AMADDevice 192.168.0.23 123456 IODev=NAME_des_AMADCommBridge_Devices
      + define WandTabletWohnzimmer AMADDevice 192.168.0.23 123456 IODev=NAME_des_AMADCommBridge_Devices

    In diesem Fall wird ein AMADDevice von Hand angelegt. Die AMAD_ID, hier 123456, muß auch exakt so als globale Variable in Automagic eingetragen sein. From 3c66d2a94d2ef85dfec02ac4b2f11ad7e8ccc697 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Mon, 24 Jul 2017 10:57:33 +0200 Subject: [PATCH 32/32] ready for final, add englisch Commandref --- 73_AMADCommBridge.pm | 68 +- 74_AMADDevice.pm | 165 +- 74_AMADautomagicFlowset_4.0.0.xml | 4618 +++++++++++++++++++++++++++++ 3 files changed, 4841 insertions(+), 10 deletions(-) create mode 100644 74_AMADautomagicFlowset_4.0.0.xml diff --git a/73_AMADCommBridge.pm b/73_AMADCommBridge.pm index 29d1778..46315e0 100644 --- a/73_AMADCommBridge.pm +++ b/73_AMADCommBridge.pm @@ -70,8 +70,8 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode "; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.80"; -my $flowsetversion = "3.9.76"; +my $modulversion = "4.0.0"; +my $flowsetversion = "4.0.0"; @@ -979,7 +979,61 @@ sub AMADCommBridge_ParseMsg($$) {

    AMADCommBridge

    -comming soon +
      + AMAD - Automagic Android Device

      + AMADCommBridge - Communication bridge for all AMAD devices +
      + This module is the central point for the successful integration of Android devices in FHEM. It also provides a link level between AMAD supported devices and FHEM. All communication between AMAD Android and FHEM runs through this interface.
      + Therefore, the initial setup of an AMAD device is also performed exactly via this module instance. +

      + In order to successfully establish an Android device in FHEM, an AMADCommBridge device must be created in the first step. +

      + + Define +

        + define <name> AMADCommBridge +

        + Example: +

          + define AMADBridge AMADCommBridge
          +
        +
        + This statement creates a new AMADCommBridge device named AMADBridge. +

      + In the following, only the Flowset has to be installed on the Android device and the Flow 'First Run Assistant' run. (Simply press the Homebutton)
      + The wizard then guides you through the setup of your AMAD device and ensures that at the end of the installation process the Android device is created as an AMAD device in FHEM. +
    +

    + + Readings +

      +
    • JSON_ERROR - JSON Error message reported by Perl
    • +
    • JSON_ERROR_STRING - The string that caused the JSON error message
    • +
    • fhemServerIP - The IP address of the FHEM server, is set by the module based on the JSON string from the installation wizard. Can also be set by user using set command
    • +
    • receiveFhemCommand - is set the fhemControlMode attribute to trigger, the reading is set as soon as an FHEM command is sent. A notification can then be triggered.
      + If set instead of trigger setControl as value for fhemControlMode, the reading is not executed but the set command executed immediately.
    • +
    • receiveVoiceCommand - The speech control is activated by AMAD (set DEVICE activateVoiceInput), the last recognized voice command is written into this reading.
    • +
    • receiveVoiceDevice - Name of the device from where the last recognized voice command was sent
    • +
    • state - state of the Bridge, open, closed
    • +
    +

    + + Attributes +

      +
    • allowFrom - Regexp the allowed IP addresses or hostnames. If this attribute is set, only connections from these addresses are accepted.
      + Attention: If allowfrom is not set, and no kind allowed instance is defined, and the remote has a non-local address, then the connection is rejected. The following addresses are considered local:
      + IPV4: 127/8, 10/8, 192.168/16, 172.16/10, 169.254/16
      + IPV6: ::1, fe80/10
    • +
    • debugJSON - If set to 1, JSON error messages are written in readings. See JSON_ERROR * under Readings
    • +
    • fhemControlMode - Controls the permissible type of control of FHEM devices. You can control the bridge in two ways FHEM devices. Either by direct FHEM command from a flow, or as a voice command by means of voice control (set DEVICE activateVoiceInput) +
      • trigger - If the value trigger is set, all FHEM set commands sent to the bridge are written to the reading receiveFhemCommand and can be executed using notify. Voice control is possible; readings receiveVoice * are set. On the Android device several voice commands can be linked by means of "and". Example: turn on the light scene in the evening and turn on the TV
      • +
      • setControl - All set commands sent via the flow are automatically executed. The triggering of a reading is not necessary. The control by means of language behaves like the value trigger
      • +
      • thirdPartControl - Behaves as triggered, but in the case of voice control, a series of voice commands by means of "and" is not possible. Used for voice control via modules of other module authors ((z.B. 39_TEERKO.pm)
      +
    • +
    +

    + If you have problems with the wizard, an Android device can also be applied manually, you will find in the Commandref to the AMADDevice module. + =end html =begin html_DE @@ -1007,8 +1061,8 @@ comming soon
    Diese Anweisung erstellt ein neues AMADCommBridge Device Namens AMADBridge.
    - Im folgenden muß lediglich das Flowset auf dem Android Gerät installiert werden und der Flow 'First Run Assistant' ausgeführt werden. (einfach den Homebutton drücken)
    - Der Assistant geleitet Dich dann durch die Einrichtung Deines AMAD Gerätes und sorgt dafür das am Ende des Installationsprozess das Androidgerät als AMAD Device in FHEM angelegt wird. + Im folgenden muß lediglich das Flowset auf dem Android Gerät installiert werden und der Flow 'First Run Assistent' ausgeführt werden. (einfach den Homebutton drücken)
    + Der Assistent geleitet Dich dann durch die Einrichtung Deines AMAD Gerätes und sorgt dafür das am Ende des Installationsprozess das Androidgerät als AMAD Device in FHEM angelegt wird.

    @@ -1018,7 +1072,7 @@ comming soon
  • JSON_ERROR_STRING - der String welcher die JSON Fehlermeldung verursacht hat
  • fhemServerIP - die Ip-Adresse des FHEM Servers, wird vom Modul auf Basis des JSON Strings vom Installationsassistenten gesetzt. Kann aber auch mittels set Befehles vom User gesetzt werden
  • receiveFhemCommand - ist das Attribut fhemControlMode auf trigger gestellt, wird das Reading gesetzt sobald ein FHEM Befehl übersendet wird. Hierauf kann dann ein Notify triggern.
    - Wird anstelle von trigger setControl als Wert für fhemControlMode eingestellt, wird das Reading nicht gestzt sondern der set Behel sofort ausgeführt.
  • + Wird anstelle von trigger setControl als Wert für fhemControlMode eingestellt, wird das Reading nicht gestzt sondern der set Befehl sofort ausgeführt.
  • receiveVoiceCommand - wird die Sprachsteuerung von AMAD aktiviert (set DEVICE activateVoiceInput) so wird der letzte erkannten Sprachbefehle in dieses Reading geschrieben.
  • receiveVoiceDevice - Name des Devices von wo aus der letzte erkannte Sprachbefehl gesendet wurde
  • state - Status der Bridge, open, closed
  • @@ -1039,7 +1093,7 @@ comming soon

    - Wie man bei Problemen mit dem Assistenten ein Androidgerät auch von Hand anlegen kann, erfärst Du in der Commandref zum AMADDevice Modul. + Wie man bei Problemen mit dem Assistenten ein Androidgerät auch von Hand anlegen kann, erfährst Du in der Commandref zum AMADDevice Modul. =end html_DE diff --git a/74_AMADDevice.pm b/74_AMADDevice.pm index b73f9f6..6410b46 100644 --- a/74_AMADDevice.pm +++ b/74_AMADDevice.pm @@ -54,8 +54,8 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode "; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "3.9.80"; -my $flowsetversion = "3.9.76"; +my $modulversion = "4.0.0"; +my $flowsetversion = "4.0.0"; @@ -881,7 +881,166 @@ sub AMADDevice_decrypt($) {

    AMADDevice

    - +
      + AMAD - Automagic Android Device +
      + This module integrates Android devices into FHEM and displays several settings using the Android app "Automagic". + Automagic is comparable to the "Tasker" app for automating tasks and configuration settings. But Automagic is more user-friendly. The "Automagic Premium" app currently costs EUR 2.90. +
      + Any information retrievable by Automagic can be displayed in FHEM by this module. Just define your own Automagic-"flow" and send the data to the AMADCommBridge. One even can control several actions on Android devices. +
      + To be able to make use of all these functions the Automagic app and additional flows need to be installed on the Android device. The flows can be retrieved from the FHEM directory, the app can be bought in Google Play Store. +

      + How to use AMADDevice? +
        +
      • first, make sure that the AMADCommBridge in FHEM was defined
      • +
      • install the "Automagic Premium" app from the PlayStore
      • +
      • install the flowset 74_AMADDeviceautomagicFlowset$VERSION.xml file from the $INSTALLFHEM/FHEM/lib/ directory on the Android device
      • +
      • activate the "installation assistant" Flow in Automagic. If one now sends Automagic into the background, e.g. Homebutton, the assistant starts and creates automatically a FHEM device for the android device
      • +
      +

      + Define a AMADDevice device by hand. +

      + + Define +

        + 10.6.9.10 1496497380000 IODev=AMADBridge + define <name> AMADDevice <IP-ADRESSE> <AMAD_ID> IODev=<IODEVICE> +

        + Example: +

          + define WandTabletWohnzimmer AMADDevice 192.168.0.23 123456 IODev=NAME_des_AMADCommBridge_Devices
          +
        +
        + In this case, an AMADDevice is created by hand. The AMAD_ID, here 123456, must also be entered exactly as a global variable in Automagic. +
      +


      + + Readings +
        +
      • airplanemode - on/off, state of the aeroplane mode
      • +
      • androidVersion - currently installed version of Android
      • +
      • automagicState - state of the Automagic App (prerequisite Android >4.3). In case you have Android >4.3 and the reading says "not supported", you need to enable Automagic inside Android / Settings / Sound & notification / Notification access
      • +
      • batteryHealth - the health of the battery (1=unknown, 2=good, 3=overheat, 4=dead, 5=over voltage, 6=unspecified failure, 7=cold)
      • +
      • batterytemperature - the temperature of the battery
      • +
      • bluetooth - on/off, bluetooth state
      • +
      • checkActiveTask - state of an app (needs to be defined beforehand). 0=not active or not active in foreground, 1=active in foreground, see note below
      • +
      • connectedBTdevices - list of all devices connected via bluetooth
      • +
      • connectedBTdevicesMAC - list of MAC addresses of all devices connected via bluetooth
      • +
      • currentMusicAlbum - currently playing album of mediaplayer
      • +
      • currentMusicApp - currently playing player app (Amazon Music, Google Play Music, Google Play Video, Spotify, YouTube, TuneIn Player, Aldi Life Music)
      • +
      • currentMusicArtist - currently playing artist of mediaplayer
      • +
      • currentMusicIcon - cover of currently play albumNoch nicht fertig implementiert
      • +
      • currentMusicState - state of currently/last used mediaplayer
      • +
      • currentMusicTrack - currently playing song title of mediaplayer
      • +
      • daydream - on/off, daydream currently active
      • +
      • deviceState - state of Android devices. unknown, online, offline.
      • +
      • doNotDisturb - state of do not Disturb Mode
      • +
      • dockingState - undocked/docked, Android device in docking station
      • +
      • flow_SetCommands - active/inactive, state of SetCommands flow
      • +
      • flow_informations - active/inactive, state of Informations flow
      • +
      • flowsetVersionAtDevice - currently installed version of the flowsets on the Android device
      • +
      • incomingCallerName - Callername from last Call
      • +
      • incomingCallerNumber - Callernumber from last Call
      • +
      • incommingWhatsAppMessageFrom - last WhatsApp message
      • +
      • incommingWhatsTelegramMessageFrom - last telegram message
      • +
      • intentRadioName - name of the most-recent streamed intent radio
      • +
      • intentRadioState - state of intent radio player
      • +
      • keyguardSet - 0/1 keyguard set, 0=no 1=yes, does not indicate whether it is currently active
      • +
      • lastSetCommandError - last error message of a set command
      • +
      • lastSetCommandState - last state of a set command, command send successful/command send unsuccessful
      • +
      • lastStatusRequestError - last error message of a statusRequest command
      • +
      • lastStatusRequestState - ast state of a statusRequest command, command send successful/command send unsuccessful
      • +
      • nextAlarmDay - currently set day of alarm
      • +
      • nextAlarmState - alert/done, current state of "Clock" stock-app
      • +
      • nextAlarmTime - currently set time of alarm
      • +
      • powerLevel - state of battery in %
      • +
      • powerPlugged - 0=no/1,2=yes, power supply connected
      • +
      • screen - on locked,unlocked/off locked,unlocked, state of display
      • +
      • screenBrightness - 0-255, level of screen-brightness
      • +
      • screenFullscreen - on/off, full screen mode
      • +
      • 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
      • +
        + Prerequisite for using the reading checkActivTask the package name of the application to be checked needs to be defined in the attribute checkActiveTask. Example: attr Nexus10Wohnzimmer + checkActiveTask com.android.chrome für den Chrome Browser. +

        +
      +

      + + Set +
        +
      • activateVoiceInput - start voice input on Android device
      • +
      • bluetooth - on/off, switch bluetooth on/off
      • +
      • clearNotificationBar - All/Automagic, deletes all or only Automagic notifications in status bar
      • +
      • closeCall - hang up a running call
      • +
      • currentFlowsetUpdate - start flowset update on Android device
      • +
      • installFlowSource - install a Automagic flow on device, XML file must be stored in /tmp/ with extension xml. Example: set TabletWohnzimmer installFlowSource WlanUebwerwachen.xml
      • +
      • doNotDisturb - sets the do not Disturb Mode, always Disturb, never Disturb, alarmClockOnly alarm Clock only, onlyImportant only important Disturbs
      • +
      • mediaAmazonMusic - play/stop/next/back , controlling the amazon music media player
      • +
      • mediaGoogleMusic - play/stop/next/back , controlling the google play music media player
      • +
      • mediaSpotifyMusic - play/stop/next/back , controlling the spotify media player
      • +
      • mediaTuneinRadio - play/stop/next/back , controlling the TuneinRadio media player
      • +
      • mediaAldiMusic - play/stop/next/back , controlling the Aldi music media player
      • +
      • mediaAudible - play/stop/next/back , controlling the Audible media player
      • +
      • mediaYouTube - play/stop/next/back , controlling the YouTube media player
      • +
      • mediaVlcPlayer - play/stop/next/back , controlling the VLC media player
      • +
      • nextAlarmTime - sets the alarm time. Only valid for the next 24 hours.
      • +
      • notifySndFile - plays a media-file which by default needs to be stored in the folder "/storage/emulated/0/Notifications/" of the Android device. You may use the attribute setNotifySndFilePath for defining a different folder.
      • +
      • openCall - initial a call and hang up after optional time / set DEVICE openCall 0176354 10 call this number and hang up after 10s
      • +
      • screenBrightness - 0-255, set screen brighness
      • +
      • screenMsg - display message on screen of Android device
      • +
      • sendintent - send intent string Example: set $AMADDEVICE sendIntent org.smblott.intentradio.PLAY url http://stream.klassikradio.de/live/mp3-192/stream.klassikradio.de/play.m3u name Klassikradio, first parameter contains the action, second parameter contains the extra. At most two extras can be used.
      • +
      • sendSMS - Sends an SMS to a specific phone number. Bsp.: sendSMS Dies ist ein Test|555487263
      • +
      • startDaydream - start Daydream
      • +
      • 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
      • +
      +
      + Set (depending on attribute values) +
        +
      • changetoBtDevice - switch to another bluetooth device. Attribute setBluetoothDevice needs to be set. See note below!
      • +
      • openApp - start an app. attribute setOpenApp
      • +
      • openURL - opens a URLS in the standard browser as long as no other browser is set by the attribute setOpenUrlBrowser.Example: attr Tablet setOpenUrlBrowser de.ozerov.fully|de.ozerov.fully.MainActivity, first parameter: package name, second parameter: Class Name
      • +
      • screen - on/off/lock/unlock, switch screen on/off or lock/unlock screen. In Automagic "Preferences" the "Device admin functions" need to be enabled, otherwise "Screen off" does not work. attribute setScreenOnForTimer changes the time the display remains switched on!
      • +
      • screenFullscreen - on/off, activates/deactivates full screen mode. attribute setFullscreen
      • +
      • screenLock - Locks screen with request for PIN. attribute setScreenlockPIN - enter PIN here. Only use numbers, 4-16 numbers required.
      • +
      • screenOrientation - Auto,Landscape,Portait, set screen orientation (automatic, horizontal, vertical). attribute setScreenOrientation
      • +
      • system - issue system command (only with rooted Android devices). reboot,shutdown,airplanemodeON (can only be switched ON) attribute root, in Automagic "Preferences" "Root functions" need to be enabled.
      • +
      • setAPSSID - set WLAN AccesPoint SSID to prevent WLAN sleeps
      • +
      • setNotifySndFilePath - set systempath to notifyfile (default /storage/emulated/0/Notifications/
      • +
      • setTtsMsgSpeed - set speaking speed for TTS (Value between 0.5 - 4.0, 0.5 Step) default is 1.0
      • +
      • setTtsMsgLang - set speaking language for TTS, de or en (default is de)
      • +
        + To be able to use "openApp" the corresponding attribute "setOpenApp" needs to contain the app package name. +

        + To be able to switch between bluetooth devices the attribute "setBluetoothDevice" needs to contain (a list of) bluetooth devices defined as follows: attr <DEVICE> BTdeviceName1|MAC,BTDeviceName2|MAC No spaces are allowed in any BTdeviceName. Defining MAC please make sure to use the character : (colon) after each second digit/character.
        + Example: attr Nexus10Wohnzimmer setBluetoothDevice Logitech_BT_Adapter|AB:12:CD:34:EF:32,Anker_A3565|GH:56:IJ:78:KL:76 +
      +

      + + state +
        +
      • initialized - shown after initial define.
      • +
      • active - device is active.
      • +
      • disabled - device is disabled by the attribute "disable".
      • +
      +


      + Further examples and reading: + +


      +
    =end html =begin html_DE diff --git a/74_AMADautomagicFlowset_4.0.0.xml b/74_AMADautomagicFlowset_4.0.0.xml new file mode 100644 index 0000000..92f5f81 --- /dev/null +++ b/74_AMADautomagicFlowset_4.0.0.xml @@ -0,0 +1,4618 @@ + + + + true + Akku Ladestand: grösser als 0% + false + 0 + HIGHER_THAN + true + true + + + false + App Task Beendet + false + CLASSIC + * + + + true + App Task Beendet: ch.gridvision.ppam.androidautomagic + false + CLASSIC + ch.gridvision.ppam.androidautomagic + + + true + Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic + false + ch.gridvision.ppam.androidautomagic + TEXT + CONTAINS_TEXT + + false + false + + + true + Benachrichtigung in Statusbar angezeigt: com.whatsapp + false + com.whatsapp + TEXT + CONTAINS_TEXT + + false + true + + + true + Benachrichtigung in Statusbar angezeigt: org.telegram.messenger + false + org.telegram.messenger + TEXT + CONTAINS_TEXT + + false + true + + + true + Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic + false + ch.gridvision.ppam.androidautomagic + TEXT + CONTAINS_TEXT + + false + false + + + true + Bluetooth Gerät getrennt: Alle Geräte + false + true + + + + + true + Bluetooth Gerät verbunden: Alle Geräte + false + true + + + + + true + Bluetooth Status: Schaltet aus, Aus + false + false + false + true + true + + + true + Bluetooth Status: Schaltet ein, Ein + false + true + true + false + false + + + true + Daydream Status: Gestartet + false + true + + + true + Daydream Status: Gestoppt + false + false + + + true + Display Orientierung: Landscape + false + false + + + true + Display Orientierung: Portrait + false + true + + + true + Display Status: Aus + false + false + + + true + Display Status: Ein + false + true + + + true + Dock Event: Docked + false + true + + + true + Dock Event: Undocked + false + false + + + true + Eingehender Anruf. Status: Klingelt, Nummern: Alle + false + true + + true + true + false + false + false + + + true + Flugmodus: Aus + false + false + + + true + Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT + false + com.android.deskclock.ALARM_ALERT + + + + + + + + + false + + + true + Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS + false + com.android.deskclock.ALARM_DISMISS + + + + + + + + + false + + + true + Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE + false + com.android.deskclock.ALARM_DONE + + + + + + + + + false + + + true + Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE + false + com.android.deskclock.ALARM_SNOOZE + + + + + + + + + false + + + true + Genereller Broadcast: wenn org.smblott.intentradio.STATE + false + org.smblott.intentradio.STATE + + + + + + + + irstate=getString("state"); +irname=getString("name") + false + + + false + HTTP Request: /fhem-amad/currentFlowsetUpdate + true + /fhem-amad/currentFlowsetUpdate + 8090 + true + + + false + HTTP Request: /fhem-amad/deviceInfo/ + false + /fhem-amad/deviceInfo/ + 8090 + true + + + false + HTTP Request: /fhem-amad/setCommands/* + false + /fhem-amad/setCommands/* + 8090 + true + + + false + Medien Session verändert + false + com.amazon.mp3,com.amazon.avod.thirdpartyclient,com.audible.application,com.rhapsody.alditalk,com.spotify.music,com.google.android.videos,com.google.android.music,org.smblott.intentradioio,de.maxdome.app.android,tunein.player,org.videolan.vlc,com.google.android.youtube,com.sec.android.app.music + + + false + Periodischer Timer: alle 120s + false + 120000 + true + false + false + Mon + Tue + Wed + Thu + Fri + Sat + Sun + 8 + 0 + 17 + 0 + true + false + + + true + Sprachbefehl angefordert + false + + + true + Stromversorgung: Angeschlossen + false + true + true + true + true + + + true + Stromversorgung: Entfernt + false + false + true + true + true + + + false + Systemeinstellung verändert: System next_alarm + false + SYSTEM + next_alarm_formatted + setting + + + true + Systemeinstellung verändert: System screen_brightness + false + SYSTEM + screen_brightness + screenBrightness + + + true + Systemeinstellung verändert: System volume_music_bt_a2dp + false + SYSTEM + volume_music_bt_a2dp + volume + + + true + Systemeinstellung verändert: System volume_music_headphone + false + SYSTEM + volume_music_headphone + volume + + + false + Systemeinstellung verändert: System volume_music_headset + false + SYSTEM + volume_music_headset + volume + + + true + Systemeinstellung verändert: System volume_music_speaker + false + SYSTEM + volume_music_speaker + volume + + + true + Systemeinstellung verändert: System volume_ring + false + SYSTEM + volume_ring + volumeRingSound + + + true + Systemeinstellung verändert: System volume_ring_speaker + false + SYSTEM + volume_ring_speaker + volumeNotification + + + true + Unterbrechnungen-Modus: Alle / Immer unterbrechen + false + OFF + + + true + Unterbrechnungen-Modus: Keine / Nicht unterbrechen + false + NO_INTERRUPTIONS + + + true + Unterbrechnungen-Modus: Nur Wecker (Android 6+) + false + ALARMS_ONLY + + + true + Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + false + IMPORTANT_INTERRUPTIONS + + + false + WLAN Getrennt: toGo + true + false + {global_apssid} + + + false + WLAN Verbunden: toGo + true + false + {global_apssid} + + + false + App Task läuft: App (neuster) + CLASSIC + {param_app} + true + + + true + App Task läuft: {global_activetask} (neuster) + CLASSIC + {global_activetask} + true + + + false + Benachrichtigung in Statusbar angezeigt: Automagic + ch.gridvision.ppam.androidautomagic + true + 1 + TEXT + CONTAINS_TEXT + + false + false + + + false + Benachrichtigung in Statusbar angezeigt: Telegram Messenger + org.telegram.messenger + true + 1 + TEXT + CONTAINS_TEXT + + false + false + + + false + Benachrichtigung in Statusbar angezeigt: WhatsApp + com.whatsapp + true + 1 + TEXT + CONTAINS_TEXT + + false + false + + + true + Bluetooth eingeschaltet + + + true + Bluetooth Gerät verbunden: Beliebiges Geräte + true + + + ANY + + + true + Bluetooth Gerät verbunden: Beliebiges Geräte (Advanced Audio Distribution) + true + + + A2DP + + + true + Display automatisch drehen eingeschaltet + + + true + Display eingeschaltet + + + true + Display Orientierung: Portrait + true + + + true + Dock Status: Docked + true + true + true + true + true + false + + + true + Expression: airpcount < 11 + airpcount < 11 + + + false + Expression: Airplanemode + param_syscmd == "airplanemodeON" + + + false + Expression: All + param_app == "All" + + + true + Expression: amadcmd == "firstrun" + amadcmd == "firstrun" + + + false + Expression: Automagic + param_app == "Automagic" + + + false + Expression: Clear Automagic Meldungen" + request_path == "/fhem-amad/setCommands/clearnotificationbar" + + + false + Expression: closeCall" + request_path == "/fhem-amad/setCommands/closeCall" + + + true + Expression: contains(value, " und ") + contains(value, " und ") + + + false + Expression: do not Disturb" + request_path == "/fhem-amad/setCommands/donotdisturb" + + + true + Expression: fhemcmd == "readingsval" + fhemcmd == "readingsval" + + + true + Expression: fhemcmd == "set" + fhemcmd == "set" + + + true + Expression: fhemcmd == "setreading" + fhemcmd == "setreading" + + + true + Expression: fhemcmd == "voiceinputvalue" + fhemcmd == "voiceinputvalue" + + + false + Expression: flowState" + request_path == "/fhem-amad/setCommands/flowState" + + + true + Expression: getAndroidSDKVersion() >= "16" + getAndroidSDKVersion() >= "16" + + + true + Expression: getAndroidSDKVersion() >= "19" + getAndroidSDKVersion() >= "19" + + + true + Expression: getAndroidSDKVersion() >= "21" + getAndroidSDKVersion() >= "21" + + + true + Expression: global_activetask != null + global_activetask != null + + + true + Expression: global_fhemctlmode != "thirdPartControl" + global_fhemctlmode != "thirdPartControl" + + + true + Expression: global_fhemip != null or global_bridgeport != null + global_fhemip != null or global_bridgeport != null + + + true + Expression: global_userflowstate != "none" + global_userflowstate != "none" + + + false + Expression: installFlow" + request_path == "/fhem-amad/setCommands/installFlow" + + + true + Expression: keyguard == "locked" + keyguard == "locked" + + + true + Expression: Leon == "Gaultier" + Leon == "Gaultier" + + + false + Expression: multimediaControl" + request_path == "/fhem-amad/setCommands/multimediaControl" + + + false + Expression: notifysnd" + request_path == "/fhem-amad/setCommands/playnotifysnd" + + + false + Expression: openApp" + request_path == "/fhem-amad/setCommands/openApp" + + + false + Expression: openCall" + request_path == "/fhem-amad/setCommands/openCall" + + + false + Expression: openURL" + request_path == "/fhem-amad/setCommands/openURL" + + + true + Expression: package_name == {global_activetask} + package_name == {global_activetask} + + + true + Expression: param_bluetooth == "off" + param_bluetooth == "off" + + + true + Expression: param_bluetooth == "on" + param_bluetooth == "on" + + + true + Expression: param_button == "back" + param_button == "back" + + + true + Expression: param_button == "next" + param_button == "next" + + + true + Expression: param_button == "play/pause" + param_button == "play/pause" + + + true + Expression: param_button == "stop" + param_button == "stop" + + + true + Expression: param_disturbmod == "alarmClockOnly" + param_disturbmod == "alarmClockOnly" + + + true + Expression: param_disturbmod == "always" + param_disturbmod == "always" + + + true + Expression: param_disturbmod == "never" + param_disturbmod == "never" + + + true + 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" + param_fullscreen == "off" + + + true + Expression: param_fullscreen == "on" + param_fullscreen == "on" + + + true + Expression: param_lockmod == "lock" + param_lockmod == "lock" + + + true + Expression: param_notifyfile == "RedAlert.mp3" + param_notifyfile == "RedAlert.mp3" + + + false + Expression: param_option + param_hanguptime != "none" + + + true + Expression: param_orientation == "auto" + param_orientation == "auto" + + + true + Expression: param_orientation == "landscape" + param_orientation == "landscape" + + + true + Expression: param_orientation == "portrait" + param_orientation == "portrait" + + + true + Expression: param_screen=="off" + param_screen=="off" + + + true + Expression: param_screen=="on" + param_screen=="on" + + + false + Expression: Reboot + param_syscmd == "reboot" + + + true + Expression: respreadingsval != "kaputt" and respreadingsval != "none" + respreadingsval != "kaputt" and respreadingsval != "none" + + + true + Expression: respreadingsval == "online" + respreadingsval == "online" + + + true + Expression: scrcount < 5 + scrcount < 5 + + + false + Expression: screenMsg" + request_path == "/fhem-amad/setCommands/screenMsg" + + + false + Expression: sendIntent" + request_path == "/fhem-amad/setCommands/sendIntent" + + + false + Expression: sendSms" + request_path == "/fhem-amad/setCommands/sendSms" + + + false + Expression: setAlarm" + request_path == "/fhem-amad/setCommands/setAlarm" + + + false + Expression: setBluetooth" + request_path == "/fhem-amad/setCommands/setbluetooth" + + + false + Expression: setBrightness" + request_path == "/fhem-amad/setCommands/setBrightness" + + + false + Expression: setBTDevice" + request_path == "/fhem-amad/setCommands/setbtdevice" + + + false + Expression: setNotifiVolume" + request_path == "/fhem-amad/setCommands/setNotifiVolume" + + + false + Expression: setRingSoundVolume" + request_path == "/fhem-amad/setCommands/setRingSoundVolume" + + + false + Expression: setScreenFullscreen" + request_path == "/fhem-amad/setCommands/setScreenFullscreen" + + + false + Expression: setScreenlock" + request_path == "/fhem-amad/setCommands/screenlock" + + + false + Expression: setScreenOnOff" + request_path == "/fhem-amad/setCommands/setScreenOnOff" + + + false + Expression: setScreenOrientation" + request_path == "/fhem-amad/setCommands/setScreenOrientation" + + + false + Expression: setTimer" + request_path == "/fhem-amad/setCommands/setTimer" + + + false + Expression: setVibrate" + request_path == "/fhem-amad/setCommands/setvibrate" + + + false + Expression: setVoiceCommand" + request_path == "/fhem-amad/setCommands/setvoicecmd" + + + false + Expression: setVolume" + request_path == "/fhem-amad/setCommands/setVolume" + + + false + Expression: Shutdown + param_syscmd == "shutdown" + + + true + Expression: sprachassi == "ja" + sprachassi == "ja" + + + false + Expression: startDaydream" + request_path == "/fhem-amad/setCommands/startDaydream" + + + false + Expression: System Command" + request_path == "/fhem-amad/setCommands/systemcommand" + + + true + Expression: togocount < 6 + togocount < 6 + + + true + Expression: trigger == "Akku Ladestand: grösser als 0%" + trigger == "Akku Ladestand: grösser als 0%" + + + true + Expression: trigger == "App Task Beendet" + trigger == "App Task Beendet" + + + true + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" + or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" + trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" + + + true + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" + trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" + + + true + Expression: trigger == "Bluetooth Status: Schaltet aus, Aus" or trigger == "Bluetooth Gerät verbunden: Alle Geräte" or trigger == "Bluetooth Gerät getrennt: Alle Geräte" or trigger == "Bluetooth Status: Schaltet ein, Ein" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Bluetooth Status: Schaltet aus, Aus" + or trigger == "Bluetooth Gerät verbunden: Alle Geräte" + or trigger == "Bluetooth Gerät getrennt: Alle Geräte" + or trigger == "Bluetooth Status: Schaltet ein, Ein" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Daydream Status: Gestartet" + trigger == "Daydream Status: Gestartet" + + + true + Expression: trigger == "Daydream Status: Gestartet" or trigger == "Daydream Status: Gestoppt" + trigger == "Daydream Status: Gestartet" + or trigger == "Daydream Status: Gestoppt" + + + true + Expression: trigger == "Display Orientierung: Landscape" or trigger == "Display Orientierung: Portrait" or trigger == "Display Status: Ein" or trigger == "Display Status: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Display Orientierung: Landscape" + or trigger == "Display Orientierung: Portrait" + or trigger == "Display Status: Ein" + or trigger == "Display Status: Aus" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Display Status: Aus" or trigger == "Display Status: Ein" or udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Display Status: Aus" + or trigger == "Display Status: Ein" + or udef_trigger == "setLockPin" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Dock Event: Docked" or trigger == "Dock Event: Undocked" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Dock Event: Docked" + or trigger == "Dock Event: Undocked" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" + trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" + + + true + Expression: trigger == "Flugmodus: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Flugmodus: Aus" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" +or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" +or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" +or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" +or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" + trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" + + + true + Expression: trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + trigger == "HTTP Request: /fhem-amad/setCommands/*" + + + true + Expression: trigger == "Medien Session verändert" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Medien Session verändert" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Periodischer Timer: alle 120s" + trigger == "Periodischer Timer: alle 120s" + + + true + Expression: trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Sprachbefehl angefordert" + trigger == "Sprachbefehl angefordert" + + + true + Expression: trigger == "Systemeinstellung verändert: System next_alarm" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Systemeinstellung verändert: System next_alarm" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "Systemeinstellung verändert: System screen_brightness" + trigger == "Systemeinstellung verändert: System screen_brightness" + + + true + Expression: trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" or trigger == "Systemeinstellung verändert: System volume_music_speaker" or trigger == "Systemeinstellung verändert: System volume_music_headphone" or trigger == "Systemeinstellung verändert: System volume_music_headset" + trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" + or trigger == "Systemeinstellung verändert: System volume_music_speaker" + or trigger == "Systemeinstellung verändert: System volume_music_headphone" + or trigger == "Systemeinstellung verändert: System volume_music_headset" + + + true + Expression: trigger == "Systemeinstellung verändert: System volume_ring" + trigger == "Systemeinstellung verändert: System volume_ring" + + + true + Expression: trigger == "Systemeinstellung verändert: System volume_ring_speaker" + trigger == "Systemeinstellung verändert: System volume_ring_speaker" + + + true + Expression: trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" +or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" +or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" +or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" +or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: trigger == "WLAN Getrennt: toGo" + trigger == "WLAN Getrennt: toGo" + + + true + Expression: trigger == "WLAN Verbunden: toGo" + trigger == "WLAN Verbunden: toGo" + + + false + Expression: ttsMsg" + request_path == "/fhem-amad/setCommands/ttsMsg" + + + false + Expression: ttsMsgLang" + param_msglang == "en" + + + true + Expression: udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + udef_trigger == "setLockPin" + or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + + + true + Expression: value != "" + value != "" + + + true + Expression: value == "ja" + value == "ja" + + + true + Expression: value == "nein" + value == "nein" + + + true + Flow Aktiv: First Run Assistant + First Run Assistant + + + true + Flow Aktiv: Informations + Informations + + + true + Flow Aktiv: Send Data to AMADCommBridge + Send Data to AMADCommBridge + + + true + Flow Aktiv: SetCommands + SetCommands + + + true + Flow Aktiv: {global_userflowstate} + {global_userflowstate} + + + true + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/sdcard) + /sdcard + true + true + 1024 + + + true + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) + /storage/emulated/0 + true + true + 1024 + + + true + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/sdcard0) + /storage/sdcard0 + true + true + 1024 + + + true + Host erreichbar: {global_fhemip}:{global_bridgeport} + SOCKET + {global_fhemip} + {global_bridgeport} + + + true + Keyguard gesperrt + + + true + Keyguard mit Sicherheit + + + true + Musik Aktiv + + + true + Stromversorgung: Angeschlossen + true + true + true + true + + + true + Unterbrechnungen-Modus: Alle / Immer unterbrechen + OFF + + + true + Unterbrechnungen-Modus: Keine / Nicht unterbrechen + NO_INTERRUPTIONS + + + true + Unterbrechnungen-Modus: Nur Wecker (Android 6+) + ALARMS_ONLY + + + true + Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + IMPORTANT_INTERRUPTIONS + + + true + WLAN verfügbar: {global_apssid} + {global_apssid} + + + false + Abfrage + Send Data to AMADCommBridge + + false + true + true + + + false + AMAD First Run Assistent Begrüßung + MUSIC + Hallo und herzlich willkommen beim Einrichtungs Assistenten von Fhem Amaad. Wenn Du fortfahren möchtest antworte einfach mit ja. Wenn nicht mit nein. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + false + AMAD Voice Control + true + + true + de-DE + false + + + true + Anruf beenden + + + false + App Starten: App + {param_app} + + + + true + Audio Player steuern: Medienknopf Play/Pause (/{kname}) + true + TOGGLE_PAUSE + KEYCODE_MEDIA_PLAY_PAUSE + true + {pname} + {kname} + + + + true + Audio Player steuern: Medienknopf Stopp ({pname}/{kname}) + true + STOP + KEYCODE_MEDIA_STOP + true + {pname} + {kname} + + + + true + Audio Player steuern: Medienknopf Weiter ({pname}/{kname}) + true + NEXT + KEYCODE_MEDIA_NEXT + true + {pname} + {kname} + + + + true + Audio Player steuern: Medienknopf Zurück ({pname}/{kname}) + true + PREVIOUS + KEYCODE_MEDIA_PREVIOUS + true + {pname} + {kname} + + + + true + Benachrichtigung auf Bildschirm: [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! (lange) + true + [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! + + 200 + 250 + false + 1.0 + true + false + TOP_LEFT + 0 + 0 + + + true + Benachrichtigung auf Bildschirm: {param_message} (lange) + true + {param_message} + + 200 + 250 + false + 1.0 + true + false + TOP_LEFT + 0 + 0 + + + true + Benachrichtigung auf Bildschirm: {value} (lange) + true + {value} + + 200 + 250 + false + 1.0 + true + false + TOP_LEFT + 0 + 0 + + + true + Benachrichtigung aus Statusbar entfernen: Alle + false + true + 1 + true + + true + {id} + TEXT + CONTAINS_TEXT + + + + true + Benachrichtigung aus Statusbar entfernen: Alle (Automagic) + true + true + 1 + false + + true + {id} + TEXT + CONTAINS_TEXT + + + + true + Bluetooth ein-/ausschalten: Aus + false + + + true + Bluetooth ein-/ausschalten: Ein + true + + + true + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} + A2DP + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} + A2DP + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} + INPUT_DEVICE + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} + INPUT_DEVICE + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} + HEADSET + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} + HEADSET + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} + PAN + {param_btdeviceone} + + false + + + true + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} + PAN + {param_btdevicetwo} + + false + + + true + Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} + A2DP + {param_swtobtdevicemac} + + 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 + Dateien löschen: /sdcard/Download/currentFlowsetUpdate.xml + /sdcard/Download/currentFlowsetUpdate.xml + true + + + true + Dateien löschen: /storage/emulated/0/Download/currentFlowsetUpdate.xml + /storage/emulated/0/Download/currentFlowsetUpdate.xml + true + + + true + Dateien löschen: /storage/emulated/0/Download/installFlow_{param_flowname} + /storage/emulated/0/Download/installFlow_{param_flowname} + true + + + true + Dateien löschen: /storage/sdcard0/Download/currentFlowsetUpdate.xml + /storage/sdcard0/Download/currentFlowsetUpdate.xml + true + + + true + Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} + /storage/sdcard0/Download/installFlow_{param_flowname} + true + + + true + Display automatisch drehen ein-/ausschalten: Aus + false + + + true + Display automatisch drehen ein-/ausschalten: Ein + true + + + true + Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /sdcard/Download + http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml + /sdcard/Download + true + + + true + Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /storage/emulated/0/Download + http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml + /storage/emulated/0/Download + true + + + true + Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /storage/sdcard0/Download + http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml + /storage/sdcard0/Download + true + + + true + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/emulated/0/Download + http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} + /storage/emulated/0/Download + true + + + true + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download + http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} + /storage/sdcard0/Download + true + + + true + Eingabedialog: AMADCommBridge Port Einzeiliger Text Bitte gebe den Port der AMADCommBridge vom FHEM Server an. + AMADCommBridge Port + SINGLE_LINE_TEXT + Bitte gebe den Port der AMADCommBridge vom FHEM Server an. + + 8090 + false + 60000 + + false + false + false + + + true + Eingabedialog: Android Device IP Adresse Einzeiliger Text Bitte gebe die IP Adresse Deines Androidgerätes an. NUR IP kein FQDN!!! + Android Device IP Adresse + SINGLE_LINE_TEXT + Bitte gebe die IP Adresse Deines Androidgerätes an. NUR IP kein FQDN!!! + + 192.168.x.x + false + 60000 + + false + false + false + + + true + Eingabedialog: FHEM Devicename Einzeiliger Text Wie soll das Device in FHEM heißen? + FHEM Devicename + SINGLE_LINE_TEXT + Wie soll das Device in FHEM heißen? + + TabletWohnzimmer + false + 60000 + + false + false + false + + + true + Eingabedialog: FHEM Server IP Einzeiliger Text Bitte gebe die IP Adresse oder den FQDN Deines FHEM Servers an. + FHEM Server IP + SINGLE_LINE_TEXT + Bitte gebe die IP Adresse oder den FQDN Deines FHEM Servers an. + + 192.168.x.x + false + 60000 + + false + false + false + + + true + Eingabedialog: Wünschst Du einen sprachgestützten oder dialoggestützten Installationsassistanten? Einfachauswahl Menü Sprache,Dialog (15s) + Wünschst Du einen sprachgestützten oder dialoggestützten Installationsassistanten? + SINGLE_CHOICE_MENU + + Sprache,Dialog + Sprache + true + 15000 + + false + false + false + + + true + Flows ausführen: Send Data to AMADCommBridge + Send Data to AMADCommBridge + + false + false + false + + + false + Flows ausführen: Send Data to AMADCommBridge mit warten + Send Data to AMADCommBridge + + false + true + false + + + false + Flows ausführen: udef_trigger setLockPin + Informations + + false + true + false + + + true + Flows ausführen: VoiceControl + VoiceControl + + false + false + false + + + true + Flows löschen: First Run Assistant + First Run Assistant + true + + + true + Flows löschen: MultimediaControl + MultimediaControl + true + + + true + Flows/Widgets importieren: /sdcard/Download/currentFlowsetUpdate.xml + /sdcard/Download/currentFlowsetUpdate.xml + true + + + true + Flows/Widgets importieren: /storage/emulated/0/Download/currentFlowsetUpdate.xml + /storage/emulated/0/Download/currentFlowsetUpdate.xml + true + + + true + Flows/Widgets importieren: /storage/emulated/0/Download/installFlow_{param_flowname} + /storage/emulated/0/Download/installFlow_{param_flowname} + true + + + true + Flows/Widgets importieren: /storage/sdcard0/Download/currentFlowsetUpdate.xml + /storage/sdcard0/Download/currentFlowsetUpdate.xml + true + + + true + Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} + /storage/sdcard0/Download/installFlow_{param_flowname} + true + + + true + Flugmodus ein-/ausschalten: Ein + SYSTEM_SETTING + true + + + true + Gerät sperren + + + false + Get Android Version + + + + true + Herunterfahren + + + false + HTTP Request: send FIRSTRUN data to AMADCommBridge JSON + http://{global_fhemip}:{global_bridgeport} + false + false + + false + + POST + GENERAL_TEXT + text/json + {firstrundata} + @@@@readingsNameXYZ@@readingsValueABC + 15000 + true + Connection: close + true + respfirstrun + /storage/emulated/0/Download/file.bin + false + + + false + HTTP Request: send READINGS data to AMADCommBridge JSON + http://{global_fhemip}:{global_bridgeport} + false + false + + false + + POST + GENERAL_TEXT + text/json + {fhemdata} + @@@@readingsNameXYZ@@readingsValueABC + 15000 + true + Connection: close + true + respsetreading + /storage/emulated/0/Download/file.bin + false + + + false + HTTP Request: send READINGSVAL data to AMADCommBridge JSON + http://{global_fhemip}:{global_bridgeport} + false + false + + false + + POST + GENERAL_TEXT + text/json + {readingsvalcmd} + @@@@readingsNameXYZ@@readingsValueABC + 15000 + true + Connection: close + true + respreadingsval + /storage/emulated/0/Download/file.bin + false + + + false + HTTP Request: send SET data to AMADCommBridge JSON + http://{global_fhemip}:{global_bridgeport} + false + false + + false + + POST + GENERAL_TEXT + text/json + {setcmd} + @@@@readingsNameXYZ@@readingsValueABC + 15000 + true + Connection: close + true + respset + /storage/emulated/0/Download/file.bin + false + + + false + HTTP Request: send VOICEINPUTVALUE data to AMADCommBridge + http://{global_fhemip}:{global_bridgeport} + false + false + + false + + POST + GENERAL_TEXT + text/json + {voiceinputdata} + @@@@readingsNameXYZ@@readingsValueABC + 15000 + true + FHEMDEVICE: {global_fhemdevice} +FHEMCMD: voiceinputvalue +Connection: close + true + respvoiceinputvalue + /storage/emulated/0/Download/file.bin + true + + + true + In Datei Schreiben: Aktiviere Flows in /storage/emulated/0/file.txt (anhängen) + /storage/emulated/0/file.txt + Aktiviere Flows + true + + + true + In Datei Schreiben: Deaktiviere Flows in /storage/emulated/0/file.txt (anhängen) + /storage/emulated/0/file.txt + Deaktiviere Flows + true + + + false + Initialisiere Variable Nächster Alarm: next_alarm + next_alarm + + + false + Initialisiere Variable Systemeinstellung: screenBrightness + SYSTEM + screen_brightness + screenBrightness + + + false + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth.2 + SYSTEM + volume_music_bt_a2dp + volumeBT + + + false + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker.2 + SYSTEM + volume_music_speaker + volumeSP + + + false + Initialisiere Variable Systemeinstellung: volumeNotification + SYSTEM + volume_ring_speaker + volumeNotification + + + false + Initialisiere Variable Systemeinstellung: volumeRingSound + SYSTEM + volume_ring + volumeRingSound + + + true + Lautstärke einstellen: Medien auf Level 8 + MUSIC + ADJUST_SET_ABSOLUTE + 8 + false + false + + + false + Lautstärken setzen param_notifivolume + false + global_volume_alarm + false + global_volume_dtmf + false + param_volume + true + param_notifivolume + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + Lautstärken setzen param_ringsoundvolume + false + global_volume_alarm + false + global_volume_dtmf + false + param_volume + false + param_notifivolume + true + param_ringsoundvolume + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + Lautstärken setzen param_volume + false + global_volume_alarm + false + global_volume_dtmf + true + param_volume + false + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + Medianlautstärken Speichern + false + global_volume_alarm + false + global_volume_dtmf + true + global_volume_music + false + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + Medienlautstärke Wiederherstellen + false + global_volume_alarm + false + global_volume_dtmf + true + global_volume_music + false + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + true + Meldungsdialog: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + + Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + Weiter + false + 60000 + + + true + Meldungsdialog: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Am + + Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Amaad, Flows aktiv sind. + Weiter + false + 60000 + + + true + Meldungsdialog: Leider scheint es ein Problem beim Einrichten des FHEM Devices gegeben zu haben. Hast Du die AMADCommBridge definiert, und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an CoolTux alias Leon, im FHEM Forum. + + Leider scheint es ein Problem beim Einrichten des FHEM Devices gegeben zu haben. Hast Du die AMADCommBridge definiert, und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an CoolTux alias Leon, im FHEM Forum. + Weiter + false + 60000 + + + true + Meldungsdialog: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + + Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + Weiter + false + 60000 + + + true + Neustart + + + + false + Notification Lautstärke Speichern + false + global_volume_alarm + false + global_volume_dtmf + false + global_volume_music + true + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + Notification Lautstärke Wiederherstellen + false + global_volume_alarm + false + global_volume_dtmf + false + param_volume + true + global_volume_notification + false + global_volume_ring + false + global_volume_system + false + global_volume_voice_call + false + global_ringer_mode + false + global_interruptions_mode + + + false + NotificationLautstärke auf Level 7 + NOTIFICATION + ADJUST_SET_ABSOLUTE + 7 + false + false + + + true + Nummer anrufen: {param_callnumber} + + {param_callnumber} + true + + + true + Pause: 1s (Gerät wach halten) + 1s + true + false + + + true + Pause: 2s (Gerät wach halten) + 2s + true + false + + + true + Pause: 3s (Gerät wach halten) + 3s + true + false + + + true + Pause: {param_hanguptime}s (Gerät wach halten) + {param_hanguptime}s + true + false + + + false + Prüfe und setze Bridgeport Variable + + + + false + Prüfe und setze globale Variable + + + + false + Schalte Display ein + false + 5s + true + + + true + Schalte Display ein: Hell für {param_screenontime}s + true + {param_screenontime}s + true + + + true + Script: airpcount = 0 + + + + true + Script: airpcount = airpcount + 1 + + + + true + Script: airplanemode = "\"airplanemode\":" + " \"" + {airplanemode} + "\""; fhemcmd = "setreading"; + + + + true + Script: airplanemode = "airplanemode@@on"; fhemcmd = "setreading"; + + + + true + Script: airplanemode = "off" + + + + true + Script: amadcmd = "firstrun" + + + + true + Script: amaddevice_ip = {value} + + + + true + Script: androidVersion = "\"androidVersion\":" + " \"" + {androidVersion} + "\""; fhemcmd = "setreading"; + + + + true + Script: androidVersion = "not supported funktion" + + + + true + Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + + + + true + Script: bluetooth = "\"bluetooth\":" + " \"" + {bluetooth_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: bluetooth_state = "off" + + + + true + Script: bluetooth_state = "on" + + + + true + Script: btdeviceinfo = "\"connectedBTdevices\":" + " \"" + {connected_devices_names} + "\"" + "," + "\"connectedBTdevicesMAC\":" + " \"" + {connected_devices_addresses} + "\""; fhemcmd = "setreading"; + + + + true + Script: checkActiveTask = "\"checkActiveTask\":" + " \"" + {runTask} + "\""; fhemcmd = "setreading"; + + + + true + Script: connected_devices_names = "none"; connected_devices_addresses = "none" + + + + true + Script: currentMusic = "\"currentMusicTrack\":" + " \"" + {title} + "\"" + "," + "\"currentMusicAlbum\":" + " \"" + {description} + "\"" + "," + "\"currentMusicArtist\":" + " \"" + {subtitle} + "\"" + "," + "\"currentMusicApp\":" + " \"" + {musicapp} + "\"" + "," + "\"currentMusicIcon\":" + " \"" + {icon} + "\"" + "," + "\"currentMusicState\":" + " \"" + {playback_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: daydream = "\"daydream\":" + " \"" + {daydream_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: daydream_state = "off" + + + + true + Script: daydream_state = "on" + + + + true + Script: deviceState = "\"deviceState\": \"online\""; fhemcmd = "setreading"; + + + + true + Script: dndValue = "alarmClockOnly" + + + + true + Script: dndValue = "always" + + + + true + Script: dndValue = "never" + + + + true + Script: dndValue = "onlyImportant" + + + + true + Script: dock_state = "docked" + + + + true + Script: dock_state = "undocked" + + + + true + Script: dockingState = "\"dockingState\":" + " \"" + {dock_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: doNotDisturb = "\"doNotDisturb\":" + " \"" + {dndValue} + "\""; fhemcmd = "setreading"; + + + + true + Script: flow_informations = "\"flow_informations\":" + " \"" + {informationFlow_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: flow_informations = "\"userFlowState\":" + " \"" + {flowState} + "\""; fhemcmd = "setreading"; + + + + true + Script: flow_SetCommands = "\"flow_SetCommands\":" + " \"" + {setCommandFlow_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: flowState = "active" + + + + true + Script: flowState = "inactive" + + + + true + Script: global_activetask = "none"; global_apssid = "none"; global_userflowstate = "none"; + + + + true + Script: global_amadid = getDate(); + + + + true + Script: global_bridgeport = {value} + + + + true + Script: global_fhemdevice = {value} + + + + true + Script: global_fhemip = {value} + + + + true + Script: if(index == 0) { sprachassi = "ja"; } else { sprachassi = "nein"; } + + + + 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } if(package_name == "com.sec.android.app.music") { musicapp = "Samsung Music Player" } + + + + true + Script: if(playback_state == 0) { playback_state = "keiner" } if(playback_state == 1) { playback_state = "gestoppt" } if(playback_state == 2) { playback_state = "pausiert" } if(playback_state == 3) { playback_state = "spielt ab" } if(playback_state == 4) { playback_state = "spult vorwärts" } if(playback_state == 5) { playback_state = "spült rückwärts" } if(playback_state == 6) { playback_state = "buffert" } if(playback_state == 7) { playback_state = "Fehler" } if(playback_state == 8) { playback_state = "verbindet" } if(playback_state == 9) { playback_state = "springt zum vorherigen" } if(playback_state == 10) { playback_state = "springt zum nächsten" } if(playback_state == 11) { playback_state = "springt zu Position in Wiedergabeliste" } + + + + true + Script: if(togocount > 0) { togocount = togocount + 1; } else { togocount = 0; togocount = togocount + 1; } + + + + true + Script: if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT") { nextalarmstate = "alert" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS") { nextalarmstate = "dismiss" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE") { nextalarmstate = "done" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE") { nextalarmstate = "snooze" } + + + + true + Script: incomingCaller = "\"incomingCallerName\":" + " \"" + {contact_name} + "\"" + "," + "\"incomingCallerNumber\":" + " \"" + {incoming_number} + "\""; fhemcmd = "setreading"; + + + + true + Script: incommingTelegramMessage = "\"incommingTelegramMessageFrom\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + + + + true + Script: incommingWhatsAppMessage = "\"incommingWhatsAppMessageFrom\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + + + + true + Script: informationFlow_state = "aktiv" + + + + true + Script: informationFlow_state = "inaktiv" + + + + true + Script: intentRadioState = "\"intentRadioState\":" + " \"" + {irstate} + "\"" + "," + "\"intentRadioName\":" + " \"" + {irname} + "\""; fhemcmd = "setreading"; + + + + true + Script: keyguard = "locked" + + + + true + Script: keyguard = "unlocked" + + + + true + Script: keyguardSet = "0" + + + + true + Script: keyguardSet = "1" + + + + true + Script: keyguardSet = "\"keyguardSet\":" + " \"" + {keyguardSet} + "\""; fhemcmd = "setreading"; + + + + true + Script: keyguardSet = "not supported from your device" + + + + true + Script: next_alarmday = "{next_alarm,dateformat,c}" + + + + true + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + + + + true + Script: nextAlarm = "\"nextAlarmTime\":" + " \"" + {next_alarmtime} + "\"" + "," + "\"nextAlarmDay\":" + " \"" + {next_alarmday} + "\""; fhemcmd = "setreading"; + + + + true + Script: nextAlarmState = "\"nextAlarmState\":" + " \"" + {nextalarmstate} + "\""; fhemcmd = "setreading"; + + + + true + 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" + + + + true + Script: notification_text = "Flowset Update: path for download not exist" + + + + true + Script: notification_text = "not supported from your device" + + + + true + Script: powerinfo = "\"powerLevel\":" + " \"" + "{battery_percentage,numberformat,0}" + "\"" + "," + "\"powerPlugged\":" + " \"" + {battery_plugged} + "\"" + "," + "\"batteryTemperature\":" + " \"" + "{battery_temperature/10.0,numberformat.0.0}" + "\"" + "," + "\"batteryHealth\":" + " \"" + {battery_health} + "\""; fhemcmd = "setreading"; + + + + true + Script: readingsvalcmd = "{global_fhemdevice} deviceState kaputt"; fhemcmd = "readingsval"; respfirstrun = "none"; + + + + true + Script: runTask = "0" + + + + true + Script: runTask = "1" + + + + true + Script: runTask = "not supported android version" + + + + true + Script: runTask = "null" + + + + true + Script: scrcount = 0 + + + + true + Script: scrcount = scrcount + 1 + + + + true + Script: screen = "\"screen\":" + " \"" + {screen_state} + "\""; fhemcmd = "setreading"; + + + + true + Script: screen_orientation = "landscape" + + + + true + Script: screen_orientation = "portrait" + + + + true + Script: screen_orientation_mode = "auto" + + + + true + Script: screen_orientation_mode = "manual" + + + + true + Script: screen_state = "off {keyguard}" + + + + true + Script: screen_state = "off" + + + + true + Script: screen_state = "on {keyguard}" + + + + true + Script: screen_state = "on" + + + + true + Script: screenBrightness = "\"screenBrightness\":" + " \"" + {screenBrightness} + "\""; fhemcmd = "setreading"; + + + + true + Script: screenOrientation = "\"screenOrientation\":" + " \"" + {screen_orientation} + "\"" + "," + "\"screenOrientationMode\":" + " \"" + {screen_orientation_mode} + "\""; fhemcmd = "setreading"; + + + + false + Script: Set FHEMDATA JSON + + + + false + Script: Set FHEMDATA JSON First Run Assistant + + + + false + Script: Set FHEMREADINGSVALCMD JSON + + + + false + Script: Set FHEMSETCMD JSON + + + + false + Script: Set FHEMVOICEINPUTDATA JSON + + + + true + Script: setCommandFlow_state = "aktiv" + + + + true + Script: setCommandFlow_state = "inaktiv" + + + + true + Script: subtitle = "no player active"; title = "no player active"; description = "no player active"; musicapp = "no player active"; icon = "no player active" + + + + true + Script: udef_trigger = "setLockPin" + + + + true + Script: voiceinputdata = value; fhemcmd = "voiceinputvalue"; + + + + true + Script: voiceinputdata = {left(value, (indexOf(value, " und ")))}; fhemcmd = "voiceinputvalue"; + + + + true + Script: volume = {volumeBT} + + + + true + Script: volume = {volumeSP} + + + + true + Script: volumeNotification = "\"volumeNotification\":" + " \"" + {volumeNotification} + "\""; fhemcmd = "setreading"; + + + + true + Script: volumeRingSound = "\"volumeRingSound\":" + " \"" + {volumeRingSound} + "\""; fhemcmd = "setreading"; + + + + true + Script: volumevalue = "\"volume\":" + " \"" + {volume} + "\""; fhemcmd = "setreading"; + + + + false + Script: Zuordnung Mediaplayer + + + + true + Setze Alarm: um {param_hour}:{param_minute} + + {param_hour} + {param_minute} + + + false + true + + + true + Setze Display Helligkeit: {param_brightness} + false + {param_brightness} + false + 50 + true + + + true + Setze Display Orientierung: Auf Default zurücksetzen + UNSPECIFIED + false + + + true + Setze Display Orientierung: Landscape + LANDSCAPE + false + + + true + Setze Display Orientierung: Portrait + PORTRAIT + false + + + true + Setze Flow Status: Aktivieren Informations + true + Informations + + + + true + Setze Flow Status: Aktivieren Informations,SetCommands + true + Informations,SetCommands + + + + true + Setze Flow Status: Aktivieren Send Data to AMADCommBridge + true + Send Data to AMADCommBridge + + + + true + Setze Flow Status: Aktivieren SetCommands + true + SetCommands + + + + true + Setze Flow Status: Aktivieren SetCommands,Update AMAD Flowset,VoiceControl + true + SetCommands,Update AMAD Flowset,VoiceControl + + + + true + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + true + {imported_flow_names,listformat,comma} + + + + true + Setze Flow Status: Aktivieren {param_flowname} + true + {param_flowname} + + + + true + Setze Flow Status: Deaktivieren First Run Assistant + false + First Run Assistant + + + + true + Setze Flow Status: Deaktivieren Informations,SetCommands + false + Informations,SetCommands + + + + true + Setze Flow Status: Deaktivieren {param_flowname} + false + {param_flowname} + + + + true + Setze Lock PIN/Passwort: PIN/Passwort zurücksetzen + true + PIN + false + param_lockPIN + + + true + Setze Lock PIN/Passwort: Setze PIN von Variable param_lockpin + false + PIN + false + param_lockpin + + + false + Setze Timer + + {param_minute}m + true + + + true + Setze Unterbrechnungen-Modus: Alle / Immer unterbrechen + NOTIFICATION_LISTENER + OFF + + + true + Setze Unterbrechnungen-Modus: Keine / Nicht unterbrechen + NOTIFICATION_LISTENER + NO_INTERRUPTIONS + + + true + Setze Unterbrechnungen-Modus: Nur Wecker (Android 6+) + NOTIFICATION_LISTENER + ALARMS_ONLY + + + true + Setze Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + NOTIFICATION_LISTENER + IMPORTANT_INTERRUPTIONS + + + false + Setze voice Variablen + + + + true + Setze Vollbild Modus: Auf Default zurücksetzen + UNSPECIFIED + false + + + true + Setze Vollbild Modus: Navigation nicht anzeigen + HIDE_NAVIGATION + false + + + true + SMS senden an: an {param_smsnumber} '{param_smsmessage}' (10 in 12h) + + {param_smsnumber} + {param_smsmessage} + true + true + 10 + 43200000 + false + false + true + 600000 + + + true + Sound: {param_notifypath}{param_notifyfile} als Benachrichtigung + FILE + Lautlos + {param_notifypath}{param_notifyfile} + NOTIFICATION + + false + true + true + TRANSIENT + + + true + Sprachausgabe: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + MUSIC + Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + false + Sprachausgabe: Deutsch + MUSIC + {param_message} + de_DE + true + 1.0 + true + {param_msgspeed} + true + false + false + true + TRANSIENT + + + true + Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device online. +Soll der Assistent gelöscht werden? + MUSIC + Die Einrichtung ist nun abgeschlossen und das Amaad Device online. +Soll der Assistent gelöscht werden? + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + true + Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Amaad, Flows aktiv sind. +Soll der Assistent gelöscht werden? + MUSIC + Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Amaad, Flows aktiv sind. +Soll der Assistent gelöscht werden? + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + true + Sprachausgabe: Du möchtest also nicht fortfahren. Das ist schade. Bitte bedenke das dieses Android Gerät somit nicht als Amaad Device in Fhem angelegt ist. Du kannst jeder Zeit den Assistenten Flow neu aktivieren und von vorn beginnen. +Auf Wiedersehen. + MUSIC + Du möchtest also nicht fortfahren. Das ist schade. Bitte bedenke das dieses Android Gerät somit nicht als Amaad Device in Fhem angelegt ist. Du kannst jeder Zeit den Assistenten Flow neu aktivieren und von vorn beginnen. +Auf Wiedersehen. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + false + Sprachausgabe: Englisch + MUSIC + {param_message} + en_US + true + 1.0 + true + {param_msgspeed} + true + false + false + true + TRANSIENT + + + true + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + MUSIC + In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + true + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + MUSIC + In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + true + Sprachausgabe: Leider scheint es ein Problem beim einrichten des Fhem Devices gegeben zu haben. Hast Du die Amaad Comm Bridge definiert? Und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an Cooltux alias Leon, im Fhem Forum. +Soll der Assistent gelöscht werden? + MUSIC + Leider scheint es ein Problem beim einrichten des Fhem Devices gegeben zu haben. Hast Du die Amaad Comm Bridge definiert? Und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an Cooltux alias Leon, im Fhem Forum. +Soll der Assistent gelöscht werden? + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + true + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + MUSIC + Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + true + Sprachausgabe: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + MUSIC + Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + de_DE + true + 1.0 + true + 1.0 + false + true + false + true + TRANSIENT + + + false + Spracheingabe wurde nicht erkannt + NOTIFICATION + Ihre Eingabe wurde nicht verstanden + de_DE + true + 1.0 + true + 1.0 + true + false + false + true + TRANSIENT + + + true + Starte Daydream + + + true + URL in Browser öffnen: {param_url} (mit {param_browserapp}/{param_browserappclass}) + {param_url} + true + {param_browserapp} + {param_browserappclass} + + + + true + Vibrieren: Pattern 2 (-- --) + false + vibrate_pattern_2 + 0,500 + + + true + WLAN Reassoziieren + + + First Run Assistant + AMADNG Info/Control Flowset v3.9.76 + false + PARALLEL + + App Task Beendet: ch.gridvision.ppam.androidautomagic + + AMAD Voice Control + Flows löschen: First Run Assistant + AMAD Voice Control + AMAD Voice Control + Flows löschen: First Run Assistant + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + Abfrage + Script: amadcmd = "firstrun" + Script: amaddevice_ip = {value} + Eingabedialog: Android Device IP Adresse Einzeiliger Text Bitte gebe die IP Adresse Deines Androidgerätes an. NUR IP kein FQDN!!! + Script: global_fhemip = {value} + Eingabedialog: FHEM Server IP Einzeiliger Text Bitte gebe die IP Adresse oder den FQDN Deines FHEM Servers an. + Script: global_fhemdevice = {value} + Eingabedialog: FHEM Devicename Einzeiliger Text Wie soll das Device in FHEM heißen? + Script: global_bridgeport = {value} + Eingabedialog: AMADCommBridge Port Einzeiliger Text Bitte gebe den Port der AMADCommBridge vom FHEM Server an. + Sprachausgabe: Du möchtest also nicht fortfahren. Das ist schade. Bitte bedenke das dieses Android Gerät somit nicht als Amaad Device in Fhem angelegt ist. Du kannst jeder Zeit den Assistenten Flow neu aktivieren und von vorn beginnen. +Auf Wiedersehen. + AMAD Voice Control + Medienlautstärke Wiederherstellen + Lautstärke einstellen: Medien auf Level 8 + Medianlautstärken Speichern + Setze Flow Status: Aktivieren Informations + Setze Flow Status: Aktivieren SetCommands,Update AMAD Flowset,VoiceControl + Pause: 2s (Gerät wach halten) + Script: readingsvalcmd = "{global_fhemdevice} deviceState kaputt"; fhemcmd = "readingsval"; respfirstrun = "none"; + Expression: value != "" + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Expression: value == "nein" + Expression: value == "ja" + Expression: value == "ja" + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Expression: value != "" + Expression: value == "nein" + Expression: value != "" + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Expression: value == "nein" + Expression: value == "ja" + Flows löschen: First Run Assistant + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + Expression: value != "" + Sprachausgabe: Oh das tut mir leid, da scheine ich Dich nicht verstanden zu haben. Bitte versuche es mit etwas Ruhe im Hintergrund noch einmal. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent wird gelöscht. Auf Wiedersehen. + Sprachausgabe: In Ordnung. Der Einrichtungs Assistent bleibt erhalten. Auf Wiedersehen. + Expression: value == "ja" + Expression: value == "nein" + Script: if(index == 0) { sprachassi = "ja"; } else { sprachassi = "nein"; } + AMAD First Run Assistent Begrüßung + Eingabedialog: Wünschst Du einen sprachgestützten oder dialoggestützten Installationsassistanten? Einfachauswahl Menü Sprache,Dialog (15s) + Script: global_amadid = getDate(); + Setze Flow Status: Deaktivieren First Run Assistant + Setze Flow Status: Aktivieren Send Data to AMADCommBridge + Script: global_activetask = "none"; global_apssid = "none"; global_userflowstate = "none"; + Sprachausgabe: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + Meldungsdialog: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + Expression: sprachassi == "ja" + Flows ausführen: Send Data to AMADCommBridge + Sprachausgabe: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + Expression: sprachassi == "ja" + Meldungsdialog: Alle Informationen wurden nun erfasst und zur Amaad Comm Bridge gesendet. Ich werde gleich einmal prüfen ob die Einrichtung des Devices in Fhem gelungen ist. Gib mir bitte bis zu einer Minute Zeit für die Prüfung. + Expression: respreadingsval != "kaputt" and respreadingsval != "none" + Expression: sprachassi == "ja" + Sprachausgabe: Leider scheint es ein Problem beim einrichten des Fhem Devices gegeben zu haben. Hast Du die Amaad Comm Bridge definiert? Und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an Cooltux alias Leon, im Fhem Forum. +Soll der Assistent gelöscht werden? + Meldungsdialog: Leider scheint es ein Problem beim Einrichten des FHEM Devices gegeben zu haben. Hast Du die AMADCommBridge definiert, und ist sie auch aktiv? Sollte es weiterhin Probleme geben, wende Dich bitte an CoolTux alias Leon, im FHEM Forum. + Expression: sprachassi == "ja" + Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Amaad, Flows aktiv sind. +Soll der Assistent gelöscht werden? + Meldungsdialog: Die Einrichtung ist nun abgeschlossen und das Amaad Device wurde angelegt. Es scheint aber noch keine Verbindung zwischen Fhem und Deinem Amaad Device zu bestehen. Mache am besten einmal ein Status Request in Fhem für das Amaad Device. Ist der Status in Fhem weiterhin offline schaue bitte ob alle Am + Expression: respreadingsval == "online" + Sprachausgabe: Die Einrichtung ist nun abgeschlossen und das Amaad Device online. +Soll der Assistent gelöscht werden? + Expression: sprachassi == "ja" + Meldungsdialog: Wunderbar. Bitte nimm Dir Zeit und lese Dir die Hilfe Dialoge genau durch. Wenn Du Dir unsicher bist, kannst Du die Standardeinstellung, sofern vorhanden, belassen. Lass uns nun mit der Einrichtung beginnen. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Informations + AMADNG Info/Control Flowset v3.9.76 + false + QUEUE + 900 + Script: daydream_state = "on" + Script: daydream_state = "off" + Script: keyguard = "unlocked" + Display Orientierung: Portrait + Script: screen_orientation = "portrait" + Script: screen_orientation = "landscape" + Script: dock_state = "docked" + Script: dock_state = "undocked" + Script: keyguardSet = "0" + Script: screen_orientation_mode = "manual" + Script: scrcount = 0 + Script: keyguard = "locked" + Expression: scrcount < 5 + Script: scrcount = scrcount + 1 + Pause: 2s (Gerät wach halten) + Dock Status: Docked + Display automatisch drehen eingeschaltet + Expression: trigger == "Daydream Status: Gestartet" + Bluetooth eingeschaltet + Expression: trigger == "App Task Beendet" + Keyguard gesperrt + Expression: keyguard == "locked" + Expression: getAndroidSDKVersion() >= "16" + Script: keyguardSet = "not supported from your device" + Display eingeschaltet + Display eingeschaltet + Expression: getAndroidSDKVersion() >= "16" + Unterbrechnungen-Modus: Nur Wecker (Android 6+) + Unterbrechnungen-Modus: Keine / Nicht unterbrechen + Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + Unterbrechnungen-Modus: Alle / Immer unterbrechen + Script: dndValue = "always" + Script: dndValue = "onlyImportant" + Script: dndValue = "never" + Script: dndValue = "alarmClockOnly" + Script: screen_state = "on" + Script: screen_state = "off" + Script: screen_state = "on {keyguard}" + Script: screen_state = "off {keyguard}" + Script: airplanemode = "off" + Script: bluetooth_state = "on" + Script: androidVersion = "not supported funktion" + App Task läuft: {global_activetask} (neuster) + Script: runTask = "1" + Script: runTask = "0" + Expression: getAndroidSDKVersion() >= "19" + Script: runTask = "not supported android version" + Script: runTask = "null" + Expression: trigger == "Periodischer Timer: alle 120s" + Expression: global_activetask != null + Expression: trigger == "Display Status: Aus" or trigger == "Display Status: Ein" or udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Daydream Status: Gestartet" or trigger == "Daydream Status: Gestoppt" + Expression: trigger == "Display Orientierung: Landscape" or trigger == "Display Orientierung: Portrait" or trigger == "Display Status: Ein" or trigger == "Display Status: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Akku Ladestand: grösser als 0%" + Stromversorgung: Angeschlossen + Script: screen_orientation_mode = "auto" + Script: bluetooth_state = "off" + Script: if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT") { nextalarmstate = "alert" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS") { nextalarmstate = "dismiss" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE") { nextalarmstate = "done" } if(trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE") { nextalarmstate = "snooze" } + Keyguard mit Sicherheit + Script: keyguardSet = "1" + Expression: udef_trigger == "setLockPin" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Eingehender Anruf. Status: Klingelt, Nummern: Alle" + Expression: trigger == "Flugmodus: Aus" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Systemeinstellung verändert: System screen_brightness" + Bluetooth Gerät verbunden: Beliebiges Geräte (Advanced Audio Distribution) + Script: volume = {volumeBT} + Pause: 2s (Gerät wach halten) + Musik Aktiv + Benachrichtigung auf Bildschirm: [AMAD2] Nicht mehr benötigte AMAD Flows wurden entfernt! (lange) + Expression: trigger == "Systemeinstellung verändert: System volume_music_bt_a2dp" or trigger == "Systemeinstellung verändert: System volume_music_speaker" or trigger == "Systemeinstellung verändert: System volume_music_headphone" or trigger == "Systemeinstellung verändert: System volume_music_headset" + Initialisiere Variable Systemeinstellung: volumeMusikBluetooth.2 + Script: volume = {volumeSP} + Initialisiere Variable Systemeinstellung: volumeMusikSpeaker.2 + Expression: trigger == "Unterbrechnungen-Modus: Alle / Immer unterbrechen" or trigger == "Unterbrechnungen-Modus: Keine / Nicht unterbrechen" or trigger == "Unterbrechnungen-Modus: Nur Wecker (Android 6+)" or trigger == "Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: getAndroidSDKVersion() >= "21" + Script: airpcount = 0 + Host erreichbar: {global_fhemip}:{global_bridgeport} + WLAN Reassoziieren + Expression: trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE" or trigger == "Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Systemeinstellung verändert: System next_alarm" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Initialisiere Variable Nächster Alarm: next_alarm + Script: next_alarmday = "{next_alarm,dateformat,c}" + Script: next_alarmtime = "{next_alarm,dateformat,HH:mm}" + Expression: global_fhemip != null or global_bridgeport != null + Expression: getAndroidSDKVersion() >= "19" + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + Script: notification_text = "not supported from your device" + Expression: getAndroidSDKVersion() >= "19" + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + Expression: trigger == "Genereller Broadcast: wenn org.smblott.intentradio.STATE" + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: com.whatsapp" + Benachrichtigung in Statusbar angezeigt: WhatsApp + Script: notification_text = "not supported from your device" + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: org.telegram.messenger" + Initialisiere Variable Systemeinstellung: screenBrightness + Expression: trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Systemeinstellung verändert: System volume_ring_speaker" + Initialisiere Variable Systemeinstellung: volumeNotification + Expression: trigger == "Systemeinstellung verändert: System volume_ring" + Initialisiere Variable Systemeinstellung: volumeRingSound + Expression: trigger == "Medien Session verändert" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Get Android Version + WLAN verfügbar: {global_apssid} + Script: volumeRingSound = "\"volumeRingSound\":" + " \"" + {volumeRingSound} + "\""; fhemcmd = "setreading"; + Script: intentRadioState = "\"intentRadioState\":" + " \"" + {irstate} + "\"" + "," + "\"intentRadioName\":" + " \"" + {irname} + "\""; fhemcmd = "setreading"; + Script: keyguardSet = "\"keyguardSet\":" + " \"" + {keyguardSet} + "\""; fhemcmd = "setreading"; + Script: dockingState = "\"dockingState\":" + " \"" + {dock_state} + "\""; fhemcmd = "setreading"; + Script: screenOrientation = "\"screenOrientation\":" + " \"" + {screen_orientation} + "\"" + "," + "\"screenOrientationMode\":" + " \"" + {screen_orientation_mode} + "\""; fhemcmd = "setreading"; + Script: screenBrightness = "\"screenBrightness\":" + " \"" + {screenBrightness} + "\""; fhemcmd = "setreading"; + Script: daydream = "\"daydream\":" + " \"" + {daydream_state} + "\""; fhemcmd = "setreading"; + Script: nextAlarm = "\"nextAlarmTime\":" + " \"" + {next_alarmtime} + "\"" + "," + "\"nextAlarmDay\":" + " \"" + {next_alarmday} + "\""; fhemcmd = "setreading"; + Script: volumevalue = "\"volume\":" + " \"" + {volume} + "\""; fhemcmd = "setreading"; + Script: volumeNotification = "\"volumeNotification\":" + " \"" + {volumeNotification} + "\""; fhemcmd = "setreading"; + Script: airplanemode = "\"airplanemode\":" + " \"" + {airplanemode} + "\""; fhemcmd = "setreading"; + Script: screen = "\"screen\":" + " \"" + {screen_state} + "\""; fhemcmd = "setreading"; + Script: nextAlarmState = "\"nextAlarmState\":" + " \"" + {nextalarmstate} + "\""; fhemcmd = "setreading"; + Script: doNotDisturb = "\"doNotDisturb\":" + " \"" + {dndValue} + "\""; fhemcmd = "setreading"; + Script: checkActiveTask = "\"checkActiveTask\":" + " \"" + {runTask} + "\""; fhemcmd = "setreading"; + Expression: Leon == "Gaultier" + Flows löschen: MultimediaControl + Script: androidVersion = "\"androidVersion\":" + " \"" + {androidVersion} + "\""; fhemcmd = "setreading"; + Script: powerinfo = "\"powerLevel\":" + " \"" + "{battery_percentage,numberformat,0}" + "\"" + "," + "\"powerPlugged\":" + " \"" + {battery_plugged} + "\"" + "," + "\"batteryTemperature\":" + " \"" + "{battery_temperature/10.0,numberformat.0.0}" + "\"" + "," + "\"batteryHealth\":" + " \"" + {battery_health} + "\""; fhemcmd = "setreading"; + Expression: trigger == "Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic" or trigger == "Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: getAndroidSDKVersion() >= "19" + Script: notification_text = "Aktiviere Automagic unter Einstellungen -> Benachrichtigungen -> Benachrichtigungszugriff" + Benachrichtigung in Statusbar angezeigt: Automagic + Expression: package_name == {global_activetask} + Script: deviceState = "\"deviceState\": \"online\""; fhemcmd = "setreading"; + Expression: trigger == "Dock Event: Docked" or trigger == "Dock Event: Undocked" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Expression: trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Flows ausführen: Send Data to AMADCommBridge + Prüfe und setze globale Variable + Script: bluetooth = "\"bluetooth\":" + " \"" + {bluetooth_state} + "\""; fhemcmd = "setreading"; + Script: connected_devices_names = "none"; connected_devices_addresses = "none" + Script: btdeviceinfo = "\"connectedBTdevices\":" + " \"" + {connected_devices_names} + "\"" + "," + "\"connectedBTdevicesMAC\":" + " \"" + {connected_devices_addresses} + "\""; fhemcmd = "setreading"; + Bluetooth Gerät verbunden: Beliebiges Geräte + Expression: trigger == "Bluetooth Status: Schaltet aus, Aus" or trigger == "Bluetooth Gerät verbunden: Alle Geräte" or trigger == "Bluetooth Gerät getrennt: Alle Geräte" or trigger == "Bluetooth Status: Schaltet ein, Ein" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Host erreichbar: {global_fhemip}:{global_bridgeport} + Script: flow_SetCommands = "\"flow_SetCommands\":" + " \"" + {setCommandFlow_state} + "\""; fhemcmd = "setreading"; + Setze Flow Status: Aktivieren SetCommands + Script: setCommandFlow_state = "aktiv" + Script: setCommandFlow_state = "inaktiv" + Flow Aktiv: SetCommands + Expression: trigger == "Periodischer Timer: alle 120s" + Expression: global_userflowstate != "none" + Flow Aktiv: {global_userflowstate} + Script: flowState = "inactive" + Script: flowState = "active" + Script: flow_informations = "\"userFlowState\":" + " \"" + {flowState} + "\""; fhemcmd = "setreading"; + Expression: trigger == "Periodischer Timer: alle 120s" or trigger == "HTTP Request: /fhem-amad/deviceInfo/" + Flow Aktiv: Send Data to AMADCommBridge + Setze Flow Status: Aktivieren Send Data to AMADCommBridge + Expression: trigger == "Periodischer Timer: alle 120s" + Script: incomingCaller = "\"incomingCallerName\":" + " \"" + {contact_name} + "\"" + "," + "\"incomingCallerNumber\":" + " \"" + {incoming_number} + "\""; fhemcmd = "setreading"; + Script: incommingWhatsAppMessage = "\"incommingWhatsAppMessageFrom\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Script: incommingTelegramMessage = "\"incommingTelegramMessageFrom\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Benachrichtigung in Statusbar angezeigt: Telegram Messenger + Pause: 2s (Gerät wach halten) + Script: airpcount = airpcount + 1 + Expression: airpcount < 11 + Script: notification_text = "not supported from your device" + + Genereller Broadcast: wenn com.android.deskclock.ALARM_DONE + Genereller Broadcast: wenn org.smblott.intentradio.STATE + Systemeinstellung verändert: System volume_music_headphone + Systemeinstellung verändert: System volume_music_headset + Stromversorgung: Angeschlossen + Bluetooth Status: Schaltet ein, Ein + Display Status: Aus + Display Orientierung: Portrait + Genereller Broadcast: wenn com.android.deskclock.ALARM_SNOOZE + Genereller Broadcast: wenn com.android.deskclock.ALARM_DISMISS + Bluetooth Status: Schaltet aus, Aus + Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + Benachrichtigung in Statusbar angezeigt: com.whatsapp + Daydream Status: Gestoppt + Benachrichtigung in Statusbar angezeigt: ch.gridvision.ppam.androidautomagic + Eingehender Anruf. Status: Klingelt, Nummern: Alle + Display Status: Ein + Systemeinstellung verändert: System volume_music_speaker + Systemeinstellung verändert: System screen_brightness + Daydream Status: Gestartet + Bluetooth Gerät verbunden: Alle Geräte + Bluetooth Gerät getrennt: Alle Geräte + Dock Event: Docked + Periodischer Timer: alle 120s + Systemeinstellung verändert: System volume_music_bt_a2dp + Akku Ladestand: grösser als 0% + Unterbrechnungen-Modus: Alle / Immer unterbrechen + App Task Beendet + HTTP Request: /fhem-amad/deviceInfo/ + Genereller Broadcast: wenn com.android.deskclock.ALARM_ALERT + Benachrichtigung in Statusbar angezeigt: org.telegram.messenger + Stromversorgung: Entfernt + Systemeinstellung verändert: System next_alarm + Benachrichtigung in Statusbar entfernt: ch.gridvision.ppam.androidautomagic + Unterbrechnungen-Modus: Keine / Nicht unterbrechen + Dock Event: Undocked + Display Orientierung: Landscape + Unterbrechnungen-Modus: Nur Wecker (Android 6+) + Systemeinstellung verändert: System volume_ring + Flugmodus: Aus + Systemeinstellung verändert: System volume_ring_speaker + Medien Session verändert + + Script: subtitle = "no player active"; title = "no player active"; description = "no player active"; musicapp = "no player active"; icon = "no player active" + Script: if(playback_state == 0) { playback_state = "keiner" } if(playback_state == 1) { playback_state = "gestoppt" } if(playback_state == 2) { playback_state = "pausiert" } if(playback_state == 3) { playback_state = "spielt ab" } if(playback_state == 4) { playback_state = "spult vorwärts" } if(playback_state == 5) { playback_state = "spült rückwärts" } if(playback_state == 6) { playback_state = "buffert" } if(playback_state == 7) { playback_state = "Fehler" } if(playback_state == 8) { playback_state = "verbindet" } if(playback_state == 9) { playback_state = "springt zum vorherigen" } if(playback_state == 10) { playback_state = "springt zum nächsten" } if(playback_state == 11) { playback_state = "springt zu Position in Wiedergabeliste" } + Script: currentMusic = "\"currentMusicTrack\":" + " \"" + {title} + "\"" + "," + "\"currentMusicAlbum\":" + " \"" + {description} + "\"" + "," + "\"currentMusicArtist\":" + " \"" + {subtitle} + "\"" + "," + "\"currentMusicApp\":" + " \"" + {musicapp} + "\"" + "," + "\"currentMusicIcon\":" + " \"" + {icon} + "\"" + "," + "\"currentMusicState\":" + " \"" + {playback_state} + "\""; fhemcmd = "setreading"; + 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" } if(package_name == "org.videolan.vlc") { musicapp = "VLC Player" } if(package_name == "com.sec.android.app.music") { musicapp = "Samsung Music Player" } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Send Data to AMADCommBridge + AMADNG Info/Control Flowset v3.9.76 + true + PARALLEL + 900 + + WLAN Getrennt: toGo + WLAN Verbunden: toGo + + Expression: fhemcmd == "set" + Expression: fhemcmd == "voiceinputvalue" + Expression: amadcmd == "firstrun" + Expression: fhemcmd == "readingsval" + Script: Set FHEMSETCMD JSON + Script: Set FHEMVOICEINPUTDATA JSON + Script: Set FHEMREADINGSVALCMD JSON + Expression: fhemcmd == "setreading" + Script: Set FHEMDATA JSON First Run Assistant + Host erreichbar: {global_fhemip}:{global_bridgeport} + In Datei Schreiben: Deaktiviere Flows in /storage/emulated/0/file.txt (anhängen) + Setze Flow Status: Deaktivieren Informations,SetCommands + Flow Aktiv: Informations + Flow Aktiv: SetCommands + Expression: trigger == "WLAN Getrennt: toGo" + Expression: togocount < 6 + Pause: 1s (Gerät wach halten) + Setze Flow Status: Aktivieren Informations,SetCommands + Flow Aktiv: Informations + Flow Aktiv: SetCommands + Expression: trigger == "WLAN Verbunden: toGo" + In Datei Schreiben: Aktiviere Flows in /storage/emulated/0/file.txt (anhängen) + HTTP Request: send FIRSTRUN data to AMADCommBridge JSON + HTTP Request: send READINGS data to AMADCommBridge JSON + HTTP Request: send SET data to AMADCommBridge JSON + HTTP Request: send READINGSVAL data to AMADCommBridge JSON + HTTP Request: send VOICEINPUTVALUE data to AMADCommBridge + Script: if(togocount > 0) { togocount = togocount + 1; } else { togocount = 0; togocount = togocount + 1; } + Script: Set FHEMDATA JSON + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SetCommands + AMADNG Info/Control Flowset v3.9.76 + false + QUEUE + 900 + + HTTP Request: /fhem-amad/deviceInfo/ + Sprachbefehl angefordert + HTTP Request: /fhem-amad/setCommands/* + Periodischer Timer: alle 120s + + Expression: setBrightness" + Expression: setScreenFullscreen" + Expression: param_orientation == "auto" + Setze Display Orientierung: Portrait + Setze Display Orientierung: Landscape + Expression: param_orientation == "landscape" + Setze Vollbild Modus: Navigation nicht anzeigen + Setze Vollbild Modus: Auf Default zurücksetzen + Setze Display Orientierung: Auf Default zurücksetzen + Display automatisch drehen ein-/ausschalten: Aus + Display automatisch drehen ein-/ausschalten: Ein + Expression: setScreenOrientation" + Expression: param_fullscreen == "off" + Expression: param_bluetooth == "off" + Expression: param_bluetooth == "on" + Bluetooth ein-/ausschalten: Ein + Bluetooth eingeschaltet + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Advanced Audio Distribution {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Eingabegerät {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdeviceone} + Bluetooth Gerät verbinden/trennen: Trennen Headset {param_btdevicetwo} + Bluetooth Gerät verbinden/trennen: Trennen Personal Area Network {param_btdevicetwo} + Pause: 3s (Gerät wach halten) + Bluetooth Gerät verbinden/trennen: Verbinden Advanced Audio Distribution {param_swtobtdevicemac} + Pause: 2s (Gerät wach halten) + Expression: setBTDevice" + Bluetooth ein-/ausschalten: Aus + Expression: param_orientation == "portrait" + Expression: setVoiceCommand" + Setze Display Helligkeit: {param_brightness} + Expression: setScreenlock" + Expression: sendIntent" + Expression: param_lockmod == "lock" + Setze Lock PIN/Passwort: PIN/Passwort zurücksetzen + Setze Lock PIN/Passwort: Setze PIN von Variable param_lockpin + Expression: trigger == "Sprachbefehl angefordert" + Expression: setAlarm" + Setze Timer + Expression: screenMsg" + Benachrichtigung auf Bildschirm: {param_message} (lange) + Script: udef_trigger = "setLockPin" + Display eingeschaltet + Gerät sperren + Schalte Display ein + Gerät sperren + Expression: setTimer" + Expression: param_option + Pause: {param_hanguptime}s (Gerät wach halten) + Anruf beenden + Broadcast senden: {param_action} + URL in Browser öffnen: {param_url} (mit {param_browserapp}/{param_browserappclass}) + Setze Unterbrechnungen-Modus: Alle / Immer unterbrechen + Setze Unterbrechnungen-Modus: Wichtig / Nur wichtige Unterbrechnungen zulassen + Setze Unterbrechnungen-Modus: Keine / Nicht unterbrechen + Setze Unterbrechnungen-Modus: Nur Wecker (Android 6+) + Expression: openURL" + Expression: param_fullscreen == "on" + Expression: do not Disturb" + Expression: param_disturbmod == "always" + Expression: param_disturbmod == "onlyImportant" + Expression: param_disturbmod == "never" + Expression: param_disturbmod == "alarmClockOnly" + Expression: setBluetooth" + Expression: ttsMsg" + Expression: param_screen=="on" + Expression: setScreenOnOff" + Gerät sperren + Expression: param_screen=="off" + Expression: openApp" + App Task läuft: App (neuster) + Expression: setVolume" + App Starten: App + Dateien löschen: /storage/emulated/0/Download/installFlow_{param_flowname} + Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} + Dateien löschen: /storage/sdcard0/Download/installFlow_{param_flowname} + Script: notification_text = "Flow install: path for download not exist" + Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/sdcard0/Download + Flows/Widgets importieren: /storage/emulated/0/Download/installFlow_{param_flowname} + Flows/Widgets importieren: /storage/sdcard0/Download/installFlow_{param_flowname} + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/sdcard0) + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/sdcard) + Expression: installFlow" + Neustart + Expression: Reboot + Expression: System Command" + Expression: Shutdown + Expression: Airplanemode + Script: airplanemode = "airplanemode@@on"; fhemcmd = "setreading"; + Flows ausführen: Send Data to AMADCommBridge mit warten + Flugmodus ein-/ausschalten: Ein + Herunterfahren + Notification Lautstärke Wiederherstellen + Expression: param_notifyfile == "RedAlert.mp3" + Benachrichtigung aus Statusbar entfernen: Alle + Benachrichtigung aus Statusbar entfernen: Alle (Automagic) + Expression: Automagic + Expression: All + Expression: notifysnd" + NotificationLautstärke auf Level 7 + Notification Lautstärke Speichern + Expression: param_notifyfile == "RedAlert.mp3" + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Expression: Clear Automagic Meldungen" + Expression: setVibrate" + Vibrieren: Pattern 2 (-- --) + Audio Player steuern: Medienknopf Zurück ({pname}/{kname}) + Expression: param_button == "stop" + Expression: param_button == "next" + Expression: param_button == "back" + Schalte Display ein: Hell für {param_screenontime}s + Expression: ttsMsgLang" + Expression: global_fhemip != null or global_bridgeport != null + Setze Alarm: um {param_hour}:{param_minute} + Audio Player steuern: Medienknopf Weiter ({pname}/{kname}) + Expression: openCall" + Nummer anrufen: {param_callnumber} + Expression: sendSms" + Expression: param_flowstate == "active" or param_flowstate == "inactive" + Expression: param_flowstate == "active" + SMS senden an: an {param_smsnumber} '{param_smsmessage}' (10 in 12h) + Setze Flow Status: Deaktivieren {param_flowname} + Script: notification_text = "Flow '{param_flowname}' has been set {param_flowstate}" + Expression: flowState" + Expression: closeCall" + Expression: multimediaControl" + Starte Daydream + Expression: startDaydream" + Lautstärken setzen param_volume + Expression: setNotifiVolume" + Lautstärken setzen param_notifivolume + Expression: trigger == "HTTP Request: /fhem-amad/setCommands/*" + Expression: setRingSoundVolume" + Lautstärken setzen param_ringsoundvolume + Expression: param_button == "play/pause" + Audio Player steuern: Medienknopf Play/Pause (/{kname}) + Sound: {param_notifypath}{param_notifyfile} als Benachrichtigung + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) + Download URL: http://{global_fhemip}:{global_bridgeport}/installFlow_{param_flowname} to /storage/emulated/0/Download + Script: flow_informations = "\"flow_informations\":" + " \"" + {informationFlow_state} + "\""; fhemcmd = "setreading"; + Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Flows ausführen: Send Data to AMADCommBridge + Sprachausgabe: Englisch + Sprachausgabe: Deutsch + Flows ausführen: VoiceControl + Flows ausführen: udef_trigger setLockPin + Setze Flow Status: Aktivieren {param_flowname} + Flow Aktiv: Informations + Script: informationFlow_state = "aktiv" + Script: informationFlow_state = "inaktiv" + Setze Flow Status: Aktivieren Informations + Host erreichbar: {global_fhemip}:{global_bridgeport} + Flow Aktiv: Send Data to AMADCommBridge + Setze Flow Status: Aktivieren Send Data to AMADCommBridge + Audio Player steuern: Medienknopf Stopp ({pname}/{kname}) + Script: Zuordnung Mediaplayer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Update AMAD Flowset + AMADNG Info/Control Flowset v3.9.76 + true + QUEUE + + HTTP Request: /fhem-amad/currentFlowsetUpdate + + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Flows/Widgets importieren: /storage/sdcard0/Download/currentFlowsetUpdate.xml + Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /storage/sdcard0/Download + Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /sdcard/Download + Flows/Widgets importieren: /sdcard/Download/currentFlowsetUpdate.xml + Setze Flow Status: Aktivieren {imported_flow_names,listformat,comma} + Script: notification_text = "Flowset Update: path for download not exist" + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/sdcard0) + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/sdcard) + Gerätespeicherplatz: Freier Speicherplatz > 1kb (/storage/emulated/0) + Script: automagicState = "\"automagicState\":" + " \"" + replaceAll({notification_text}, "\\n", " ") + "\""; fhemcmd = "setreading"; + Prüfe und setze Bridgeport Variable + Flows/Widgets importieren: /storage/emulated/0/Download/currentFlowsetUpdate.xml + Download URL: http://{global_fhemip}:{global_bridgeport}/currentFlowsetUpdate.xml to /storage/emulated/0/Download + Dateien löschen: /storage/emulated/0/Download/currentFlowsetUpdate.xml + Dateien löschen: /storage/sdcard0/Download/currentFlowsetUpdate.xml + Dateien löschen: /sdcard/Download/currentFlowsetUpdate.xml + Flows ausführen: Send Data to AMADCommBridge + Flow Aktiv: First Run Assistant + Setze Flow Status: Deaktivieren First Run Assistant + + + + + + + + + + + + + + + + + + + + + + + + + + + + + VoiceControl + AMADNG Info/Control Flowset v3.9.76 + true + QUEUE + + AMAD Voice Control + Expression: value != "" + Expression: contains(value, " und ") + Script: voiceinputdata = {left(value, (indexOf(value, " und ")))}; fhemcmd = "voiceinputvalue"; + Flows ausführen: Send Data to AMADCommBridge + Setze voice Variablen + Spracheingabe wurde nicht erkannt + Script: voiceinputdata = value; fhemcmd = "voiceinputvalue"; + Flows ausführen: Send Data to AMADCommBridge + Benachrichtigung auf Bildschirm: {value} (lange) + Expression: global_fhemctlmode != "thirdPartControl" + Script: voiceinputdata = value; fhemcmd = "voiceinputvalue"; + Flows ausführen: Send Data to AMADCommBridge + Benachrichtigung auf Bildschirm: {value} (lange) + + + + + + + + + + + + + + + + +