From 5da6a0e1cd2bd072c5cf4b47347ccebc268d34a6 Mon Sep 17 00:00:00 2001 From: dominikkarall Date: Wed, 13 Feb 2019 19:12:10 +0000 Subject: [PATCH] 39_gassistant: better loginURL handling git-svn-id: https://svn.fhem.de/fhem/trunk@18588 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/39_gassistant.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/39_gassistant.pm b/fhem/FHEM/39_gassistant.pm index fcbd90ffb..b2071b248 100755 --- a/fhem/FHEM/39_gassistant.pm +++ b/fhem/FHEM/39_gassistant.pm @@ -77,6 +77,7 @@ gassistant_Define($$) my $name = $a[0]; $hash->{NAME} = $name; + my $d = $modules{$hash->{TYPE}}{defptr}; return "$hash->{TYPE} device already defined as $d->{NAME}." if( defined($d) && $name ne $d->{NAME} ); $modules{$hash->{TYPE}}{defptr} = $hash; @@ -103,6 +104,8 @@ gassistant_Define($$) }; if( $init_done ) { + setKeyValue('gassistantFHEM.loginURL', '' ); + readingsSingleUpdate($hash, 'gassistantFHEM.loginURL', 'Waiting for login url from gassistant-fhem', 1 ); CoProcess::start($hash); } else { $hash->{STATE} = 'active'; @@ -187,7 +190,6 @@ gassistant_detailFn($$$$) $ret .= "". AttrVal($name, "alias", "Logfile") ."
"; } - #if( my $url = ReadingsVal($name, 'gassistantFHEM.loginURL', undef ) ) { # $ret .= "Login
"; #} @@ -482,7 +484,7 @@ gassistant_Set($$@) return "usage: set $name $cmd " if( !@args ); my $url = $args[0]; - $url = "$url
"; + $url = "Click here to login
"; $hash->{".triggerUsed"} = 1; @@ -543,6 +545,9 @@ gassistant_Set($$@) CommandSave(undef,undef) if( AttrVal( "autocreate", "autosave", 1 ) ); return undef; + } elsif( $cmd eq 'start' || $cmd eq 'stop' || $cmd eq 'restart' ) { + setKeyValue('gassistantFHEM.loginURL', '' ); + readingsSingleUpdate($hash, 'gassistantFHEM.loginURL', 'Waiting for login url from gassistant-fhem', 1 ); } return CoProcess::setCommands($hash, $list, $cmd, @args);