Contribution - LG ThinQ Binding

Hej there,

I got the Binding up and running and it work really well.
Now, as I am putting all “running” things and items into files I have a feature request (or the question for a hint what I am missing):
It would be really cool to be able to add the Things via a .things-file. Therefore, it seems to be important to have the possibility to add the property “device-id” via the .things file. The Philips Hue Binding offers such a feature: it discovers all properties on it’s own except those set in the .things file…

1 Like

You meant, to just put the device-id into .things file and the binding get other properties on-the-fly ? I will take a look on it.

1 Like

In that sense: Yes.

As an example I would refer to the Hue Binding. In the things files you add a bridge thing an then all “device things”. The connection between the exposed thing one has to add a “resource-id” as a configuration parameter refering the “real” lamp so one can steer it. This configuration parameter is also a property of the thing.

So, far LqThinq does discover the “device-id” and sets other properties when in auto discovery mode. The “device-id” seems already to be settable via the config parameters in the things file (e.g. {device-id=“blabla”}. As far as I saw: this already sets a device-id property. BUT: Based on that hand-set device-id all other properties are not discovered which makes the things-file not work.

What should help: Check whether there is a hand-set “device-id”, use that device-id to get /discover all other properties. Then when all properties are there, start the working thing.

Hope that explaing it.

Status:

OFFLINE

COMMUNICATION_ERROR

Error getting devices from LG API in scanner process.

THE ERROR since today - any of you have the same problem?

1 Like

Same here. looks like LG is asking to use another API to access their devices:

Please consider using the official API: https://smartsolution.developer.lge.com/en/product/useCase11

This is the response I could see in the OH logs.

2 Likes

It looks that they have changed also the method of Authorization!

1 Like

LG Changed his API and is identifying not official integration asking to move to the new official open API delivered:

Error calling device settings from LG Server API. The reason is:Please consider using the official API. Visit https://smartsolution.developer.lge.com/en/product/useCase11?s=1740015848379 for more details.

The bad new is that this Binding must the rewritten, but the good news is that now we supposed to have an open and official API to use, but I don’t know it has all the features and capabilities of the official older one.

I have already tried this for manual connection to the Thinq API server. It works, but as @nemer suspected i.e. for my 3xAC does not give the information about the “filter usege” and other options.

I start to hate Cloud API systems and for the future devices I would chose those with local access, through local protocols. Since I have many devices it looks like every week I have to rewrite the code to adopt to the changes made to some devices.

@Tomasz_W could you document us a little what you have done to perform the manual connection, at least until we have a new version of the binding?

Thank you

@cmachtel please read GitHub - thinq-connect/pythinqconnect

  1. you should install the python module - pip install pythinqconnect
  2. Form the LG Thinq server you should generate PAT token
  3. the python script to get the devices is also there:

import asyncio
from aiohttp import ClientSession
from thinqconnect.thinq_api import ThinQApi

async def test_devices_list():
async with ClientSession() as session:
thinq_api = ThinQApi(session=session, access_token=‘your_personal_access_token’, country_code=‘your_contry_code’, client_id=‘your_client_id’)
response = await thinq_api.async_get_device_list()
print(“device_list : %s”, response.body)

asyncio.run(test_devices_list())

with the code above you will get each device number which you can use to directly read the data of such device with:

status = await thinq_api.async_get_device_status(device_id)
print(json.dumps(status, indent=4))

you can transefer this data to the items using various ways: REST API or by rule-> executeCommandLine()

in my case i needed to replace response.body with response

hi guys,from what i read ,if i get it right, LG broke this super usefull binding changing something?Is there a way to get it back?I dont have dev skills but if there is a fix i am willing to test with my washer/dryer/fridge…

It has already been fixed. Please, get the latest version at my public repository or update through ddons marketplace.

3 Likes

great!i did download the latest version but i am still at 4.1.2 so it does not seem to work right…Is there a compatible jar or do i have to update to 4.3?

@nemer any chance for 4.1.X compilation?

i think its time to update :slight_smile: ,i did update to 4.3.3 with no issues (so far).Installed the binding from within and i just had to delete the old things and relink the items to the new things…no problems so far!Thnx @nemer

1 Like

The version 4.2.X should work for you.

1 Like

Hey everyone,

could anyone help me with a text-file based specification of a thing? Binding works well, I connect the bridge but I do not get a washing machine online via a text file based specification.
However: I can normally configure the washing machine via UI. SO, something seems wrong with my text file.

My thing-file looks like:

Bridge lgthinq:bridge:Laundry "LG ThinQ Account"
    [ username="<mymail@abc.com>", password="<mypassword>.", language="de-DE", country="DE", pollingIntervalSec=86400 ] {

      washer-201 SmartDevices_KG_Laundry_WashingMachine "Laundry Washing Machine" [
        device_id="bef4ef11-cccc-ffff-dddd-34e6e6b8d99d",
        model_url_info="https://objectcontent.lgthinq.com/5f422e88-bbbb-cccc-dddd-65e81ee6bd5a?hdnts=exp=1763269794~hmac=973f42dafab5aeee897738f3eada6e45b54d6c5555b3be542fcff134fcb5d596",
        platform_type="thinq2",
        polling-period-poweron-seconds=30,
        polling-period-poweroff-seconds=30
      ]
}

The code of the working UI-based thing looks like:

UID: lgthinq:washer-201:Laundry:bef4ef11-cccc-ffff-dddd-34e6e6b8d99d
label: _TEST Laundry Washing Machine
thingTypeUID: lgthinq:washer-201
configuration:
  pollingPeriodPowerOffSeconds: 10
  pollingPeriodPowerOnSeconds: 10
bridgeUID: lgthinq:bridge:Laundry
channels:
  - id: dashboard#power
    channelTypeUID: system:power
    label: Betrieb
    description: Steuert die Betriebsbereitschaft. Bei ON ist das Gerät
      betriebsbereit, bei OFF nicht.
    configuration: {}
  - id: dashboard#state
    channelTypeUID: lgthinq:washer-state
    label: Washer State
    description: Washer State Operation
    configuration: {}
  - id: dashboard#process-state
    channelTypeUID: lgthinq:washerdryer-process-state
    label: Process State
    description: Process State
    configuration: {}
  - id: dashboard#course
    channelTypeUID: lgthinq:washerdryer-course
    label: Course
    description: Course
    configuration: {}
  - id: dashboard#temperature-level
    channelTypeUID: lgthinq:washerdryer-temp-level
    label: Temp. Level
    description: Target Temperature Level
    configuration: {}
  - id: dashboard#door-lock
    channelTypeUID: lgthinq:washerdryer-door-lock
    label: Door Lock
    description: Door Lock
    configuration: {}
  - id: dashboard#remain-time
    channelTypeUID: lgthinq:washerdryer-remain-time
    label: Remaining Time
    description: Remaining Time
    configuration: {}
  - id: dashboard#rinse
    channelTypeUID: lgthinq:washer-rinse
    label: Rinse
    description: Rinse
    configuration: {}
  - id: dashboard#spin
    channelTypeUID: lgthinq:washer-spin
    label: Spin
    description: Spin Speed
    configuration: {}
  - id: dashboard#delay-time
    channelTypeUID: lgthinq:washerdryer-delay-time
    label: Delay Time
    description: Delay Time
    configuration: {}
  - id: dashboard#stand-by
    channelTypeUID: lgthinq:washerdryer-stand-by
    label: Standby Mode
    description: Standby Mode
    configuration: {}
  - id: dashboard#remote-start-flag
    channelTypeUID: lgthinq:washerdryer-remote-start
    label: Remote Start
    description: Remote start
    configuration: {}
  - id: remote-start-grp#rs-start-stop
    channelTypeUID: lgthinq:rs-start-stop
    label: Remote Start/Stop
    description: Remote Start/Stop
    configuration: {}
  - id: remote-start-grp#rs-course
    channelTypeUID: lgthinq:rs-course
    label: Course to Run
    description: Course
    configuration: {}
  - id: remote-start-grp#rs-rinse
    channelTypeUID: lgthinq:rs-rinse
    label: Rinse
    description: Rinse
    configuration: {}
  - id: remote-start-grp#rs-spin
    channelTypeUID: lgthinq:rs-spin
    label: Spin
    description: Spin Speed
    configuration: {}
  - id: remote-start-grp#rs-temperature-level
    channelTypeUID: lgthinq:rs-temperature-level
    label: Temp. Level
    description: Target Temperature Level
    configuration: {}

It seems like the device ID is undef. Did the label change?

2025-03-02 10:32:03.138 [ERROR] [al.handler.LGThinQWasherDryerHandler] - Error updating thing /undef from LG API. Thing goes OFFLINE until next retry: Error starting device monitor in LG API for the device:undef

Full log:

2025-03-02 10:32:14.821 [ERROR] [al.handler.LGThinQWasherDryerHandler] - Error stopping LG Device monitor
org.openhab.binding.lgthinq.lgservices.errors.LGThinqApiException: LG API report error processing the request -> resultCode=[null], message=[]
	at org.openhab.binding.lgthinq.lgservices.LGThinQAbstractApiV2ClientService.handleGenericErrorResult(LGThinQAbstractApiV2ClientService.java:123) ~[bundleFile:?]
	at org.openhab.binding.lgthinq.lgservices.LGThinQAbstractApiClientService.stopMonitor(LGThinQAbstractApiClientService.java:513) ~[bundleFile:?]
	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler.stopDeviceV1Monitor(LGThinQAbstractDeviceHandler.java:639) [bundleFile:?]
	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler.getSnapshotDeviceAdapter(LGThinQAbstractDeviceHandler.java:678) [bundleFile:?]
	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler.updateThingStateFromLG(LGThinQAbstractDeviceHandler.java:491) [bundleFile:?]
	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler$UpdateThingStateFromLG.run(LGThinQAbstractDeviceHandler.java:484) [bundleFile:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?]
	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) [?:?]
2025-03-02 10:32:14.822 [ERROR] [al.handler.LGThinQWasherDryerHandler] - Error updating thing /undef from LG API. Thing goes OFFLINE until next retry: Error starting device monitor in LG API for the device:undef
org.openhab.binding.lgthinq.lgservices.errors.LGThinqApiException: Error starting device monitor in LG API for the device:undef
	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler.getSnapshotDeviceAdapter(LGThinQAbstractDeviceHandler.java:679) ~[bundleFile:?]
	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler.updateThingStateFromLG(LGThinQAbstractDeviceHandler.java:491) [bundleFile:?]
	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler$UpdateThingStateFromLG.run(LGThinQAbstractDeviceHandler.java:484) [bundleFile:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?]
	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: org.openhab.binding.lgthinq.lgservices.errors.LGThinqApiException: LG API report error processing the request -> resultCode=[null], message=[]
	at org.openhab.binding.lgthinq.lgservices.LGThinQAbstractApiV2ClientService.handleGenericErrorResult(LGThinQAbstractApiV2ClientService.java:123) ~[bundleFile:?]
	at org.openhab.binding.lgthinq.lgservices.LGThinQAbstractApiClientService.startMonitor(LGThinQAbstractApiClientService.java:495) ~[bundleFile:?]
	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler.getSnapshotDeviceAdapter(LGThinQAbstractDeviceHandler.java:668) ~[bundleFile:?]
	... 8 more

Thanks for any help in advance! Best Lui

Hi @LuiSauberhorn ,

Yes, the properties have changed, I faced the same issue. The separator character is not the underscore “_” anymore. Now it is hyphen “-”.

        device_id -> device-id 
        model_url_info -> model-url-info 
        platform_type -> platform-type 

I hope it helps;

I think so; thanks for the fast reply!! I cannot test before end of next week but I will let you know.

Best, Lui