Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ducted air con Zones not available. #705

Open
andyrowe247 opened this issue Feb 22, 2024 · 18 comments
Open

Ducted air con Zones not available. #705

andyrowe247 opened this issue Feb 22, 2024 · 18 comments

Comments

@andyrowe247
Copy link

andyrowe247 commented Feb 22, 2024

Describe the bug
The zones from ducted air conditioner are not visible in Home Assistant.

Expected behavior
Zones are visible in home assistant.

Actions Taken
Followed Duct zone control failed #670 suggestion, but no change.
#670

Screenshots
Screenshot_20240222_144749_Chrome

Environment details:

  • Environment (HASSIO,

  • Home Assistant version installed:
    Core 2024.2.2
    Supervisor 2024.02.0
    Operating System 11.5
    Frontend 20240207.1

  • Component version installed:
    v0.38.3

  • Last know working version:
    Not sure.

  • LG device type and model with issue:
    DUCT_626301_AU-SAC_DUCT (AC) by LG
    Firmware: 1.1.12

  • LG devices connected (list):
    DUCT_626301_AU-SAC_DUCT (AC) by LG
    Firmware: 1.1.12

Output of HA logs
2024-02-22 14:40:05.723 ERROR (MainThread) [custom_components.smartthinq_sensors.wideq.devices.ac] Duct zone control failed
Traceback (most recent call last):
File "/config/custom_components/smartthinq_sensors/wideq/devices/ac.py", line 957, in poll
await self.update_duct_zones()
File "/config/custom_components/smartthinq_sensors/wideq/devices/ac.py", line 445, in update_duct_zones
states = await self._get_duct_zones()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/smartthinq_sensors/wideq/devices/ac.py", line 502, in _get_duct_zones
zones = await self._get_config(DUCT_ZONE_V1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 620, in _get_config
data = await self._client.session.get_device_config(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 1328, in get_device_config
res = await self.post(
^^^^^^^^^^^^^^^^
File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 1057, in post
return await self._auth.gateway.core.lgedm2_post(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 387, in lgedm2_post
return self._manage_lge_result(out, is_api_v2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 414, in _manage_lge_result
raise exc.APIError(message, code)
custom_components.smartthinq_sensors.wideq.core_exceptions.APIError: 0011 - 등록되지 않은 모델입니다.


Additional context
Add any other context about the problem here.

@ollo69
Copy link
Owner

ollo69 commented Feb 22, 2024

Problem seems the response from LG server, that is returning "This model is not registered". Are you sure that you are using same configuration used in LG app (account, language, etc...)

@srrsparky
Copy link

I have more to add to this.

I still get the "Duct zone control failed" after restarting HA. If I disable the integration for a period (haven't worked out how long, but probably more than 30 minutes), and then re-enable it, everything works as expected.

This kinda makes me think the account is still "locked" by the integration, and doesn't unload itself properly. I started doing some debugging with the LG app, and think I saw two "de-authorise" requests when logging out of the app, whereas I think this integration is only doing one de-authorise. However, I would have to do some more testing.

The above could be completely made up, I have very little experience with HA & integrations. If there is anything I can do to help, let me know.

@ollo69
Copy link
Owner

ollo69 commented Feb 26, 2024

Can you provide more details about this two "de-authorise" done by LG app?

@srrsparky
Copy link

srrsparky commented Feb 28, 2024

I've done some testing, and data capture. Let me know if this helps, or if you need more logs / info. These were captured using version 5.0.16130 of the LG Thinq app.

Once I exit the app, HA works as expected.

When there is another user (or HA) is accessing the device, /api/rti/rtiResult reports a stateCode of "P".
When the app gets control, /api/rti/rtiResult reports a stateCode of "S".
There is about 12 minutes between disabling the HA integration, before the App reports it can control the device.

Once logged in on the app, this is the regular /api/rti/rtiResult
Request:
{ "lgedmRoot": { "workList": [ { "workId": "n-a031afda-0523-6563-6b9d-f0cb779e11db", "deviceId": "a031afda-0523-6563-6b9d-f0cb779e11db" } ] } }
Response:
{ "lgedmRoot": { "returnCd": "0000", "returnMsg": "OK", "workList": { "deviceId": "a031afda-0523-6563-6b9d-f0cb779e11db", "deviceState": "E", "format": "B64", "returnCode": "0000", "returnData": "eyJPcGVyYXRpb24iOiIxIiwiT3BNb2RlIjoiMiIsIldpbmRTdHJlbmd0aCI6IjYiLCJUZW1wVW5pdCI6IjAiLCJUZW1wQ3VyIjoiMjciLCJUZW1wQ2ZnIjoiMjUiLCJHcm91cFR5cGUiOiI1IiwiQWlyQ2xlYW4iOiJOUyIsIkF1dG9EcnkiOiJOUyIsIlBvd2VyU2F2ZSI6Ik5TIiwiU2xlZXBUaW1lIjoiMCIsIk9uVGltZSI6Ik5TIiwiT2ZmVGltZSI6Ik5TIiwiUmFjQWRkRnVuYyI6Ik5TIiwiRXh0cmFPcCI6IjAiLCJEaWFnQ29kZSI6IjAwIiwiVGVtcExpbWl0TWF4IjoiMzAiLCJUZW1wTGltaXRNaW4iOiIxNiIsIlRpbWVCc09uIjoiMCIsIlRpbWVCc09mZiI6IjAiLCJEdWN0Wm9uZVR5cGUiOiI0IiwiWm9uZUNvbnRyb2wiOiIxMyIsIkRSRUQiOiIwIn0=", "stateCode": "S", "workId": "n-a031afda-0523-6563-6b9d-f0cb779e11db" } } }

When I change the duct zone the app sends a POST to /api/rt/rtiControl
Request:
{ "lgedmRoot": { "deviceId": "a031afda-0523-6563-6b9d-f0cb779e11db", "workId": "09cc2bef-b76e-4e9d-30bf-d22c31741d44", "cmd": "Control", "cmdOpt": "Set", "value": { "DuctZone": "1_1/2_0/3_1/4_1/5_0" }, "format": "B64" } }
Response:
{ "lgedmRoot": { "returnCd": "0000", "returnMsg": "OK", "deviceId": "a031afda-0523-6563-6b9d-f0cb779e11db", "stateCode": "S", "workId": "n-09cc2bef-b76e-4e9d-30bf-d22c31741d", "format": "B64", "deviceState": "E", "timestamp": 0 } }

When I "exit" from the device in the app it sends 2 POSTS to /api/rti/delControlPermission
First
Request:
{ "lgedmRoot": { "deviceId": "a031afda-0523-6563-6b9d-f0cb779e11db" } }
Response:
{ "lgedmRoot": { "returnCd": "0000", "returnMsg": "OK", "stateCode": "S", "workId": "n-65dd37ae-2651-4a57-89b2-83aab96ec8", "deviceState": "E", "timestamp": 0 } }
Second
Request:
{ "lgedmRoot": { "deviceId": "a031afda-0523-6563-6b9d-f0cb779e11db" } }
Response:
{ "lgedmRoot": { "returnCd": "0000", "returnMsg": "OK", "stateCode": "S", "workId": "n-36b03e42-b9b0-4f40-8591-cca1160723", "deviceState": "E", "timestamp": 0 } }

This is what happens when I logout.
image

POST /api/rti/rtiMon
Request:
{ "lgedmRoot": { "deviceId": "a031afda-0523-6563-6b9d-f0cb779e11db", "workId": "n-a031afda-0523-6563-6b9d-f0cb779e11db", "cmd": "Mon", "cmdOpt": "Stop" } }
Response:
{ "lgedmRoot": { "returnCd": "0000", "returnMsg": "OK", "stateCode": "S", "workId": "n-n-a031afda-0523-6563-6b9d-f0cb779e", "deviceState": "E", "timestamp": 0 } }

DELETE /v1/service/users/client
Response:
{ "resultCode": "0000", "result": "" }

DELETE /proxy/v1/service/users/push
Response:
{ "resultCode": "0000", "result": {}, "resultExtra": [ { "iotSS": { "resultCode": "0000", "duration": "83" } } ] }

DELETE /v1/service/users/push
Response:
{ "resultCode": "0000", "result": "" }

@andyrowe247
Copy link
Author

Problem seems the response from LG server, that is returning "This model is not registered". Are you sure that you are using same configuration used in LG app (account, language, etc...)

I reinstalled the air con unit within the LG app a few times, using different air con remote types, and got the same issue each time.

Strangely, completing one of the installations resulted in the zones being available in HA for 1 minute before the zones vanished. I haven't been able to recreate the same result since.

@ollo69
Copy link
Owner

ollo69 commented Feb 28, 2024

You cannot control zone (or any other feature) when LG app is open, this is a know limitation for APIv1 devices

@andyrowe247
Copy link
Author

You cannot control zone (or any other feature) when LG app is open, this is a know limitation for APIv1 devices

That's want the problem.

@andyrowe247
Copy link
Author

Ran update to 1.34.0 from HACS, and re-established new AirCon device in LG app. Zones are now visible and working.

@ollo69
Copy link
Owner

ollo69 commented Mar 9, 2024

Suppose you mean 0.34.0, right? Are you saying that version over 0.34.0 is not working?

@andyrowe247
Copy link
Author

Hi. Found some time to get back to this.
My bad. No idea where i got 1.34.0 from.

I have version 0.38.7 installed.

What i have found is that the zones cease to exist following a reboot of HA.

The only way to get the zones to be available again is to complete a removal of the LG device from the integration, restart of HA, and reinstall a new device in the integration.

Reloading the integration doesn't work.

This error originated from a custom integration.

//------
Logger: custom_components.smartthinq_sensors.wideq.devices.ac
Source: custom_components/smartthinq_sensors/wideq/devices/ac.py:957
integration: SmartThinQ LGE Sensors (documentation, issues)
First occurred: 8:45:50 AM (21 occurrences)
Last logged: 10:15:32 AM

Duct zone control failed
Traceback (most recent call last):
File "/config/custom_components/smartthinq_sensors/wideq/devices/ac.py", line 957, in poll
await self.update_duct_zones()
File "/config/custom_components/smartthinq_sensors/wideq/devices/ac.py", line 445, in update_duct_zones
states = await self._get_duct_zones()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/smartthinq_sensors/wideq/devices/ac.py", line 502, in _get_duct_zones
zones = await self._get_config(DUCT_ZONE_V1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 620, in _get_config
data = await self._client.session.get_device_config(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 1328, in get_device_config
res = await self.post(
^^^^^^^^^^^^^^^^
File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 1057, in post
return await self._auth.gateway.core.lgedm2_post(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 387, in lgedm2_post
return self._manage_lge_result(out, is_api_v2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 414, in _manage_lge_result
raise exc.APIError(message, code)
custom_components.smartthinq_sensors.wideq.core_exceptions.APIError: 0011 - 등록되지 않은 모델입니다.

@andyrowe247
Copy link
Author

andyrowe247 commented Mar 17, 2024

You cannot control zone (or any other feature) when LG app is open, this is a know limitation for APIv1 devices

I have logged out of my LG app, and removed the app from my phone.

I'm not a coder so won't pretend that i know, but could it be that upon rebooting HA, LG still thinks that HA is logged in and won't allow access to the zones?

I am however able to still turn the air con on and off, and adjust the temperature however. It's just the zones that drop off.

@ollo69
Copy link
Owner

ollo69 commented Mar 18, 2024

I have logged out of my LG app, and removed the app from my phone

Not so sure that this is a good idea. Don't know what you exactly do, but registration of device go through LG app. If device is not registered through application with your LG account, the device will not be visible inside integration. I always left LG app on my phone, just keeping it always close. Translation of the message with code 0011 is "This model is not registered", so there could be a relation.

could it be that upon rebooting HA, LG still thinks that HA is logged in and won't allow access to the zones?

This could also be an option. Maybe the problem is that with a reboot the permission are not properly released and because when the integration restart a new clientid is generated probably the server think that is still in use by the previous one. I will take a look at it.

@andyrowe247
Copy link
Author

I have logged out of my LG app, and removed the app from my phone

Not so sure that this is a good idea. Don't know what you exactly do, but registration of device go through LG app. If device is not registered through application with your LG account, the device will not be visible inside integration. I always left LG app on my phone, just keeping it always close. Translation of the message with code 0011 is "This model is not registered", so there could be a relation.

could it be that upon rebooting HA, LG still thinks that HA is logged in and won't allow access to the zones?

This could also be an option. Maybe the problem is that with a reboot the permission are not properly released and because when the integration restart a new clientid is generated probably the server think that is still in use by the previous one. I will take a look at it.

Thanks for the quick reply.

Just for completeness, I've reinstalled and logged back onto the LG app. Keeping the app closed it produces the same result.

@andyrowe247
Copy link
Author

@ollo69, I've done a bit for testing and found that reloading the LG integration, on top of restarting HA, the zones become unavailable.

I what I've also found is, if i disable the integration for a period of time, (12 minutes on first test), then re-enable thy integration, the zones become available again.

Which looks like a timeout related issue.

@ollo69
Copy link
Owner

ollo69 commented Mar 18, 2024

I'm convinced that the problem are clientid. This should be stored and reused on reboot. I will work on this on my next idle time...

Copy link

github-actions bot commented May 3, 2024

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label May 3, 2024
@ollo69 ollo69 removed the Stale label May 4, 2024
@ollo69
Copy link
Owner

ollo69 commented May 4, 2024

Please try if last release fix this issue. Now client ID is stored with config entry and reused on startup. Consider that at least 2 reboot are required for have this change active.

@andyrowe247
Copy link
Author

Upon first tests, it seems to be working as intended, and did require two reboots for the zones to become available as indicated.

I'll keep an eye on it and advise if things change.

Many thanks @ollo69.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants