-
-
Notifications
You must be signed in to change notification settings - Fork 916
Add meter plugin #21477
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 meter plugin #21477
Conversation
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.
Hey @andig - I've reviewed your changes - here's some feedback:
- plugin/meter.go calls registry.AddCtx but never imports a registry package—add the correct import or fully qualify the registry reference.
- In plugin/meter.go the imported meter/config package and the local variable both named
meter
can be confusing—consider a distinct alias (e.g.metercfg
) to avoid shadowing.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Hey @andig - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
||
var _ FloatGetter = (*meterPlugin)(nil) | ||
|
||
func (o *meterPlugin) FloatGetter() (func() (float64, error), error) { |
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.
issue (bug_risk): Type assertions in FloatGetter may panic if interface is not implemented.
The default case (Power) does not verify if o.meter implements api.MeterPower, which could cause a runtime panic. Use the 'ok' idiom for type assertions or ensure all cases are safely handled.
@andig
|
Bis uf die Einrückung deines soc, ja |
Nach einigen Versuchen hab ich es hinbekommen. Ohne Bei
|
Ups- im master behoben. |
passt, jetzt tut´s. Danke |
Fix #21467
Configure similarly to
charger
plugin, but specify measurement:More methods can be added if required, even setters are possible.