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: "State of Operation", "Float voltage" and "Absorption Voltage" #1576

Open
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

SW-Niko
Copy link

@SW-Niko SW-Niko commented Jan 23, 2025

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?

@@ -26,6 +26,15 @@ class Stats {
// sum of today's yield of all MPPT charge controllers in Wh
virtual std::optional<float> getYieldDay() const;

// state of operation from the first available controller
virtual std::optional<uint8_t> getStateOfOperation() const { return std::nullopt; };
Copy link
Member

Choose a reason for hiding this comment

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

can we return an enum instead of a number?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, sure.

@@ -26,6 +26,20 @@ class Stats {
// sum of today's yield of all MPPT charge controllers in Wh
virtual std::optional<float> getYieldDay() const;

// state of operation from the first available controller
enum class StateOfOperation : uint8_t {
Copy link
Member

Choose a reason for hiding this comment

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

using victron values as the base of the enum does not match our wish to have a generic solarcharger implementation. Having all victron related enum cases is fine but the mapping from a number to the enum case should be implementation specific.

Copy link
Author

Choose a reason for hiding this comment

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

I reduced the cases to the minimum. Actual I just need Off, Bulk, Adsorption and Float. All other states will be handled as Various.

@SW-Niko SW-Niko requested a review from AndreasBoehm January 26, 2025 16:04
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