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 Peak Shaving work mode for H3 Inverters & H1 (Gen 2) #737

Merged
merged 9 commits into from
Jan 22, 2025

Conversation

FozzieUK
Copy link
Contributor

Adds the Peak Shaving work mode in the select for H3 set Inverters & H1 (Gen 2)

See #699

@FozzieUK
Copy link
Contributor Author

If anyone can assist with this -

This is for a small change to the workmode select for the H1_G2 and H3_SET it has been tested in operation ok but when doing the PR all of the tests are ok with the exception of pytest on the Inv.H3 - when I run a pytest --snapshot-update it fails with this error (as if the test script itself is breaking) but only on the Inv.H3 ?

FAILED tests/test_entity_descriptions.py::test_entity_descriptions_for_model[Inv.H3] - RuntimeError: dictionary keys changed during iteration

…nging keys during iteration

added copy() to avoid the iteration changing the desired dict

The snapshot tests now run correctly
@FozzieUK
Copy link
Contributor Author

To avoid the runtime error i've had to make a change in test_entity_descriptions.py, the pytest snapshot now works correctly and the output in the inverter model tests is correct.

@FozzieUK
Copy link
Contributor Author

@canton7 Hi Antony would you please review this change - i've had a load of problems for what was only a minor change to the workmode select for the H3_SET to add 'Peak Shaving', and the pytest snapshots start to fail with a RuntimeError: dictionary keys changed during iteration.

When I looked more closely at the content of the existing tests I found that with work_mode select the test results were random and in the case of the H3_Pro incorrectly showing only 2 of the options - in the case of the Inv.H3 the snapshot crashed with the above error.

I've had to make a change in test_entity_descriptions.py changing from for k, v in d.items(): to for k, v in d.copy().items(): and the snapshots now run correctly (and i've verified each manually) but I would be grateful if you could check my logic !

@canton7
Copy link
Collaborator

canton7 commented Jan 22, 2025

Good catch on the test!

Thanks, looks good.

@canton7 canton7 merged commit 54da800 into nathanmarlor:main Jan 22, 2025
3 checks passed
@FozzieUK FozzieUK deleted the patch-4 branch January 23, 2025 12:18
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