Skip to content
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

Add configuration for the reporting type of power in electricityMeter… #8909

Merged
merged 11 commits into from
Mar 8, 2025

Conversation

shinasys
Copy link
Contributor

@shinasys
Copy link
Contributor Author

@Koenkk I encountered 'Merging is blocked.' How can I proceed?
Thanks.

@@ -1894,15 +1895,16 @@ function genericMeter(args?: MeterArgs) {
if (args.producedEnergy !== false) exposes.push(e.produced_energy().withAccess(ea.STATE_GET));
fromZigbee = [args.fzElectricalMeasurement ?? fz.electrical_measurement, args.fzMetering ?? fz.metering];
toZigbee = [
tz.electrical_measurement_power,
args.reportingPowerType === "electrical" ? tz.electrical_measurement_power : tz.metering_power,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we base this off the cluster parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a good idea at the moment. I can't find a suitable parameter in the cluster. Do you have any good methods in mind?
Thanks.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
args.reportingPowerType === "electrical" ? tz.electrical_measurement_power : tz.metering_power,
cluster === "electrical" ? tz.electrical_measurement_power : tz.metering_power,

I mean this

Copy link
Contributor Author

@shinasys shinasys Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean adding an argument such as 'both_meter' in the args.cluster parameter?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you want to do now, maybe we can do something like this?

power?: false | (MultiplierDivisor & Partial<ReportingConfigWithoutAttribute> & {cluster?: "metering" | "electrical"});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see now. Thanks for clarifying. I will apply this immediately.

@@ -1894,15 +1894,18 @@ function genericMeter(args?: MeterArgs) {
if (args.producedEnergy !== false) exposes.push(e.produced_energy().withAccess(ea.STATE_GET));
fromZigbee = [args.fzElectricalMeasurement ?? fz.electrical_measurement, args.fzMetering ?? fz.metering];
toZigbee = [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
toZigbee = [
const useMetering = args.power !== false && args.power?.cluster === "metering";
toZigbee = [

Then use it below (to avoid having the same condition twice.

@Koenkk Koenkk merged commit c05d482 into Koenkk:master Mar 8, 2025
4 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Mar 8, 2025

Thanks!

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.

2 participants