Page 2 of 9

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Saturday 29 February 2020 1:12
by Melissen
Finally it works with ONE ac.. now I want to add my second ac. Anybody knows how to do that?

Many thanks in advance

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Saturday 29 February 2020 23:46
by Melissen
Yeeaaahhhhhh, finally got it all to work.

When you have multiple AC's and you want to control them all in Domoticz you need to make some adjustments.

Copy for each AC the file LGACServerNew.py to LGACServerNew2.py (or LGACServerNew3.py and so on)
In this file you should change 127.0.0.1 to 127.0.0.2 ( or 127.0.0.3 and so on)
Also change 22233 to 22234 (or 22235 and so on)
And put the devicenumber of that airco in that file.

Do the same steps as LGACServerNew.py, but now with 2 (or 3 added)
So make it executable and test this file

Also copy the file TestServer.py to TestServer2.py (or 3 and so on)
Also change here the ip-adress and portnumber as above

Then make the systemd-file.... also the same as above. Copy this file and call it: LGAC_server2.service
Change the Execstart path with the right file. ExecStart=/usr/bin/python3 /home/pi/LGAC_SmartT/LGACServerNew2.py



Also add 2 or 3 after the filenames:
sudo systemctl daemon-reload
sudo systemctl enable lgac_server.service
sudo systemctl start lgac_server
sudo systemctl status lgac_server

So.... basicly it's all copying the existing files to a file with a higher number. Change the ip-adresses and portnumbers with a higher number.

After all this copying and pasting, run Domoticz.

Go to Hardware as described and select LG AC....
Now at the fields with ip-adress and portnumber, use the ip-adresses and portnumbers with the higher number.
Now you can see Domoticz added new AC to the switches.....

So you add bij Hardware for every AC a device.....


No faults in the log of Domoticz, and everything works great.

I've tested and use this on a Raspberry with the latest Stretch-version. Buster gave me some troubles in the beginning (but maybe I made some mistakes as you can see by my questions above in this topic)

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Wednesday 18 March 2020 18:14
by Melissen
Both ac's can be controlled in Domoticz. But after a few hours or days one or both ac's can't be controlled. Got some errors in Domoticz log. After a restart both ac's can be controlled again.

Who's got the same problem.and knows how to fix this?

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Thursday 19 March 2020 20:57
by javalin
Melissen wrote:Both ac's can be controlled in Domoticz. But after a few hours or days one or both ac's can't be controlled. Got some errors in Domoticz log. After a restart both ac's can be controlled again.

Who's got the same problem.and knows how to fix this?
I have the plugin running from 2 months ago and only once I had and issue with the AC. Works very well. Do you have good wireless coverage at home?


Sent from my SM-G973F using Tapatalk


Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Friday 20 March 2020 0:07
by Melissen
When I start (or restart) Domoticz:
Schermafdruk 2020-03-20 00.01.34.png
Schermafdruk 2020-03-20 00.01.34.png (242.29 KiB) Viewed 8122 times
After a while:
AC error.jpg
AC error.jpg (154.05 KiB) Viewed 8122 times

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Friday 20 March 2020 15:48
by javalin
When you receive {'cmd': 'status', 'exception': "python-LGAC: 'Monitor' object has no attribute 'work_id'"} seems you loose connection with the server but don´t know why.
I would try to get a new "refresh_token".

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Friday 20 March 2020 19:34
by Melissen
It's strange, because when I reboot the Pi (not my AC's) everyting is running good again...

I'm going to make a fresh install again... but now installing this 'scripts' at the end of all my other devices (P1 meter, KWh-meter, GPIO-settings, Zigbee, MQTT etc...)

Also making different folders for my two airco-units. Hopefully this helps... Or has someone also 2 of more airco's running in Domoticz without any problems?

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Friday 20 March 2020 21:39
by javalin
Melissen wrote:It's strange, because when I reboot the Pi (not my AC's) everyting is running good again...

I'm going to make a fresh install again... but now installing this 'scripts' at the end of all my other devices (P1 meter, KWh-meter, GPIO-settings, Zigbee, MQTT etc...)

Also making different folders for my two airco-units. Hopefully this helps... Or has someone also 2 of more airco's running in Domoticz without any problems?
You can check the server status when you get the error with the following telnet command:

sudo systemctl status lgac_server

Maybe you get more info.

I only have one LG AC connected to Domoticz

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Wednesday 25 March 2020 5:49
by mattl0
Do you plan to support washer and dryer ?

I can see them with https://github.com/gladhorn/wideq/tree/api2_merged and it works.


this is the command i used to register

Code: Select all

python3 example.py -c CA -l en-CA

this is the washing machien when using it

Code: Select all

[code]        "washerDryer": {
            "extraRinse": "EXTRARINSE_OFF",
            "stainCare": "STAINCARE_OFF",
            "initialTimeMinute": 6.0,
            "smartCourseTLBaseUS": "NOT_SELECTED",
            "waterPlus": "WATERPLUS_OFF",
            "addGarment": "ADDGARMENT_OFF",
            "remoteStart": "REMOTE_START_OFF",
            "state": "RUNNING",
            "doorLock": "DOOR_LOCK_ON",
            "wifiSDS": "WIFI_SDS_OFF",
            "smallUE": "SMALLUE_OFF",
            "turboWash": "TURBOWASH_ON",
            "preState": "DETECTING",
            "spin": "SPIN_EXTRA_HIGH",
            "initialBit": "INITIAL_BIT_OFF",
            "reserveTimeMinute": 0.0,
            "initialTimeHour": 1.0,
            "reserveTimeHour": 0.0,
            "error": "ERROR_NO",
            "remainTimeHour": 1.0,
            "courseTLBaseUS": "PREWASH_PLUS",
            "rinse": "NO_RINSE",
            "soilWash": "SOILWASH_NORMAL",
            "dnnReady": "DNNREADY_OFF",
            "preWash": "PREWASH_OFF",
            "soak": "SOAK_OFF",
            "TCLCount": 1.0,
            "temp": "TEMP_TAP_COLD",
            "fabricSoftener": "FABRICSOFTENER_OFF",
            "downloadedCourseTLBaseUS": "SMALL_LOAD",
            "soakBit": "SOAK_OFF",
            "coldWash": "COLDWASH_OFF",
            "saveEnergy": "SAVE_ENERGY_OFF",
            "remainTimeMinute": 3.0,
            "steam": "STEAM_OFF",
            "childLock": "CHILDLOCK_OFF"
        },

And this is the dryer when i use it :

Code: Select all

        "washerDryer": {
            "dampDrySignal": "DAMPDRYSIGNAL_OFF",
            "initialTimeMinute": 59.0,
            "antiBacterial": "ANTIBACTERIAL_OFF",
            "remoteStart": "REMOTE_START_OFF",
            "state": "DRYING",
            "energySaver": "ENERGYSAVER_OFF",
            "easyIron": "EASYIRON_OFF",
            "moreLessTime": 0.0,
            "turboSteam": "TURBOSTEAM_OFF",
            "courseDryer27inchBase": "NORMAL",
            "wrinkleCare": "WRINKLECARE_OFF",
            "preState": "INITIAL",
            "initialBit": "INITIAL_BIT_OFF",
            "loadItem": "LOADITEM_OFF",
            "initialTimeHour": 0.0,
            "downloadedCourseDryer27inchBase": "SUPERDRY",
            "error": "ERROR_NO",
            "remainTimeHour": 0.0,
            "reduceStatic": "REDUCESTATIC_OFF",
            "smartCourseDryer27inchBase": "NOT_SELECTED",
            "dryLevel": "DRYLEVEL_VERYDRY",
            "temp": "TEMP_MEDIUM",
            "timeDry": "TIMEDRY_OFF",
            "remainTimeMinute": 57.0,
            "childLock": "CHILDLOCK_OFF"
        },

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Thursday 02 April 2020 20:25
by Melissen
Hi,

After the Domoticz upgrade to 2020.1.. I need to have Buster installed.
Now I get errors on :

pi@raspberrypi:~/LGAC_SmartT $ sudo systemctl status lgac_serverW
● lgac_serverW.service - LG AC Device Server
Loaded: loaded (/lib/systemd/system/lgac_serverW.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2020-04-02 20:12:45 CEST; 10min ago
Process: 1643 ExecStart=/usr/bin/python3 /home/pi/LGAC_SmartT/LGACServerNewW.py (code=exited, status=1/FAILURE)
Main PID: 1643 (code=exited, status=1/FAILURE)

apr 02 20:12:44 raspberrypi systemd[1]: Started LG AC Device Server.
apr 02 20:12:45 raspberrypi python3[1643]: Traceback (most recent call last):
apr 02 20:12:45 raspberrypi python3[1643]: File "/home/pi/LGAC_SmartT/LGACServerNewW.py", line 12, in <module>
apr 02 20:12:45 raspberrypi python3[1643]: import msgpack
apr 02 20:12:45 raspberrypi python3[1643]: ModuleNotFoundError: No module named 'msgpack'
apr 02 20:12:45 raspberrypi systemd[1]: lgac_serverW.service: Main process exited, code=exited, status=1/FAILURE
apr 02 20:12:45 raspberrypi systemd[1]: lgac_serverW.service: Failed with result 'exit-code'.


So I need a solution for "IMPORT MSGPACK"
How can I solve this in Buster.... (in Stretch there are no problems)

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Sunday 21 June 2020 23:24
by romansladecek
fix for errors with ssl:

sudo sed -i "s|TLSv1.2|TLSv1.0|g" /etc/ssl/openssl.cnf

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Monday 22 June 2020 17:35
by arma_esiea
Hi,

Anybody use a LG washer (new model) with this plugin ?
I have found this fork who display washer in list item but i don't how send an ON command :

https://github.com/tinkerborg/wideq

Sincerely

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Saturday 27 June 2020 14:58
by stingone
Any update how to get this working on buster? The scripts are giving a lot of errors.

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Saturday 27 June 2020 21:51
by stingone
Thierry33700 wrote: Sunday 03 November 2019 15:41
luckymr2201 wrote: Monday 26 August 2019 8:53 Thierry,

Once you logged in using the provided URL you should see that the resulting URL has 3 data in it. access_token, refresh_token and oauth2_backend_url
This is all that would go in the resulting json file anyway.
I suggest you simply move to the next step using the raw information from the URL that you can copy / paste in a text editor.

I hope this will be enough to get you out of trouble.
Hello luckymr2201,
Thanks for your help, unfortunately i was not able to go next step, i created a wideq_state.json file like follow :

"{
"access_token": "1ca3e111112234e543cfada616f65ee60493d136640adc1e1f841989a7fe9cf3350594da1c6ae485e6e6e8182f4f42451d",
"refresh_token": "194be3b7596111111a5eb8ee484e180d3adb4644a63fc4f8ce9709e3f1c696fb20d1329e022d56daab51ac820893bd7",
"oauth2_backend_url": "https://gb.lgeapi.com/"
}
"
But i had the same issue when running 'python3 example.py ls' :

Traceback (most recent call last):
File "example.py", line 214, in <module>
example(sys.argv[1:])
File "example.py", line 200, in example
example_command(client, args)
File "example.py", line 180, in example_command
func(client, *args[1:])
File "example.py", line 25, in ls
for device in client.devices:
File "/root/LGAC_SmartT/wideq.py", line 474, in devices
self._devices = self.session.get_devices()
File "/root/LGAC_SmartT/wideq.py", line 465, in session
self._session, self._devices = self.auth.start_session()
File "/root/LGAC_SmartT/wideq.py", line 257, in start_session
return Session(self, session_id), as_list(session_info['item'])
KeyError: 'item'


Can't go further. Hope someone has the same issue and help ;-)

Thx.
Thierry
How did you solve this? get the same error. With both Buster and Stretch

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Wednesday 01 July 2020 6:59
by Thierry33700
stingone wrote: Saturday 27 June 2020 21:51
Thierry33700 wrote: Sunday 03 November 2019 15:41
luckymr2201 wrote: Monday 26 August 2019 8:53 Thierry,

Once you logged in using the provided URL you should see that the resulting URL has 3 data in it. access_token, refresh_token and oauth2_backend_url
This is all that would go in the resulting json file anyway.
I suggest you simply move to the next step using the raw information from the URL that you can copy / paste in a text editor.

I hope this will be enough to get you out of trouble.
Hello luckymr2201,
Thanks for your help, unfortunately i was not able to go next step, i created a wideq_state.json file like follow :

"{
"access_token": "1ca3e111112234e543cfada616f65ee60493d136640adc1e1f841989a7fe9cf3350594da1c6ae485e6e6e8182f4f42451d",
"refresh_token": "194be3b7596111111a5eb8ee484e180d3adb4644a63fc4f8ce9709e3f1c696fb20d1329e022d56daab51ac820893bd7",
"oauth2_backend_url": "https://gb.lgeapi.com/"
}
"
But i had the same issue when running 'python3 example.py ls' :

Traceback (most recent call last):
File "example.py", line 214, in <module>
example(sys.argv[1:])
File "example.py", line 200, in example
example_command(client, args)
File "example.py", line 180, in example_command
func(client, *args[1:])
File "example.py", line 25, in ls
for device in client.devices:
File "/root/LGAC_SmartT/wideq.py", line 474, in devices
self._devices = self.session.get_devices()
File "/root/LGAC_SmartT/wideq.py", line 465, in session
self._session, self._devices = self.auth.start_session()
File "/root/LGAC_SmartT/wideq.py", line 257, in start_session
return Session(self, session_id), as_list(session_info['item'])
KeyError: 'item'


Can't go further. Hope someone has the same issue and help ;-)

Thx.
Thierry
How did you solve this? get the same error. With both Buster and Stretch
Hello, i did not solve this problem,, can't use the plugin ;-(

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Wednesday 01 July 2020 20:24
by stingone
[/quote]

How did you solve this? get the same error. With both Buster and Stretch
[/quote]

Hello, i did not solve this problem,, can't use the plugin ;-(
[/quote]

Seems to be a APIv2 issue that is not implemented in this plugin. :(

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Saturday 15 August 2020 0:29
by heggink
Since this repo had not been updated for quite a while and there were a bunch of issues I encountered, Forked it and made a couple of changes:
- update to the latest msgpack (which has utf8 by default)
- that in turn allows plugin restart (thanks @dnpwwo!!!)
- some connection management optimisations
- general logging improvements

Tested on rpi3 / buster. Still many thanks to olinek2 for doing the work to begin with.

https://github.com/heggink/LGAC_SmartT

H

Re: Python Plugin: LG Smart AC (SmartThinQ) - SOLVED

Posted: Sunday 04 October 2020 12:23
by Thierry33700
stingone wrote: Saturday 27 June 2020 21:51
Thierry33700 wrote: Sunday 03 November 2019 15:41
luckymr2201 wrote: Monday 26 August 2019 8:53 Thierry,

Once you logged in using the provided URL you should see that the resulting URL has 3 data in it. access_token, refresh_token and oauth2_backend_url
This is all that would go in the resulting json file anyway.
I suggest you simply move to the next step using the raw information from the URL that you can copy / paste in a text editor.

I hope this will be enough to get you out of trouble.
Hello luckymr2201,
Thanks for your help, unfortunately i was not able to go next step, i created a wideq_state.json file like follow :

"{
"access_token": "1ca3e111112234e543cfada616f65ee60493d136640adc1e1f841989a7fe9cf3350594da1c6ae485e6e6e8182f4f42451d",
"refresh_token": "194be3b7596111111a5eb8ee484e180d3adb4644a63fc4f8ce9709e3f1c696fb20d1329e022d56daab51ac820893bd7",
"oauth2_backend_url": "https://gb.lgeapi.com/"
}
"
But i had the same issue when running 'python3 example.py ls' :

Traceback (most recent call last):
File "example.py", line 214, in <module>
example(sys.argv[1:])
File "example.py", line 200, in example
example_command(client, args)
File "example.py", line 180, in example_command
func(client, *args[1:])
File "example.py", line 25, in ls
for device in client.devices:
File "/root/LGAC_SmartT/wideq.py", line 474, in devices
self._devices = self.session.get_devices()
File "/root/LGAC_SmartT/wideq.py", line 465, in session
self._session, self._devices = self.auth.start_session()
File "/root/LGAC_SmartT/wideq.py", line 257, in start_session
return Session(self, session_id), as_list(session_info['item'])
KeyError: 'item'


Can't go further. Hope someone has the same issue and help ;-)

Thx.
Thierry
How did you solve this? get the same error. With both Buster and Stretch
Hi,
After lot of several new tests, i succeded. Here is what i did to make it work.
First, i deleted /home/pi/LGAC_SmartT folder:
sudo rm -rf LGAC_SmartT/

then i choosed fork from https://github.com/heggink/LGAC_SmartT. - Thanks to heggink !!!
I followed mostly his installation process, get the same problem ... BUT then i had the idea to change this line in the installation process :

python3 example.py

was changed into
sudo python3 example.py

then everything worked for the server.

Then in domoticz, i get the following errors in domoticz's logs :
...
2020-10-04 11:42:09.327 Error: (LG-SmartThinq-AC) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/LG-SThinq-AC/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-10-04 11:42:09.328 Error: (Clim_Salon) Module Import failed, exception: 'AttributeError'
2020-10-04 11:42:09.328 Error: (Clim_Salon) Error Line details not available.
2020-10-04 11:43:20.329 Error: Clim_Salon hardware (7) thread seems to have ended unexpectedly
..
I found a similar issue there : https://github.com/mrin/domoticz-mirobo ... /issues/26

So i followed to type :
sudo pip3 install -U --ignore-installed msgpack=="0.6.2"

Then domoticz started to use the plugin !!

Next i'll add others Climatisers by creating duplications of the server scripts as explain.
And i will now prepare or look for a script to manage start and stop within a given temperature in the room.

Thanks to all developpers that worked on this.

Thierry

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Wednesday 14 October 2020 21:53
by Devious
I'm still getting the same error

...
7&oauth2_backend_url=https://gb.lgeapi.com/
Traceback (most recent call last):
File "example.py", line 214, in <module>
example(sys.argv[1:])
File "example.py", line 200, in example
example_command(client, args)
File "example.py", line 177, in example_command
ls(client)
File "example.py", line 25, in ls
for device in client.devices:
File "/home/pi/LGAC_SmartT/wideq.py", line 474, in devices
self._devices = self.session.get_devices()
File "/home/pi/LGAC_SmartT/wideq.py", line 465, in session
self._session, self._devices = self.auth.start_session()
File "/home/pi/LGAC_SmartT/wideq.py", line 257, in start_session
return Session(self, session_id), as_list(session_info['item'])
KeyError: 'item'
pi@raspberrypi:~/LGAC_SmartT $

I used the sudo python3 example.py

anyone else?

Re: Python Plugin: LG Smart AC (SmartThinQ)

Posted: Friday 23 October 2020 19:54
by molnaratti
mattl0 wrote: Wednesday 25 March 2020 5:49 Do you plan to support washer and dryer ?

I can see them with https://github.com/gladhorn/wideq/tree/api2_merged and it works.


this is the command i used to register

Code: Select all

python3 example.py -c CA -l en-CA

this is the washing machien when using it

Code: Select all

[code]        "washerDryer": {
            "extraRinse": "EXTRARINSE_OFF",
            "stainCare": "STAINCARE_OFF",
            "initialTimeMinute": 6.0,
            "smartCourseTLBaseUS": "NOT_SELECTED",
            "waterPlus": "WATERPLUS_OFF",
            "addGarment": "ADDGARMENT_OFF",
            "remoteStart": "REMOTE_START_OFF",
            "state": "RUNNING",
            "doorLock": "DOOR_LOCK_ON",
            "wifiSDS": "WIFI_SDS_OFF",
            "smallUE": "SMALLUE_OFF",
            "turboWash": "TURBOWASH_ON",
            "preState": "DETECTING",
            "spin": "SPIN_EXTRA_HIGH",
            "initialBit": "INITIAL_BIT_OFF",
            "reserveTimeMinute": 0.0,
            "initialTimeHour": 1.0,
            "reserveTimeHour": 0.0,
            "error": "ERROR_NO",
            "remainTimeHour": 1.0,
            "courseTLBaseUS": "PREWASH_PLUS",
            "rinse": "NO_RINSE",
            "soilWash": "SOILWASH_NORMAL",
            "dnnReady": "DNNREADY_OFF",
            "preWash": "PREWASH_OFF",
            "soak": "SOAK_OFF",
            "TCLCount": 1.0,
            "temp": "TEMP_TAP_COLD",
            "fabricSoftener": "FABRICSOFTENER_OFF",
            "downloadedCourseTLBaseUS": "SMALL_LOAD",
            "soakBit": "SOAK_OFF",
            "coldWash": "COLDWASH_OFF",
            "saveEnergy": "SAVE_ENERGY_OFF",
            "remainTimeMinute": 3.0,
            "steam": "STEAM_OFF",
            "childLock": "CHILDLOCK_OFF"
        },

And this is the dryer when i use it :

Code: Select all

        "washerDryer": {
            "dampDrySignal": "DAMPDRYSIGNAL_OFF",
            "initialTimeMinute": 59.0,
            "antiBacterial": "ANTIBACTERIAL_OFF",
            "remoteStart": "REMOTE_START_OFF",
            "state": "DRYING",
            "energySaver": "ENERGYSAVER_OFF",
            "easyIron": "EASYIRON_OFF",
            "moreLessTime": 0.0,
            "turboSteam": "TURBOSTEAM_OFF",
            "courseDryer27inchBase": "NORMAL",
            "wrinkleCare": "WRINKLECARE_OFF",
            "preState": "INITIAL",
            "initialBit": "INITIAL_BIT_OFF",
            "loadItem": "LOADITEM_OFF",
            "initialTimeHour": 0.0,
            "downloadedCourseDryer27inchBase": "SUPERDRY",
            "error": "ERROR_NO",
            "remainTimeHour": 0.0,
            "reduceStatic": "REDUCESTATIC_OFF",
            "smartCourseDryer27inchBase": "NOT_SELECTED",
            "dryLevel": "DRYLEVEL_VERYDRY",
            "temp": "TEMP_MEDIUM",
            "timeDry": "TIMEDRY_OFF",
            "remainTimeMinute": 57.0,
            "childLock": "CHILDLOCK_OFF"
        },
Thank you! works . Domoticz plugin expected?