Skip to content

Conversation

@jeverley
Copy link
Contributor

@jeverley jeverley commented Nov 17, 2025

Proposed change

Adds support for MatSeePlus PJ-1203A 2 CT clamp Energy Meter.

Addresses Device Support Requests

Simplifies original pull requests

Separated from other Tuya devices to isolate logic handling the late flow reporting behaviour summarised below:

There is a known issue on the _TZE204_81yrt3lo (with appVersion 74, stackVersion 0 and hwVersion 1).
The energy_flow datapoints are (incorrectly) emitted during the next update. This is quite problematic
because that means that the direction can be inverted for up to update_frequency seconds.

More detail in the Zigbee2MQTT tuya.ts device handler

The quirk makes use of common power value signing logic for both device variations (combining power and energy flow DP values), however the mitigation for the late energy flow bug is disabled by default.

This is because it is not required in the _TZE284 device revision (sharing the same data points, but reporting the correct direction in the current interval), nor is it required if the _TZE204 device is used to measure power that always flows in the same direction.

Exposes Electrical Measurement entities

  • Power A
  • Power B
  • Total Power
  • Current A
  • Current B
  • Power Factor A
  • Power Factor B
  • Voltage (measured from device power source)
  • AC Frequency (measured from device power source)

Exposes Metering entities

  • Current Summation Delivered A
  • Current Summation Delivered B
  • Current Summation Received A
  • Current Summation Received B

Exposes configuration entities

  • Calibrate reported values, occurs on device (0-200% adjustment)
  • Reporting interval (5-60 seconds)
  • Energy flow report delay mitigation (disabled by default)

Additional information

  • Users of the original draft v1/v2 quirks will need to remove and re-add devices to remove redundant entities.

Checklist

@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.32%. Comparing base (1e5953b) to head (cad3859).
⚠️ Report is 3 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #4498      +/-   ##
==========================================
+ Coverage   92.24%   92.32%   +0.08%     
==========================================
  Files         369      372       +3     
  Lines       12094    12228     +134     
==========================================
+ Hits        11156    11290     +134     
  Misses        938      938              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeverley jeverley marked this pull request as ready for review November 17, 2025 20:42
@jeverley jeverley changed the title MatSeePlus ts0601 _TZE204_81yrt3lo and _TZE284_81yrt3lo V2 quirk MatSeePlus Energy Meter TS0601 _TZE204_81yrt3lo and _TZE284_81yrt3lo V2 quirk Nov 17, 2025
@jeverley jeverley changed the title MatSeePlus Energy Meter TS0601 _TZE204_81yrt3lo and _TZE284_81yrt3lo V2 quirk Tuya PJ-1203A MatSeePlus Energy Meter (TS0601 _TZE204_81yrt3lo/_TZE284_81yrt3lo) v2 quirk Nov 19, 2025
@jeverley
Copy link
Contributor Author

Quirk itself validated working in all scenarios with the last commit - will update the validate the tests cases tomorrow prior to making a final commit (haven't got access to my dev container today to automate testing these).

…o 2 CT Bidirectional Energy Meter

- Removed the over-engineered channel logic implemented in previous v2 PR
- ElectricalMeasurement and Metering clusters just handle reporting, no calculations
- Implements interval based signing logic to ensure the correct energy flow value is used to sign power
- Ensures that the calculated total (replacing DP 115 due to a device bug in _TZE204) uses the correct pairing of power values
- Allows selective enablement of the late flow report bug mitigation (off by default)
@jeverley jeverley force-pushed the ts0601_ct_power_matseeplus branch from d955c00 to 2dc9886 Compare November 21, 2025 10:10
@jeverley
Copy link
Contributor Author

Ready for review, let me know of any issues👍

…simplify _process_power_and_energy_flow. No functional change in outcome
…uces code repetition

- Improve clarity of comments
- Use TuyaEnergyFlow type value for _align_value_with_energy_flow comparision
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant