LG Thinq Binding

LG Thinq Binding

This binding was developed to integrate the LG ThinQ API with openHAB.
The ThinQ Thinq Binding works as a hub/bridge to discovery and first configure the LG ThinQ devices related with the LG’s user account.
Thus, the first thing is to create the LG ThinQ Bridge and then, it will discover all Things you have related in your LG Account.
Please, read the README for more details.
Notice: if you are updating to the 0.3 version, you need to remove all things and dicovery them again (because of the changes in the properties and channels names).

Changelog

Version 0.3 (released 11/17/2024)

  • fix error dealing with discovery process
  • fix bridge language/country properties map
  • changed channel & properties’s names for almost all thinq devices (fixed convention names)

Version 0.2

  • fix labeling error in AC’s Operation Mode
  • fix constant warning reported by LG API in AC devices.

Version 0.1

  • initial release

Resources

6 Likes

Thanks for contributing this binding!
Is there a documentation for textual configuration of the things and and items?

There’s no documentation for textual configuration. Some required configuration attributes are gotten at discovery process and can’t be predict by yourself. So, it’s not possible to manually/textualy registry some LG Thinq thing.

However, if you’ve already had your things discovered by the bridge and want to create textual configuration, it’s possible because the pre required configuration attributes were already discovered and you can copy that even I thinking it should’t be useful, unless you have some backup needs.

I just installed the binding and it appears to be working as I’m getting values from the LG API but I am constantly getting this error in OH 4.2.

2024-09-24 12:58:25.303 [WARN ] [es.LGThinQAbstractApiV2ClientService] - Error returned by LG Server API. HTTP Status: 400. The reason is: {“resultCode”:“9006”,“result”:“”}

Also, should I be able to set the Target Temperature or is this just for read only values?

Thanks!

Steve

What’s the kind of your device ?

Window A/C Unit
Model# LW1217ERSM1.AT1AUSH

This is a known log message for AC’s that was already fixed but has not been released yet and you can safely ignore it.
When the new version will be released, I will notice in this topic.

1 Like

Thanks!

Is it possible to set the temperature of the AC from within openhab? Target Temperature seems to be a read only value for me.

Sure. Everything (and a little bit more) that you can do with AC in the App, you can do with this binding.
The thing is… since the target temperature is a Numeric Type, (and not a enum labeled), you can’t enter values through the settings interface, if you are trying to do so.
You need to create a vision of the thing using some UI Interface avaliable for OpenHab end users, like sitemap, habpanel or (my preferrable) OpenHab UI. Then you create a Widget and map the target temperature and that’s it.

You can use a some available widget in the market store. I like “Air Conditioner Controller” provided by @hmerk with some changes to fit better to this binding.

If you want, I can send the json here to you give a try.

The result is something like this:

1 Like

Dear Nemer,

Thanks for easing up so many lives trying to talk with the LG gadgets! Your work is commendable.
I just tried binding your work too, in an attempt to connect to my heat-pump. The discovery of the device worked like a charm. But no matter how much I fiddle with the bridge configuration, I don’t seem to get my way through. I am ONLINE for a moment and am thrown out immediately after that. Attached is the screenshot of a connection attempt by disabling/enabling the thing. What is it that I might be doing wrong here?

(This being my first post, pardon me for missing infos/broken rules!)

My settings:

It’s not usual to have error in this connection phase. The bridge can’t get the list of devices related to your account.

It’ the first time I see this issue and because this we have to debug a little bit. Please, reinstall the last version of the binding I left in the repository and put the binding in debug mode. Then try to test again. You probably will have the same error, but I will have more information to understand the problem.

Regards.

I did the following:

  1. Removed the LG Thinq binding from openhab in browser
  2. Made sure the jar file was removed in the bundles folder
  3. Ensured that there was no active binding (openhab terminal / ls -l)
  4. Logged out of the session
  5. Started a new session in debug mode
    A. openhab terminal / ./start_debug.sh
    B. log:set DEBUG org.openhab.binding.lgthinq
  6. Reinstalled the bundle from openhab browser
    → Atleast my LG device was discovered on first attempt before, it appeared along with the bridge in my inbox this time even that did not happen
  7. Repeated steps 1-4, then reinstalled .jar file from the first post here into the add-ons folder manually
  8. Restarted my mac
  9. Repeated step 5 but with no success

What I observe is that the LG Thinq binding is perhaps now broken.
As a new user, I am unable to attach logs here - yesterday the session continued atleast until the LGAirConditioner services got called, not I am stuck around the LGThinQ services (org.openhab.binding.lgthinq.internal.** with IDs: 409-412)

Hello Nemer!

I installed a LG S12ET Mono-Split-A/C.

The LGThing App works fine.

After installing your binding in an existing Openhab 4.1.3 container following error occurred on startup:
[org.openhab.core.thing.internal.ThingManagerImpl(233)] : The addThingHandlerFactory method has thrown an exception
java.lang.NoClassDefFoundError: org/openhab/core/config/discovery/AbstractThingHandlerDiscoveryService

I tried a fresh Openhab 4.2.2 install in a new Docker container.
No startup error, but this error occurred after configuring the bridge:
[hab.event.ThingStatusInfoChangedEvent] - Thing ‘lgthinq:bridge:0bfa78ceb9’ changed from OFFLINE (COMMUNICATION_ERROR): @text/error.lgapi-communication-error to UNINITIALIZED

Language is “German(Standard)” from list, Country is “Other”, manually added “AT” for austria.
Double checked credentials, they are correct.

I have no idea what’s wrong…

1 Like

The binding will work only with 4.2 or early. About the communication error check:
You account registered country and language.

  1. If you have the LG Thinq App working, open it, go “Menu bottom” and click at the gear in the top-right of the app
  2. Scroll down until see “Logoff”. Press it and confirm
  3. You will be invited to login again. Fill with your email and LG Account password (important: do not login with Google. Your account must have login/password to work with this binding).
  4. Pay attention at the right top of the login page it’s the country and language for your account.
  5. Go ahead with the login. If everithing went well, use the email, password, country and language (you can’t use different countries and languages) used to login into LG Thinq App in the LG Thinq Bridge of the binding.

Let me know if it works.

Thanks for the fast reply!

The communication error is in 4.2.2.
I tried a third container with openhab 4.2.0. Has the same communication error.

Settings in app are:

In all three containers i have following settings:
Can’t upload 2nd photo as a new user
User Language (LG registry): German(Standard)
User Country: Other
Manual User Lang.: “”, as stated in your readme to leave empty when selected from list
Manual User Country: AT
Username: Acc-Email from app
Password: Password from app

So German (Deutsch) and AT (Austria) should be correct, or am i misunderstanding something?
Tracing the log (see below) it seems that it doesn’t like my region settings…

Terminal Output from the 4.2.0 Container:
Launching the openHAB runtime…

                       _   _     _     ____  

___ ___ ___ ___ | | | | / \ | __ )
/ _ \ / _ \ / _ \ / _ \ | || | / _ \ | _ \
| (
) | () | __/| | | || _ | / ___ \ | |) )
___/| / _/|| |||| ||// _|__/
|
| 4.2.0.RC2 - Milestone Build

Use ‘’ for a list of available commands
and ‘[cmd] --help’ for help on a specific command.
To exit, use ‘’ or ‘logout’.

openhab> log:set TRACE org.openhab.binding.lgthinq
[Fatal Error] log4j2.xml:1:1: Premature end of file.
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Error parsing /openhab/userdata/etc/log4j2.xml
openhab> log:tail
06:39:57.791 [INFO ] [org.openhab.core.Activator ] - Starting openHAB 4.2.0.RC2 (Milestone Build)
06:39:58.862 [INFO ] [b.core.internal.i18n.I18nProviderImpl] - Time zone set to ‘Europe/Vienna’.
06:39:58.883 [INFO ] [b.core.internal.i18n.I18nProviderImpl] - Locale set to ‘de_AT’.
06:40:00.790 [WARN ] [f.transport.servlet.ServletController] - Can’t find the request for http://127.0.0.1:32786/'s Observer
06:40:11.289 [INFO ] [b.core.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
06:40:30.228 [INFO ] [re.automation.internal.RuleEngineImpl] - Rule engine started.
06:42:45.092 [DEBUG] [internal.handler.LGThinQBridgeHandler] - Initializing LGThinq bridge handler.
06:42:45.095 [TRACE] [ding.lgthinq.lgservices.api.RestUtils] - GET request: https://route.lgthinq.com:46030/v1/service/application/gateway-uri
06:42:45.803 [TRACE] [ding.lgthinq.lgservices.api.RestUtils] - GET response: {“resultCode”:“0003”,“result”:“”}
06:42:45.805 [DEBUG] [internal.handler.LGThinQBridgeHandler] - Error accessing LG API. Updating Bridge Status to OFFLINE.
org.openhab.binding.lgthinq.lgservices.errors.LGThinqGatewayException: Error trying to discovery the LG Gateway Setting for the region informed
at org.openhab.binding.lgthinq.lgservices.api.TokenManager.oauthFirstRegistration(TokenManager.java:102) ~[bundleFile:?]
at org.openhab.binding.lgthinq.internal.handler.LGThinQBridgeHandler$PollingRunnable.run(LGThinQBridgeHandler.java:136) [bundleFile:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.lang.Thread.run(Thread.java:840) [?:?]
Caused by: java.lang.IllegalStateException: Expected HTTP OK return, but received result core:{“resultCode”:“0003”,“result”:“”}
at org.openhab.binding.lgthinq.lgservices.api.OauthLgEmpAuthenticator.discoverGatewayConfiguration(OauthLgEmpAuthenticator.java:133) ~[bundleFile:?]
at org.openhab.binding.lgthinq.lgservices.api.TokenManager.oauthFirstRegistration(TokenManager.java:99) ~[bundleFile:?]
… 7 more


There’s also a new error in the 4.1.3 container, but if we get the comm error resolved, i’ll migrate to that container, as it seems that the 4.1.3 is utterly broken. Just consider this as an FYI:
Launching the openHAB runtime…

                       _   _     _     ____  

___ ___ ___ ___ | | | | / \ | __ )
/ _ \ / _ \ / _ \ / _ \ | || | / _ \ | _ \
| (
) | () | __/| | | || _ | / ___ \ | |) )
___/| / _/|| |||| ||// _|__/
|
| 4.1.3 - Release Build

Use ‘’ for a list of available commands
and ‘[cmd] --help’ for help on a specific command.
To exit, use ‘’ or ‘logout’.

06:00:16.634 [Start Level: Equinox Container: cb1d699f-8316-46f0-93ae-6cac72157651] ERROR org.openhab.binding.lgthinq.internal.LGThinQHandlerFactory - bundle org.openhab.binding.lgthinq:4.3.0.202411032357 (320)[org.openhab.binding.lgthinq.internal.LGThinQHandlerFactory(404)] : Error during instantiation of the implementation object
java.lang.IllegalArgumentException: argument type mismatch

1 Like

I found a bug that could be related to your problem. Please, try to install de latest version of the binding.

The binding is passing through a review process to be available Official in the OH Store. So, some changes has being made and during this phase, you can find some bugs (I hope not :slight_smile: ).

Let me know if the new binding works for you and if you have some other problem, report here.

Hi,

Thank you for the update.

Unfortunately I’m still having the same lgapi-communication-error that [JohnMcLeod] was getting with this new version.

Manual User Country: NZ

2024-11-18 08:46:34.063 [DEBUG] [al.discovery.LGThinqDiscoveryService] - bundle org.openhab.binding.lgthinq:4.3.0.202411171609 (302)[org.openhab.binding.lgthinq.internal.discovery.LGThinqDiscoveryService(417)] : invoked activate: activate
2024-11-18 08:46:34.066 [DEBUG] [al.discovery.LGThinqDiscoveryService] - bundle org.openhab.binding.lgthinq:4.3.0.202411171609 (302)[org.openhab.binding.lgthinq.internal.discovery.LGThinqDiscoveryService(417)] : Changed state from satisfied to active
2024-11-18 08:46:35.045 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'lgthinq:bridge:94580c042c' changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR): @text/error.lgapi-communication-error
2024-11-18 08:46:36.105 [TRACE] [ing.lgthinq.lgservices.api.RestUtils] - GET request: https://route.lgthinq.com:46030/v1/service/application/gateway-uri
2024-11-18 08:46:36.317 [TRACE] [ing.lgthinq.lgservices.api.RestUtils] - GET response: {"resultCode":"0003","result":""}
2024-11-18 08:46:36.321 [DEBUG] [nternal.handler.LGThinQBridgeHandler] - Error accessing LG API. Updating Bridge Status to OFFLINE.

https://thinq.developer.lge.com/en/cloud/docs/commercial-laundry/api-reference/common-response/

Missing parameter or header

Sorry. Fixing other parts. You can test, but I think your problem is more related to the parameters set in the Bridge configuration.

Please, put the Binding in Trace mode and Test with the new version and let me know if it fixes your problem. If not, send me the log and we can check better the parameters you are configuring the bridge.

Try again please.

Thanks for the reference. I will check de missing error description and fix the result messages