-
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
Changes from 2 commits
6d3ec11
ca630d0
2d3b135
826f689
50a22de
e0765de
b09eec4
1e58561
5188356
ad839f1
af8f352
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1666,6 +1666,7 @@ interface MeterArgs { | |||||
configureReporting?: boolean; | ||||||
endpointNames?: string[]; | ||||||
fzMetering?: Fz.Converter; | ||||||
reportingPowerType?: "metering" | "electrical"; | ||||||
// applies only to electrical | ||||||
electricalMeasurementType?: "both" | "ac" | "dc"; | ||||||
voltage?: false | (MultiplierDivisor & Partial<ReportingConfigWithoutAttribute>); | ||||||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Can't we base this off the There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I mean this There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I see now. Thanks for clarifying. I will apply this immediately. |
||||||
tz.acvoltage, | ||||||
tz.accurrent, | ||||||
tz.currentsummdelivered, | ||||||
tz.currentsummreceived, | ||||||
tz.frequency, | ||||||
tz.powerfactor, | ||||||
]; | ||||||
delete configureLookup.seMetering.power; | ||||||
if (args.reportingPowerType === "electrical") delete configureLookup.seMetering.power; | ||||||
else delete configureLookup.haElectricalMeasurement.power; | ||||||
} else if (args.cluster === "metering" && args.type === "electricity") { | ||||||
if (args.power !== false) exposes.push(e.power().withAccess(ea.STATE_GET)); | ||||||
if (args.energy !== false) exposes.push(e.energy().withAccess(ea.STATE_GET)); | ||||||
|
@@ -2038,6 +2040,7 @@ export function electricityMeter(args?: ElectricityMeterArgs): ModernExtend { | |||||
powerFactor: false, | ||||||
status: false, | ||||||
extendedStatus: false, | ||||||
reportingPowerType: "electrical", | ||||||
...args, | ||||||
}; | ||||||
return genericMeter(args); | ||||||
|
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.
Then use it below (to avoid having the same condition twice.