From d17ca565493799430804626ebee611d716fe6bf3 Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Mon, 14 Jan 2019 11:22:21 +0000 Subject: [PATCH] 39_alexa.pm: added set clearProxyCredentials command git-svn-id: https://svn.fhem.de/fhem/trunk@18250 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/39_alexa.pm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/fhem/FHEM/39_alexa.pm b/fhem/FHEM/39_alexa.pm index a6604db78..a89fcd9e9 100644 --- a/fhem/FHEM/39_alexa.pm +++ b/fhem/FHEM/39_alexa.pm @@ -790,6 +790,8 @@ alexa_Set($$@) return "usage: set $name $cmd " if( !@args ); my $key = $args[0]; + $hash->{".triggerUsed"} = 1; + $key = alexa_encrypt($key); setKeyValue('alexaFHEM.skillRegKey', $key ); readingsSingleUpdate($hash, 'alexaFHEM.skillRegKey', $key, 1 ); @@ -802,12 +804,29 @@ alexa_Set($$@) return "usage: set $name $cmd " if( !@args ); my $token = $args[0]; + $hash->{".triggerUsed"} = 1; + $token = alexa_encrypt($token); setKeyValue('alexaFHEM.bearerToken', $token ); readingsSingleUpdate($hash, 'alexaFHEM.bearerToken', $token, 1 ); CommandSave(undef,undef) if( AttrVal( "autocreate", "autosave", 1 ) ); + return undef; + + } elsif( $cmd eq 'clearProxyCredentials' ) { + setKeyValue('alexaFHEM.skillRegKey', undef ); + setKeyValue('alexaFHEM.bearerToken', undef ); + + readingsBeginUpdate($hash); + readingsBulkUpdate($hash, 'alexaFHEM.skillRegKey', '', 1 ); + readingsBulkUpdate($hash, 'alexaFHEM.bearerToken', '', 1 ); + readingsEndUpdate($hash,1); + + CommandSave(undef,undef) if( AttrVal( "autocreate", "autosave", 1 ) ); + + FW_directNotify($name, 'clearProxyCredentials'); + return undef; } @@ -1402,6 +1421,9 @@ alexa_Attr($$$)
  • createDefaultConfig
    adds the default config for the sshproxy to the existing config file or creates a new config file. sets the alexaFHEM-config attribut if not already set.
  • + +
  • clearProxyCredentials
    + clears all stored sshproxy credentials