Skip to content
This repository has been archived by the owner on Oct 30, 2021. It is now read-only.

Commit

Permalink
Updated wideq (jet mode) & hoepfully fixed issue with corrupted state…
Browse files Browse the repository at this point in the history
… file
  • Loading branch information
beele committed Jul 9, 2020
1 parent dd1959d commit f34c1a6
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ After that an update of the state is performed every minute.

- Open a terminal on the device where you installed this plugin and type: `cd "$(npm root -g)" && cd homebridge-lg-airco/resources/wideq`
- Your terminal should navigate to the folder, if any error comes up the plugin was not installed correctly!
- Make sure requests has been installed, if not execute: `sudo python3 -m pip install requests`
- Execute the command `python3 example.py -c country-code -l language-code -p path-to-wideq-file-in-homebridge-folder` where you should replace `country-code`, `language-code` and `path-to-homebridge-folder` with the respective values.
For example: `python3 example.py -c BE -l en-UK -p /home/pi/.homebridge/wideq_state.json`
- Make sure the wideq_state.json does not exist yet! If the file is corrupted, delete it before executing the command again!
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-lg-airco",
"version": "0.1.3",
"version": "0.1.4",
"description": "Homebridge plugin to control a Smart Thinq enabled LG airco unit. Makes use of WideQ => https://github.com/sampsyo/wideq",
"main": "src/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion resources/wideq/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def ac_mon(client, device_id):
'on' if state.is_on else 'off'
)
)

break
except KeyboardInterrupt:
pass
finally:
Expand Down
25 changes: 25 additions & 0 deletions resources/wideq/wideq/ac.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@
from .core import FailedRequestError


class ACJetMode(enum.Enum):
"""JET mode puts your AC into highest cooling or dry or
heat mode(for a certain amount of time) depending on what you choose
This mode Overrides following setting:
1. Vertical swing is set to @100
2. Temperature gets set to 18 after jet mode turns off
3. Fan speed is set to HIGH (@AC_MAIN_WIND_STRENGTH_HIGH_W)
after jet mode turns off
"""

OFF = "@OFF"
COOL = "@COOL_JET"
HEAT = "@HEAT_JET"
DRY = "@DRY_JET_W"
HIMALAYAS = "@HIMALAYAS_COOL"


class ACVSwingMode(enum.Enum):
"""The vertical swing mode for an AC/HVAC device.
Expand Down Expand Up @@ -235,6 +253,13 @@ def get_zones(self):

return self._get_config('DuctZone')

def set_jet_mode(self, jet_opt):
"""Set jet mode to a value from the `ACJetMode` enum.
"""

jet_opt_value = self.model.enum_value('Jet', jet_opt.value)
self._set_control('Jet', jet_opt_value)

def set_fan_speed(self, speed):
"""Set the fan speed to a value from the `ACFanSpeed` enum.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/lg/wideq-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class WideqAdapter {

public async getStatus(deviceId: string): Promise<AirCoolerStatus> {
try {
const data: string = await PythonUtils.executePython3(WideqAdapter.wideqFolder, WideqAdapter.wideqScriptFile, ['-c', this.country, '-l', this.language, '-p', this.storagePath, this.debug ? '-v' : null, 'ac-mon', deviceId], true);
const data: string = await PythonUtils.executePython3(WideqAdapter.wideqFolder, WideqAdapter.wideqScriptFile, ['-c', this.country, '-l', this.language, '-p', this.storagePath, this.debug ? '-v' : null, 'ac-mon', deviceId]);
this.logDebug(data);

const dataPieces: string[] = data.split(';').map(s => s.trim());
Expand Down

0 comments on commit f34c1a6

Please sign in to comment.