From 1d146f9aee5e08a9d03893217b55dde55dce6b10 Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Tue, 17 Feb 2015 21:13:38 +0000 Subject: [PATCH] 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 --- FHEM/37_harmony.pm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/FHEM/37_harmony.pm b/FHEM/37_harmony.pm index 16939694b..3941e79f0 100644 --- a/FHEM/37_harmony.pm +++ b/FHEM/37_harmony.pm @@ -855,7 +855,6 @@ harmony_Read($) $data = $3; if( $line eq "" ) { - $hash->{STATE} = "LoggedIn"; $hash->{ConnectionState} = "LoggedIn"; #harmony_sendIq($hash, ""); @@ -1123,8 +1122,8 @@ harmony_disconnect($) my $name = $hash->{NAME}; RemoveInternalTimer($hash); - $hash->{STATE} = "Disconnected"; $hash->{ConnectionState} = "Disconnected"; + readingsSingleUpdate( $hash, "state", $hash->{ConnectionState}, 1 ) if( $hash->{ConnectionState} ne ReadingsVal($hash->{NAME},"state", "" ) ); return if( !$hash->{CD} ); Log3 $name, 2, "$name: disconnect"; @@ -1157,8 +1156,8 @@ harmony_connect($) if( $conn ) { Log3 $name, 3, "$name: connected"; - $hash->{STATE} = "Connected"; $hash->{ConnectionState} = "Connected"; + readingsSingleUpdate( $hash, "state", $hash->{ConnectionState}, 1 ) if( $hash->{ConnectionState} ne ReadingsVal($hash->{NAME},"state", "" ) ); $hash->{LAST_CONNECT} = FmtDateTime( gettimeofday() ); $hash->{FD} = $conn->fileno(); @@ -1359,11 +1358,9 @@ harmony_parseToken($$) $hash->{helper}{UserAuthToken} = $json->{GetUserAuthTokenResult}->{UserAuthToken}; if( $json->{GetUserAuthTokenResult} ) { - $hash->{STATE} = "GotToken"; $hash->{ConnectionState} = "GotToken"; } else { - $hash->{STATE} = "Error" if( !$hash->{helper}{UserAuthToken} ); $hash->{ConnectionState} = "Error" if( !$hash->{helper}{UserAuthToken} ); RemoveInternalTimer($hash);