-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[mideaac] Initial Contribution #17395
Conversation
Thank you for creating this PR to contribute this binding. Have not looked at this PR yet, it may be of very good quality. But common review comments for new bindings are about thing structure (xml), naming convention and log levels. So you might double check those areas. |
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/best-air-conditioner-for-openhab-integration-in-2023/145852/65 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing. This seems to be a binding that has been used for a while. I left some initial comments to specific parts. Have not covered everything yet as i think some comments woudl otherwise be stacked. While looking at the comments you might also look at the bindingt structure, the discovery/handler/security folders seem to have some kind of overlap.
Personally i prefer to have a handler folder, and a api
or servcie
folder with everything related to the remote service. Usually the DTO-classes go in a api/dto
subfolder. This is meant to give some guidance and not necesairly as a strict rule.
...nding.mideaac/src/main/java/org/openhab/binding/mideaac/internal/handler/MideaACHandler.java
Outdated
Show resolved
Hide resolved
...inding.mideaac/src/main/java/org/openhab/binding/mideaac/internal/MideaACHandlerFactory.java
Outdated
Show resolved
Hide resolved
...ac/src/main/java/org/openhab/binding/mideaac/internal/discovery/MideaACDiscoveryService.java
Outdated
Show resolved
Hide resolved
...ac/src/main/java/org/openhab/binding/mideaac/internal/discovery/MideaACDiscoveryService.java
Outdated
Show resolved
Hide resolved
...ab.binding.mideaac/src/main/java/org/openhab/binding/mideaac/internal/security/TokenKey.java
Outdated
Show resolved
Hide resolved
...nding.mideaac/src/main/java/org/openhab/binding/mideaac/internal/handler/MideaACHandler.java
Outdated
Show resolved
Hide resolved
...nding.mideaac/src/main/java/org/openhab/binding/mideaac/internal/handler/MideaACHandler.java
Outdated
Show resolved
Hide resolved
I still have several suppress "null" generally related to this variable on line 677 in the MideaACHandler I think I will add a commit to try to close off some of the questions (narrow down the problems) Edit: Last night, with your insight that the Suppress("null") doesn't affect the compiler, I'll take them all out and see what happens. As noted above, I have struggled, and it is like the carnival game "Whack-a-mole". Fixing one causes another to popup. The version committed last night has no warnings during the compile, so it is a good base to start from. |
I'm going to need a few days to do some testing with all the changes to address some of the null warnings. |
Addressed most suppressed null issues. In VSC the remaining ones are marked as "info" (not "warning') or not highlighted at all. However, in the compile process they are still shown as warnings. I tried a number of things (and some AI suggestions), but nothing worked. Also made some changes to address the first review topics more completely. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for addressing most comments. There are some new comments, made some good progress and allmost covered all files. I expect 1 or 2 more passes left, also depends on the follow up offcourse ;-)
<label>Cloud Provider</label> | ||
<description>Cloud Provider name for email and password.</description> | ||
<options> | ||
<option value=""></option> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this makes sense, but this could be: "Not set (pre V3)" or something similar to indicate this is not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I responded to this. There a couple of concerns, one is that "" is the default to decipher the discovery message. And to get the AC on the LAN one of the apps needed to be used, so a V2 user could either leave blank after discovery or add one of the three defined options. I think it would be confusing to have a default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if i understand it. But the value can still remain empty, but the option needs a label so that it works nice in the UI.
Example:
<option value="">Not set (V2) or auto detect</option>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok misunderstood. Just the description
bundles/org.openhab.binding.mideaac/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.mideaac/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.mideaac/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
...enhab.binding.mideaac/src/main/java/org/openhab/binding/mideaac/internal/handler/Packet.java
Outdated
Show resolved
Hide resolved
...hab.binding.mideaac/src/main/java/org/openhab/binding/mideaac/internal/handler/Response.java
Show resolved
Hide resolved
...hab.binding.mideaac/src/main/java/org/openhab/binding/mideaac/internal/handler/Response.java
Outdated
Show resolved
Hide resolved
...ding.mideaac/src/main/java/org/openhab/binding/mideaac/internal/MideaACBindingConstants.java
Outdated
Show resolved
Hide resolved
...inding.mideaac/src/main/java/org/openhab/binding/mideaac/internal/MideaACHandlerFactory.java
Outdated
Show resolved
Hide resolved
I think the only major item left is the |
Experimenting with extracting the ConnectionManager as a separate class. The first issue (and in a lot of places) appears that it was using the fact that MideaACHandler extended the BaseThingHandler. All the EDIT: Another option is to eliminate the ConnectionManager class completely. I've never been a fan (it was in the code when I got it). In essence the poll could be replaced with a simple cron rule using a channel refresh (I've done this test- |
...nding.mideaac/src/main/java/org/openhab/binding/mideaac/internal/handler/MideaACHandler.java
Outdated
Show resolved
Hide resolved
...binding.mideaac/src/main/java/org/openhab/binding/mideaac/internal/dto/CloudProviderDTO.java
Outdated
Show resolved
Hide resolved
The A typicall pattern is that the |
Out of the gate the binding no longer works. I put back part of the old initialize() and got the configs back, but the cloud retrieval of token and key doesn't work. Looks like the parts were commented out. I tried to move this back to the initialize() (I think it makes more sense to get everything correct first) but is still failed. I committed my work in progress, but probably need to drop this. We'll see how I feel in the morning. I'll convert to draft since it is no longer working. |
Yes this was part of the TODO I mentioned. Handling the token should be done from the connection manager, also have to look how it works together with the discovery part. I’ll look into it today. |
My thought was to get all the configurations set in the initialize() method, not do part there and the other in the connectionManager. |
54e9c21
to
5f7556f
Compare
new midea ac binding - Had to delete old one due to rebase malfunction (operator error) Signed-off-by: Bob Eckhoff <[email protected]>
Conform to OH logging on Thing offline status changes, review of log levels. Signed-off-by: Bob Eckhoff <[email protected]>
Added Javadoc to public methods excluding enum lists and binding constants Signed-off-by: Bob Eckhoff <[email protected]>
Add body type filter to ensure meaningful readings. Signed-off-by: Bob Eckhoff <[email protected]>
Add body type filter to allow only correctly formated responses to be evaluated and minor edits to add javadoc author. Signed-off-by: Bob Eckhoff <[email protected]>
Addressed a number of the OH addons review points. Primarily fixed and formatted the README file. Also tested the Thing textual configuration and automated the key and token discovery if the cloud provider and could account details are provided. Signed-off-by: Bob Eckhoff <[email protected]>
Remove gets from token key, defaults on Readme plus other comments, removed a few suppress nulls. Signed-off-by: Bob Eckhoff <[email protected]>
Removed all suppressions and addressed what I could. Also separated the cloud connections into a DTO folder. Signed-off-by: Bob Eckhoff <[email protected]>
Addressed most minor issues. Have not yet addressed changing the CloudDTO or splitting the MideaACHandler. Signed-off-by: Bob Eckhoff <[email protected]>
Addressed more review comments. Some still WIP pending answers. Signed-off-by: Bob Eckhoff <[email protected]>
Signed-off-by: Leo Siepel <[email protected]> Signed-off-by: Bob Eckhoff <[email protected]>
added discovery back in initialize and moved tokenkey to connection manager. Signed-off-by: Bob Eckhoff <[email protected]>
This reverts commit 86a62ee. Signed-off-by: Bob Eckhoff <[email protected]>
This reverts commit 1f4bf56, reversing changes made to 5650d73. Signed-off-by: Bob Eckhoff <[email protected]>
Thanks for all your time. Sorry it couldn't work out. You are obviously a skilled developer. I'll update the forum version with the changes up to closing this PR. |
There is no need to rush, why close it? There where some things on the TODO list that i can fix. Only needed a little more time as i also have other things todo. |
This was a test to see if I could update the original code to pass OH official review. I had looked through most of the requirements before starting, but it appears the separation of the ConnectionManager from the MideaACHandler was way beyond my ability. In a nutshell I am unsure I can support your revisions if any problems arise. That said I do think the OH community would benefit from this binding. There is quite an active effort with HA. I would be happy to test anything you develop, but the support issue still looms. I was hoping there would be a much simpler way to update the Thing status in the ConnectionManager. |
new midea ac binding - Had to delete old one due to rebase malfunction (operator error)
Signed-off-by: Bob Eckhoff [email protected]
I’d like to put this out for new binding review.
This binding was started by the original author as a forum topic, but has since had other contributors. I picked it up when I installed a mini-split AC that used the Midea protocol earlier this year, originally to allow for longer polling frequencies. Then as a retirement challenge (no formal java training), decided to attempt to clean it up for official status. I cleaned up the summary report from over 150 items and believe I conformed to current developer guidelines (Java docs, naming, tests, etc.). Along the way added some additional functionality and corrected some code issues.
The discovery and security classes remain largely unchanged from the original author (who I haven’t been able to contact), and work well. The other classes I understand pretty well at this point and hopefully can address any concerns.
As a note, to conform to the guidelines there are breaking changes in naming from the version I published on the forum thread.