espressif / esp-zigbee-sdk

Espressif Zigbee SDK
Apache License 2.0
130 stars 19 forks source link

Error when running esp_zb_mfg_tool.py (TZ-962) #371

Open mjdswan opened 6 days ago

mjdswan commented 6 days ago

Question

On attempting to run the esp_zb_mfg_tool.py using the given example command lines, I get "unsupported operand type(s)" errors.

I am using esp-zigbee-sdk/tools 1.3.0, ESP-IDF 5.2 on Windows 10.

Please suggest what might be the issue.

Additional context.

PS C:\Users\mswan.espressif\Espressif\esp-zigbee-sdk\tools\mfg_tool> python esp_zb_mfg_tool.py -i NULL -m NULL -c 0x8000 -mn Espressif -mc 0x131B unsupported operand type(s) for +: 'NoneType' and 'str' PS C:\Users\mswan.espressif\Espressif\esp-zigbee-sdk\tools\mfg_tool> python esp_zb_mfg_tool.py --csv ./single_device.csv unsupported operand type(s) for +: 'NoneType' and 'str' PS C:\Users\mswan.espressif\Espressif\esp-zigbee-sdk\tools\mfg_tool>

xieqinan commented 5 days ago

@mjdswan ,

Please refer to this issue https://github.com/espressif/esp-zigbee-sdk/issues/237#issuecomment-1925671397, which is similar to the one you encountered.

mjdswan commented 5 days ago

Hi @xieqinan, yes I saw there is a similar question there (last post) but it is not answered. Please explain?

xieqinan commented 5 days ago

@mjdswan ,

The issue is caused by an invalid + operation between a NoneType data and a string. Could you help us locate the specific line where this occurs?

mjdswan commented 4 days ago

Hi @xieqinan, I managed to trace the Python file through to the error at line 415 in esp_zb_mfg_tool.py. It seems that the function mfg_gen.get_fileid_val(file_identifier, key_value_data, fileid_value) returns a value of None and this is why the + operation fails.

I'm not really sure why this happens, hope you can please assist.

mjdswan commented 2 days ago

Hi @xieqinan, do you have any suggestion? Sorry but I'm quite new to Python and I'm not really sure what the above function is supposed to return.

Some background on this: we need to use the tool to create the ZB Mfr name and ID because we need to integrate our ESP32C6 based host device with a SONOFF ZB hub. I can see from sniffing that this hub requests our mfr name but we respond with "unsupported attribute". This response unfortunately causes the SONOFF hub to reboot, which makes testing impossible because we are stuck in a loop.

I am assuming that ESP ZigBee SDK responds like this because the mfr name is empty. The response in this case would appear to be incorrect, and I would think it's a better approach to respond with a default value of "Espressif" to avoid these kinds of problems - I can open a separate issue on that if you think it's needed. By the way, if there is some other way to create the mfr name and ID directly (without the tool), please let me know.

Would appreciate your update soonest, so we can continue our development and testing thanks.