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

[solax] Add support for Solax X3MIC / G2 inverter and workmode channel #16248

Merged
merged 6 commits into from Feb 10, 2024

Conversation

realthk
Copy link
Contributor

@realthk realthk commented Jan 9, 2024

Support for my Solax X3MIC / G2 inverter, and include workmode which is useful if the inverter cannot work continuously (for example our area very often has over-voltage problem)

…xisting X1, X3 also

Signed-off-by: Henrik Tóth <realthk@gmail.com>
@realthk realthk requested a review from theater as a code owner January 9, 2024 18:01
@lsiepel lsiepel changed the title Support for Solax X3MIC / G2 inverter, and workmode channel for the e… [solax] Add support for Solax X3MIC / G2 inverter and workmode channel Jan 9, 2024
@lsiepel lsiepel added the enhancement An enhancement or new feature for an existing add-on label Jan 9, 2024
@theater
Copy link
Contributor

theater commented Jan 10, 2024

Hi,
Thanks for the contribution!
I'll have a review when I have some free time as an initial creator of the binding.

Unfortunately additional review maybe needed by some of the openhab-addon maintainers because I don't have a merge permissions.

Cheers,
Konstantin

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/solax-local-direct-and-cloud-connect-binding/146326/97

Copy link
Contributor

@theater theater left a comment

Choose a reason for hiding this comment

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

Hi.
Things look pretty much OK to me. I added some comments.
What is missing is an update instructions for the added channels.
See how it's done in the local_connect_inverter_type_update.xml
I don't request changes as I'm not an official reviewer so I added only a comments :)

Cheers,
Konstantin

@theater theater requested a review from jlaur January 15, 2024 16:09
@realthk
Copy link
Contributor Author

realthk commented Jan 15, 2024

Thanks Konstantin!
Sorry for the late reply, I'm quite busy with my daily job now, and have to admit, OpenHab is not my main system, only trying it for curiosity. I have my Solax X3MicG2 inverter integrated into Home Assistant by transforming data fetched by REST with Jinja expressions in simple template sensors.
Also, besides OpenHAB is new for me, I have no experience with Java at all, just duplicated an original class for other inverter, and modified where and how it seemed logical until it was working fine on my system. So this is the explanation why I used Units.ONE, and you're perfectly right, I also felt it fishy, but had no better idea for passing a unit-less state number. Same goes for enum and translation, I agree completely, just did not know how to do better.
As for the two temperature sensors, I could not find any documentation, so yes, that is the reason for just using numbers. From my experience, temp1 seems to be the more useful, covering a greater range, so that is the one I'm using, displaying on my dashboard. But of course, it could be quite different with another Solax model...
Here is a recent day, temp2 did not even start below zero (even though it was cold in the morning, temp1 was about right), and both fall back to 0 at once when the inverter does not work:

Opera Snapshot_2024-01-11_210154_192 168 8 123

@theater
Copy link
Contributor

theater commented Jan 16, 2024

For a non-Java developer you did really well. :) I guess some programming experience you still have :)

@theater
Copy link
Contributor

theater commented Jan 16, 2024

Btw if you don't have the capacity to do the requested changes, maybe you could give me permissions for this branch and I can do them for you. I expect that the reviewer will also request changes but it's up to you...

@realthk
Copy link
Contributor Author

realthk commented Jan 16, 2024

Thanks, I’d appreciate that!
(yes, I mostly work on PHP projects, and as a hobby in Python, since Home Assistant)

Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
@theater
Copy link
Contributor

theater commented Jan 19, 2024

@realthk I've added two commits with the refactoring I was talking about and also added the update instructions.
Before I start I have also created a branch with the same name, ending with _backup, so you can go anytime to your original changes.
Would appreciate if you could test my changes whenever is possible for you.

@realthk
Copy link
Contributor Author

realthk commented Jan 20, 2024

@theater Just did a rebuild on your changes, and it works fine, thank you very much!

@theater
Copy link
Contributor

theater commented Jan 20, 2024

OK. Great then the PR is ready for a review. Please tag me if someone requests some changes, so I can have a look and implement them...

Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

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

About the two channels inverter-workmode and inverter-workmode-code what is the benefit of seperating these? They seem to be allways in sync.
I guess it would be fine to drop the non-code variant and supply a option list with value/label pair: https://www.openhab.org/docs/developer/addons/config-xml.html#xml-structure-for-configuration-descriptions

Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
@realthk
Copy link
Contributor Author

realthk commented Jan 20, 2024

The reason why I thought it might be useful to have a text sensor, if not all Solax inverters use the same workmode codes for the same status, then it is possible to translate these.
But after googling (in this not so well documented subject) it seems the only difference is how many codes exists on a certain model but the most important first few statuses seem to share the same code for all inverter models, so the code might be enough, indeed.

@theater
Copy link
Contributor

theater commented Jan 20, 2024

The reason why I thought it might be useful to have a text sensor, if not all Solax inverters use the same workmode codes for the same status, then it is possible to translate these. But after googling (in this not so well documented subject) it seems the only difference is how many codes exists on a certain model but the most important first few statuses seem to share the same code for all inverter models, so the code might be enough, indeed.

Actually I have added all the statuses that I know about (from the cloud API document). Hopefully they're documented well enough...

Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
@theater
Copy link
Contributor

theater commented Jan 29, 2024

@jlaur, when you have the capacity and your schedule permits it, could we proceed as I think I have covered most if not all the concerns.
Not trying to push you or anything, just want to make sure that you're not awaiting some changes from my end...

Cheers,
K.

@jlaur
Copy link
Contributor

jlaur commented Feb 1, 2024

@jlaur, when you have the capacity and your schedule permits it, could we proceed as I think I have covered most if not all the concerns. Not trying to push you or anything, just want to make sure that you're not awaiting some changes from my end...

I assume you mean @lsiepel? 🙂

@theater
Copy link
Contributor

theater commented Feb 2, 2024

@jlaur, when you have the capacity and your schedule permits it, could we proceed as I think I have covered most if not all the concerns. Not trying to push you or anything, just want to make sure that you're not awaiting some changes from my end...

I assume you mean @lsiepel? 🙂

Apologies, mate! Not sure why I messed that up. Excuse me.

@theater
Copy link
Contributor

theater commented Feb 8, 2024

@lsiepel could we continue the review when you have some time?

@lsiepel
Copy link
Contributor

lsiepel commented Feb 8, 2024

@lsiepel could we continue the review when you have some time?

Sure! Hopefully this weekend, might be later. Have some busy days.

@theater
Copy link
Contributor

theater commented Feb 9, 2024 via email

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM

@lsiepel lsiepel merged commit d1caa31 into openhab:main Feb 10, 2024
3 checks passed
@lsiepel lsiepel added this to the 4.2 milestone Feb 10, 2024
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
openhab#16248)

* Support for Solax X3MIC / G2 inverter, and workmode channel for the existing X1, X3 also
* Add update instructions and make raise the target version to 1
* Refactor the workmode to be enum instead of string constants

Signed-off-by: Henrik Tóth <realthk@gmail.com>
Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants