beele / HomebridgeLgSmartThinqAirco

Homebridge plugin for controlling a split unit LG SmartThinq Airco unit
GNU General Public License v3.0
30 stars 7 forks source link

Wrong behavior since update docker homebridge #11

Open serbasan opened 4 years ago

serbasan commented 4 years ago

Hi. Thanks for your work and for this plugin.

With the latest version of the homebridge docker (python3.8.1, Node.js12.16.1 and Npm version 6.13.4) I can turn on the AC but after a while I can no longer turn it off, the state monitoring is lost.

If I turn it on and off without a long time it works well.

Also if I turn on manually the status in homebridge is not updated.

All this happens since I updated docker homebridge, before it was fine.

beele commented 4 years ago

If you try running it outside docker does it work then? Did you update docker or did you update homebridge?

serbasan commented 4 years ago

Docker and homebridge are up to date. If I turn on the manual ac the state at home does not change (it remains off).

If I turn it on with Home, after a while it ignores the shutdown command. I have to turn it back on and then turn it off. Then it works.

It looks like it doesn't refresh or query the status after a while.

beele commented 4 years ago

I'm working on a full rewrite which will hopefully fix the issue

serbasan commented 4 years ago

Thank you. I really want to try it and report it. Very grateful for your time

beele commented 4 years ago

I've published the new version, could you try with that? Please not that the config has changed! Follow the readme!

serbasan commented 4 years ago

Hi, I just tried it but something is wrong:

Environment: docker + Homebridge Config UI X

cd node_modules/homebridge-lg-airco/resources/wideq/ python3 example.py -c ES -l es-ES -p /homebridge/wideq_state.json

Create file wideq_state.json

My config:

        {
            "accessory": "LgAirCooler",
            "name": "Aire Acondicionado",
            "deviceId": "d281f580-XXXX-XXX-XXXX-2c2bf96c4a44",
            "model": "AC DUCT_626301_WW",
            "country": "ES",
            "language": "es-ES",
            "maxCoolingTemp": 30,
            "minCoolingTemp": 16,
            "maxHeatingTemp": 30,
            "minHeatingTemp": 16,
            "updateInterval": 60000,
            "debug": false,
            "dummy": false
        }, 

Log

[6/15/2020, 4:33:26 PM] ---
[6/15/2020, 4:33:26 PM] ====================
[6/15/2020, 4:33:26 PM] ERROR LOADING PLUGIN homebridge-lg-airco:
[6/15/2020, 4:33:26 PM] Error: Cannot find module '/homebridge/node_modules/homebridge-lg-airco/src/index.js'
Require stack:
- /usr/local/lib/node_modules/homebridge/lib/plugin.js
- /usr/local/lib/node_modules/homebridge/lib/pluginManager.js
- /usr/local/lib/node_modules/homebridge/lib/api.js
- /usr/local/lib/node_modules/homebridge/lib/server.js
- /usr/local/lib/node_modules/homebridge/lib/cli.js
- /usr/local/lib/node_modules/homebridge/bin/homebridge
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Plugin.load (/usr/local/lib/node_modules/homebridge/src/plugin.ts:181:27)
    at /usr/local/lib/node_modules/homebridge/src/pluginManager.ts:120:16
    at Map.forEach (<anonymous>)
    at PluginManager.initializeInstalledPlugins (/usr/local/lib/node_modules/homebridge/src/pluginManager.ts:118:18)
    at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:149:24)
    at cli (/usr/local/lib/node_modules/homebridge/src/cli.ts:80:10)
[6/15/2020, 4:33:26 PM] ====================

and:

    at PluginManager.getPluginForAccessory (/usr/local/lib/node_modules/homebridge/src/pluginManager.ts:198:15)
    at /usr/local/lib/node_modules/homebridge/src/server.ts:346:37
    at Array.forEach (<anonymous>)
    at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:329:29)
    at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:155:12)
    at cli (/usr/local/lib/node_modules/homebridge/src/cli.ts:80:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
[6/15/2020, 4:33:27 PM] Got SIGTERM, shutting down Homebridge...
beele commented 4 years ago

There were some files missing in the build, I've released a new one which should fix that issue

serbasan commented 4 years ago

It seems that now it is working. Some problems with fan speed. Does not match the scroll bar. Automatic mode, fan mode and dry mode would be fine. Thank you


  File "/homebridge/node_modules/homebridge-lg-airco/resources/wideq/wideq/core.py", line 232, in lgedm_post

    raise APIError(code, message)

wideq.core.APIError: ('0111', '제품 응답 지연')

[6/16/2020, 12:17:36 AM] [LG Airco] python error!
(node:3125) UnhandledPromiseRejectionWarning: Error: Could not set new fan speed of the AC unit!
    at LgAircoController.setFanSpeed (/homebridge/node_modules/homebridge-lg-airco/src/lg/lg-airco-controller.ts:160:23)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3125) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
[6/16/2020, 12:17:36 AM] [LG Airco] 163

[6/16/2020, 12:17:36 AM] [LG Airco] 163
beele commented 4 years ago

Could you enable the debug flag in the config, try again and paste the output here. Also what type of AC are you using?

serbasan commented 4 years ago

Today I receive this log and it doesn't work:

2020-06-17 00:00:18 DEBUG [wideq.example] State file found '/homebridge/wideq_state.json'

2020-06-17 00:00:18 DEBUG [wideq.example] State file found '/homebridge/wideq_state.json' Traceback (most recent call last): File "example.py", line 306, in main() File "example.py", line 302, in main

example(args.country, args.language, args.path, args.verbose, args.cmd, args.args)

File "example.py", line 219, in example state = json.load(f) File "/usr/lib/python3.8/json/init.py", line 293, in load return loads(fp.read(), File "/usr/lib/python3.8/json/init.py", line 357, in loads

return _default_decoder.decode(s)

File "/usr/lib/python3.8/json/decoder.py", line 337, in decode

obj, end = self.raw_decode(s, idx=_w(s, 0).end())

File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode

raise JSONDecodeError("Expecting value", s, err.value) from None

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

(node:371) UnhandledPromiseRejectionWarning: python error! (node:371) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:371) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

serbasan commented 4 years ago

My log now is this:

Traceback (most recent call last):
  File "example.py", line 306, in <module>

    main()
  File "example.py", line 302, in main
    example(args.country, args.language, args.path, args.verbose, args.cmd, args.args)
  File "example.py", line 219, in example
    state = json.load(f)
  File "/usr/lib/python3.8/json/__init__.py", line 293, in load

    return loads(fp.read(),
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads

    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode

    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode

    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

[6/17/2020, 12:07:37 AM] [Aire acondicionado] python error!
(node:1480) UnhandledPromiseRejectionWarning: Error: Could not change isOn state of the AC unit!
    at LgAircoController.setPowerState (/homebridge/node_modules/homebridge-lg-airco/src/lg/lg-airco-controller.ts:45:23)
(node:1480) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1480) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
beele commented 4 years ago

Try deleting the wideq state file and perform the login sequence again

serbasan commented 4 years ago

Okay. Deleting works again. This happens to me when I change from debub true to false or vice versa.

This is my log when I change different modes and fan speeds in case there is the possibility of adding them to HOME

[6/23/2020, 5:11:38 PM] LG TV is running on port 40821.
[6/23/2020, 5:11:38 PM] Please add [LG TV] manually in Home app. Setup Code: 031-45-154
2020-06-23 17:11:38 DEBUG [wideq.example] State file found '/homebridge/wideq_state.json'
2020-06-23 17:11:38 DEBUG [wideq.example] State file found '/homebridge/wideq_state.json'

[6/23/2020, 5:11:38 PM] [Aire acondicionado] d281f580-xxxxxxxx4a44: AIRE ACONDICIONADO (AC DUCT_626301_WW)

2020-06-23 17:11:38 DEBUG [wideq.example] Wrote state file '/homebridge/wideq_state.json'
2020-06-23 17:11:38 DEBUG [wideq.example] Wrote state file '/homebridge/wideq_state.json'

[6/23/2020, 5:11:38 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json ac-mon d281fxxxxxx4a44
[6/23/2020, 5:11:41 PM] [Aire acondicionado] on; DRY; cur 25.5; cfg 24; fan speed HIGH

[6/23/2020, 5:11:42 PM] [Aire acondicionado] on; DRY; cur 25.5; cfg 24; fan speed HIGH

[6/23/2020, 5:11:42 PM] [Aire acondicionado] [ 'on', 'DRY', 'cur 25.5', 'cfg 24', 'fan speed HIGH' ]
[6/23/2020, 5:11:42 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json get-power-draw d281xxxxxxxx6c4a44
[6/23/2020, 5:11:44 PM] [Aire acondicionado] 85

[6/23/2020, 5:11:44 PM] [Aire acondicionado] 85

[6/23/2020, 5:11:48 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json ac-mon d281f580xxxxxxx4a44
[6/23/2020, 5:11:53 PM] [Aire acondicionado] on; DRY; cur 25.5; cfg 24; fan speed HIGH

[6/23/2020, 5:11:53 PM] [Aire acondicionado] on; DRY; cur 25.5; cfg 24; fan speed HIGH

[6/23/2020, 5:11:53 PM] [Aire acondicionado] [ 'on', 'DRY', 'cur 25.5', 'cfg 24', 'fan speed HIGH' ]
[6/23/2020, 5:11:53 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json get-power-draw d281f58xxxxxxxxxx6c4a44
[6/23/2020, 5:11:55 PM] [Aire acondicionado] 85

[6/23/2020, 5:11:55 PM] [Aire acondicionado] 85

[6/23/2020, 5:11:58 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json ac-mon d28xxxxxxx4a44
[6/23/2020, 5:12:03 PM] [Aire acondicionado] on; DRY; cur 25.5; cfg 24; fan speed HIGH

[6/23/2020, 5:12:03 PM] [Aire acondicionado] on; DRY; cur 25.5; cfg 24; fan speed HIGH

[6/23/2020, 5:12:03 PM] [Aire acondicionado] [ 'on', 'DRY', 'cur 25.5', 'cfg 24', 'fan speed HIGH' ]
[6/23/2020, 5:12:03 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json get-power-draw d2xxxxxxxxa44
[6/23/2020, 5:12:05 PM] [Aire acondicionado] 85

[6/23/2020, 5:12:05 PM] [Aire acondicionado] 85

[6/23/2020, 5:12:08 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json ac-mon d2xxxxxxc4a44
[6/23/2020, 5:12:13 PM] [Aire acondicionado] on; FAN; cur 25.5; cfg 16; fan speed HIGH

[6/23/2020, 5:12:13 PM] [Aire acondicionado] on; FAN; cur 25.5; cfg 16; fan speed HIGH

[6/23/2020, 5:12:13 PM] [Aire acondicionado] [ 'on', 'FAN', 'cur 25.5', 'cfg 16', 'fan speed HIGH' ]
[6/23/2020, 5:12:13 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json get-power-draw d28xxxxxxc4a44
[6/23/2020, 5:12:15 PM] [Aire acondicionado] 85

[6/23/2020, 5:12:15 PM] [Aire acondicionado] 85

[6/23/2020, 5:12:18 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json ac-mon d28xxxxxc4a44
[6/23/2020, 5:12:23 PM] [Aire acondicionado] on; FAN; cur 25.5; cfg 24; fan speed HIGH

[6/23/2020, 5:12:23 PM] [Aire acondicionado] on; FAN; cur 25.5; cfg 24; fan speed HIGH

[6/23/2020, 5:12:23 PM] [Aire acondicionado] [ 'on', 'FAN', 'cur 25.5', 'cfg 24', 'fan speed HIGH' ]
[6/23/2020, 5:12:23 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json get-power-draw d28xxxxxxa44
[6/23/2020, 5:12:25 PM] [Aire acondicionado] 85

[6/23/2020, 5:12:25 PM] [Aire acondicionado] 85

[6/23/2020, 5:12:28 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json ac-mon d2xxxxxxxx4a44
[6/23/2020, 5:12:34 PM] [Aire acondicionado] on; ACO; cur 25.5; cfg 18; fan speed HIGH

[6/23/2020, 5:12:34 PM] [Aire acondicionado] on; ACO; cur 25.5; cfg 18; fan speed HIGH

[6/23/2020, 5:12:34 PM] [Aire acondicionado] [ 'on', 'ACO', 'cur 25.5', 'cfg 18', 'fan speed HIGH' ]
[6/23/2020, 5:12:34 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json get-power-draw d28xxxxxxxxc4a44
[6/23/2020, 5:12:36 PM] [Aire acondicionado] 85

[6/23/2020, 5:12:36 PM] [Aire acondicionado] 85

[6/23/2020, 5:12:38 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json ac-mon d2xxxxxxc4a44
[6/23/2020, 5:12:43 PM] [Aire acondicionado] on; COOL; cur 25.5; cfg 16; fan speed HIGH

[6/23/2020, 5:12:43 PM] [Aire acondicionado] on; COOL; cur 25.5; cfg 16; fan speed HIGH

[6/23/2020, 5:12:43 PM] [Aire acondicionado] [ 'on', 'COOL', 'cur 25.5', 'cfg 16', 'fan speed HIGH' ]
[6/23/2020, 5:12:43 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json get-power-draw d2xxxxxxx6c4a44
[6/23/2020, 5:12:45 PM] [Aire acondicionado] 85

[6/23/2020, 5:12:46 PM] [Aire acondicionado] 85

[6/23/2020, 5:12:48 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json ac-mon d281fxxxxxx4a44
[6/23/2020, 5:12:53 PM] [Aire acondicionado] on; HEAT; cur 25; cfg 16; fan speed HIGH

[6/23/2020, 5:12:53 PM] [Aire acondicionado] on; HEAT; cur 25; cfg 16; fan speed HIGH

[6/23/2020, 5:12:53 PM] [Aire acondicionado] [ 'on', 'HEAT', 'cur 25', 'cfg 16', 'fan speed HIGH' ]
[6/23/2020, 5:12:53 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json get-power-draw d281fxxxxxc4a44
[6/23/2020, 5:12:56 PM] [Aire acondicionado] 85

[6/23/2020, 5:12:56 PM] [Aire acondicionado] 85

[6/23/2020, 5:12:57 PM] [Camera ffmpeg] Snapshot from Default Camera at 480:270
[6/23/2020, 5:12:58 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json ac-mon d281f5xxxxxx6c4a44
[6/23/2020, 5:13:04 PM] [Aire acondicionado] on; DRY; cur 25.5; cfg 24; fan speed HIGH

[6/23/2020, 5:13:05 PM] [Aire acondicionado] on; DRY; cur 25.5; cfg 24; fan speed HIGH

[6/23/2020, 5:13:05 PM] [Aire acondicionado] [ 'on', 'DRY', 'cur 25.5', 'cfg 24', 'fan speed HIGH' ]
[6/23/2020, 5:13:05 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json get-power-draw d28xxxxx6c4a44
[6/23/2020, 5:13:07 PM] [Aire acondicionado] 85

[6/23/2020, 5:13:07 PM] [Aire acondicionado] 85

[6/23/2020, 5:13:08 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json ac-mon d28xxxxx6c4a44
[6/23/2020, 5:13:10 PM] [Camera ffmpeg] Snapshot from Default Camera at 480:270
[6/23/2020, 5:13:13 PM] [Aire acondicionado] on; DRY; cur 25.5; cfg 24; fan speed MID

[6/23/2020, 5:13:13 PM] [Aire acondicionado] on; DRY; cur 25.5; cfg 24; fan speed MID

[6/23/2020, 5:13:13 PM] [Aire acondicionado] [ 'on', 'DRY', 'cur 25.5', 'cfg 24', 'fan speed MID' ]
[6/23/2020, 5:13:13 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json get-power-draw d281fxxxxxf96c4a44
[6/23/2020, 5:13:15 PM] [Aire acondicionado] 86

[6/23/2020, 5:13:16 PM] [Aire acondicionado] 86

[6/23/2020, 5:13:18 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json ac-mon d2xxxxc4a44
[6/23/2020, 5:13:22 PM] [Camera ffmpeg] Snapshot from Default Camera at 480:270
[6/23/2020, 5:13:23 PM] [Aire acondicionado] on; DRY; cur 25.5; cfg 24; fan speed LOW

[6/23/2020, 5:13:23 PM] [Aire acondicionado] on; DRY; cur 25.5; cfg 24; fan speed LOW

[6/23/2020, 5:13:23 PM] [Aire acondicionado] [ 'on', 'DRY', 'cur 25.5', 'cfg 24', 'fan speed LOW' ]
[6/23/2020, 5:13:23 PM] [Aire acondicionado] python3 -u example.py -c ES -l es-ES -p /homebridge/wideq_state.json get-power-draw d281xxxxxc4a44
beele commented 4 years ago

I don't understand, it appears to be working. I see the AC is in DRY mode, which is not supported in the heatercooler service from homekit. It only supports HEAT/COOL/AUTO/OFF

beele commented 4 years ago

Can you try with the latest version (0.1.4)?