mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
70_PHTV: refactoring pairing request structures
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@13450 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
672bbb18e4
commit
b77c57fc20
@ -360,11 +360,14 @@ sub PHTV_Set($@) {
|
||||
return "Not in pairing mode"
|
||||
unless ( defined( $hash->{pairing} )
|
||||
&& defined( $hash->{pairing}{auth_key} )
|
||||
&& defined( $hash->{pairing}{timestamp} ) );
|
||||
&& defined( $hash->{pairing}{timestamp} )
|
||||
&& defined( $hash->{pairing}{request} )
|
||||
&& defined( $hash->{pairing}{request}{device} ) );
|
||||
|
||||
readingsSingleUpdate( $hash, "state", "pairing-grant", 1 );
|
||||
|
||||
$hash->{pairing}{grant} = {
|
||||
auth => {
|
||||
auth_AppId => 1,
|
||||
pin => trim( $a[2] ),
|
||||
auth_timestamp => $hash->{pairing}{timestamp},
|
||||
@ -373,6 +376,8 @@ sub PHTV_Set($@) {
|
||||
$a[2],
|
||||
"ZmVay1EQVFOaZhwQ4Kv81ypLAZNczV9sG4KkseXWn1NEk6cXmPKO/MCa9sryslvLCFMnNe4Z4CPXzToowvhHvA=="
|
||||
),
|
||||
},
|
||||
device => $hash->{pairing}{request}{device},
|
||||
};
|
||||
PHTV_SendCommand( $hash, "pair/grant", $hash->{pairing}{grant} );
|
||||
}
|
||||
@ -1705,13 +1710,15 @@ sub PHTV_ReceiveCommand($$$) {
|
||||
delete $hash->{PAIRING_BEGIN} if ( defined( $hash->{PAIRING_BEGIN} ) );
|
||||
delete $hash->{PAIRING_END} if ( defined( $hash->{PAIRING_END} ) );
|
||||
$hash->{pairing}{request} = {
|
||||
device => {
|
||||
device_name => 'fhem',
|
||||
device_os => 'Android',
|
||||
app_name => 'FHEM PHTV',
|
||||
type => 'native',
|
||||
scope => [ "read", "write", "control" ],
|
||||
app_id => 'org.fhem.PHTV',
|
||||
id => $device_id,
|
||||
},
|
||||
scope => [ "read", "write", "control" ],
|
||||
};
|
||||
PHTV_SendCommand( $hash, "pair/request", $hash->{pairing}{request} );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user