In development: LG SmartThinQ component

Yes mate
I’m in AUS too same deal with my two ac keep dropping out now it won’t even let me register one of my ac through the smarthinq app. No point in talking to those LG drop kicks. Not sure what to do next

I’ll check later if the remote servers are common in between au and nz. Also I will try to forward the ac through a vpn to the US where my vps is hosted.

@samps the oauth keys where they obtained from proxying a phone ? Could it be now they are required different foreach region?

Same problem here with my 3 ac units and German account. So I guess this is not limited to AU and NZ…

Just left the unit registered this morning with no intervention and is being fine so far (12 hrs). I just arrived and pushed one api query to lg servers, see what happens in the next hour or so. Funny thing is even the device is unregistered, is still connected to the WiFi, and trafficking data to remote servers.

Just being through reviewing a mitmproxy log, looks like the wideq component needs to be re-done in some parts. Headers look different, the gateway URL also is different, the oauth refresh token endpoint is different.

Here is a couple of ss



After upgrading HA to 0.96.4 and cloning the latest from github.com/sampsyo/hass-smartthinq, three of my AC’s are not showing anymore in HA.

I also cloned wideq to my custom_components folder and did the procedure to retrieve a new refresh token.

sudo python3 example.py -c NL -l nl-NL

Example.py outputted all my AC’s:

d27b3ec0-7149-11d3-80ac-2c2bf923a9fb: RnD workshop (AC RAC_056905_NL)
d27b8ce0-7149-11d3-80ae-2c2bf923ed40: Vergaderruimte (AC RAC_056905_NL)
d27af0a0-7149-11d3-80aa-2c2bf923ec73: Command office (AC RAC_056905_NL)
d27bb3f0-7149-11d3-80af-7c1c4ec13ae6: Logistiek (AC RAC_056905_NL)
d27b3ec0-7149-11d3-80ac-2c2bf971afea: Project office (AC RAC_056905_WW)
d27b8ce0-7149-11d3-80ae-2c2bf971b0e6: Wouter (AC RAC_056905_WW)
d27b3ec0-7149-11d3-80ac-2c2bf923ecf1: Ontvangstruimte (AC RAC_056905_NL)
d27b3ec0-7149-11d3-80ac-2c2bf971afcb: Comms (AC RAC_056905_WW)
d27dfde0-7149-11d3-80be-203dbd480d34: Lunchtafel (AC CST_570004_WW)

The top 3 AC’s in this list are the ones now missing from HA.

My HA config is as follows:

climate:
  - platform: smartthinq
    refresh_token:  [actual token is here]
    country: NL
    language: nl-NL

My HA logfile shows errors like:

2019-07-25 17:20:32 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 226, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 256, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 206, in state_attributes
    data[ATTR_FAN_MODE] = self.fan_mode
  File "/config/custom_components/smartthinq/climate.py", line 177, in fan_mode
    return FAN_MODES[mode.name]
KeyError: 'MID_HIGH'

In some errors I see ‘LOW_MID’ instead of ‘MID_HIGH’.

I don’t know if this has to do with the 3 missing AC’s.

What can I do to get all of my AC’s back in HA ?

Looks like the devices are still there. Not unregistered, maybe connectivity problem no WiFi or internet for the units. Have you check if you can still ping them on local network ?

They are all still controllable with the SmartThinQ app. So their internet connection must be good I guess.

They also are all listed as online + good WiFi signal in my Unifi controller:

Those errors mid-high low-mid are because the units fans are in that mode however the component only uses 3. Take a look at my comment above. Try to either make a change in the cc that I did or use the app to set them low mid or high.

Hey subzero
Have you tried to change anything in wideq?
Still getting the ac dropout. Think your on the money after Lg updated the app they must have changed url’s.

I haven’t attempted anything yet since i have little knowledge on how to use library, i’ve been trying to replicate the post requests in node-red, which as i already mentioned before have the same effect as using the component making the unit unregistered from LG servers

I need to discuss that with @samps privately, there is a lot of stuff i have figure out this last two days. So I won’t go into further details for now, hopefully the library needs a little bit of tweak, maybe not sure.

Thanks!

I changed climate.py with the extra fan-modes, and this solved my problem. All ACs are back in HA.

FAN_MODES = {
    'LOW'		: c_const.FAN_LOW,
    'LOW_MID'	: 'low-mid',
    'MID'		: c_const.FAN_MEDIUM,  # Custom modes are supported but these 
    'MID_HIGH'	: 'mid-high',
    'HIGH'		: c_const.FAN_HIGH,   # are fine for now.
}
1 Like

So I finally got this working (temporarily) As per other comments, this addon now removes (de-registers) the devices from my SmartthinQ app. Initially it works for a short period of time, then commands stop working in Hassio but the devices are still showing in HA (Hassio in my case)

When this happens, checking the SmartthinQ app, all the added devices have disappeared and need to be re-added. This though it temporary as the above just repeats, disabling the addon returns the app to normal.

I hope there is a fix for this, as I really wanted this to work, thanks for your efforts all involved.

Regards

Craig

I did try to tweak the wideq library to adapt it to the new endpoints, new headers but it was beyond my capabilities at some point. I ended up gathering as much info as possible from wideq, mitmproxy, other sources also, and created a mqtt climate device controlled by node-red. Took me a while but i managed to simplify it a lot in the last week.

The usage of this new api endpoints do not un-register the device so far

1 Like

Well beyond my skill level!, good to see that you are making progress, thanks for the reply.

node-red can export-import all this in one json file text. The only caveat of this flow is designed to control one device only. But wouldn’t take much to put it for more AC units

Well if you’re are happy to share it I would certainly give it a try

Yes i’ll post it in another thread. Need to clear some passwords and keys

1 Like

Any updates? Anyone have this working?

Thanks