Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #5201 +/- ##
==========================================
+ Coverage 93.99% 94.02% +0.02%
==========================================
Files 448 449 +1
Lines 15547 16816 +1269
==========================================
+ Hits 14614 15811 +1197
- Misses 933 1005 +72 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Cover payload codecs, diagnostic mirrors, virtual reads and writes, and UI command dispatch to keep project coverage above the CI baseline.
|
@zigpy-review-bot Thanks for pointing this out. I reviewed zigpy/zha#845 and agree that this is an upstream diagnostics tooling issue: ZhaJsonEncoder currently cannot serialize bytes in quirk entity info. The bytes value in command_args is intentional because it is the raw payload required by the TP-WGZBA temporary-mode command. Changing it to an integer would risk changing the actual ZCL command payload. I propose keeping the quirk payload unchanged and addressing the ZhaJsonEncoder fix upstream in zigpy/zha#845. Once that fix is available, I will rerun the diagnostics import/snapshot tests for this PR. Please let me know if you would prefer a temporary JSON-safe metadata workaround in this PR. |
Handle switch-only bind and unbind payloads while preserving cached state when vendor writes fail. Split linkage packing to satisfy complexity checks and correct ReportingConfig typing.
|
Just wanted to add that I've been using this as a custom quirk since I installed my two TP-WGZBA's last month, and it's all working well. |
|
@viys thanks for this quirk, it works well here on 7 TP-WGZBA units (ZHA, loaded as a custom quirk). While testing I found a firmware behaviour I would like to report, since you are closest to the device. TP-WGZBA (fw 1.0.4, date code 20260814): reported temperature steps up 0.5–1.6 °C when the relay switches off While the heating relay is on, Measured against an SNZB-02P mounted directly beside the thermostat (66 min heating run, values read from the device once a minute, every 10 s around relay-off):
The reference sensor did not move, and humidity was flat. So far I have seen the step on 2 of the 7 units; the other 5 have not had a long heating run yet. It looks like a self-heating correction that grows with relay on-time and is removed in one step at relay-off. While heating, the device then regulates on a value that is about 0.3 °C lower than its own idle baseline, and right after relay-off it reads about 0.9 °C higher. With a ±0.2 °C control threshold that is larger than the control band. In external temperature mode (value fed from the SNZB-02P) the reported temperature follows the fed value exactly and there is no step at relay-off (30 min heating run). So that is a workaround, but it needs one extra sensor per room. Requests for the firmware:
I can provide the logs at 10 s resolution. If this PR is the wrong place, tell me where SONOFF prefers such reports and I will move it. |
|
@philippop thanks for the detailed report and the side-by-side measurements, very helpful. This is related to the device's internal temperature compensation for heat generated while the relay is active. We've shared your findings with our firmware team and plan to optimize the compensation strategy in the next update so the transition after relay-off is smoother. Your suggestions have also been forwarded for evaluation. |
|
Thanks for the quirk @viys. I've observed that with my device on firmware 0x00001004 (4100) the setpoint drops to exactly 5C at 00:00 local every night, even though the schedule read back from the device has 16C for the 00:00 slot. The same behaviour is reported on Zigbee2MQTT (Koenkk/zigbee2mqtt#33317), so I suspect a possible a firmware bug and not the quirk. |
|
@jeverley Thanks for the report. We've confirmed this is a firmware bug: at midnight, the end of the previous day's last slot can override the new 00:00 slot, so the setpoint falls back to 5°C until the next transition. We'll fix it as soon as possible. |
|
@jeverley @philippop Quick update: both issues you reported are fixed in firmware 1.0.5, which we're planning to release this week.
Thanks to you both for the detailed reports and measurements, they made these a lot easier to track down. |
|
@viys thank you, that was fast. I did not expect a fix within a week. I will repeat the same measurement on 1.0.5 (SNZB-02P beside the thermostat, 60 min heating, 10 s sampling around relay-off) and post the before/after numbers here. One question: how will 1.0.5 be distributed for ZHA? The public index at |
|
@philippop Thanks a lot for your support! A SONOFF bridge isn't the only way to get this OTA update. You can also update over Bluetooth with the eWeLink app:
We'll also submit the 1.0.5 OTA image to both ZHA and Z2M this week. |
|
Hi @viys , I've uncovered a bug in the current quirk version's device work mode, issue outlined below: Device work mode shows Manual after any Reading Thermostat The same happens 6 to 15 seconds after every HA start or ZHA reload, when ZHA reads the climate attributes. I've seen it 17 times on two thermostats over four days, always with no user or automation context in the logbook. Cause:
Reports from the device go straight to Suggested fix: convert in one place only. For example, drop the |
|
@jeverley Thanks for reporting this. I’ve fixed the duplicate |
|
Hi, and thanks for working on this quirk! I tried it on my TP-WGZBA (firmware 0x00001005) and most of it works nicely: display brightness, frost protection, the weekly schedule (apply and fetch both round-trip) and the switches I tried. Three things don't work for me, though. The device rejects the writes with
Nothing changed on the device after the failed writes (holiday mode stays off, work mode still Manual). One more thing from the startup log: Additional question: Happy to test anything else or provide more logs if that helps. |
|
@cooki371 Thanks for testing and reporting this. The display default page, valve anti-stuck schedule, and holiday mode controls are newly added features. They will be supported in firmware version 1.0.6 (0x00001006), which has not been released yet and is planned for a future release. |
Proposed change
Add support for the SONOFF TP-WGZBA thermostat.
The quirk replaces the device thermostat and manufacturer-specific private cluster, exposes the device controls and diagnostics as ZHA entities, and encodes the device-specific weekly schedule and temporary-mode commands. It also includes behavior tests for entity creation, system-mode handling, schedule parsing/encoding, and write failure handling.
Additional information
The device uses manufacturer code
0x1286and private cluster0xFC11.The imports include compatibility fallbacks for older Home Assistant/ZHA releases. The primary target is the current quirk builder API, while the fallback was verified with Home Assistant 2026.3.3.
Full-suite testing completed with two unrelated pre-existing Tuya time-payload failures:
tests/test_tuya.py::test_moes[MoesHY368_Type1]tests/test_tuya_mcu.py::test_tuya_mcu_set_time[TuyaDoubleSwitchDimmer]Device diagnostics
Diagnostic dump provided by the reporter:
zha-01KY9HWXPG21KE9QBDGQ6YABRW-SONOFF TP-WGZBA-98d70e73f61912a31a5ea9db77861c38.json
The dump was collected from Home Assistant 2026.3.3 with ZHA 1.0.2. It reports
quirk_applied: true,issues: [], and the expected thermostat endpoint0x0201plus private cluster0xFC11. The original JSON should be attached to this section through the GitHub PR page.Checklist
pre-commitchecks pass / the code has been formatted using Black