70_PHTV: show some internals during pairing state

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@13442 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2017-02-19 12:28:14 +00:00
parent a61e798b4e
commit c7381dd368

View File

@ -1592,9 +1592,9 @@ sub PHTV_ReceiveCommand($$$) {
$loglevel = 3; $loglevel = 3;
readingsBulkUpdate( $hash, "state", "pairing" ); readingsBulkUpdate( $hash, "state", "pairing" );
$hash->{pairing}{begin} = time(); $hash->{PAIRING_BEGIN} = time();
$hash->{pairing}{end} = $hash->{PAIRING_END} =
$hash->{pairing}{begin} + $return->{timeout}; $hash->{PAIRING_BEGIN} + $return->{timeout};
$hash->{pairing}{auth_key} = $return->{auth_key}; $hash->{pairing}{auth_key} = $return->{auth_key};
$hash->{pairing}{timeout} = $return->{timeout}; $hash->{pairing}{timeout} = $return->{timeout};
$hash->{pairing}{timestamp} = $return->{timestamp}; $hash->{pairing}{timestamp} = $return->{timestamp};
@ -1658,6 +1658,8 @@ sub PHTV_ReceiveCommand($$$) {
Log3 $name, $loglevel, "PHTV $name: $log"; Log3 $name, $loglevel, "PHTV $name: $log";
delete $hash->{pairing}; delete $hash->{pairing};
delete $hash->{PAIRING_BEGIN};
delete $hash->{PAIRING_END};
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
InternalTimer( gettimeofday() + $interval, "PHTV_GetStatus", $hash, 0 ); InternalTimer( gettimeofday() + $interval, "PHTV_GetStatus", $hash, 0 );
@ -1668,8 +1670,8 @@ sub PHTV_ReceiveCommand($$$) {
# authorization/pairing needed # authorization/pairing needed
elsif ( $code == 401 ) { elsif ( $code == 401 ) {
if ( defined( $hash->{pairing} ) if ( defined( $hash->{pairing} )
&& defined( $hash->{pairing}{end} ) && defined( $hash->{PAIRING_END} )
&& $hash->{pairing}{end} < time() ) && $hash->{PAIRING_END} < time() )
{ {
readingsEndUpdate( $hash, 1 ); readingsEndUpdate( $hash, 1 );
return; return;
@ -1700,6 +1702,8 @@ sub PHTV_ReceiveCommand($$$) {
} }
delete $hash->{pairing} if ( defined( $hash->{pairing} ) ); delete $hash->{pairing} if ( defined( $hash->{pairing} ) );
delete $hash->{PAIRING_BEGIN} if ( defined( $hash->{PAIRING_BEGIN} ) );
delete $hash->{PAIRING_END} if ( defined( $hash->{PAIRING_END} ) );
$hash->{pairing}{request} = { $hash->{pairing}{request} = {
device_name => 'fhem', device_name => 'fhem',
device_os => 'Android', device_os => 'Android',