From f190a4a460c879e82bbcb703b900d0b0696c76a2 Mon Sep 17 00:00:00 2001 From: LeonGaultier Date: Mon, 24 Jul 2017 09:10:06 +0000 Subject: [PATCH] 74_AMAD: delete older AMAD Version git-svn-id: https://svn.fhem.de/fhem/trunk@14776 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/74_AMAD.pm | 1865 -------- .../lib/74_AMADautomagicFlowset_2.6.12.xml | 3745 ----------------- 2 files changed, 5610 deletions(-) delete mode 100644 fhem/FHEM/74_AMAD.pm delete mode 100644 fhem/FHEM/lib/74_AMADautomagicFlowset_2.6.12.xml diff --git a/fhem/FHEM/74_AMAD.pm b/fhem/FHEM/74_AMAD.pm deleted file mode 100644 index 4e1b38fe8..000000000 --- a/fhem/FHEM/74_AMAD.pm +++ /dev/null @@ -1,1865 +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/fhem/FHEM/lib/74_AMADautomagicFlowset_2.6.12.xml b/fhem/FHEM/lib/74_AMADautomagicFlowset_2.6.12.xml deleted file mode 100644 index ddf86ed70..000000000 --- a/fhem/FHEM/lib/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