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 cloud connection support #16124

Merged
merged 4 commits into from Feb 14, 2024
Merged

Conversation

theater
Copy link
Contributor

@theater theater commented Dec 27, 2023

Besides the direct connection to the local wi-fi module that we started to support with OpenHAB 4.1, now the binding will support also a new type - cloud connect. The documentation for the API can be obtained from the Solax web portal even though it's not very thorough.

========

Implemented a new thing type - cloud connect inverter.

Refactored the packages, model and classes to reflect that now we have two different ways to retrieve the data.

The common logic is extracted in the AbstractSolaxHandler.
The handler now requires two method implementations with the specific logics for the Local and Cloud connection:

  • createConnector() - specific for the two different types of HTTP connection.
  • updateFromData() - method that maps from the response to the specific thing type channels.

README is updated with the new type and the examples are up to date. Made a small corrections to other parts in the README.

I'm not sure if the thing type is new if I need to create an update instructions. I would expect to NOT need it.

@lolodomo lolodomo added the enhancement An enhancement or new feature for an existing add-on label Dec 28, 2023
@theater theater force-pushed the retrieval_from_cloud branch 3 times, most recently from f6a9c45 to 1416cc3 Compare January 14, 2024 15:24
@theater theater requested a review from jlaur January 15, 2024 16:10
@theater theater added the awaiting other PR Depends on another PR label Jan 22, 2024
@theater
Copy link
Contributor Author

theater commented Jan 22, 2024

Depends on #16248 and has to be rebased on it once it's merged into main

* Initial rearrangement of classes and cloud response in test
* Refactoring of packages and initial version of retrieval of data
* Test for parsed raw data
* Move the enums for status and type to the root model package
* Another package refactoring + basic handler functionality
* Handler works now, most build warnings removed
* Add initial exception handling during the update
* Small code style fixes and channel for inverter status
* Add all defined channels from the XML in the handler
* Add translations of the status and support for zones and I18N
* Update readme
* Fix error handling in the Cloud connection handler
* Manual fixes openhab#16249 and openhab#16214 due to refactored packages and classes
* Fix the headers for the new / refactored / moved classes for 2024

Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
@theater theater removed the awaiting other PR Depends on another PR label Feb 12, 2024
Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
@theater
Copy link
Contributor Author

theater commented Feb 12, 2024

I have rebased everything on top of the change from the other PR which resulted in a very unpleasant fix of conflicts.
Now the PR is ready for a review.

Hope someone finds time to review it before any other changes in main branch happen, so I don't have to do this again. It's very time consuming due to a lot of refactoring (including a package refactoring) in this PR.

Best regards,
Konstantin

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.

Did a full review. Most are minor comments. I also think the properties file lacks some values, so it is good to clean/re-run i18n plugin to be sure all are added correctly.

As this is on top of the previous PR and some conflicts have been resolved, i think it would be wise to spend some extra time on testing as we want to prevent regression.

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

theater commented Feb 13, 2024

Hi @lsiepel, thanks very much for the fast review!

I have fixed most of the comments, for some I left my own comments for clarification.

If you decide to meanwhile merge it, please hold until I do some integration testing of the changes, related to the exception management, so I don't pass any missed runtime exception... maybe I should just catch any exception in the AbstractSolaxHandler.retrieveData() method so I ensure another schedule attempt afterwards...

Cheers,
Konstantin

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

theater commented Feb 14, 2024

Hi. I changed the requested minimum refresh interval to 9s, even though from practical perspective it doesn't make sense to refresh lower than 30-60 seconds, because the cloud API data gets updated from the local module once on each 5 minutes. :)
I checked the connectivity and for a whole night no issues (before when there was an issue it stopped working after an hour or so max), so I would expect also that the exception handling is OK and we're OK to merge now, unless you see anything else to add.

Thanks a lot for the review!

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 7434a38 into openhab:main Feb 14, 2024
3 checks passed
@lsiepel lsiepel added this to the 4.2 milestone Feb 14, 2024
@lsiepel lsiepel changed the title [solax] Cloud connection support [solax] Add cloud connection support Feb 14, 2024
@theater theater deleted the retrieval_from_cloud branch February 15, 2024 09:20
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
* Initial rearrangement of classes and cloud response in test

Signed-off-by: Konstantin Polihronov <polychronov@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

3 participants