Expand LG RAC support (deviceType 401, modern caps & 0xA7 TLV) - #143
Expand LG RAC support (deviceType 401, modern caps & 0xA7 TLV)#143Nacorsito wants to merge 7 commits into
Conversation
Modern LG Room Air Conditioners running newer firmware variants (e.g. 917be) omit the legacy EEPROM checksum tag (0x2da) in their capabilities payload, reporting tags 0x2db or 0x2c1 instead. Without recognizing these tags, isCapsResponse fails and the device loops in capabilities query timeout. Expand isCapsResponse to accept 0x2db and 0x2c1 alongside 0x2da.
Follow-up to 931a3d8: allow 0xA7 in addition to 0x87 for processPrivData and processPrivDataCmdResp frames sent by newer appliances.
Many LG Room Air Conditioners present model names (e.g. WZ12AWN, WZ18AWN, S3NW12TZXBB, S3NW18TZXBA) or identify generically as deviceType 401 during ThinQ v2 registration without an exact match for meta.modelId. This patch: - Adds explicit model aliases for common WZ and S3NW RAC model series. - Adds fallback matching by meta.modelName when meta.modelId is missing. - Adds fallback resolution to RAC_056905_WW when deviceType is 401 or the model starts with RAC_/WZ/S3NW.
- Extract the RSA public key dynamically from ca.cert (with fallback to bundled key) so appliances encrypt provisioning credentials using the active local CA certificate instead of failing with encryptRes:ffff. - Dynamically resolve hostname, https_port, and mqtts_port from config.json. - Add connection (4s) and data (3s) timeouts to request() so thinq1Setup cleanly falls through to thinq2Setup without hanging indefinitely on ThinQ2 appliances. - Add timeout guard to thinq2Setup socket connection.
Add comprehensive unit tests verifying that WZ, S3NW, RAC_ prefix, and deviceType 401 models are correctly mapped to RAC_056905_WW.
…tributor attribution
| isCapsResponse(tlvArray: TLV.TLV[]) { | ||
| /* eeprom checksum */ | ||
| return tlvArray.some(({ t, v }) => t === 0x2da) | ||
| /* eeprom checksum (0x2da on older firmware, 0x2db or 0x2c1 on modern firmware) */ |
There was a problem hiding this comment.
That's obviously wrong since 0x2db is probably a FW version while 0x2c1 is support.airState.opMode.
And they are present on older FW versions too.
There was a problem hiding this comment.
Hi, thanks for the quick response. I don't know much about this protocol, i tried to follow the guide for adding support for new devices with some LLM help and after whole days it finally found a solution that worked for both my devices (WZ12AWN + WZ18AWN) and if im not wrong with some others that use the same internals. I debated about opening the PR because I couldn't 100% vouch for the code but i decided sharing the solution so someone with more knowledge can make use of it and save some time when adding support for those devices.
TLDR: I dont know much about the protocol, LLM produced some hallucinations but underlying fix works and is fully tested by hand on real hardware so i'd rather share it than leave it hidden in a drawer.
Summary
Adds support for modern LG DualCool Room Air Conditioners (RAC) running newer firmware (
917beand European/GlobalWZ/S3NWinverter series), improves provisioning reliability with custom CA certs, and formats the supported appliances list inREADME.mdinto a structured table with contributor attribution.Key Changes
Capabilities Tag Detection (
cloud/devices/RAC_056905_WW.ts):0x2daEEPROM tag, sending0x2dbor0x2c1instead.isCapsResponse()to accept0x2dband0x2c1to prevent devices from getting stuck in a capabilities query retry loop.TLV Private Data Command Byte (
cloud/devices/tlv_device.ts):0xA7command bytes alongside0x87inprocessPrivDataandprocessPrivDataCmdRespframes.HA Bridge Model Aliases & Fallbacks (
cloud/ha_bridge.ts):WZ12AWN,WZ18AWN, andS3NWseries.meta.modelIdis not found, fallback tometa.modelNameor map appliances reportingdeviceType === 401/RAC_toRAC_056905_WW.Dynamic RSA Key in Provisioning Tool (
rethink-setup.ts):./data/ca.certusing Nodecrypto(falling back to bundled key), fixingencryptRes:fffferrors when custom CA certificates are generated.thinq1Setupgracefully falls through tothinq2Setupwithout hanging.Unit Tests & Documentation:
tests/cloud/ha_bridge.test.tsfor model matching & fallbacks.0xA7modern caps test intests/cloud/devices/RAC_056905_WW.test.ts.README.mdsupported appliances list into a clean, categorized table with contributor credits.Testing
WZ12AWN SNU3 / S3NW12TZXBBandWZ18AWN SNU1 / S3NW18TZXBA) with full bidirectional Home Assistant climate control and live telemetry.npm test).npm run build).