Skip to content

Conversation

TheJulianJES
Copy link
Collaborator

@TheJulianJES TheJulianJES commented Nov 28, 2023

Proposed change

Adds a constant divisor attribute for the Innr SP240 plug for the Metering cluster.
It also fixes the divisors for other plugs and cleans everything up a bit.

Additional information

Addresses #2781. The comment in that issue is still relevant though.

Note: The SP-234 apparently has ac_current_divisor set correctly to 1000 already. We're doing that again in our EM cluster now.
The original quirk just set power divider to 1. Apparently it was 10 before (reported by original quirk creator).
Z2M code comments mentions that ac_current_divisor wasn't present on some devices though, hence why we're always overriding it now.
EDIT: It seems like it's not present (correctly) on older firmware versions. Hence this PR adds it always.

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

@TheJulianJES TheJulianJES added the bugfix This PR fixes a bug label Nov 28, 2023
Copy link

codecov bot commented Nov 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (dev@d30dac2). Click here to learn what that means.
Report is 1 commits behind head on dev.

Additional details and impacted files
@@          Coverage Diff           @@
##             dev    #2782   +/-   ##
======================================
  Coverage       ?   87.34%           
======================================
  Files          ?      286           
  Lines          ?     8829           
  Branches       ?        0           
======================================
  Hits           ?     7712           
  Misses         ?     1117           
  Partials       ?        0           

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

@TheJulianJES TheJulianJES changed the title Fix Metering divisor for Innr SP240 plug Fix Metering divisor for Innr SP240 plug, improve other plugs Nov 29, 2023
@TheJulianJES TheJulianJES changed the title Fix Metering divisor for Innr SP240 plug, improve other plugs Fix energy and current divisors for Innr plugs, clean up Nov 29, 2023
@TheJulianJES TheJulianJES merged commit d35fc05 into zigpy:dev Nov 29, 2023
elupus pushed a commit to elupus/zha-device-handlers that referenced this pull request Jan 17, 2024
* Fix Metering divisor for Innr SP240 plug

* Use `CustomCluster` for Innr 0xE001 manufacturer cluster

This is to avoid test failure

* Add docstring for `InnrCluster`

* Move `MeteringClusterInnr` to main innr file

This is so other devices will be able to use it too.

* Add constant with "innr" manufacturer name

* Replace local `MeteringCluster` with `MeteringClusterInnr` for SP120

* Change `ElectricalMeasurementCluster` for SP234 to use `AttributeDefs`

* Also use modified `MeteringClusterInnr` for SP234

See comment in zigpy#2781 zigpy#2781 (comment)

* Change `ElectricalMeasurementCluster` for SP120 to use `AttributeDefs`

* Improve comment for SP234 plug

* Slightly update comment

* Align comments, class name with other Innr plug quirks

* Move EM cluster classes into main Innr file to fix current divider

* Update comment
lgraf pushed a commit to lgraf/zha-device-handlers that referenced this pull request May 6, 2024
* Fix Metering divisor for Innr SP240 plug

* Use `CustomCluster` for Innr 0xE001 manufacturer cluster

This is to avoid test failure

* Add docstring for `InnrCluster`

* Move `MeteringClusterInnr` to main innr file

This is so other devices will be able to use it too.

* Add constant with "innr" manufacturer name

* Replace local `MeteringCluster` with `MeteringClusterInnr` for SP120

* Change `ElectricalMeasurementCluster` for SP234 to use `AttributeDefs`

* Also use modified `MeteringClusterInnr` for SP234

See comment in zigpy#2781 zigpy#2781 (comment)

* Change `ElectricalMeasurementCluster` for SP120 to use `AttributeDefs`

* Improve comment for SP234 plug

* Slightly update comment

* Align comments, class name with other Innr plug quirks

* Move EM cluster classes into main Innr file to fix current divider

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

Labels

bugfix This PR fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant