@@ -560,8 +560,7 @@ private void discoverServices(Integer destination, int clusterId) {
560
560
561
561
MatchDescriptorRequest matchRequest = new MatchDescriptorRequest ();
562
562
matchRequest .setInClusterList (clusterList );
563
- matchRequest .setOutClusterList (clusterList );
564
- matchRequest .setDestinationAddress (new ZigBeeEndpointAddress (destination ));
563
+ matchRequest .setOutClusterList (Collections .emptyList ());
565
564
matchRequest .setDestinationAddress (new ZigBeeEndpointAddress (destination ));
566
565
matchRequest .setProfileId (ZigBeeProfileType .ZIGBEE_SMART_ENERGY .getKey ());
567
566
matchRequest .setNwkAddrOfInterest (destination );
@@ -678,8 +677,8 @@ private ZigBeeStatus requestSimpleDescriptor(final ZigBeeEndpoint endpoint)
678
677
CommandResult response = networkManager .sendTransaction (simpleDescriptorRequest , simpleDescriptorRequest ).get ();
679
678
680
679
final SimpleDescriptorResponse simpleDescriptorResponse = (SimpleDescriptorResponse ) response .getResponse ();
681
- logger .debug ("{}: SEP Extension: SimpleDescriptorResponse returned {}" , endpoint .getIeeeAddress (),
682
- simpleDescriptorResponse );
680
+ logger .debug ("{}: SEP Extension: Endpoint {} SimpleDescriptorResponse returned {}" , endpoint .getIeeeAddress (),
681
+ endpoint . getEndpointId (), simpleDescriptorResponse );
683
682
if (simpleDescriptorResponse == null ) {
684
683
return ZigBeeStatus .FAILURE ;
685
684
}
@@ -771,26 +770,32 @@ private void handleMatchDescriptorResponse(MatchDescriptorResponse response) {
771
770
case DISCOVER_METERING_SERVERS :
772
771
ZigBeeNode node = networkManager .getNode (response .getSourceAddress ().getAddress ());
773
772
if (node == null ) {
774
- logger .debug ("SEP Extension: SEP discovery Node {} is unknown - getting IEEE address." ,
773
+ logger .debug ("{}: SEP Extension: SEP discovery node is unknown - getting IEEE address." ,
775
774
response .getSourceAddress ().getAddress ());
776
775
// This node is unknown to us - get the long address
777
776
IeeeAddress ieeeAddress = requestIeeeAddress (response .getSourceAddress ().getAddress ());
778
777
node = new ZigBeeNode (networkManager , ieeeAddress );
779
778
networkManager .updateNode (node );
780
779
}
781
780
781
+ // Check if this node is authorised to communicate securely
782
+ if (!cbkeProvider .isAuthorised (node .getIeeeAddress ())) {
783
+ logger .debug ("{}: SEP Extension: SEP discovery node is not authorised" , node .getIeeeAddress ());
784
+ return ;
785
+ }
786
+
782
787
ZigBeeNode updatedNode = new ZigBeeNode (networkManager , node .getIeeeAddress (),
783
788
node .getNetworkAddress ());
784
789
for (Integer endpointId : response .getMatchList ()) {
785
790
ZigBeeEndpoint endpoint = new ZigBeeEndpoint (updatedNode , endpointId );
786
- logger .debug ("SEP Extension: Metering endpoint {} being added/updated" ,
787
- endpoint .getEndpointAddress ());
791
+ logger .debug ("{}: SEP Extension: Endpoint {} Metering endpoint being added/updated" ,
792
+ node . getIeeeAddress (), endpoint .getEndpointAddress ());
788
793
789
794
try {
790
795
requestSimpleDescriptor (endpoint );
791
796
} catch (InterruptedException | ExecutionException e ) {
792
- logger .debug ("SEP Extension: Exception getting simple descriptor from endpoint {} " ,
793
- endpoint .getEndpointAddress ());
797
+ logger .debug ("{}: SEP Extension: Endpoint {} Exception getting simple descriptor" ,
798
+ node . getIeeeAddress (), endpoint .getEndpointAddress ());
794
799
}
795
800
updatedNode .addEndpoint (endpoint );
796
801
}
@@ -927,12 +932,12 @@ private void setProfileSecurity(ZigBeeNode node) {
927
932
logger .debug ("{}: SEP Extension: Node is not authorised" , node .getIeeeAddress ());
928
933
return ;
929
934
}
930
- logger .debug ("{}: SEP node is authorised" , node .getIeeeAddress ());
935
+ logger .debug ("{}: SEP Extension: Node is authorised" , node .getIeeeAddress ());
931
936
932
937
for (ZigBeeEndpoint endpoint : node .getEndpoints ()) {
933
938
if (endpoint .getProfileId () != ZigBeeProfileType .ZIGBEE_SMART_ENERGY .getKey ()) {
934
- logger .debug ("{}: SEP Extension: Endpoint {} is not SmartEnergy" , node .getIeeeAddress (),
935
- endpoint .getEndpointId ());
939
+ logger .debug ("{}: SEP Extension: Endpoint {} is not SmartEnergy [{}] " , node .getIeeeAddress (),
940
+ endpoint .getEndpointId (), String . format ( "%04X" , endpoint . getProfileId ()) );
936
941
continue ;
937
942
}
938
943
@@ -942,8 +947,8 @@ private void setProfileSecurity(ZigBeeNode node) {
942
947
continue ;
943
948
}
944
949
945
- logger .debug ("{}: SEP Extension: Setting profile security for input cluster {}" , node . getIeeeAddress () ,
946
- clusterType );
950
+ logger .debug ("{}: SEP Extension: Endpoint {} Setting profile security for input cluster {}" ,
951
+ node . getIeeeAddress (), endpoint . getEndpointId (), clusterType );
947
952
cluster .setApsSecurityRequired (true );
948
953
}
949
954
@@ -953,8 +958,8 @@ private void setProfileSecurity(ZigBeeNode node) {
953
958
continue ;
954
959
}
955
960
956
- logger .debug ("{}: SEP Extension: Setting profile security for output cluster {}" , node . getIeeeAddress () ,
957
- clusterType );
961
+ logger .debug ("{}: SEP Extension: Endpoint {} Setting profile security for output cluster {}" ,
962
+ node . getIeeeAddress (), endpoint . getEndpointId (), clusterType );
958
963
cluster .setApsSecurityRequired (true );
959
964
}
960
965
}
0 commit comments