Skip to content
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

Discovery of channels should be done immediately on join #527

Closed
cdjackson opened this issue Dec 8, 2019 · 2 comments
Closed

Discovery of channels should be done immediately on join #527

cdjackson opened this issue Dec 8, 2019 · 2 comments

Comments

@cdjackson
Copy link
Contributor

Currently, when a node joins the network, the binding reads all the data required to decide what the device is. However, it does not read attributes etc that are used to determine the channels that will be supported - this is done once the thing handler is instantiated.

While this is fine from a binding perspective (the channel information isn't required at the time of association), it has one major drawback with battery devices. Since a battery device may sleep shortly after joining the network, if the user does not create a thing immediately, then the creation of channels may fail as the device may be sleeping.

It is probably a good idea to perform a channel search during the initial discovery to at least ensure that attributes etc have been read from the device while it is awake.

@cdjackson
Copy link
Contributor Author

In facilitate this, I plan the following refactoring in the near future as I consider this quite a major issue when supporting battery devices.

  • The initialize method in the channel converter will have the ThingHandler field removed. This allows the channel converter to be created without knowledge of the handler (ie before the thing is created - ie, during discovery.
  • The initializeConverter method will have the ThingHandler field added.
  • A new isChannelSupported method will be added. Converters should then be refactored so that all the detection of the channel which is currently in the getChannel method is moved to the isChannelSupported method and the getChannel method should call this for detection.
  • The channel factory will be made available to the discovery service so that following the retrieval of the device properties, it can do a channel discovery by calling isChannelSupported, and then call initializeDevice if the channel is supported.

This provides a better separation within the converter between the converter functionality, and the device functionality allowing the channel to be detected, and the device configured without knowledge of the thing.

@triller-telekom FYI. I know you're probably about to go on holiday, but comments would be welcome. @hsudbrock - also FYI although I'm not sure if you're back yet?

@cdjackson
Copy link
Contributor Author

This should be implemented in #620

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant