Xinyuan-LilyGO / T-ZigBee

Zigbee Ultra Low Power IOT Development Board
GNU Affero General Public License v3.0
77 stars 21 forks source link

Zigbee2MQTT - Home Assistant - What to flash? #6

Open dcseng opened 2 years ago

dcseng commented 2 years ago

How to flash Zigbee2MQTT? I didnt get what i have to do to come in this kind of configuration:

https://zbhci.readthedocs.io/en/latest/user-guide/zigbee2mqtt.html

What I have to flash?

My goal is to use zigbee2mqtt in Home Assistant

lbuque commented 2 years ago

Burn this program to esp32-c3: https://github.com/Xinyuan-LilyGO/T-ZigBee/tree/main/examples/zigbee2mqtt

dcseng commented 2 years ago

How to flash it? I tried to flash using platformio in windows but a received error..

image

image

image

image

image

image

@liangyingy

Uploading .pio\build\ttgo-t-oi-plus\firmware.bin esptool.py v3.3 Serial port COM5 Connecting......................................

A fatal error occurred: Failed to connect to ESP32-C3: Invalid head of packet (0x23): Possible serial noise or corruption. For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html *** [upload] Error 2

ARDUINO: image

dcseng commented 2 years ago

Hi @liangyingy, need I press some button when I'm flashing it?

lbuque commented 2 years ago

Please refer to the programming guide https://zbhci.readthedocs.io/en/latest/user-guide/burning.html

dcseng commented 2 years ago

@liangyingy what about using ch340? Need I press some button?

swkim01 commented 2 years ago

Hello, I made a mistake to erase flash before burning zigbee2mqtt firmware. Thus, the board failed to mount littleFS.

./components/esp_littlefs/src/littlefs/lfs.c:1071:error:` Corrupted dir pair at {0x0, 0x1} E (193) esp_littlefs: mount failed, (-84) E (193) esp_littlefs: Failed to initialize LittleFS

I guess that the file system for web configuration was erased. So, I'm curious how to make the FS and its contents.

lbuque commented 2 years ago

Hello, I made a mistake to erase flash before burning zigbee2mqtt firmware. Thus, the board failed to mount littleFS.

./components/esp_littlefs/src/littlefs/lfs.c:1071:error:` Corrupted dir pair at {0x0, 0x1} E (193) esp_littlefs: mount failed, (-84) E (193) esp_littlefs: Failed to initialize LittleFS

I guess that the file system for web configuration was erased. So, I'm curious how to make the FS and its contents.

You need to use platformio to do the following:

image

We will be compatible with arduino ide in the future. Because there is currently no plug-in suitable for arduino ide to create and upload the file system

swkim01 commented 2 years ago

Hello, I made a mistake to erase flash before burning zigbee2mqtt firmware. Thus, the board failed to mount littleFS.

./components/esp_littlefs/src/littlefs/lfs.c:1071:error:` Corrupted dir pair at {0x0, 0x1} E (193) esp_littlefs: mount failed, (-84) E (193) esp_littlefs: Failed to initialize LittleFS

I guess that the file system for web configuration was erased. So, I'm curious how to make the FS and its contents.

You need to use platformio to do the following:

image

We will be compatible with arduino ide in the future. Because there is currently no plug-in suitable for arduino ide to create and upload the file system

Now I can upload the file system via arduino ide! I used the Esp32 sketch data upload menu on arduino ide by installing arduino-esp32fs-plugin. Anyway, I appreciate your effort. Thank you.

ejri commented 2 years ago

Hey,

@camnop, did you end up uploading the example onto the esp32?

@liangyingy @swkim01 I'm getting the same LittleFS error and using arduino-esp32fs-plugin. It's giving me an error that the chip is different when I try to upload it. I've tried changing the board, same error: ESP32C3 Dev Module TTGO T-OI PLUS RISC-V ESP32-C3

Screen Shot 2022-08-06 at 10 59 51 AM

any thoughts on this?

lbuque commented 2 years ago

Hey,

@camnop, did you end up uploading the example onto the esp32?

@liangyingy @swkim01 I'm getting the same LittleFS error and using arduino-esp32fs-plugin. It's giving me an error that the chip is different when I try to upload it. I've tried changing the board, same error: ESP32C3 Dev Module TTGO T-OI PLUS RISC-V ESP32-C3

Screen Shot 2022-08-06 at 10 59 51 AM

any thoughts on this?

arduino-esp32fs-plugin does not support LittleFS. It is recommended to use platformio.

swkim01 commented 2 years ago

@ejri I used recently released one of arduino-esp32fs-plugin and selected LittleFS format on the dialog window, not SPIFFS. No problem with 2.0.2 or 2.0.3 version of esp32 arduino core.

pcopa commented 2 years ago

@liangyingy : I am confused. In your text you say "don't use Arduino", but in your examples you DO show "Arduino". I only use PlatformIO, but don't get joy. All Builds and Uploads have no errors. See As mentioned in #13 I get:

` Executing task in folder zigbee2mqtt: C:\Users\xxxxx.platformio\penv\Scripts\platformio.exe device monitor

--- Terminal on COM7 | 115200 8-N-1 --- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time --- More details at https://bit.ly/pio-monitor-filters --- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ESP-ROM:esp32c3-api1-20210207 Build:Feb 7 2021 rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT) SPIWP:0xee mode:DIO, clock div:1 load:0x3fcd6100,len:0x438 load:0x403ce000,len:0x918 load:0x403d0000,len:0x24e4 SHA-256 comparison failed: Calculated: 080c5cb68a075ced55f248b97bca965e3e5bd5da80a64e34e6a1638f89d6f64e Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff Attempting to boot anyway... entry 0x403ce000 ./components/esp_littlefs/src/littlefs/lfs.c:1071:error: Corrupted dir pair at {0x0, 0x1} E (211) esp_littlefs: mount failed, (-84) E (211) esp_littlefs: Failed to initialize LittleFS [ 210][E][LittleFS.cpp:94] begin(): Mounting LittleFS failed! Error: -1 An Error has occurred while mounting LittleFS `

dcseng commented 2 years ago

@ejri @pcopa @swkim01 I recorded what I did... I start to think that we don't have any example project that really works...

https://github.com/Xinyuan-LilyGO/T-ZigBee/issues/16 https://youtu.be/OmtmtGZHcNg

ejri commented 2 years ago

@camnop yeah I think so too. I tried flashing and a few different combinations on 3 boards.

The probability of 1 broken board may be low. The probability of 2 broken boards is even lower. 3 broken boards probably means there's something wrong with the board design or the firmware.

I think I'll wait for future iterations of the board. It would be amazing the board eventually works given the unique integration between esp32 and zigbee.

pawilli commented 1 year ago

@ejri @pcopa @swkim01 I recorded what I did... I start to think that we don't have any example project that really works...

16 https://youtu.be/OmtmtGZHcNg

I can confirmed that both of the following examples work with some slight modifications.

  1. Light demo - simple light example to set up a simple light that you can use to control the onboard led but more importantly renders the board as a cheap but efficient ZigBee router to extend your ZigBee network - see image 1 below -> Make sure you flash the TLSR8258 with the correct firmware - hciDevice_ZR_8258_SDK_eb644f1_MD5_3e7c395bacca28475952808a79ff2ec1.bin -> Read this readme file in its entity to save some time [https://github.com/Xinyuan-LilyGO/T-ZigBee/blob/main/examples/light_demo/README.md]. I worked on this example for hours before realizing I need a different firmware - see above.

  2. Zigbee2MQTT example and paired a Xiaomi RTCGQ11LM that is then integrated into a test set up for home assistant and can accurately detect motion and readout the lux value - see image. I have also paired the simple light above and it is controllable from HA.

    I also paired a Sonoff plug but it is not reflected in the mqtt as it may not have the definitions in the device.c and device.h files.

-> you might need to hardcode your credentials into the ...\data\db.json especially if your mqtt server needs authentication -> use the latest git versions from @lbuque as it contains an updated ...\zigbee2mqtt\app_mqtt.cpp that allows authentication. -> After you install the new versions run the following from the terminal in platformio after you clean and build the new platformio.ini to re-flash littlefs

pio run -e zigbee2mqtt -t upload
pio run -e zigbee2mqtt -t uploadfs

@lbuque thank you very much for continuing to support this board. It has a lot of promise. Please let us know how to add new devices or submit them for inclusion. Also, it would be great if it can be integrated with Zigbee2MQTT

Image 1 - Light demo - routing traffic on my zigbee network image

Image 2 - Zigbee2mqtt reporting changes in Xiaomi RTCGQ11LM image

Thanks

lbuque commented 1 year ago

@pawilli Documentation for adding new devices is still in preparation and is currently busy with other projects.