-
Notifications
You must be signed in to change notification settings - Fork 33
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
porting firmware for TS0201 _TZ3000_v1w2k9dd #128
Comments
You first have to check if your board looks like https://pvvx.github.io/TS0201_TZ3000/. You need to check if LED and BUTTON are connected to the right ports of the ZTU also. If not, you can't use any prebuilt firmware and have to compile it yourself. Look at #124 |
@pvvx Tuya is obviously very messy so wondering if you can tell me if this variant is somehow already supported either by downloading an OTA binary or compile one myself? Thanks! |
I have the same boards as @dynasticorpheus and wanted to flash them with a new firmware to get configurable report intervals. The PCB traces as follows: I quickly had a look at https://github.com/pvvx/ZigbeeTLc where I saw that apprently the boards are defined in src/board_*.h. Cheers, |
I'm currently trying to port the firmware for software I2C and the CHT832x sensors. |
Alright. I couldn't wait for the programmer to get here so I fiddled around with the USB->UART SWire emulation and got a working firmware flashed. I will download the old firmware when I get the hardware programmer. @pvvx How would you like me to contribute this? Also I'd be interested in a way to forcefully flash the original Tuya devices with the new firmware without having to solder an SWire programmer to the board.
|
Full match with ZY-ZTH02Pro. But no LCD. The sensor is probably a clone of SHT30. https://www.gxcas.com/public/en/public/html/index.html#/proOne?pid=21&id=23 Already working in an unheated garage in "LE Long Range" mode: At that distance from home and with multiple walls, Zigbee doesn't work: https://github.com/pvvx/ATC_MiThermometer/raw/refs/heads/master/ZY02_v50.bin - Will work for your device temporarily. |
I recommend unsoldering or breaking out R13 and R11. This is unnecessary battery consumption and does not provide anything else.
|
Good stuff, mate. The sensor is definitely a CHT832x. If you are interested in my changes, I have just created a fork and uploaded my changes. Basically I created or changed the following files:
Makes sense by the way that these boards are similar or share the firmware. Do you know why R13 and R11 are there in the first place? Cheers, |
ADC divider for measuring battery voltage. |
id: 00308010 -> Status Register at startup: 0x8010. |
@dbmaxpayne Is this still WIP or can I have a go at it? ( |
@dynasticorpheus Let me know in a private message what error you're getting and I might be able to help. I will upload the bin files to my fork in a second if that helps. Edit: |
Hi there, many thanks for all your efforts. |
I'd be interested too if there is a way to flash this over a stock firmware via OTA. I used this: https://github.com/pvvx/TlsrComSwireWriter
|
@dbmaxpayne - what "Zigbee Image Type" does the original TS0201 _TZ3000_v1w2k9dd have? 1002-0203-59013001 ?
? |
@pvvx |
ZHA only gives this: 1002-0203-59013001 I got from the header of the firmware binary file.
https://github.com/pvvx/ATC_MiThermometer/tree/master/utils -> zigbee_ota.py fw 1002-0203-60993001-ZYZTH02BLE_v50.zigbee for converting Tuya Zigbee to BLE added to https://github.com/pvvx/ATC_MiThermometer I don't use Zigbee2MQTT and I can't say anything about it. |
Sorry, I only started with Zigbee last week when I got those sensors, so my learning curve is still quite steep. So I guess 1002 and 0203 are correct. I will try 1002-0203-60993001-ZYZTH02BLE_v50.zigbee on my second sensor once I downloaded its stock firmware. |
For your ts0201_tz3000_v1w2k9dd.bin file, create a header for Zigbee OTA:
It will be 1002-0203-60993001-ts0201_tz3000_v1w2k9dd.zigbee Zigbee OTA is triggered automatically if the program version number is higher. |
Thanks both for your inputs. I have an "Invalid Image" error from z2m ota update. It was so close ;-) but I am unsure how I can get the exact information |
@vjaunet |
That's the one I tried, obtained as per pvvx instructions from your bin file. |
@pvvx
Can or should they be removed when using your firmware to save power? |
GPIO_PB5 and GPIO_PC0 are not used. This does not increase battery consumption. |
A large increase in consumption is created by ZHA, forcing the "Long Poll interval" to 6 seconds. This is the notification time of the device that it is working. In the Zigbee 3.0 standard, the "Long Poll interval" is set within the limits that the device transmits. But ZHA does not look at what the device says. Have to write a patch into the firmware because of ZHA... And the firmware loses full compatibility with ZigBee 3.0. zha\zigbee\cluster_handlers\general.py (LONG_POLL = 6 * 4 # 6s)
For some reason, for IKEA devices, ZHA ignores the forced LONG_POLL setting of 6 seconds. CHECK_INTERVAL - after this interval, if the device has not notified, then it will be disconnected from the network. |
Any luck with applying OTA as soldering is out of my league unfortunately? |
That worked nicely, it was just missing the write address in the second command line :
Many thanks ! |
So my hardware programmer has finally arrived. I have tried to upgrade the firmware of my second device without soldering by changing the zigbee header using the command @pvvx mentioned: However, I also get an INVALID_IMAGE error. With my narrow understanding of the topic and using a hex editor I can see that the MANUFACTURER_ID and IMAGE_TYPE should be correct at addresses 0x12 and 0x14. Cheers, |
Here are the data obtained in the ZHA log about the firmware in the new https://pvvx.github.io/ZY-ZTH02/:
manufacturer_code=4098=0x1002, But, no matter what numbers I put in, ZHA complains during OTA: I tried to feed it my own original firmware. The result is the same. It seems that the original firmware does not support Zigbee OTA or has an error. It is also possible that some special registration is required from the manufacturer's device. |
So the most solderless version will probably be using Victor's https://github.com/pvvx/TLSRPGM repo. I used the following command to write the firmware:
If you have a USB->UART converter you can also try https://github.com/pvvx/TlsrComProg825x. |
Apparently, in this version of the original firmware, Zigbee OTA simply does not work. There are many things that point to this. The firmware does not support changing the communication interval, and in the analysis of the operation by current consumption, when turning on OTA, it simply breaks the connection, and when forced to start by short pressing the button, an error appears. Otherwise, OTA will be interrupted due to timeout at the initial 0.3%. |
I did give a comparison, but with BLE. |
I can't get my flashed Thermometer to join Zigbee2mqtt. Have you managed to get it to join ? Also, no led is working anymore on the thermometer, is that for energy saving purposes ? |
I have been delivered TS0201 _TZ3000_v1w2k9dd and try to get around. |
So something went wrong during the firmware. It's worth repeating. |
LED blinks only very shortly with my firmware. If that doesn't work I also recommend just flashing it again. |
@dbmaxpayne In your firmware, the LED always turns on when TLSR825x is active. Blinking indicates any chip activity. In the ZigbeeTLc version, the LED works when the button is pressed or blinks on request "Identify", as well as at the time of pairing or when the network connection is lost. |
I have repeated the flashing process many times without luck. I even read the firware of a brand new device and tried to burn it back, without success. Seems like my flashing set-up does not make it properly... |
Rpi cannot transmit a continuous stream of bytes to UART. |
Interesting. I actually used an RPi 3B for intial flashing as my USB->UART (FTDI) didn't work. You must also connect GND of the MCU and RPi together so they share a common ground. |
Oh and if you are using pigpiod or any other interrupt-based software, disable that before flashing as it might interfere with the correct timings. |
Finally got it to work on the RPI 4 !
Many many thanks both @dbmaxpayne and @pvvx ! |
Would be great if someone could share some hints how to prep an OTA for my TS0201 _TZ3000_v1w2k9dd which is already Zigbee out of the box. Bit unsure how to create something that is recognized by ZHA when using below config.
Note they work out of the box in home assistant but only seem to update when registering big changes in temperature / humidity hence my wish to use this custom firmware.
Bought here
The text was updated successfully, but these errors were encountered: