-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
[178] Support Discovery of USB dongles (for some Telegesis and one Ember dongle) #179
[178] Support Discovery of USB dongles (for some Telegesis and one Ember dongle) #179
Conversation
Thanks Henning. One question without having looked at the code (and given I probably can't test this as I think it only works on Linux) -:
I don't think there's any way to know this for sure - at least not without doing some sort of active scan? I guess we can't be sure it will function, so presumably the user can always change the baud rate to the value that they know works? |
Good question. I have tried this on different hardwares and Linuxes, and the baud rate with which the dongles worked was always the same. But there might be some device out there where a different baud rate is needed.
If the user adds the discovered device from the inbox, the thing will be configured with that baud rate, but the user should still be able to change the baud rate afterwards if the Eclipse SmartHome-based system permits this (as, e.g., via Paper UI). I have not tried this, though; I will do a test if the ZigBee binding actually supports a change of the baud rate after the thing has been created, and report the result as comment to this PR. |
Yes, for sure this is the case. The Ember dongle will definitely require this as there are 2 common baud rates used, and other configuration parameters will also need to change. Namely, the flow control settings also change - I expect it's about 50/50 for the different configurations that are commonly used. |
|
||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = new HashSet<>(asList(THING_TYPE_EMBER)); | ||
|
||
public static final int SILICON_LABS_USB_VENDOR_ID = 0x10c4; |
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.
just a minor comment - such constants have been documented for the Telegesis dongle
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.
I commented only those constants for the Telegesis dongle where I found documentation useful (i.e., those constants where there are multiple different dongles which might or might not have the same product ID - having in mind that there are two dongles that look alike but have different product IDs, and two dongles that don't look alike but have the same product ID, which I wanted to clarify using those constants). Here, I don't think that additional documentation is needed.
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.
ok
* is used for the Telegesis ZigBee dongle model ETRX3USB+8M, as well as for one version of the QIVICON ZigBee stick | ||
* (which is also produced by Telegesis). | ||
*/ | ||
public static final int QIVICON_DONGLE_V1_USB_PRODUCT_ID = 0x8293; |
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.
I am a bit confused - the black Telegesis dongle is also supported, isn´t it? If yes shouldnt we rename the prefix to Telegesis?
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.
You are right - we could add TELEGESIS to the constant name (as this product ID is used both by one version of the Qivicon dongle, and by the dongle with Telegesis label). I will add this with my next commit to this PR.
in general this PR looks good to me - just two additional comments one question regarding the baud rate - if we use the "wrong" baud rate per default for a specific dongle this would always result in the situation that the bridge thing will not be online after discovery - is there an easy possibility to auto-configure this? |
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.
Looks fine - thanks. I can't easily test as I'm not running Linux, but I'm sure you've got that under control ;)
.withLabel(createBitronVideoDongleLabel(deviceInformation)) | ||
.withRepresentationProperty(CONFIGURATION_PORT) | ||
.withProperty(CONFIGURATION_PORT, deviceInformation.getSerialPort()) | ||
.withProperty(CONFIGURATION_BAUD, BITRON_VIDEO_2010_10_BAUD_RATE).build(); |
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.
It may also be worth setting the flow control property as well (Should be XON/OFF for this version).
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.
Ah, I wasn't aware of that option yet, thanks! I will add this with my next commit to this PR (I tested this setting with the Ember dongle, and it worked fine so far).
@cdjackson Do you have any infos on flow control for the telegesis dongles? I have looked at https://www.silabs.com/documents/public/reference-manuals/TG-PM-0518-ETRX357USB.pdf which mentions that nRTS and nCTS lines are connected to the USB bridge chip - from which I (as a layman) would deduce that hardware flow control could be used - or am I mistaken completely here?
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.
I tested this setting with the Ember dongle, and it worked fine so far
I think the lower speed that is used in the XON/OFF flow control means that it's not a big issue this way around when running on a reasonably fast computer. But the other way around (ie using XON/OFF instead of CTS/RTS) can completely stop the dongle from working. This is what is used when the Ember runs at 115k2.
which mentions that nRTS and nCTS lines are connected to the USB bridge chip - from which I (as a layman) would deduce that hardware flow control could be used - or am I mistaken completely here?
I would agree with your assessment. Currently I think I don't use flow control. I think I read somewhere that it is optional, but the Telegesis runs at such a slow speed (19k2) that it shouldn't matter I think (except on a really slow computer!)
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.
Thanks for explaining! I wil thenl leave it as is for now (i.e., use the default flow control setting for the telegesis discovery result, which is 'no flow control'). We can still change this if issues arise somewhere.
I have tested changing the baud rate of a ZigBee coordinator after initial configuration using Paper UI - and it did not work in my test. It appears to me that this is not possible, because the method As far as I see it, this would need to be changed before being able to change baud rate (and other config parameters) after initial thing creation. Or do I overlook something, @cdjackson ? |
I would have thought that the handler should be reinitialised if the serial port config changes, but this doesn't sound like it's implemented. I'll add that separately. |
Thanks, @cdjackson ! |
The USB-Serial discovery has now been deployed to https://openhab.jfrog.io/openhab/eclipse-smarthome-stable; this is, hence, no longer an impediment for merging this PR. |
7350647
to
6d27491
Compare
I rebased this PR to be able to use the newly introduced flow control constants from #184; I added a commit for using these constants. |
Before merging this PR, #186 should be fixed (as otherwise one cannot change the baud rate of a thing created from a discovery result, and the baud rate from the discovery result might not always match the needed one as indicated by @cdjackson above). |
You can change the baud rate etc - you ‘just’ need to restart the bundle (not nice I know, but it should work).
|
Looks like this needs rebasing then I guess it can be merged now that #187 is merged. |
dongle) Adds discovery participants for the USB-serial discovery of Eclipse SmartHome, able to discover three Telegesis dongles (from the Qivicon brand) and one Ember dongle (from Bitron Video brand). Bug: openhab#178 Signed-off-by: Henning Sudbrock <[email protected]>
* Rename constant for USB product ID for one Qivicon/Telgesis USB dongle. * Add flow control configuration for Ember discovery result (to XONOFF)
participant Signed-off-by: Henning Sudbrock <[email protected]>
6d27491
to
cd8c7a2
Compare
I have rebased the PR, so this can be merged now. |
Thanks @hsudbrock - @tomhoefer I guess you will merge? |
Thanks @cdjackson - I have no preference who is going to merge actually a PR I will merge this PR now |
Looks as if this broke the build: https://openhab.ci.cloudbees.com/job/openHAB-Distribution/1261/console |
I thought this was meant to be part of ESH, and therefore included in OH core? Is it just that OH hasn’t been updated since this was merged into ESH?
|
@kaikreuzer @cdjackson I think the reason is that - while the USB-Serial discovery is a part of ESH - it is not in the ESH-Karaf-feature I will create a PR now in the |
@kaikreuzer @cdjackson I added a PR to the |
This PR adds two discovery participants for the USB-serial discovery of Eclipse SmartHome, one for the telegesis bundle, and one for the ember bundle. These discovery participants can discover three Telegesis dongles (from the Qivicon brand) and one Ember dongle (from Bitron Video brand).
Discovery of USB dongles is held rather simple - the discovery participants check whether USB vendor and product ID match the vendor and product ID of a known ZigBee dongle. If yes, a discovery result is created using the dongle's serial number in the thing ID, and configuring the baud rate to a hard-coded baud rate with which the dongle is known to function.
I would be happy about any feedback on this PR!
Fixes #178.