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

Invalid AC Temperature Range #273

Closed aabdellah closed 5 months ago

aabdellah commented 10 months ago

Describe The Bug: Allows temperature control out of the supported value ranges on RAC_056905. Available range in home app is 16 to 30 and it allows setting 0.5 values while AC doesn't support it.

To Reproduce: Use temperature slider in home app to access the unavailable ranges.

Expected behavior: Temperature slider should show only support the available range, which in my case 20-28.

Plugin Config:

{
    "country": "",
    "language": "",
    "auth_mode": "token",
    "refresh_token": "",
    "username": "",
    "password": "",
    "devices": [
        {
            "id": "",
            "name": "Air Conditioner 2",
            "type": "AC",
            "serial_number": "",
            "ac_mode": "BOTH",
            "ac_swing_mode": "BOTH",
            "ac_temperature_sensor": true,
            "ac_fan_control": false,
            "ac_temperature_unit": "C",
            "ac_buttons": []
        },
        {
            "id": "",
            "name": "Air Conditioner 1",
            "type": "AC",
            "serial_number": "",
            "ac_mode": "BOTH",
            "ac_swing_mode": "BOTH",
            "ac_temperature_sensor": true,
            "ac_fan_control": false,
            "ac_temperature_unit": "C"
        }
    ],
    "thinq1": false,
    "refresh_interval": 60,
    "platform": "LGThinQ"
}

Screenshots:

Environment:

aabdellah commented 10 months ago

I have failed to find where the min/max/step values for each model is stored in the device payload, my assumption is that the application has them hardcoded according to the model number.

I think it would be better if we can set them in the json config in as a string in the format of min,max,step for my device case it would be 16,28,1 for Heat and 20,30,1.

But I'm not sure if HomeKit supports setting different ranges for each mode.

nVuln commented 9 months ago

can you share your device data? homekit can have different range setting for cooling and heating

aabdellah commented 9 months ago

The ranges for my device in ThinQ app is: Heat from 16c to 28c with 1c increments Cool from 20c to 30c with 1c increments

I notice also that the range changes when other functions are enabled.

Is there any other data that would be helpful?

nVuln commented 9 months ago

device data json in debug logging, they have device model json and we can extract min/max from this

aabdellah commented 9 months ago

{ "modelAppType": "NUTS", "brandType": "common", "deviceId": "f89ebcc0-2d00-1435-a61b-4cbad730c287", "deviceType": 401, "modelName": "RAC_056905_WW", "subModelNm": null, "sensorType": null, "alias": "Air Conditioner 1", "deviceCode": "AI01", "networkType": "02", "tftYn": "N", "guideTypeYn": "Y", "guideType": "RAC_TYPE1", "pccModelYn": "N", "autoOrderYn": "N", "drServiceYn": "N", "ssid": "TP-Link_56B4", "timezoneCode": "UTC", "timezoneCodeAlias": "UTC", "sdsGuide": "{\"deviceCode\":\"AI01\"}", "newRegYn": "N", "remoteControlType": null, "fareTarget": null, "area": "127159", "sleep": null, "deviceState": "E", "rmsClientId": null, "regDtUtc": "20240121202441000", "regIndex": 0, "blackboxYn": "Y", "groupableYn": "Y", "controllableYn": "Y", "combinedProductYn": "N", "masterYn": "Y", "snapshot": { "airState.windStrength": 8, "airState.wMode.lowHeating": 0, "airState.diagCode": 0, "airState.lightingState.displayControl": 1, "airState.wDir.hStep": 0, "mid": 207282178, "airState.energy.onCurrent": 50, "airState.wMode.airClean": 0, "airState.quality.sensorMon": 0, "airState.miscFuncState.antiBugs": 0, "airState.tempState.target": 22, "airState.miscFuncState.autoDryRemainTime": 0, "airState.operation": 0, "airState.wMode.jet": 0, "airState.wDir.vStep": 0, "timestamp": 1707901659346, "airState.powerSave.basic": 0, "airState.quality.PM10": 0, "fwUpgradeInfo": { "upgSched": { "upgUtc": "0", "cmd": "none" } }, "static": { "deviceType": "401", "countryCode": "XX" }, "airState.miscFuncState.Uvnano": 1, "airState.quality.overall": 0, "airState.tempState.current": 23, "airState.miscFuncState.extraOp": 0, "airState.reservation.sleepTime": 0, "airState.miscFuncState.autoDry": 0, "airState.reservation.targetTimeToStart": 0, "meta": { "allDeviceInfoUpdate": false, "messageId": "mcDsKO32Q8KVeqQwa2h1NA" }, "airState.quality.PM1": 0, "airState.wMode.smartCare": 0, "airState.quality.PM2": 0, "online": true, "airState.opMode": 4, "airState.reservation.targetTimeToStop": 0, "airState.filterMngStates.maxTime": 0, "airState.filterMngStates.useTime": 0 }, "manufacture": { "inventoryOrg": "EAT", "macAddress": "4C:BA:D7:XX:XX:XX", "manufactureModel": "S4-W18KLRMA", "manufacturedAt": "2023-01-17T05:21:34+00:00", "registeredAt": "2023-01-17T06:05:42.459750+00:00", "salesModel": "S4-W18KLRMA", "serialNo": "301TKUR4XXXX" }, "online": true, "platformType": "thinq2", "homeDeviceOrder": -1, "roomDeviceOrder": -1, "ownershipYn": "Y", "modelJsonVer": "13.89", "**modelJsonUri**": "https://objectcontent.lgthinq.com/2f786c1f-55ec-493a-b2e3-2214a29d2e28?hdnts=exp=1769135674~hmac=bae118d77e7f54b9411c32ecb9806cf657799e9caeb476c21ad0164762312290", "appModuleVer": "17.78", "appModuleUri": "https://objectcontent.lgthinq.com/6f9e5106-2098-4fff-8382-44224a29519d?hdnts=exp=1761876104~hmac=dab9befc1797f38e4810be383b21a85f2f907fb843b24d09d46d550cd5213ac4", "appRestartYn": "Y", "appModuleSize": "12867303", "langPackProductTypeVer": "97.4", "langPackProductTypeUri": "https://objectcontent.lgthinq.com/de179906-32ea-43e6-819b-e3004dcbf8ac?hdnts=exp=1770945840~hmac=030f2a30fd959eee006abd9d6496f80f532d3cf4a0428102e1f9960f5940e70d", "langPackModelVer": null, "langPackModelUri": null, "roomId": "168099967585225981", "fwInfoList": [ { "checksum": "00006C65", "order": 1, "partNumber": "SAA38690472" } ], "modemInfo": { "appVersion": "clip_hna_v1.9.198", "modelName": "RAC_056905_WW", "modemType": "RTK_RTL8711am", "oneshot": "y", "ruleEngine": "y", "size": 1572864 }, "modemConfig": { "online_check": "y" }, "existsEntryPopup": "N", "fwVer": null, "modemVer": "clip_hna_v1.9.138", "subDeviceCount": 0, "firebaseLogKey": "P:SD", "cardType": "Large", "cardControl": "Control", "detailDeviceCode": null, "upgradableYn": "N", "autoFwDownloadYn": "N", "homeMovableYn": "Y", "protocolVersion": null, "btAddress": null, "isTLV": null, "jsonList": null, "mdFotaYn": "Y", "demandType": "RTK_RTL8711am" }

This is the device info and below is the file referenced from modelJsonUri: 2f786c1f-55ec-493a-b2e3-2214a29d2e28.txt

nVuln commented 9 months ago

this one matched your provided information

"support.coolLowLimit": {
      "data_type": "enum",
      "value_mapping": {
        "0": 0,
        "20": 20
      }
    },
    "support.coolHighLimit": {
      "data_type": "enum",
      "value_mapping": {
        "0": 0,
        "30": 30
      }
    },
    "support.heatLowLimit": {
      "data_type": "enum",
      "value_mapping": {
        "0": 0,
        "16": 16
      }
    },
    "support.heatHighLimit": {
      "data_type": "enum",
      "value_mapping": {
        "0": 0,
        "28": 28
      }
    },
aabdellah commented 9 months ago

Yes, that seems to be correct.

I wonder if they provide the steps information anywhere in that file as this AC units doesn't support setting temperatures in half degrees even though its sensor supports that.

nVuln commented 9 months ago

I published new test version v1.8.2-test.3, could you try test it?

JasonGoldenDDT commented 7 months ago

I'm running 1.8.3, I'm no longer able to set 60f, min is now 64f.

Will this thread address custom min max?

aabdellah commented 7 months ago

Range is updated successfully now. It still allows setting temperatures in half degrees which is not supported by the device.

JasonGoldenDDT commented 7 months ago

IDK if this is related... I'm getting an error in the log now when the ac is turned on. I'm also not able to set the Cool temp to 60. minimum is now 64.

[4/4/2024, 4:17:42 PM] [homebridge-lg-thinq] This plugin generated a warning from the characteristic 'Cooling Threshold Temperature': characteristic was supplied illegal value: number 15.77 exceeded minimum of 17.77. See https://homebridge.io/w/JtMGR for more info. [4/4/2024, 4:17:42 PM] [homebridge-lg-thinq] This plugin generated a warning from the characteristic 'Cooling Threshold Temperature': characteristic was supplied illegal value: number 15.77 exceeded minimum of 17.77. See https://homebridge.io/w/JtMGR for more info.

nVuln commented 7 months ago

@JasonGoldenDDT please check your device data in debug log, I need modelJsonUri

JasonGoldenDDT commented 7 months ago

Sure, here's what I've got:

https://objectcontent.lgthinq.com/8b0c2833-99c7-4201-b7b4-145a41291222?hdnts=exp=1764735072~hmac=94c936fe15720c779d91447c578816bd0d7bd3b6177a7b0c4002d86d4e471c35

I'm running version 1.8.3

nVuln commented 7 months ago

@JasonGoldenDDT I just released v1.8.4 to fix your issue

JasonGoldenDDT commented 4 months ago

Thank you. I've stopped using this plug-in because LG's servers are slow making it unusable.