-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add methods to get supported cluster list from converters #517
Conversation
04b4686
to
e1d1c09
Compare
I have renamed |
I've now added the @hsudbrock or @triller-telekom I would really appreciate it if you can take a quick look at this ASAP as I would like to get this included into the latest OH for the 2.5 release so we can update the ZSS libraries. (Thanks). |
4cd8dde
to
47030ef
Compare
Hi Chris, sorry to get back to you this late again. I wish I could use more time on this here... While seeing the latest changes in ZSS I also thought about a way that the converters should announce their used clusters by themselves. It certainly makes sense to define the clusters where we use them, so in the converters is a good idea. I also like "implemented" over "supported" due to the confusion mentioned by you. However, what we should not miss, is those clusters which are used by instances of I don't know if you plan to register them within ZSS, or if any program who wants to make use of these applications has to register the clusters. |
Thanks for your thoughts @triller-telekom.
Yes, there is a plan to do this, but it's not all joined up - zsmartsystems/com.zsmartsystems.zigbee#411 is basically linked to this. In the first instance I might add these explicitly to the binding to make sure it's registered, but the above issue is becoming more important now that we have code to reject packets received from clusters that aren't registered... You will find as well that there are now 2 APIs - one to set the clusters in the I will progress with this then and try and finish it tonight or tomorrow - I think it's all done now so it just needs testing. Do you want to review? Or should I ask - do you have time to review ;) |
Rather the later, but I can try to have a deeper look at this PR during this week. Sorry can't promise. |
47030ef
to
e5abeb8
Compare
@Nullable | ||
private ZigBeeChannelConverterFactory zigbeeChannelConverterFactory; | ||
|
||
@Reference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the @Reference
directly on the field would remove the need for the set
and unset
methods.
@@ -50,6 +54,16 @@ | |||
|
|||
private ZclPressureMeasurementCluster cluster; | |||
|
|||
@Override | |||
public Set<Integer> getImplementedClientClusters() { | |||
return Stream.of(ZclPressureMeasurementCluster.CLUSTER_ID).collect(Collectors.toSet()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collections.singleton()
@@ -439,6 +445,13 @@ private synchronized void initialiseZigBee() { | |||
return; | |||
} | |||
|
|||
// Add all the clusters that we are supporting. | |||
// If we don't do this, the framework will reject any packets for clusters we have not stated support for. | |||
channelFactory.getImplementedClientClusters().stream() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the OSGi references in the handler factories the channelFactory can be null
.
This would throw a NPE here.
// If we don't do this, the framework will reject any packets for clusters we have not stated support for. | ||
channelFactory.getImplementedClientClusters().stream() | ||
.forEach(clusterId -> networkManager.addSupportedClientCluster(clusterId)); | ||
channelFactory.getImplementedServerClusters().stream() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be reduced to channelFactory.getImplementedServerClusters().forEach(networkManager::addSupportedServerCluster)
Thanks for the review @t-8ch |
fc01e2b
to
07e942e
Compare
Signed-off-by: Chris Jackson <[email protected]>
Signed-off-by: Chris Jackson <[email protected]>
Signed-off-by: Chris Jackson <[email protected]>
Signed-off-by: Chris Jackson <[email protected]>
Signed-off-by: Chris Jackson <[email protected]>
7ea289b
to
a3287ac
Compare
Closes #531 |
Signed-off-by: Chris Jackson <[email protected]>
a3287ac
to
f1e42a1
Compare
This now updates to the ZSmart System libraries |
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/mijia-windows-door-sensor-model-mccgq01lm/104082/1 |
This PR is incomplete and will fail CI - do not merge!!
From recent versions of the Z-Smart Systems ZigBee library (1.2.6 I think), we need to tell the framework what clusters we support. This is to allow the framework to only process messages that the application supports, and more importantly, to reject ones that are not supported with the appropriate error.
This is required for ZigBee certification and there is a test for this.
To achieve this, I've added two methods to the converters, and the converter factory to allow the coordinator handler to get the list of clusters that are implemented by the system. Each cluster will return a Set of cluster IDs it supports through the
Set<Integer> getSupportedClientClusters()
andSet<Integer> getSupportedServerClusters()
methods. The converter factory has a similar set of methods and will return the consolidated Set of cluster IDs supported by all converters so that this can be passed to the framework.@hsudbrock or @triller-telekom you should review this concept please.
Design questions - I have one thought - the framework methods set the client/server clusters the framework supports, but the converters internally use client/server clusters on the remote device, so the naming is reversed. Within the converter, does the
getSupportedServerClusters
method return the server clusters consumed by the converter, or the server clusters implemented by the converted?This PR currently only implements the initial concept, and the methods in a single converter for comment.
Note that we probably also need to add the converter factory provider to the coordinator factories as this information is required in the
ZigBeeCoordinatorHandler
class (I've added this as a parameter on the constructor, but not hooked this all together yet).Signed-off-by: Chris Jackson [email protected]