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

[lgthinq] Initial contribution #12149

Open
wants to merge 130 commits into
base: main
Choose a base branch
from

Conversation

nemerdaud
Copy link

@nemerdaud nemerdaud commented Jan 28, 2022

Binding to integrate OpenHab to LG Thinq API to control Thinq compatible devices through OpenHab.
See README.MD documentation for supported devices.

Signed-off-by: Nemer Daud [email protected]

@nemerdaud nemerdaud requested a review from a team as a code owner January 28, 2022 22:37
@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/contribution-lg-thinq-air-conditioner-addon/132444/3

@lolodomo lolodomo added the new binding If someone has started to work on a binding. For a new binding PR. label Jan 29, 2022
Copy link
Contributor

@hmerk hmerk left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.
Please check for a constant naming scheme.
Some first comments made with required changes.

@nemerdaud nemerdaud requested a review from hmerk January 29, 2022 18:34
@tobof
Copy link

tobof commented Feb 3, 2022

@nemerdaud Gave your binding a first shot and it just worked. Amazing! 😄

@tobof
Copy link

tobof commented Feb 5, 2022

Changing the op_mode does not seem to work, it results in an error after a few seconds.

14:19:13.543 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'corridorACMode' changed from 3 to 2
14:19:16.040 [ERROR] [ervices.LGThinqApiV2ClientServiceImpl] - Error returned by LG Server API. The reason is:{"resultCode":"9006","result":{"data":""}}
14:19:16.041 [ERROR] [internal.LGThinqAirConditionerHandler] - Error executing Command 3 to the channel op_mode. Thing goes offline until retry
org.openhab.binding.lgthinq.internal.errors.LGThinqApiException: Error returned by LG Server API. The reason is:{"resultCode":"9006","result":{"data":""}}
        at org.openhab.binding.lgthinq.lgservices.LGThinqApiV2ClientServiceImpl.handleV2GenericErrorResult(LGThinqApiV2ClientServiceImpl.java:231) ~[bundleFile:?]
        at org.openhab.binding.lgthinq.lgservices.LGThinqApiV2ClientServiceImpl.changeOperationMode(LGThinqApiV2ClientServiceImpl.java:128) ~[bundleFile:?]
        at org.openhab.binding.lgthinq.internal.LGThinqAirConditionerHandler$1.run(LGThinqAirConditionerHandler.java:443) [bundleFile:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
14:19:16.043 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'lgthinq:401:2a9a539f15:569c7573-8e85-12aa-86e5-44cb8b809993' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error returned by LG Server API. The reason is:{"resultCode":"9006","result":{"data":""}}

@nemerdaud
Copy link
Author

@tobof , please provide me $OPENHAB_USERDATA/thinq/thinq-569c7573-8e85-12aa-86e5-44cb8b809993-cap.json file.

Changing the op_mode does not seem to work, it results in an error after a few seconds.

14:19:13.543 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'corridorACMode' changed from 3 to 2
14:19:16.040 [ERROR] [ervices.LGThinqApiV2ClientServiceImpl] - Error returned by LG Server API. The reason is:{"resultCode":"9006","result":{"data":""}}
14:19:16.041 [ERROR] [internal.LGThinqAirConditionerHandler] - Error executing Command 3 to the channel op_mode. Thing goes offline until retry
org.openhab.binding.lgthinq.internal.errors.LGThinqApiException: Error returned by LG Server API. The reason is:{"resultCode":"9006","result":{"data":""}}
        at org.openhab.binding.lgthinq.lgservices.LGThinqApiV2ClientServiceImpl.handleV2GenericErrorResult(LGThinqApiV2ClientServiceImpl.java:231) ~[bundleFile:?]
        at org.openhab.binding.lgthinq.lgservices.LGThinqApiV2ClientServiceImpl.changeOperationMode(LGThinqApiV2ClientServiceImpl.java:128) ~[bundleFile:?]
        at org.openhab.binding.lgthinq.internal.LGThinqAirConditionerHandler$1.run(LGThinqAirConditionerHandler.java:443) [bundleFile:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
14:19:16.043 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'lgthinq:401:2a9a539f15:569c7573-8e85-12aa-86e5-44cb8b809993' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error returned by LG Server API. The reason is:{"resultCode":"9006","result":{"data":""}}

@nemerdaud nemerdaud force-pushed the feature/lgthinq-binding branch 2 times, most recently from aea5f82 to ef8745b Compare February 8, 2022 20:43
@hmerk hmerk changed the title [lgthinq] New LG Thinq Binding [lgthinq] [WIP] New LG Thinq Binding Feb 12, 2022
@hmerk hmerk added the work in progress A PR that is not yet ready to be merged label Feb 12, 2022
@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/snapshot-binding-will-not-load/157873/10

@nemerdaud
Copy link
Author

@lsiepel , I think I resolved all the itens. Fell free to continue 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.

This pass i had a better look to some dto / model / and other code files. Some comments can be applied binding wide, please check.
Also want to mention that there are 100+ compile warnings. Most of them should be fixed, the same for the SAT warnings.

@marcelrv
Copy link
Contributor

@nemerdaud sorry for my commit e473608 directly to your branch. Intended to make it in a private branch but clearly that did not happen.

@nemerdaud
Copy link
Author

Sorry for the delay, @lsiepel . It was a little bit of work to fix the warning (compiler & sat) and logs. The last review is done (I hope :-) ) .

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.

Thank you for maintaining this PR and working towards a merge. In general the binding is in a good shape. The review is mainly about smaller issues like naming, labels and smaller inconsistency's but the overall structure seems good.
When looking at the comments, please keep in mind that the sugggestions might also apply to other places. Especially when looking at null suppresions and thing/channel structure.
Looked at 148/154 files, only the handlers are left.

bundles/org.openhab.binding.lgthinq/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.lgthinq/README.md Outdated Show resolved Hide resolved
Comment on lines 4 to 5
The ThinQ Bridge is necessary to work as a hub/bridge to discovery and first configure the LG ThinQ devices related with the LG's user account.
Then, the first thing is to create the LG ThinQ Bridge and then, it will discover all Things you have related in your LG Account.
Copy link
Contributor

Choose a reason for hiding this comment

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

These two lines should be moved to the discovery paragraph (and streamlined)

Copy link
Author

Choose a reason for hiding this comment

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

I think the second paragraph is unnecessary since it's a basic concept of the platform.

Copy link
Contributor

Choose a reason for hiding this comment

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

To make sure we talk about the same, to what lines do you refer with the second paragraph?

Copy link
Author

@nemerdaud nemerdaud Nov 6, 2024

Choose a reason for hiding this comment

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

There were some redundant and unnecessary information. I reorganized this 2 topics like this:
`

Bridge Thing

This Binding has a Bridge responsible for discovering and registering LG Things.
Thus, adding the Bridge (LGThinq GW Bridge) is the first step in configuring this Binding.

Discovery

This Binding has auto-discovery for the supported LG Thinq devices. Once LG Thinq Bridge has been added, LG Thinq devices linked to your account will be automatically discovered and displayed in the OpenHab Inbox.
`
Let me know if it's OK for you.

bundles/org.openhab.binding.lgthinq/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.lgthinq/README.md Outdated Show resolved Hide resolved
*/
@NonNullByDefault
public interface LGThinQACApiClientService extends LGThinQApiClientService<ACCapability, ACCanonicalSnapshot> {
void changeOperationMode(String bridgeName, String deviceId, int newOpMode) throws LGThinqApiException;
Copy link
Contributor

Choose a reason for hiding this comment

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

See earlier comment, please provide javadoc to all public interfaces methods

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I missed it ! It will take some time...

@lsiepel
Copy link
Contributor

lsiepel commented Nov 6, 2024

Regarding the review, I would propose that you comment or thumbs up a comment if it has been fixed. I can then verify and mark it resolved. This would make it easy for me to keep track. Hope it also works for you.

Nemer Daud added 7 commits November 6, 2024 11:34
Signed-off-by: Nemer Daud <[email protected]>
Signed-off-by: Nemer Daud <[email protected]>
Signed-off-by: Nemer Daud <[email protected]>
Signed-off-by: Nemer Daud <[email protected]>
Signed-off-by: Nemer Daud <[email protected]>
Signed-off-by: Nemer Daud <[email protected]>
Signed-off-by: Nemer Daud <[email protected]>
@nemerdaud
Copy link
Author

Regarding the review, I would propose that you comment or thumbs up a comment if it has been fixed. I can then verify and mark it resolved. This would make it easy for me to keep track. Hope it also works for you.

OK ! I think it's better. When I fix an item, I will push it and thumbs up in a sequence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new binding If someone has started to work on a binding. For a new binding PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.