mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
37_harmony.pm: added state reading for connection state
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@8028 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
fddac1af27
commit
1d146f9aee
@ -855,7 +855,6 @@ harmony_Read($)
|
|||||||
$data = $3;
|
$data = $3;
|
||||||
|
|
||||||
if( $line eq "<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>" ) {
|
if( $line eq "<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>" ) {
|
||||||
$hash->{STATE} = "LoggedIn";
|
|
||||||
$hash->{ConnectionState} = "LoggedIn";
|
$hash->{ConnectionState} = "LoggedIn";
|
||||||
|
|
||||||
#harmony_sendIq($hash, "<oa xmlns='connect.logitech.com' mime='vnd.logitech.connect/vnd.logitech.ping?get' token=''></oa>");
|
#harmony_sendIq($hash, "<oa xmlns='connect.logitech.com' mime='vnd.logitech.connect/vnd.logitech.ping?get' token=''></oa>");
|
||||||
@ -1123,8 +1122,8 @@ harmony_disconnect($)
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
$hash->{STATE} = "Disconnected";
|
|
||||||
$hash->{ConnectionState} = "Disconnected";
|
$hash->{ConnectionState} = "Disconnected";
|
||||||
|
readingsSingleUpdate( $hash, "state", $hash->{ConnectionState}, 1 ) if( $hash->{ConnectionState} ne ReadingsVal($hash->{NAME},"state", "" ) );
|
||||||
|
|
||||||
return if( !$hash->{CD} );
|
return if( !$hash->{CD} );
|
||||||
Log3 $name, 2, "$name: disconnect";
|
Log3 $name, 2, "$name: disconnect";
|
||||||
@ -1157,8 +1156,8 @@ harmony_connect($)
|
|||||||
|
|
||||||
if( $conn ) {
|
if( $conn ) {
|
||||||
Log3 $name, 3, "$name: connected";
|
Log3 $name, 3, "$name: connected";
|
||||||
$hash->{STATE} = "Connected";
|
|
||||||
$hash->{ConnectionState} = "Connected";
|
$hash->{ConnectionState} = "Connected";
|
||||||
|
readingsSingleUpdate( $hash, "state", $hash->{ConnectionState}, 1 ) if( $hash->{ConnectionState} ne ReadingsVal($hash->{NAME},"state", "" ) );
|
||||||
$hash->{LAST_CONNECT} = FmtDateTime( gettimeofday() );
|
$hash->{LAST_CONNECT} = FmtDateTime( gettimeofday() );
|
||||||
|
|
||||||
$hash->{FD} = $conn->fileno();
|
$hash->{FD} = $conn->fileno();
|
||||||
@ -1359,11 +1358,9 @@ harmony_parseToken($$)
|
|||||||
$hash->{helper}{UserAuthToken} = $json->{GetUserAuthTokenResult}->{UserAuthToken};
|
$hash->{helper}{UserAuthToken} = $json->{GetUserAuthTokenResult}->{UserAuthToken};
|
||||||
|
|
||||||
if( $json->{GetUserAuthTokenResult} ) {
|
if( $json->{GetUserAuthTokenResult} ) {
|
||||||
$hash->{STATE} = "GotToken";
|
|
||||||
$hash->{ConnectionState} = "GotToken";
|
$hash->{ConnectionState} = "GotToken";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$hash->{STATE} = "Error" if( !$hash->{helper}{UserAuthToken} );
|
|
||||||
$hash->{ConnectionState} = "Error" if( !$hash->{helper}{UserAuthToken} );
|
$hash->{ConnectionState} = "Error" if( !$hash->{helper}{UserAuthToken} );
|
||||||
|
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user