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 Victron inverter #202

Merged
merged 37 commits into from
Oct 25, 2024
Merged

Conversation

mduffin95
Copy link
Contributor

@mduffin95 mduffin95 commented Sep 20, 2024

Pull Request

Description

Adds support for Victron inverters.

How Has This Been Tested?

I've got access to a Victron system so I've been able to test it against their API. I've also included some response data from their API and used it to write a small test.

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

pyproject.toml Outdated Show resolved Hide resolved
@mduffin95 mduffin95 changed the title Topic/victron Add Victron inverter Sep 20, 2024
@mduffin95 mduffin95 marked this pull request as ready for review September 20, 2024 22:26
@peterdudfield
Copy link
Contributor

hi @mduffin95

Thanks so much for this. Really appreciate you putting in the effort to put this in.
@zakwatts or @aryanbhosale do you fancy reviewing this?

Thanks

@aryanbhosale
Copy link
Member

hi @mduffin95

Thanks so much for this. Really appreciate you putting in the effort to put this in. @zakwatts or @aryanbhosale do you fancy reviewing this?

Thanks

LGTM!
@mduffin95 would be nice if you could update the .env.example file from this PR

@mduffin95
Copy link
Contributor Author

Sorry for the late response, I've been away.

@aryanbhosale I've updated the pr with your suggested change

@aryanbhosale
Copy link
Member

aryanbhosale commented Oct 14, 2024

Sorry for the late response, I've been away.

@aryanbhosale I've updated the pr with your suggested change

Thank you, @peterdudfield i guess this could be merged now

@peterdudfield
Copy link
Contributor

Sorry for the late response, I've been away.
@aryanbhosale I've updated the pr with your suggested change

Thank you, @peterdudfield i guess this could be merged now

Thanks, yea just one comment, we are trying to work out, about this repo - https://github.com/mduffin95/vrm-api-python-client

@aryanbhosale
Copy link
Member

Sorry for the late response, I've been away.
@aryanbhosale I've updated the pr with your suggested change

Thank you, @peterdudfield i guess this could be merged now

Thanks, yea just one comment, we are trying to work out, about this repo - https://github.com/mduffin95/vrm-api-python-client

Yea i think opening an Issue and a PR in their original repo is a good idea, but i doubt theyll respond since the last activity was an issue that was opened 2 years back

@peterdudfield
Copy link
Contributor

Sorry for the late response, I've been away.
@aryanbhosale I've updated the pr with your suggested change

Thank you, @peterdudfield i guess this could be merged now

Thanks, yea just one comment, we are trying to work out, about this repo - https://github.com/mduffin95/vrm-api-python-client

Yea i think opening an Issue and a PR in their original repo is a good idea, but i doubt theyll respond since the last activity was an issue that was opened 2 years back

Hm,yea, and it does say its not maintained. maybe some different options

  1. Create PR into orginal repo from https://github.com/mduffin95/vrm-api-python-client
  2. Create a vrim-api-python-client in OCF repos and publish to pypi
  3. Pull in relevant code to this repo, perhaps we dont actually need that much

I would defiantly do 1. so other people can see the improvements. Im not sure about 2. or 3., probably depends how much code is needed for 3.

I think separately we should put this a an optional requirements in the pyproject.toml as most people dont need to install this.

@mduffin95
Copy link
Contributor Author

mduffin95 commented Oct 19, 2024

@peterdudfield @aryanbhosale

The original repo hasn't accepted any new PRs for years so I don't think 1 will work. IMO 2 is a better option than 3 for a couple of reasons:

  • It allows others to use a working python client for the Victron API for other purposes
  • It minimises the amount of vendor-specific code within this repo

I personally think it's better to reduce the scope of this repo to not include too much low-level API connectivity code. It keeps this repo clearly focussed on forecasting.

I think separately we should put this a an optional requirements in the pyproject.toml as most people dont need to install this.

☝️ I can make this change now.

@aryanbhosale
Copy link
Member

@peterdudfield @aryanbhosale

The original repo hasn't accepted any new PRs for years so I don't think 1 will work. IMO 2 is a better option than 3 for a couple of reasons:

  • It allows others to use a working python client for the Victron API for other purposes
  • It minimises the amount of vendor-specific code within this repo

I personally think it's better to reduce the scope of this repo to not include too much low-level API connectivity code. It keeps this repo clearly focussed on forecasting.

I think separately we should put this a an optional requirements in the pyproject.toml as most people dont need to install this.

☝️ I can make this change now.

Sounds good to me

Copy link

codecov bot commented Oct 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.28%. Comparing base (5093843) to head (ec2da9d).
Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #202      +/-   ##
==========================================
+ Coverage   61.76%   62.28%   +0.51%     
==========================================
  Files          25       25              
  Lines        1020     1034      +14     
==========================================
+ Hits          630      644      +14     
  Misses        390      390              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@peterdudfield
Copy link
Contributor

Sounds. I'll create a new repo and @mduffin95 I'll make you to admin of it. I'm happy to do the pypi project things if you get the code ready

@peterdudfield
Copy link
Contributor

Sounds. I'll create a new repo and @mduffin95 I'll make you to admin of it. I'm happy to do the pypi project things if you get the code ready

Its created here https://github.com/openclimatefix/vrm-api-python-client. @mduffin95 ive invited you to be an admin on this repo. Do you want to do any changes, and I can then sort the pypi stuff out

@peterdudfield
Copy link
Contributor

Great stuff, thanks @mduffin95 for this. I miht merge into a development branch, to make sure all tests work e.t.c

@peterdudfield peterdudfield changed the base branch from main to development October 25, 2024 14:11
@peterdudfield peterdudfield merged commit 3f60fb7 into openclimatefix:development Oct 25, 2024
1 of 2 checks passed
peterdudfield added a commit that referenced this pull request Oct 25, 2024
* Add Victron inverter (#202)

* wip

* wip

* solarman

* update token

* update inverters

* undo some changes

* add docstring

* mock inverter docstring

* remove dotenv

* update givenergy

* enphase

* try to fix tests running twice

* delete event

* pr comments

* revert workflow changes

* split inverters into separate modules

* import

* Revert "import"

This reverts commit f9f3c5f.

* Revert "split inverters into separate modules"

This reverts commit 94a9e70.

* add pydantic_settings

* set config within settings classes

* add dependency

* add victron

* use named argument

* start and end times

* add a line to the documentation

* dependencies

* add test

* add test

* update script

* add username and password to example env variable file

* move vrmapi dependency to optional-dependencies

* comment

* update to use ocf_vrmapi

* use issue/pip-all branch

* add all to project.optional-dep

* update import

---------

Co-authored-by: Matthew Duffin <[email protected]>
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.

3 participants