Closed Hedda closed 3 years ago
FYI; I noticed this PR to Home Assistant Core which indicates that tube0013 must have managed have added USB discovery in Home Assistant and ZHA for tubeszb ch340B based serial devices by configuring a unique "Product Description String":
https://github.com/home-assistant/core/pull/56719
So the CH340B is another USB to serial bridge chip that integrates EEPROM used to configure the "Product Description String", etc.
http://www.wch-ic.com/products/CH340.html
"tool to program the eeprom is hard to find. Google "ch340cfg-produce" ,Chinese and windows only, but pretty straight forward."
Home Assistant and ZHA will soon also detect tubeszb USB connected devices that uses CH340B serial chip with a custom descriptor:
https://github.com/home-assistant/core/pull/56719
https://github.com/home-assistant/core/pull/56719/commits/c3c0e343aacde82d59878619594199278ee67b01
homeassistant/components/zha/manifest.json
{"vid":"1A86","pid":"7523","description":"*tubeszb*","known_devices":["TubesZB Coordinator"]},
homeassistant/generated/usb.py
{
"domain": "zha",
"vid": "1A86",
"pid": "7523",
"description": "*tubeszb*"
},
Note! Home Assistant and ZHA uses the descriptor in combination with VID and PID to auto detect and identify unique devices.
You do not want to change VID and PID as the operating system uses those two to select which device driver to use.
This way multiple devices from different manufacturers can have same VID and PID while still being detected by app as unique.
Warning! If you do change the VID or PID you must provide the customer with your own custom driver for your specific device.
FYI, there is some more information found in zigpy discussion zigpy/zigpy#808 which indirectly describe how to submit support to upstream Home Assistant core for ZHA integration detection of your custom USB stick once you configured the USB-to-UART converter chip with a unique identifier.
Again, if you want your Zigbee adapters connected via USB you still need to program your USB-to-serial bridge chip EEPROM with a unique "Product Description String". If using CH340B then the tool to program the EEPROM is hard to find. Google "ch340cfg-produce" (it's in Chinese and windows only, but tube0013 wrote that it was pretty straightforward to figure it out).
BTW, I also started a new related thread in the Home Assistant community forum in regards to auto-discovering USB-adapters, see:
I believe it would be great for new users of Home Assistant if all Zigbee adapters (and Z-Wave adapters) could be auto-detected.
Hi @Hedda,
zzhp and zzh2 both use FT231X and will come with customised "Manufacturer" and "Product Description" strings. zzh will keep CH340E.
Closing this issue.
@omerk Cool! However please note that you only want to change the description identifier and not the VID or the PID. Changing VID and PID means users that the operating system will not detect which driver to use so customers need to add a custom driver. This is why the other Zigbee USB adapters have only configured/changed the description identifier and not the VID or PID for their USB-to-UART bridge chips EEPROM. Please see: https://community.home-assistant.io/t/community-help-wanted-to-whitelist-all-compatible-zigbee-and-z-wave-usb-adapters-for-automatic-discovery-in-home-assistant-os/344412
I'm aware @Hedda, thanks for your concern.
@omerk Please consider switching design to other USB-to-Serial converter chip with its own writable EEPROM as hardware feature.
This would allow you to add your own custom "Product Description String" as a unique identifier for it via the USB interface, and the reason for wanting a unique identifier via the USB interface is in order to enable the possibility for it to support automatic USB discovery of Zigbee USB adapters.
The whole point of this is to make it possible for developers to make the initial installation of Zigbee solution plug-and-play friendly and easier for different home automation software to automatically USB discover and initiate a setup without end-user interactions.
Support for USB discovery was recently added to Home Assistant OS (formerly HASSIO) and the ZHA integration for it, see here:
https://community.home-assistant.io/t/unique-friendly-name-description-for-automatic-zigbee-usb-adapter-discovery-in-home-assistant-zha-using-dongle-vendor-product-ids/337077
That unique customized USB description string could be something like ex.; "Electrolama zig-a-zig-ah (zzh) CC2652R Zigbee stick version 2 hardware revision 2.0.0".
The unique "description" string for each USB adapter can then be added to HA via a PR like this -> https://github.com/home-assistant/core/pull/56201
As I understand it, cheaper CH340 series (example CH340C and CH340E) by WCH which unfortunately does not support this feature.
UPDATE! It has now been confirmed that the CH340B variant does have an EEPROM that support "Product Description String", etc.
http://www.wch-ic.com/products/CH340.html
I understand that more expensive chips like FT231 chips by FTDI and CP210x chips by Silicon Labs / Silabs do support this feature:
https://ftdichip.com/products/ft231xs/ https://ftdichip.com/products/ft231xq/
FT231X/FT231XS: "Key Hardware Features" "Fully integrated 2048 byte EEPROM for storing device descriptors and CBUS I/O configuration."
https://www.silabs.com/interface/usb-bridges/classic/device.cp2102 https://www.silabs.com/interface/usb-bridges/classic/device.cp2104 https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers https://www.silabs.com/documents/public/data-sheets/cp2102n-datasheet.pdf https://www.silabs.com/documents/public/application-notes/an197.pdf https://www.silabs.com/documents/public/application-notes/an978-cp210x-usb-to-uart-api-specification.pdf https://www.silabs.com/documents/public/application-notes/AN571.pdf
"The CP2102N devices have the following features" "Internal 960-byte programmable ROM for vendor ID, product ID, serial number, power descriptor, release number, and product description strings"
"The CP2102N includes an internal electrically erasable programmable read-only memory (EEPROM). This memory may be used to customize the USB Vendor ID (VID), Product ID (PID), Product Description String, Power Descriptor, Device Release Number and Device Serial Number as desired for OEM applications. If the EEPROM is not programmed with OEM data, the default configuration data shown in the table below is used."
"Product String The Product String is an optional string that describes the product. It is limited to 126 characters."
PS: I understand that a bonus feature in of chips like FT231 and CP210x is to add the ability to allow users to auto-reset and put the device in bootloader mode via the DTR/RTS pins exposed will enable much easier firmware upgrades for the end-users as they will no longer need to press any buttons to enter bootloader mode, and then bootloader mode could be activated via software from the firmware flasher program software which could make the OTW (Over-The-Wire) firmware upgrade procedure more user-friendly.