-
-
Notifications
You must be signed in to change notification settings - Fork 67
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: "State of Operation", "Float voltage" and "Absorption Voltage" #1576
Conversation
…e" from the Solar Charger
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.
Looks good now, thanks!
Only one last thing, please also adjust https://github.com/hoylabs/OpenDTU-OnBattery/blob/development/include/solarcharger/mqtt/Stats.h
I'm not sure what you mean. Add the new functions to the solar charger MPTT provider? |
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 think i know why the confusion about the MQTT stats came up.
Please don't put default declarations in the Stats.h base class. After this change the following sentence applies: All classes that inherit 'SolarChargers::Stats' need to implement all functions of the base class. In the case of the MQTT stats it will be necessary to implement the three new methods in the same fashion that you implemented them in DummyStats.h..
Ok, done. Hmm .... There must be some advantage to doing it this way. 🤔 |
Maybe i need to read more about abstract classes and virtual functions in C++ as well. |
The difference is that this way someone who implements a new solar charger provider is forced to think about how to implement these functions. Otherwise, their new solar charger provider class will have a pure virtual class and cannot be instantiated. The way it was before one could add a new solar charger provider class, derive from Stats ("implement the interface"), but could skip implementing these three functions, i.e., not think about that they exists and that they need to return something meaningful.
Actually, now that I think about it... They should be
and so on. It tells the compiler that the function will never have an implementation in the base class, forcing the behavior I described above. |
Thanks for the hint @schlimmchen! |
@schlimmchen @AndreasBoehm |
I'm not sure if I did it the right way.
I want to get the "State of Operation", "Float voltage" and "Absorption Voltage" from the victron charge controller.
But I don't want to force every solar charger provider to provide these functions.
If other provider (MPPT) support these functions, then other functions like the "Surplus" or the "Batterie Guard" should also work.
At least that was the idea behind.
Any suggestions?