From bc6d425427a2ec77722eec43bd27058612717fbe Mon Sep 17 00:00:00 2001 From: LeonGaultier Date: Thu, 10 Aug 2017 07:34:54 +0000 Subject: [PATCH] 74_AMADDevice: fix openApp Trigger in the Flowset, add NFC Support and scanning NFC_id's support git-svn-id: https://svn.fhem.de/fhem/trunk@14873 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 4 +- fhem/FHEM/73_AMADCommBridge.pm | 6 +- fhem/FHEM/74_AMADDevice.pm | 44 +- ....xml => 74_AMADautomagicFlowset_4.0.2.xml} | 1505 +++++++++-------- 4 files changed, 845 insertions(+), 714 deletions(-) rename fhem/FHEM/lib/{74_AMADautomagicFlowset_4.0.1.xml => 74_AMADautomagicFlowset_4.0.2.xml} (81%) diff --git a/fhem/CHANGED b/fhem/CHANGED index 3879ef36c..ec65c22eb 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,6 +1,8 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. - - bugfix: 31_Nello: fixed device ID detection + - feature: 74_AMADDevice: 4.0.5 - Support für NFC and scanning NFC TagId + - bugfix: 74_AMADautomagicFlowset_4.0.2.xml: fix openApp Trigger + - bugfix: 31_Nello: fixed device ID detection - feature: 93_DbLog: V2.22.1, new attribute "suppressAddLogV3" - feature: 49_SSCam: V2.6.1, new commands snapGallery, createSnapGallery and corresponding attributes diff --git a/fhem/FHEM/73_AMADCommBridge.pm b/fhem/FHEM/73_AMADCommBridge.pm index c1c8eb2f1..998412d6a 100644 --- a/fhem/FHEM/73_AMADCommBridge.pm +++ b/fhem/FHEM/73_AMADCommBridge.pm @@ -5,6 +5,10 @@ # (c) 2015-2017 Copyright: Marko Oldenburg (leongaultier at gmail dot com) # All rights reserved # +# Special thanks goes to comitters: +# - Jens Wohlgemuth Thanks for Commandref +# +# # 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 @@ -71,7 +75,7 @@ eval "use JSON;1" or $missingModul .= "JSON "; my $modulversion = "4.0.1"; -my $flowsetversion = "4.0.1"; +my $flowsetversion = "4.0.2"; diff --git a/fhem/FHEM/74_AMADDevice.pm b/fhem/FHEM/74_AMADDevice.pm index 3b0def9b8..3c442b14d 100644 --- a/fhem/FHEM/74_AMADDevice.pm +++ b/fhem/FHEM/74_AMADDevice.pm @@ -5,6 +5,10 @@ # (c) 2015-2017 Copyright: Marko Oldenburg (leongaultier at gmail dot com) # All rights reserved # +# Special thanks goes to comitters: +# - Jens Wohlgemuth Thanks for Commandref +# +# # 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 @@ -54,8 +58,8 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode "; eval "use JSON;1" or $missingModul .= "JSON "; -my $modulversion = "4.0.3"; -my $flowsetversion = "4.0.1"; +my $modulversion = "4.0.5"; +my $flowsetversion = "4.0.2"; @@ -379,15 +383,18 @@ sub AMADDevice_WriteReadings($$) { $v =~ s/\bnull\b//g; $v = encode_utf8($v); - readingsBulkUpdateIfChanged($hash, $t, $v, 1) if( defined( $v ) and ($t ne 'deviceState' + readingsBulkUpdateIfChanged($hash, $t, $v, 1) if( defined( $v ) and ($t ne 'deviceState' or $t ne 'incomingCallerName' - or $t ne 'incomingCallerNumber') + or $t ne 'incomingCallerNumber' + or $t ne 'nfcLastTagID') ); readingsBulkUpdateIfChanged( $hash, $t, ($v / AttrVal($name,'setVolFactor',1)) ) if( $t eq 'volume' and AttrVal($name,'setVolFactor',1) > 1 ); readingsBulkUpdate( $hash, '.'.$t, $v ) if( $t eq 'deviceState' ); - readingsBulkUpdate( $hash, $t, $v ) if( $t eq 'incomingCallerName' ); - readingsBulkUpdate( $hash, $t, $v ) if( $t eq 'incomingCallerNumber' ); + readingsBulkUpdate( $hash, $t, $v ) if( $t eq 'incomingCallerName' + or $t eq 'incomingCallerNumber' + or $t eq 'nfcLastTagID' + ); } readingsBulkUpdateIfChanged( $hash, "deviceState", "offline", 1 ) if( $decode_json->{payload}{airplanemode} && $decode_json->{payload}{airplanemode} eq "on" ); @@ -622,7 +629,15 @@ sub AMADDevice_Set($$@) { my $app = join( " ", @args ); - $uri = $host . ":" . $port . "/fhem-amad/setCommands/openApp?app=$app"; + $uri = $host . ":" . $port . "/fhem-amad/setCommands/openApp?app=".$app; + $method = "POST"; + } + + elsif( lc $cmd eq 'nfc' ) { + + my $mod = join( " ", @args ); + + $uri = $host . ":" . $port . "/fhem-amad/setCommands/setnfc?nfc=".$mod; $method = "POST"; } @@ -688,6 +703,12 @@ sub AMADDevice_Set($$@) { $method = "POST"; } + elsif( lc $cmd eq 'showhomescreen' ) { + + $uri = $host . ":" . $port . "/fhem-amad/setCommands/showhomescreen"; + $method = "POST"; + } + elsif( lc $cmd eq 'sendintent' ) { my $intentstring = join( " ", @args ); @@ -753,13 +774,14 @@ sub AMADDevice_Set($$@) { my $btdev = AttrVal( $name, "setBluetoothDevice", "none" ); - my $list = "screenMsg ttsMsg mediaGoogleMusic:play/pause,stop,next,back mediaSamsungMusic:play/pause,stop,next,back mediaAmazonMusic:play/pause,stop,next,back mediaSpotifyMusic:play/pause,stop,next,back mediaTuneinRadio:play/pause,stop,next,back mediaAldiMusic:play/pause,stop,next,back mediaYouTube:play/pause,stop,next,back mediaVlcPlayer:play/pause,stop,next,back mediaAudible:play/pause,stop,next,back screenBrightness:slider,0,1,255 screen:on,off,lock,unlock openURL nextAlarmTime:time timer:slider,1,1,60 statusRequest:noArg bluetooth:on,off notifySndFile clearNotificationBar:All,Automagic activateVoiceInput:noArg vibrate:noArg sendIntent openCall closeCall:noArg currentFlowsetUpdate:noArg installFlowSource doNotDisturb:never,always,alarmClockOnly,onlyImportant userFlowState sendSMS startDaydream:noArg volumeUp:noArg volumeDown:noArg mute:on,off"; + my $list = "screenMsg ttsMsg mediaGoogleMusic:play/pause,stop,next,back mediaSamsungMusic:play/pause,stop,next,back mediaAmazonMusic:play/pause,stop,next,back mediaSpotifyMusic:play/pause,stop,next,back mediaTuneinRadio:play/pause,stop,next,back mediaAldiMusic:play/pause,stop,next,back mediaYouTube:play/pause,stop,next,back mediaVlcPlayer:play/pause,stop,next,back mediaAudible:play/pause,stop,next,back screenBrightness:slider,0,1,255 screen:on,off,lock,unlock openURL nextAlarmTime:time timer:slider,1,1,60 statusRequest:noArg bluetooth:on,off notifySndFile clearNotificationBar:All,Automagic activateVoiceInput:noArg vibrate:noArg sendIntent openCall closeCall:noArg currentFlowsetUpdate:noArg installFlowSource doNotDisturb:never,always,alarmClockOnly,onlyImportant userFlowState sendSMS startDaydream:noArg volumeUp:noArg volumeDown:noArg mute:on,off showHomeScreen:noArg"; $list .= " screenOrientation:auto,landscape,portrait" if( AttrVal( $name, "setScreenOrientation", "0" ) eq "1" ); $list .= " screenFullscreen:on,off" if( AttrVal( $name, "setFullscreen", "0" ) eq "1" ); $list .= " openApp:$apps" if( AttrVal( $name, "setOpenApp", "none" ) ne "none" ); $list .= " system:reboot,shutdown,airplanemodeON" if( AttrVal( $name, "root", "0" ) eq "1" ); $list .= " changetoBTDevice:$btdev" if( AttrVal( $name, "setBluetoothDevice", "none" ) ne "none" ); + $list .= " nfc:on,off" if( AttrVal( $name, "root", "0" ) eq "1" ); $list .= " volume:slider,0,1,$volMax"; $list .= " volumeNotification:slider,0,1,$notifyVolMax"; $list .= " volumeRingSound:slider,0,1,$ringSoundVolMax"; @@ -955,6 +977,8 @@ sub AMADDevice_decrypt($) {
  • nextAlarmDay - currently set day of alarm
  • nextAlarmState - alert/done, current state of "Clock" stock-app
  • nextAlarmTime - currently set time of alarm
  • +
  • nfc - state of nfc service on/off
  • +
  • nfcLastTagID - nfc_id of last scan nfc Tag / In order for the ID to be recognized correctly, the trigger NFC TagIDs must be processed in Flow NFC Tag Support and the TagId's Commase-separated must be entered.
  • powerLevel - state of battery in %
  • powerPlugged - 0=no/1,2=yes, power supply connected
  • screen - on locked,unlocked/off locked,unlocked, state of display
  • @@ -1010,6 +1034,7 @@ sub AMADDevice_decrypt($) { Set (depending on attribute values)