Contribution - LG Thinq [Air Conditioner/Heat Pump] [WIP]

This topic is to discuss and evolve the Air Conditioner devices implemented by LG Thinq Binding
This topic is related to:

2 Likes

Hi,
I just tried the binding with my air conditioner (LG S3-M12JA2DA and LG S3-M09JA2DA). The bridge works flawlessly and the devices are discovered. However, when trying to switch them on or off, the log says:

[ERROR] [nternal.LGThinqAirConditionerHandler] - Command OFF to the channel power not supported. Ignored.

Also I don’t get values for “target_temperature” or “current_temperature”. “fan_speed” and “op_mode” seem to work.

Any help would be appreciated.
Thanks

Tim

This error doesn’t make any sense for me. Power (“power”) is a well known channel for the binding. The binding only display this error if the command was sent to a channel that is not expected. But look:

switch (params.channelUID) {
            ...
            case CHANNEL_POWER_ID: {
                if (command instanceof OnOffType) {
                    lgThinqACApiClientService.turnDevicePower(getBridgeId(), getDeviceId(),
                            command == OnOffType.ON ? DevicePowerState.DV_POWER_ON : DevicePowerState.DV_POWER_OFF);
                } else {
                    logger.warn("Received command different of OnOffType in Power Channel. Ignoring");
                }
                break;
            }
            ...
            default: {
                logger.error("Command {} to the channel {} not supported. Ignored.", command, params.channelUID);
            }

CHANNEL_POWER_ID is a constant to “power”. Logically speaking, there’s no way to enter in default condition in your case, but the error is there :slight_smile:
A have some suggestion to you:

  1. remove the bridge and thing you created
  2. run openhabian-config and upgrade your system to the latest release.
  3. double-check if you are using the latest binding version from my personal repository.
  4. restart the device that is running openhab.
  5. Install the bridge again e discovery your air conditioner

Let me know if something changes.

Thanks, after removing the bridge, the things, the binding and reinstalling everything now it works.

Hi!

I’ve updated to the latest 3.4.3-SNAPSHOT. I’ve a lot of errors (every 5 sec?) with one of my AC-s like this:

2023-03-05 12:38:03.996 [ERROR] [handler.LGThinQAirConditionerHandler] - Error updating thing Játszószoba/2963124d-1028-1d98-9690-24e8536d5d4c from LG API. Thing goes OFFLINE until next retry.
org.openhab.binding.lgthinq.internal.errors.LGThinqApiException: Error returned by LG Server API. The reason is:{"resultCode":"9006","result":""}
	at org.openhab.binding.lgthinq.lgservices.LGThinQAbstractApiV2ClientService.handleGenericErrorResult(LGThinQAbstractApiV2ClientService.java:89) ~[?:?]
	at org.openhab.binding.lgthinq.lgservices.LGThinQACApiV2ClientServiceImpl.beforeGetDataDevice(LGThinQACApiV2ClientServiceImpl.java:168) ~[?:?]
	at org.openhab.binding.lgthinq.lgservices.LGThinQAbstractApiClientService.getDeviceData(LGThinQAbstractApiClientService.java:359) ~[?:?]
	at org.openhab.binding.lgthinq.lgservices.LGThinQAbstractApiClientService.getDeviceData(LGThinQAbstractApiClientService.java:1) ~[?:?]
	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler.getSnapshotDeviceAdapter(LGThinQAbstractDeviceHandler.java:353) ~[?:?]
	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler.updateThingStateFromLG(LGThinQAbstractDeviceHandler.java:268) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	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:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]

All other 4 ACs and my fridge is OK and ONLINE.
Thank you for your help.
Regards,
Cina.

Error 9006, when returned by the LG API, is most likely ACCESS_DENIED, that means… you don’t have access right over this device, but can be the device doesn’t support some a specific functionality as well. Can you send regular commands to this device (eg. POWER ON, OFF, etc.), regardless the error you mentioned ?

Hi!

Since my latest message I’ve disabled the thing in OH and right now I enabled it. For the last 10 minutes I have no error messages. Usually this error appears after a few hours. I’ll test if the error fires if I can control the AC from OH.
Around my previous post I’ve checked simultaneously from the LG app during errors that the AC is online and operational without any error.

Thank you,
Cina.

OK. If you have the same problem after while, try a new version I left in the repository. This method (beforeGetDataDevice) run a setup to the device to adjust the sensors (like temperature) timeout, to get changes more up to date. But, it’s not necessary to be executed before all status pooling. Then I moved to the initialization of the Thinq, so it’s execute once at the initialization phase of the Thing.

Right when you wrote about the update the unit started to throw the same error messages and during that it was uncontrollable from OH.
I stopped OH, emptied userdata/cache and /tmp, installed the new version and so far no error messages appeared. :smiley:

Thank you for your quick reply and help.

Sorry for coming back. I had to restart the server for a not related issue (I use docker and recreated the stack). After restart I’ve got these warnings coming each 3 seconds:

2023-03-05 19:35:10.885 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler tried updating the thing status although the handler was already disposed.
2023-03-05 19:35:10.961 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:2963124d-1028-1d98-9690-24e8536d5d4c tried updating channel power although the handler was already disposed.
2023-03-05 19:35:10.966 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:2963124d-1028-1d98-9690-24e8536d5d4c tried updating channel op_mode although the handler was already disposed.
2023-03-05 19:35:10.966 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:2963124d-1028-1d98-9690-24e8536d5d4c tried updating channel fan_speed although the handler was already disposed.
2023-03-05 19:35:10.967 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:2963124d-1028-1d98-9690-24e8536d5d4c tried updating channel current_temperature although the handler was already disposed.
2023-03-05 19:35:10.968 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:2963124d-1028-1d98-9690-24e8536d5d4c tried updating channel target_temperature although the handler was already disposed.
2023-03-05 19:35:10.968 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:2963124d-1028-1d98-9690-24e8536d5d4c tried updating channel cool_jet although the handler was already disposed.
2023-03-05 19:35:10.969 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:2963124d-1028-1d98-9690-24e8536d5d4c tried updating channel energy_saving although the handler was already disposed.
2023-03-05 19:35:10.969 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:2963124d-1028-1d98-9690-24e8536d5d4c tried updating channel auto_dry although the handler was already disposed.
2023-03-05 19:35:21.189 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:009fa4cb-1a7f-1102-845c-24e8536d9304 tried updating channel power although the handler was already disposed.
2023-03-05 19:35:21.190 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:009fa4cb-1a7f-1102-845c-24e8536d9304 tried updating channel op_mode although the handler was already disposed.
2023-03-05 19:35:21.191 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:009fa4cb-1a7f-1102-845c-24e8536d9304 tried updating channel fan_speed although the handler was already disposed.
2023-03-05 19:35:21.191 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:009fa4cb-1a7f-1102-845c-24e8536d9304 tried updating channel current_temperature although the handler was already disposed.
2023-03-05 19:35:21.192 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:009fa4cb-1a7f-1102-845c-24e8536d9304 tried updating channel target_temperature although the handler was already disposed.
2023-03-05 19:35:21.192 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:009fa4cb-1a7f-1102-845c-24e8536d9304 tried updating channel cool_jet although the handler was already disposed.
2023-03-05 19:35:21.193 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:009fa4cb-1a7f-1102-845c-24e8536d9304 tried updating channel energy_saving although the handler was already disposed.
2023-03-05 19:35:21.194 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler LGThinQAirConditionerHandler of thing lgthinq:401:c502233357:009fa4cb-1a7f-1102-845c-24e8536d9304 tried updating channel auto_dry although the handler was already disposed.

After a while I have these appeared instead of WARNINGS:

2023-03-06 09:01:12.819 [ERROR] [handler.LGThinQAirConditionerHandler] - System error in pooling thread (UpdateDevice) for device Játszószoba/2963124d-1028-1d98-9690-24e8536d5d4c. Filtering to do not stop the thread
java.lang.NoClassDefFoundError: org/apache/http/client/entity/UrlEncodedFormEntity
	at org.openhab.binding.lgthinq.internal.api.RestUtils.postCall(RestUtils.java:139) ~[?:?]
	at org.openhab.binding.lgthinq.internal.api.OauthLgEmpAuthenticator.doRefreshToken(OauthLgEmpAuthenticator.java:342) ~[?:?]
	at org.openhab.binding.lgthinq.internal.api.TokenManager.refreshToken(TokenManager.java:67) ~[?:?]
	at org.openhab.binding.lgthinq.internal.api.TokenManager.getValidRegisteredToken(TokenManager.java:149) ~[?:?]
	at org.openhab.binding.lgthinq.lgservices.LGThinQAbstractApiClientService.getDeviceSettings(LGThinQAbstractApiClientService.java:138) ~[?:?]
	at org.openhab.binding.lgthinq.lgservices.LGThinQAbstractApiClientService.getDeviceData(LGThinQAbstractApiClientService.java:363) ~[?:?]
	at org.openhab.binding.lgthinq.lgservices.LGThinQAbstractApiClientService.getDeviceData(LGThinQAbstractApiClientService.java:1) ~[?:?]
	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler.getSnapshotDeviceAdapter(LGThinQAbstractDeviceHandler.java:367) ~[?:?]
	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler.updateThingStateFromLG(LGThinQAbstractDeviceHandler.java:282) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	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:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]

Thank you,
Cina.

Which version of OH do you are using ? This error:
java.lang.NoClassDefFoundError: org/apache/http/client/entity/UrlEncodedFormEntity
Doesn’t make sense because it used for several parts of the Binding and I don’t have issues related with it.

The WARNs you mentioned are “commons” when you stop forcibly OH and start again, and it’s not a problem itself.

I suggest restart your OH by service (eg. sudo service openhab restart) and reinstall de binding. If you have the same problem, maybe you could have something corrupted in your installation.

Hi there,

I have successfully added the binding:
358 │ Active │ 80 │ 3.4.3.202303141750 │ openHAB Add-ons :: Bundles :: LG Thinq Binding

Successfully added the bridge with custom country and language and bridge can go online.
Successfully added my portable air condiiton and cab go online.

But when I check my log, I got the following msg every 10 secs:

2023-03-28 00:12:32.218 [ERROR] [handler.LGThinQAirConditionerHandler] - Unexpected Error gettinf ACCapability Capabilities

org.openhab.binding.lgthinq.internal.errors.LGThinqApiException: Error parsing capability registry

	at org.openhab.binding.lgthinq.lgservices.LGThinQAbstractApiClientService.getCapability(LGThinQAbstractApiClientService.java:257) ~[bundleFile:?]

	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler.getCapabilities(LGThinQAbstractDeviceHandler.java:207) ~[bundleFile:?]

	at org.openhab.binding.lgthinq.internal.handler.LGThinQAirConditionerHandler.updateDeviceChannels(LGThinQAirConditionerHandler.java:103) [bundleFile:?]

	at org.openhab.binding.lgthinq.internal.handler.LGThinQAirConditionerHandler.updateDeviceChannels(LGThinQAirConditionerHandler.java:1) [bundleFile:?]

	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler.updateThingStateFromLG(LGThinQAbstractDeviceHandler.java:304) [bundleFile:?]

	at org.openhab.binding.lgthinq.internal.handler.LGThinQAbstractDeviceHandler$UpdateThingStateFromLG.run(LGThinQAbstractDeviceHandler.java:282) [bundleFile:?]

	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]

	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:1128) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]

	at java.lang.Thread.run(Thread.java:829) [?:?]

Caused by: org.openhab.binding.lgthinq.internal.errors.LGThinqException: Course node not present in Capability Json Descriptor

	at org.openhab.binding.lgthinq.lgservices.model.devices.washerdryer.AbstractWasherDryerCapabilityFactory.create(AbstractWasherDryerCapabilityFactory.java:71) ~[bundleFile:?]

	at org.openhab.binding.lgthinq.lgservices.model.devices.washerdryer.WasherDryerCapabilityFactoryV1.create(WasherDryerCapabilityFactoryV1.java:42) ~[bundleFile:?]

	at org.openhab.binding.lgthinq.lgservices.model.devices.washerdryer.AbstractWasherDryerCapabilityFactory.create(AbstractWasherDryerCapabilityFactory.java:1) ~[bundleFile:?]

	at org.openhab.binding.lgthinq.lgservices.model.CapabilityFactory.create(CapabilityFactory.java:86) ~[bundleFile:?]

	at org.openhab.binding.lgthinq.lgservices.LGThinQAbstractApiClientService.getCapability(LGThinQAbstractApiClientService.java:253) ~[bundleFile:?]

	... 11 more

Any idea ?

Thanks.

Patrick

@phui , I found an error in the Capability Factory discovery, but it’s because de model type of your AC is apparently unknown for the binding.
Please, can you send me the thinq-***-cap.json file related to your device ? It’s located in $OH_USERDATA/thinq directory.

Tx.

here yu go:

thinq-5b71e0f2-c666-1254-b794-b8165f269678-cap.json (46.4 KB)

Thanks

@nemer
Any update ?

Yes. I fixed your issue…but this fix is in a branch with a new WM feature i’m still finishing. I will release it by tomorrow

Thanks a lot :blush:

@phui , I haven’t forgotten about you. I need some more time to finish, probably by tomorrow.
Regards

No rush and take your time!!!
The weather here is not yet hot to use the air condition yet :slight_smile:
And I have disabled the log via console temporary so no worry.

Patrick

1 Like

@phui , I uploaded a new version that must fix your issue. You can install and let me know if works.