-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Conversation
@Koenkk I encountered 'Merging is blocked.' How can I proceed? |
src/lib/modernExtend.ts
Outdated
@@ -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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.reportingPowerType === "electrical" ? tz.electrical_measurement_power : tz.metering_power, | |
cluster === "electrical" ? tz.electrical_measurement_power : tz.metering_power, |
I mean this
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"});
There was a problem hiding this comment.
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 = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toZigbee = [ | |
const useMetering = args.power !== false && args.power?.cluster === "metering"; | |
toZigbee = [ |
Then use it below (to avoid having the same condition twice.
Thanks! |
#8901 (comment)