Contribution - LG ThinQ Binding

Hi there, count me in. Running openHAB 4.2.1, placed openhab-thinq-stuff/org.openhab.binding.lgthinq-4.3.0-SNAPSHOT.jar at main · nemerdaud/openhab-thinq-stuff · GitHub under /usr/share/openhab/addons - won’t install.

I upgraded my installation from 4.2.0 → 4.2.1-1
The binding works normally for me. I don’t know if there is something new from 4.2.1 to 4.2.1-1 that can solve the issue reported, but I suggest you guys to upgrade to the latest stable version (4.2.1-1), and update the binding to the latest version I put now in the repository (just in case).

It should work. If not, let me know !

Regards.

Hi there, thanks for your reply. I am on 4.2.1-1, Sorry if it was misleading.

What I’ve done so far;

Try #1 → putting org.openhab.binding.lgthinq-4.3.0-SNAPSHOT.jar under /usr/share/openhab/addons

grep --after-context=5 --before-context=10 'thinq' openhab.log

…returns not even a single line. Yes, the .jar has openhab:openhab set.

I’ve restarted the openhab service and rebooted the machine, has no effect on it.

I also cleaned openhabs’ cache.

Try #2 → bundle:install

bundle:install https://github.com/nemerdaud/openhab-thinq-stuff/blob/main/org.openhab.binding.lgthinq-4.3.0-SNAPSHOT.jar

returns

Unable to install bundle https://github.com/nemerdaud/openhab-thinq-stuff/blob/main/org.openhab.binding.lgthinq-4.3.0-SNAPSHOT.jar: org.osgi.framework.BundleException: Error occurred installing a bundle.

The correct URL to direct download is: https://raw.githubusercontent.com/nemerdaud/openhab-thinq-stuff/main/org.openhab.binding.lgthinq-4.3.0-SNAPSHOT.jar

Try it out and see if something changes.

Hi there, thanks!

329 │ Active │  80 │ 4.3.0.202408211143    │ openHAB Add-ons :: Bundles :: LG Thinq Binding

It’s active, but I can’t add things, nor do I see anything related to the binding in the logs. Also, it’s not listed in the “Add-On Store” under installed bindigs. Strange…

I took a look with more detail in this case and could found that for me, after 4.2.1 upgrade, the binding doesn’t appear in the UI anymore, but is still working, i.e., if you’ve already have a thing configured with this binding, it will work properly, you can see it and the channels, etc. But if you try to add a new LG Thinq Thing, it won’t be available to add manually (only by discovery).

It’s a very strange behavior because there’s no change in the binding’s descriptor between the version that justify this issue.
So I did a diff between 4.2.0 and 4.2.1 files to find whats changed and I found a file named addons.xml that was created in the 4.2.1 version. I don’t know how this file is managed and updated or if it’s a static file, but this file holds the descriptor of all the distribution’s addons that doesn’t include mine, because it’s still in review.

Well, all this to say if you add this (<addon:addon id=“lgthinq” … </addon:addon>) at the beginning of the openhab-sys/runtime/etc/addons.xml file:

        <addons>
                <addon:addon id="lgthinq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:addon="https://openhab.org/schemas/addon/v1.0.0" xsi:schemaLocation="https://openhab.org/schemas/addon/v1.0.0  https://openhab.org/schemas/addon-1.0.0.xsd">
                   <type>binding</type>
                   <name>LG ThinQ Binding</name>
                   <description>Controlling LG ThinQ enabled devices</description>
                   <connection>cloud</connection>
                </addon:addon>
        ...

Restart the OH and it should work. Let me know about the result. If you confirm that it start to work, I will open another topic because it’s probably a bug in the core.

1 Like

Good morning,
so to continue from yesterday’s state (active lg thinq binding with ID 329);

  1. log-rotated openhab’s log to get a fresh file to investigate on
  2. edited /usr/share/openhab/runtime/etc/addons.xml and put your xml-node as mentioned above at the very top (of course inherited in the “big” addons-node)
  3. (console) service openhab restart (I tail-ed openhab’s log in a separate console)
  4. I couldn’t see anything related in the log, so I double-checked with a grep on the log itself, looking for “thinq” → nothing to find
  5. I also checked for any addons.xml-related errors (parsing errors, etc.) → nothing to find
  6. checked the bundle:list output, thinq binding is active with ID329
  7. Under administration > add-on store, thinq binding can’t be found (even though it’s “active”)
  8. Under administration > settings > things there’s no option to add things from thinq binding

Is there any way to see which source an active addon has? The .jar is still stored under /usr/share/openhab/addons, but the installation itself - as it didn’t work by just placing the .jar in the folder - was done via bundle:install.

At this point let me thank you for your time and effort, happy to test/support when needed :slight_smile: !

Using the correct URL I now also was able to install the JAR and get it active, but I too, now cannot add a new Thing.

Just for the record, the OH version is 4.2.1. The “-1” suffix originates from the linux package enumeration and should never ever be used anywhere (like in addons.xml)

I suggest you to ask for help/comprehensive explanation on this.
Best would be to post on the forum in the ‘development’ category.
BTW: as far as I know, files in ..../runtime/.... usually are just copies and dynamically created from a source in $OH_USERDATA/etc

OK, lets check it again step by step. I think this is important to be a guide to people that have +4.2.X until I known an official explanation about this behavior change beginning at 4.2:

  1. Check the current configuration
    • Access the console and check if the lgthinq binding is currently instaled and activated by karaf:
    • Confirm that the binding is not recognized by the OH UI in AddOns Store and not available to be manually added in the Settings->Things
  2. Stop openhab and clear cache:
# sudo service openhab stop
# sudo openhab-cli clean-cache
  1. Verify the addons.xml file: /srv/openhab-sys/runtime/etc/addons.xml. It should start like this:
  2. Change that file in order to add the following entry:
                <addon:addon id="lgthinq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:addon="https://openhab.org/schemas/addon/v1.0.0" xsi:schemaLocation="https://openhab.org/schemas/addon/v1.0.0  https://openhab.org/schemas/addon-1.0.0.xsd">
                   <type>binding</type>
                   <name>LG ThinQ Binding</name>
                   <description>Controlling LG ThinQ enabled devices</description>
                   <connection>cloud</connection>
                </addon:addon>

To result in something like this:


5) Restart the OpenHab

# sudo service openhab start
  1. After completed restarted, touch the binding file (or if it’s not installed yet, copy the binding file inside addons folder) to force a reinstallation at karaf and openhab registry
touch /srv/openhab-addons/org.openhab.binding.lgthinq-4.3.0-SNAPSHOT.jar
  1. Check the OH UI again to see if the binding is now available at AddOns Store as installed and to be manually added in the Settings->Thing.

Those are the procedures I did to get the binding available in the UI. Let me know if it works for you !

1 Like

Good morning sir,

  1. Check the current configuration
329 │ Active │  80 │ 4.3.0.202408211143    │ openHAB Add-ons :: Bundles :: LG Thinq Binding
  1. Stop openhab and clear cache → OK / done
  2. Verify the addons.xml file (/usr/share/openhab/runtime/etc/addons.xml) → can confirm the first node was “Groovy Scription”
  3. Change that file in order to add the following entry → OK / done, the first node is lgthinq now (+ verification if addons.xml is openhab:openhab)
  4. Restart the OpenHab → OK / done (at this point no entries in log)
  5. After completed restarted, touch the binding file → binding is not shown in addon-store, putting the .jar under /usr/share/openhab/addons and touch(ing) it → .jar has now a current timestamp (at this point no entries in log)
  6. Check the OH UI again to see if the binding is now available at AddOns Store → unfortunately not available
  7. checking log again (grep ‘thinq’ /var/log/openhab/openhab.log) → empty
  8. checking log again (grep ‘addons.xml’ /var/log/openhab/openhab.log) → empty
  9. repeat step 2) → no change (binding still not shown under addon-store > bindings)
  10. repeat step 1) → the bundle is now gone
  11. bundle:install
bundle:install https://raw.githubusercontent.com/nemerdaud/openhab-thinq-stuff/main/org.openhab.binding.lgthinq-4.3.0-SNAPSHOT.jar
  1. bundle:start after verifying new bundle ID(!)
bundle:start 326
  1. repeat step8) and step9) → empty
  2. repeat step7) → unfortunately not available

Stopping my tests now, have a great day!

1 Like

FWIW, I tried the above steps as well and have had similar results.

Hi, I tried all the steps listed above.
Installed the addon, copied and touched the file in addons folder.

But the binding does not show up in addon browser and can not be selected in thing creation dialog.

Can i provide anymore information for you ?

I really don’t know why, but it’s not that smooth to install jar binding after 4.2.0 anymore. A number of users are reporting problems, even in my 4.2.1 installation it’s working normal.

To avoid this, since the binding is almost finished for the first stable release and it’s been reviewed to be officially available in regular OH distribution, I published it in the Community Marketplace to be easy to integrate with new OH versions.

Please, try to install new binding from the main OH UI (Add On Store > Binding > Community Marketplace) and try to find “LG Thinq Binding”. It’s point to the latest supported version for the OH stable version

Let me know if it’s working for you.

Integration via the marketplace works. :grinning:
I was able to create a bridge and Things via the UI.
The first installation failed, but after cleaning up the addons folder and “build:uninstall ” the installation went through.

Thank you for this LG integration and very quick response.

Hi, same here - installation via marketplace works. But I get an “Generic Error in the LG API communication process.

[.openhab.binding.lgthinq.internal.api.TokenManager] - Error logging with gateway: LGThinqGateway{empBaseUri='https://de.emp.lgsmartplatform.com', loginBaseUri='https://de.m.lgaccount.com/spx', apiRootV1='https://eic.lgthinq.com:46030/api', apiRootV2='https://eic-service.lgthinq.com:46030/v1', authBase='https://de.m.lgaccount.com', language='de-DE', country='DE', username='<blank>', password='<blank>', alternativeEmpServer='', accountVersion=0}

This is the thing-code;

label: Bridge - LG ThinQ
thingTypeUID: lgthinq:bridge
configuration:
  country: DE
  password: <redacted>
  language: de-DE
  poolingIntervalSec: 86400
  username: <redacted>
  manualCountry: null

It sounds like you have some problema with account configuration.
Please, put the binding in debug mode. It should display the original exception in the log.

Hi there, got it working;

label: Bridge - LG ThinQ
thingTypeUID: lgthinq:bridge
configuration:
  country: --
  password: <redacted>
  poolingIntervalSec: 86400
  language: de-DE
  manualCountry: <2-letter-countrycode>
  username: <redacted>

Setting manualCountry was the key.

Anyhow, my log shows several entries as follows;

Error returned by LG Server API. HTTP Status: 400. The reason is: {"resultCode":"9006","result":""}

By the way if anyone needs to know how to put a binding in debug mode;

bundle:list -s | grep thinq

produces something like;

325 │ Active │  80 │ 4.3.0.202408211143    │ org.openhab.binding.lgthinq

get the binding identifier an set log level;

log:set debug org.openhab.binding.lgthinq

don’t forget to revert it once you’re done, e.g.;

log:set warn org.openhab.binding.lgthinq
1 Like

Are you using ACs V2 ? Starting some days ago, LG API start denying the command to set up monitoring time in ACs V2. It’s a kind of command that says to the device to keep alive sending information about its status the the API. Even in the LG Thinq APP the same error occur. I’ve fixed this one given up to send this command after some denies. But I’m still working in thios version and it’s not available at this moment. But you can ignore this message.

Regards

1 Like

Hi there, yes - latest product generation.

I’m ignoring it (already decreased log-level to error), just reporting it back to you so you actually get some feedback from my testing.

Many, many thanks for your time and effort in that matter! Have a nice evening…

1 Like

You can change log level through MainUI as well. Just go addon-store, select the binding and press the little gear icon…