2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

39_gassistant: better loginURL handling

git-svn-id: https://svn.fhem.de/fhem/trunk@18588 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
dominikkarall 2019-02-13 19:12:10 +00:00
parent 56e9dd79b9
commit 5da6a0e1cd

View File

@ -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 .= "<a href=\"$FW_ME?detail=$name\">". AttrVal($name, "alias", "Logfile") ."</a><br>";
}
#if( my $url = ReadingsVal($name, 'gassistantFHEM.loginURL', undef ) ) {
# $ret .= "<a href=\"$url\">Login</a><br>";
#}
@ -482,7 +484,7 @@ gassistant_Set($$@)
return "usage: set $name $cmd <url>" if( !@args );
my $url = $args[0];
$url = "<html><a href=\"$url\">$url</a><br></html>";
$url = "<html><a href=\"$url\">Click here to login</a><br></html>";
$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);