Skip to content

Extract drivers boilerplate code to common#115

Merged
jtebbens merged 3 commits intojtebbens:masterfrom
DCSBL:extract-common-code
Mar 30, 2025
Merged

Extract drivers boilerplate code to common#115
jtebbens merged 3 commits intojtebbens:masterfrom
DCSBL:extract-common-code

Conversation

@DCSBL
Copy link

@DCSBL DCSBL commented Mar 30, 2025

The API for HomeWizard energy is the same so lot of code can be reused.

This PR moves the driver of v1 and v2 devices into a common folder so they can be reused. We can keep all the code changes for all drivers at one location, instead of keeping them updated one-by-one. No logic changes in this PR, only moved some code

For now it does not seem we need unique logic per device, if we need that we can see how we can fix that.

One small drawback: This removes the 'model name' of the P1 Meter during config. It now just shows the serial ID. I don't think this is a big issue.

@DCSBL DCSBL marked this pull request as ready for review March 30, 2025 15:57
@jtebbens
Copy link
Owner

Ok, I understand the reason. It has grown this way when one by one these hardware devices found the market. I will have a look and merge the code.

@DCSBL
Copy link
Author

DCSBL commented Mar 30, 2025

Nice!

I want to add the same type of flow for v1, but that would mean tweaking 5 drivers which feels like a landmine 😇. This feels like a nice step in between :)

@jtebbens jtebbens merged commit 0f7b587 into jtebbens:master Mar 30, 2025
2 checks passed
@DCSBL DCSBL deleted the extract-common-code branch March 30, 2025 16:13
@jtebbens
Copy link
Owner

Ok merged, you might have noticed that I aligned the PIB pairing with P1.

@DCSBL
Copy link
Author

DCSBL commented Mar 30, 2025

Yeah that was awesome, thanks for that 🎉

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