nVuln / homebridge-lg-thinq

A Homebridge plugin for controlling/monitoring LG ThinQ device via their ThinQ platform.
https://github.com/nVuln/homebridge-lg-thinq
Apache License 2.0
196 stars 48 forks source link

Device Support for LG AeroTower #145

Closed PeytonRG closed 1 year ago

PeytonRG commented 2 years ago

Which device do you want to add? Please describe:

Hi, I would like support added for the new LG PuriCare AeroTower air purifier/fan. Describe the solution you'd like:

I'd like to be able to see all the sensor data that is supported by HomeKit and be able to control and automate the device via HomeKit. The sensors from its specs page on lg.com are as follows:

Screen Shot 2022-03-20 at 9 07 25 PM

Device Data:

Device data: {"deviceId":"0d6562b7-ebb7-1747-93ad-4cbce9ee475c","deviceType":410,"modelName":"AFAN_910604_WW","subModelNm":null,"sensorType":null,"alias":"AeroTower","deviceCode":"AI12","networkType":"02","tftYn":"N","guideTypeYn":"Y","guideType":"AIR_TYPE2","pccModelYn":"N","autoOrderYn":"N","drServiceYn":"N","ssid":"nunyabusiness","timezoneCode":"America/New_York","timezoneCodeAlias":"USA/New_York","sdsGuide":"{\"deviceCode\":\"AI12\"}","newRegYn":"N","remoteControlType":"","fareTarget":null,"area":"334505","sleep":null,"deviceState":"E","rmsClientId":null,"regDtUtc":"20220320215804000","regIndex":0,"blackboxYn":"Y","groupableYn":"N","controllableYn":"N","combinedProductYn":"N","masterYn":"Y","snapshot":{"airState.windStrength":8,"airState.bellSound.control":0,"airState.diagCode":0,"airState.wDir.turnAngle":0,"airState.quality.odor":1,"airState.humidity.current":60,"airState.filterMngStates.useTimeTop":4000,"airState.operation":1,"airState.quality.PM10":5,"static":{"deviceType":"410","countryCode":"US"},"airState.quality.overall":1,"airState.tempState.current":20,"airState.filterMngStates.desorption":0,"airState.reservation.targetTimeToStart":0,"meta":{"allDeviceInfoUpdate":false,"messageId":"6iJUkd7iTwqHRqj_Xwvzow"},"airState.reservation.targetTimeToStop":0,"airState.circulate.strength":4,"airState.miscFuncState.airFast":0,"airState.lightingState.displayControl":8,"mid":14716047,"airState.miscFuncState.watertankLight":0,"airState.lightingState.signal":1,"airState.quality.sensorMon":0,"airState.miscFuncState.antiBugs":0,"airState.wMode.warmAir":0,"airState.wMode.humidification":0,"timestamp":1647828657095,"fwUpgradeInfo":{"upgSched":{"upgUtc":"0","cmd":"none"}},"airState.filterMngStates.maxTimeTop":4000,"airState.sensor.3axis_X":19,"airState.miscFuncState.Uvnano":1,"airState.sensor.3axis_Y":10,"airState.sensor.3axis_Z":10,"airState.miscFuncState.airRemoval":0,"airState.reservation.sleepTime":0,"airState.wDir.windFlow":0,"airState.miscFuncState.childLock":3,"airState.smartGuide.sub1":1,"airState.smartGuide.sub3":0,"airState.miscFuncState.cleanDry":0,"airState.smartGuide.sub2":0,"airState.quality.PM1":4,"airState.smartGuide":0,"airState.circulate.rotate":0,"airState.quality.PM2":5,"online":true,"airState.opMode":41,"airState.filterMngStates.maxTime":4000,"airState.filterMngStates.useTime":3999},"manufacture":null,"online":true,"platformType":"thinq2","homeDeviceOrder":1,"roomDeviceOrder":-1,"ownershipYn":"Y","modelJsonVer":"20.28","modelJsonUri":"https://objectcontent.lgthinq.com/52690d69-9807-4f05-8d92-e86f34075b76?hdnts=exp=1710885515~hmac=7c9be0be1fc4d4a9c08e6fbd2425a6de6c1541e3f7b22fa79370e707b70c9a46","appModuleVer":"6.07","appModuleUri":"https://objectcontent.lgthinq.com/b838478e-c62d-4b53-9016-10893c43e8ca?hdnts=exp=1700113160~hmac=50f5965a5a4476d7b6ab7e9e470c4ddf430cb4c7441138cc6a5568dca8f05a05","appRestartYn":"Y","appModuleSize":"15078697","langPackProductTypeVer":"30.99","langPackProductTypeUri":"https://objectcontent.lgthinq.com/acd395db-91f6-47e1-8a32-8d86f5754a2c?hdnts=exp=1707957632~hmac=f3eb39398e25e856e1bb7f17b31722261d3151b7905e22258f12811e19cab8cc","langPackModelVer":null,"langPackModelUri":null,"roomId":"","fwInfoList":[{"checksum":"0000F3B3","partNumber":"SAA42971102","order":3},{"checksum":"00004F01","partNumber":"SAA42971002","order":2},{"checksum":"0000E4AA","partNumber":"SAA42959903","order":1}],"modemInfo":{"modelName":"AFAN_910604_WW","appVersion":"clip_ble_v1.9.163","modemType":"RTK_RTL8720cm","ruleEngine":"y","size":2097152,"oneshot":"y"},"existsEntryPopup":"N","fwVer":null,"modemVer":"clip_ble_v1.9.110","subDeviceCount":0,"firebaseLogKey":null,"cardType":"Small","cardControl":"Base","detailDeviceCode":null,"upgradableYn":"N","autoFwDownloadYn":"N"}

PeytonRG commented 2 years ago

Not sure if it's of any help but this is the actual error in the log Device not supported: 0d6562b7-ebb7-1747-93ad-4cbce9ee475c: AeroTower (undefined AFAN_910604_WW)

nVuln commented 2 years ago

this device is new kind of air purifier, I published test version 1.2.15-test.2 to enable this device as air purifier, please download and try maybe temperature sensor and humidity sensor still missed, I'll update later

PeytonRG commented 2 years ago

Thanks for getting started on this so quickly! I'll try to be as thorough as possible and I've got screenshots at the bottom so you can see what I see.

Issues Found

  1. The control for the light doesn't seem to do anything. The display on the device has three brightness levels (1, 2, 3, and Off), so it would be nice if it could control that.
  2. What I'm assuming is a fan speed control doesn't seem to do anything. Options on the device are 1-10, Auto, and "Turbo" (whatever that means lol)
  3. Like you said, there are no temperature or humidity sensors yet in this version, but it is also missing the PM1.0 sensor. (The PM2.5 and PM10 appear to have matching data with the ThinQ app)
  4. The power button turns the device on and off fine, but when I turned it on via the Home app the sensor readings showed as unknown until I opened the ThinQ app. This might just be a limitation we have to deal with but thought I'd bring it up. There was a setting deep in the ThinQ app that allows the sensors to collect data even when the device is off, and that seems to have resolved this issue.

Nice-to-Haves from ThinQ App

  1. The fan also has 3 modes you can switch between: Wide, Diffusion, and Direct.
  2. Fan rotation controls (45deg, 60deg, 90deg, 140deg)
  3. The purifier has a UV purifier that can be toggled on and off.

IMG_5151 IMG_5152 IMG_5153

PeytonRG commented 2 years ago

And here's how it shows up in the Eve app, in case it offers any additional insight. IMG_5154

pyther commented 2 years ago

Adding a data point, I tested 1.2.15-test.2 as well and can confirm all the issues @PeytonRG outlined.

nVuln commented 2 years ago

I already published v1.2.15-test.4, added light brightness level 1 - 3, UV on/off button, temperature sensor and humidity sensor air quanlity PM 1.0 is not supported by homekit at this time, so it's not appear

pyther commented 2 years ago

Thanks for the update, in v1.2.15-test.6

PeytonRG commented 2 years ago

Meant to comment this a few days ago, sorry, but I can back up everything from @pyther's findings

PeytonRG commented 2 years ago

For the brightness slider it would be best I think if there was just a select list, assuming HomeKit supports that

PeytonRG commented 2 years ago

I just updated to 1.2.15 to get the fix for this issue https://github.com/nVuln/homebridge-lg-thinq/issues/157, and I guess the special updates from tests 2 and 4 didn't make it in. Could you release a new test version for this with the fix bundled in? @nVuln

nVuln commented 2 years ago

@PeytonRG sorry for late reply, I already published another version (included patch v1.2.15) with new tag aerotower version name v1.3.0-aerotower.1, we will working on this branch until it's working completed

@pyther can you pull device data while light is turned off? and some device data while adjust fan speed, I think aerotower speed from api is different with original air purifier

in latest version I fixed issue 100% brightness

some information about fan speed

"airState.windStrength": {
      "data_type": "enum",
      "label": "바람 세기",
      "value_mapping": {
        "0": "@WINDSTRENGTH_1",
        "1": "@WINDSTRENGTH_2",
        "2": "@WINDSTRENGTH_3",
        "3": "@WINDSTRENGTH_4",
        "4": "@WINDSTRENGTH_5",
        "5": "@WINDSTRENGTH_6",
        "6": "@WINDSTRENGTH_7",
        "7": "@AP_MAIN_MID_WINDSTRENGTH_POWER_W",
        "8": "@AP_MAIN_MID_WINDSTRENGTH_AUTO_W",
        "9": "@AP_MAIN_MID_WINDSTRENGTH_LONGPOWWER_W",
        "10": "@AP_MAIN_MID_WINDSTRENGTH_SHOWER_W",
        "11": "@AP_MAIN_MID_WINDSTRENGTH_FOREST_W",
        "12": "@AP_MAIN_MID_WINDSTRENGTH_TURBO_W",
        "13": "@AP_MAIN_MID_WINDSTRENGTH_FASTWIND_W",
        "101": "@WINDSTRENGTH_1",
        "102": "@WINDSTRENGTH_2",
        "103": "@WINDSTRENGTH_3",
        "104": "@WINDSTRENGTH_4",
        "105": "@WINDSTRENGTH_5",
        "106": "@WINDSTRENGTH_6",
        "107": "@WINDSTRENGTH_7",
        "108": "@WINDSTRENGTH_8",
        "109": "@WINDSTRENGTH_9",
        "110": "@WINDSTRENGTH_10"
      }
    },
PeytonRG commented 2 years ago

@nVuln ok I've updated so I'll try it out. I did notice this in the logs even though I have thinq 1 disabled

[30/04/2022, 10:55:16] [Homebridge UI] [homebridge-lg-thinq] Failed to login to old thinq v1 gateway. See debug logs for more details. Continuing anyways.
northpolebass commented 2 years ago

Newbie here… where can I download the test versions? Thanks.

nVuln commented 2 years ago

@northpolebass

Newbie here… where can I download the test versions? Thanks.

image

northpolebass commented 2 years ago

This latest Aerotower version 1.3.0-aerotower.1 of homebridge-lg-thinq works well with my air purifier (thanks!), but doesn't seem to support the 3 vane operating modes (Wide / Direct / Diffusion). This is different from the fan speed or undulating direction. I am including an excerpt from the manual to show what I mean. This function is supported in the iPhone LG app. Would be great if you could add this function!

Screen Shot 2022-05-31 at 20 36 48