@@ -7995,6 +7995,34 @@ describe('Controller', () => {
7995
7995
expect ( error ) . toStrictEqual ( new Error ( `Unbind 0x129/1 genOnOff invalid target '1' (no group with this ID exists).` ) ) ;
7996
7996
} ) ;
7997
7997
7998
+ it ( 'Unbind against unbound cluster' , async ( ) => {
7999
+ await controller . start ( ) ;
8000
+ await mockAdapterEvents [ 'deviceJoined' ] ( { networkAddress : 129 , ieeeAddr : '0x129' } ) ;
8001
+ await mockAdapterEvents [ 'deviceJoined' ] ( { networkAddress : 170 , ieeeAddr : '0x170' } ) ;
8002
+ const endpoint = controller . getDeviceByIeeeAddr ( '0x129' ) ! . getEndpoint ( 1 ) ! ;
8003
+ const target = controller . getDeviceByIeeeAddr ( '0x170' ) ! . getEndpoint ( 1 ) ! ;
8004
+ await endpoint . bind ( 'genOnOff' , target ) ;
8005
+ mockAdapterSendZdo . mockClear ( ) ;
8006
+
8007
+ sendZdoResponseStatus = Zdo . Status . NO_ENTRY ;
8008
+
8009
+ await endpoint . unbind ( 'genOnOff' , target ) ;
8010
+
8011
+ const zdoPayload = Zdo . Buffalo . buildRequest (
8012
+ false ,
8013
+ Zdo . ClusterId . UNBIND_REQUEST ,
8014
+ '0x129' ,
8015
+ 1 ,
8016
+ Zcl . Clusters . genOnOff . ID ,
8017
+ Zdo . UNICAST_BINDING ,
8018
+ '0x170' ,
8019
+ 0 ,
8020
+ 1 ,
8021
+ ) ;
8022
+ expect ( mockAdapterSendZdo ) . toHaveBeenCalledWith ( '0x129' , 129 , Zdo . ClusterId . UNBIND_REQUEST , zdoPayload , false ) ;
8023
+ expect ( endpoint . binds ) . toStrictEqual ( [ ] ) ;
8024
+ } ) ;
8025
+
7998
8026
it ( 'Unbind error' , async ( ) => {
7999
8027
await controller . start ( ) ;
8000
8028
await mockAdapterEvents [ 'deviceJoined' ] ( { networkAddress : 129 , ieeeAddr : '0x129' } ) ;
0 commit comments