Skip to content

Add initial Ubisys support#4651

Draft
TheJulianJES wants to merge 21 commits intozigpy:devfrom
TheJulianJES:tjj/ubisys_1
Draft

Add initial Ubisys support#4651
TheJulianJES wants to merge 21 commits intozigpy:devfrom
TheJulianJES:tjj/ubisys_1

Conversation

@TheJulianJES
Copy link
Collaborator

@TheJulianJES TheJulianJES commented Jan 13, 2026

DO NOT MERGE

Proposed change

This adds support for most Ubisys devices. It currently does the following:

  • Correctly sets the power/voltage/current/frequency divisors (different for S1-R) that are not set on the device.
  • Adds device triggers for default configuration of inputs (most devices support toggle switches in their default config).
  • Prepares quirk IDs/exposed features for ZHA to poll the SmartEnergy cluster attributes.
  • Hides duplicated power entities (needs fixing in ZHA to still poll other EM attributes!).

Additional information

  • Weirdly enough, one device (S1-R (5601)) requires entirely different divisors, so I'll need to check if all devices are running the latest firmware. If not, update all of them and then check if the newer firmware version requires different divisors.
    • It would be good if Ubisys can fill-out the issue form in the zigpy-ota repo per image/device that needs updating.
      This would already make the updates available in Home Assistant (now).
  • The devices expose the power attribute on the EM cluster active_power and total_active_power, but this cluster does not support attribute reporting at all. All relevant attributes on this cluster are polled by default in ZHA, but only when the active_power entity is enabled.
  • The devices also expose the power on the SE cluster instantaneous_demand. This attribute supports attribute reporting, so we should only use this one primarily and disable the others by default.
    • But we need to figure out how to keep polling enabled for the other EM attributes (current, power factor, frequency, voltage, apparent power).
  • We also need to match the polled SE entity in ZHA against the feature/hint/quirk_id added here (or should all plugs with that attribute be polled, since it's not reportable per spec? But InstantaneousDemand is also not reportable per spec, but is reportable for this device..? This needs to be checked further).

Related PRs and issues

Supersedes:

Related:

TODO:

  • address TODOs in code (polling EM cluster properly, even if active power entity is disabled)
  • change suggested display precision for instantaneous demand for Series 2 / S1-R (5601)
  • check how to best disable the duplicated active power entities on EM cluster
  • check firmware and see if firmware updates change divisors
  • check if cover module J1 works properly (does it actually support tilt, like currently exposed?)
  • check if we can somehow add LD6 config without needing to use Ubisys app via Zigbee direct (which does work!)
  • add device triggers based on toggle command (only?) (edit: added triggers for default device config)
  • add input configuration?
  • add support for other Ubisys devices

Device diagnostics

TODO

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works
  • Device diagnostics data has been attached

@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.35%. Comparing base (40b41de) to head (c0d7065).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #4651      +/-   ##
==========================================
+ Coverage   92.32%   92.35%   +0.03%     
==========================================
  Files         371      377       +6     
  Lines       12190    12240      +50     
==========================================
+ Hits        11254    11304      +50     
  Misses        936      936              

☔ 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.

@TheJulianJES TheJulianJES added this to ZHA Jan 14, 2026
@TheJulianJES TheJulianJES moved this to In progress in ZHA Jan 14, 2026
@Hedda
Copy link
Contributor

Hedda commented Jan 19, 2026

@TheJulianJES
Copy link
Collaborator Author

TheJulianJES commented Feb 19, 2026

More advanced functionality (like input configuration and detached mode) will be added in a separate PR.
See this branch for some experimental changes: TheJulianJES/zha-device-handlers@tjj/ubisys_1...TheJulianJES:zha-device-handlers:tjj/ubisys_1_testing

These changes all rely on a LocalDataCluster, which isn't great, but it's the best we can do right now. It allows us to use quirks v2 entities and we don't need to leak any of this into ZHA.
When we have a better API for this in the future, kind of similar to LocalDataClusters, just without the fake cluster and ZCL stuff, we can migrate these quirks to that, but keep the same quirks v2 entities. So, there'd be no change for the user then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants

Comments