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

HomeBridge and Docker Issue #2 #4

Closed kaiatkins closed 4 years ago

kaiatkins commented 4 years ago

I am using oznu/docker-homebridge with homebridge UI enabled on Western Digital PR4100

the error I am getting when home bridge loads:

[8/28/2019, 10:35:23 AM] Homebridge is running on port 53998. Traceback (most recent call last): File "/homebridge/node_modules/homebridge-lg-airco/resources/wideq/example.py", line 1, in import wideq File "/homebridge/node_modules/homebridge-lg-airco/resources/wideq/wideq/init.py", line 3, in from .core import * # noqa File "/homebridge/node_modules/homebridge-lg-airco/resources/wideq/wideq/core.py", line 9, in import requests ModuleNotFoundError: No module named 'requests'

Here is python3 version:

/homebridge/node_modules/homebridge-lg-airco/resources/wideq # python3 --version Python 3.7.3

When running command: python3 example.py -c “US” -l “en-US” -s "wideq_state.json" ls

/homebridge/node_modules/homebridge-lg-airco/resources/wideq # python3 example.py -c “US” -l “en-US” -s "wideq_state.json" ls Traceback (most recent call last): File "example.py", line 1, in import wideq File "/homebridge/node_modules/homebridge-lg-airco/resources/wideq/wideq/init.py", line 3, in from .core import * # noqa File "/homebridge/node_modules/homebridge-lg-airco/resources/wideq/wideq/core.py", line 9, in import requests ModuleNotFoundError: No module named 'requests'

beele commented 4 years ago

I have no idea, Try the latest version I updated some stuff so it works on python 3.7.x I've tested on rbpi3/4 and macosx

kaiatkins commented 4 years ago

/homebridge/node_modules/homebridge-lg-airco/resources/wideq # python3 example.py -c “US” -l “en-US” -s "wideq_state.json" ls Traceback (most recent call last): File "example.py", line 1, in import wideq File "/homebridge/node_modules/homebridge-lg-airco/resources/wideq/wideq/init.py", line 3, in from .core import * # noqa File "/homebridge/node_modules/homebridge-lg-airco/resources/wideq/wideq/core.py", line 9, in import requests ModuleNotFoundError: No module named 'requests'

kaiatkins commented 4 years ago

looks still same issue

beele commented 4 years ago

Python seems to be missing some dependencies. Is it a special kind of python installation?

Xivi08 commented 4 years ago

Same error here. All was working perfectly until the last week.

Any idea?

Xivi08 commented 4 years ago

Ok, solved. You need to install the "requests" module. I followed this instructions:

https://stackoverflow.com/questions/17309288/importerror-no-module-named-requests

beele commented 4 years ago

Updated readme with this information! @Xivi08 @kaiatkins does this fix the issue for you?

kaiatkins commented 4 years ago

Progressing :) Was able to get the url and paste the link back, (had to restart homebridge first after install to get it to work properly)

Now just this error message appears:

[1/29/2020, 1:29:03 PM] [LG-AirCon-MB] TypeError: Cannot read property 'substring' of undefined at parseMon (/homebridge/node_modules/homebridge-lg-airco/src/lg/wideq.js:122:42) at python.then (/homebridge/node_modules/homebridge-lg-airco/src/lg/wideq.js:25:40) at process._tickCallback (internal/process/next_tick.js:68:7)

Thank you again for your help in this matter.

beele commented 4 years ago

@kaiatkins If you open the wideq.js file (in nano/vim/...)

Add
console.log(monitorLines); below line 118 so it should look like this:

const parseMon = (data) => {
        const monitorLines = data.split('; ');
        console.log(monitorLines);
        return {
            onOff: monitorLines[0],
            mode: monitorLines[1],
            currentTemp: monitorLines[2].substring(4).replace('°C', ''),
            targetTemp: monitorLines[3].substring(4).replace('°C', ''),
            speed: monitorLines[4].substring(10).replace('\n', '')
        };
};

And then run it again. It should print some extra info in the logging. Could you paste that here. Might be something temperature related (like no celcius temperature available)

kaiatkins commented 4 years ago

I have added but don't see anything additional in logs just the Line number change wideq.js:122:42) to wideq.js:123:42)

37m[1/31/2020, 3:50:17 PM] Got SIGTERM, shutting down Homebridge... [1/31/2020, 3:50:25 PM] Loaded config.json with 1 accessories and 0 platforms. [1/31/2020, 3:50:25 PM] --- [1/31/2020, 3:50:25 PM] Loaded plugin: homebridge-lg-airco [1/31/2020, 3:50:25 PM] Registering accessory 'homebridge-lg-airco.HomebridgeLgAirco' [1/31/2020, 3:50:25 PM] --- [1/31/2020, 3:50:25 PM] Loaded plugin: homebridge-config-ui-x [1/31/2020, 3:50:25 PM] Registering platform 'homebridge-config-ui-x.config' [1/31/2020, 3:50:25 PM] --- [1/31/2020, 3:50:25 PM] Loading 0 platforms... [1/31/2020, 3:50:25 PM] Loading 1 accessories... [1/31/2020, 3:50:25 PM] [LG-AirCon] Initializing HomebridgeLgAirco accessory... [1/31/2020, 3:50:25 PM] [Config] Homebridge Config UI X v4.9.0 is listening on :: port 9191 Path to script file: /homebridge/node_modules/homebridge-lg-airco/resources/wideq/example.py Path to state file: /homebridge/node_modules/homebridge-lg-airco/resources/wideq/wideq_state.json

[1/31/2020, 3:50:29 PM] [LG-AirCon] TypeError: Cannot read property 'substring' of undefined at parseMon (/homebridge/node_modules/homebridge-lg-airco/src/lg/wideq.js:123:42) at python.then (/homebridge/node_modules/homebridge-lg-airco/src/lg/wideq.js:25:40) at process._tickCallback (internal/process/next_tick.js:68:7)

piet2000 commented 4 years ago

I have the same issue. Added the extra logging and the message is :

[ 'Session expired.\n' ]

rashmendis commented 4 years ago

I have the same issue. Added the extra logging and the message is :

[ 'Session expired.\n' ]

Same for me. Any fix?

piet2000 commented 4 years ago

I fixed this. The issue is with "°C" in the example.py remove from example.py in the lines the "°C". 'cur {0.temp_cur_c}°C; ' 'cfg {0.temp_cfg_c}°C; ' then remove from /src/lg/wideq.js

    currentTemp: monitorLines[2].substring(4)**.replace('°C', '')**,
    targetTemp: monitorLines[3].substring(4)**.replace('°C', '')**,
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!