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
194 stars 49 forks source link

LW1019IVSM Support #178

Open ssmoss opened 2 years ago

ssmoss commented 2 years ago

Describe Your Problem:

I cannot seem find the correct OP code to set for the "Energy Saver" mode button. The OP codes 0, 1, 2 correct set the unit too Cool, Dry, and Fan mode.

Not sure if this a HomeKit issue but each mode is exposed as a separate button so I can in theory toggle them all on but only the last toggled one will apply (See first four and last screenshot).

Another strange thing is the fan speed is exposed as a slider where as this unit only has three fan modes, F1, F2, and F3 (See second and the last two screenshots; fan speed is shown as percentage).

I am also seeing 'Target Heater-Cooler State' when the unit is set to COOLING only.

Logs:

[7/19/2022, 11:57:44 PM] [homebridge-lg-thinq] This plugin generated a warning from the characteristic 'Target Heater-Cooler State': characteristic value 1 is not contained in valid values array. See https://homebridge.io/w/JtMGR for more info.
[7/19/2022, 11:57:44 PM] [homebridge-lg-thinq] This plugin generated a warning from the characteristic 'Target Heater-Cooler State': characteristic value 1 is not contained in valid values array. See https://homebridge.io/w/JtMGR for more info.
[7/19/2022, 11:58:18 PM] [homebridge-lg-thinq] This plugin generated a warning from the characteristic 'Target Heater-Cooler State': characteristic value 1 is not contained in valid values array. See https://homebridge.io/w/JtMGR for more info.
[7/19/2022, 11:58:18 PM] [homebridge-lg-thinq] This plugin generated a warning from the characteristic 'Target Heater-Cooler State': characteristic value 1 is not contained in valid values array. See https://homebridge.io/w/JtMGR for more info.

Plugin Config:

"devices": [
    {
        "id": "xxx",
        "name": "Air Conditioner",
        "type": "AC",
        "ac_mode": "COOLING",
        "ac_temperature_sensor": true,
        "ac_fan_control": true,
        "ac_buttons": [
            {
                "name": "Cool",
                "op_mode": 0
            },
            {
                "name": "Energy Saver",
                "op_mode": 6
            },
            {
                "name": "Fan",
                "op_mode": 2
            },
            {
                "name": "Dry",
                "op_mode": 1
            }
        ],
    }
]

Screenshots:

IMG_3681 IMG_3682 IMG_3683 IMG_3684 IMG_3685 IMG_3686

Environment:

seansellek commented 2 years ago

I’m super interested in learning the op code for Energy Saver mode as well. @ssmoss have you been able to find it?

nVuln commented 2 years ago

I’m super interested in learning the op code for Energy Saver mode as well. @ssmoss have you been able to find it?

energy saver mode is not controlled via OpMode, it's different way to control it at this time I enabled energy saver mode for model WINF_056905 only, if your device has support this feature, please give me model number (or upload all debug logging with device data included, it's better)

ssmoss commented 2 years ago

The model number is LW1019IVSM. There are additional models in the DUAL Inverter Smart Window Air Conditioner series as well that support energy savor. I believe these are all the module numbers.

1) LW8022IVSM 2) LW1822IVSM 3) LW2422IVSM 4) LW1222IVSM 5) LW1022IVSM 6) LW1019IVSM 7) LW1517IVSM 8) LW2217IVSM 9) LW1817IVSM

How do I collect the debugging information you need. I am somewhat new to the updated HomeBridge UI system.

nVuln commented 2 years ago

@ssmoss turn on homebridge debug mode, then restart homebridge, device data will appeared in debug logging

homebridge debug mode

you can quickly get model number via homebridge accessory detail or homekit app

seansellek commented 2 years ago

The model number from within homebridge is: WIN_056905

I can get debug logs later tonight

nVuln commented 2 years ago

The model number from within homebridge is: WIN_056905

I can get debug logs later tonight

I'll enable energy saver support for your model in next version

nVuln commented 2 years ago

The model number from within homebridge is: WIN_056905

I can get debug logs later tonight

more question, how is temperature step of your model? step 0.5 or 1? Is your model have quiet mode?

seansellek commented 2 years ago

more question, how is temperature step of your model? step 0.5 or 1? Is your model have quiet mode?

temperature step is 1.

There is no quiet mode.

Thank you for this @nVuln!

nVuln commented 2 years ago

more question, how is temperature step of your model? step 0.5 or 1? Is your model have quiet mode?

temperature step is 1.

There is no quiet mode.

Thank you for this @nVuln!

thank you so much, seem your model is different with WINF_056905

ssmoss commented 2 years ago

I turned on debug mode as suggested. It was a royal pain to find the correct log message as one of the plugins I am using barfs messages every second. I believe that you want the value for the modelName key:

    "modelName": "WIN_056905_WW",
ssmoss commented 2 years ago

I just updated to the new version (thanks for getting it out there so quickly). I see the "Energy Savor" button in HomeKit but toggling it doesn't do anything. I cleared the device from the HomeKit cache and it didn't help. I turned on debugging and don't see any errors as a result of toggling the switch.

{
    "name": "LGThinQ Smart Home",
    "country": "US",
    "language": "en-US",
    "auth_mode": "token",
    "refresh_token": "xxx",
    "username": "",
    "password": "",
    "devices": [
        {
            "id": "xxx",
            "name": "Air Conditioner",
            "type": "AC",
            "ac_mode": "COOLING",
            "ac_temperature_sensor": true,
            "ac_fan_control": true,
            "ac_buttons": [
                {
                    "name": "Cool",
                    "op_mode": 0
                },
                {
                    "name": "Fan",
                    "op_mode": 2
                },
                {
                    "name": "Dry",
                    "op_mode": 1
                }
            ]
        }
    ],
    "thinq1": false,
    "refresh_interval": 20,
    "platform": "LGThinQ",
    "_bridge": {
        "name": "LGThinQ Smart Home Bridge",
        "username": "xxx",
        "port": xxx,
        "pin": "xxx"
    }
}

I have included my configuration incase you need it.

nVuln commented 2 years ago

@ssmoss try turn on/off energy saver mode via LG mobile app, and check debug log again, let see

ssmoss commented 2 years ago

It works via the LG mobile application:

[9/14/2022, 10:22:20 PM] [LGThinQ Smart Home] [Air Conditioner] Received snapshot:  {"airState.opMode":8,"airState.tempState.target":20,"meta":{"allDeviceInfoUpdate":false,"messageId":"xxx"},"mid":xxx,"online":true,"static":{"countryCode":"US","deviceType":"401"},"timestamp":1663219340045}

I think this is the message that results from turning on "Energy Savor".

After toggling between "Cool" and "Energy Savor" I tried HomeKit again and no such luck.

[9/14/2022, 10:25:46 PM] [LGThinQ Smart Home] mqtt message received: {"controlResult":{"messageId":"xxx","deviceId":xxxx","returnCode":"0000"}}
[9/14/2022, 10:25:46 PM] [LGThinQ Smart Home] [request] post https://aic-service.lgthinq.com:46030/v1/service/devices/xxx/control-sync

I think these are the message that result from changing it with HomeKit.

ssmoss commented 2 years ago

I added the following to my buttons:

{
                    "name": "ES",
                    "op_mode": 8
                },

This seems to work.

nVuln commented 2 years ago

@ssmoss nice, look like energy saver mode on your model is controllable by opMode, other model have different way to control energy saver mode (lol I hate LG for this reason)

@seansellek please try above solution and see if it's worked for you

I should revert last commit 😵‍💫

ssmoss commented 2 years ago

I think you might be able to. The button that shows up that was a result of your last commit doesn't seem to do anything. The button with the OP code set seems to work. That said buttons in general seems to exhibit some strange behavior.

The state of the buttons doesn't seem to upgrade to correctly reflect what the state the AC is in. For instances, in energy saver mode and you put it into cool mode, the energy savor button stays on.

Another slightly strange thing is that when trying to set the temp it seems to put the AC into cool mode instead of just adjusting the temp.

I am trying to make some automations for the AC because its internal temperature sensor works about as well as their API. It things the room is colder than it actually is. I have an in room thermometer that I wanted to use as an automation input. If the room gets too hot, drop the temp by a few degrees. If the room gets to cold raise the temp by a few degrees. Unfortunately when I test the automation in addition to changing the temperature it also put the unit into cool mode.

I total understand why you hate LG. This could have been a simple API but instead they seem like they went out of their way to make "cool" and thus super convoluted.

nVuln commented 2 years ago

Another slightly strange thing is that when trying to set the temp it seems to put the AC into cool mode instead of just adjusting the temp.

because when you adjust temperature, homekit also send a request to change target mode to COOL, so plugin change opMode to 0 (that is cool mode also), I'll try handle it

ssmoss commented 2 years ago

Another slightly strange thing is that when trying to set the temp it seems to put the AC into cool mode instead of just adjusting the temp.

because when you adjust temperature, homekit also send a request to change target mode to COOL, so plugin change opMode to 0 (that is cool mode also), I'll try handle it

Oh snap, if that could be fixed it would be super cool.

I suspect this is a HomeKit limitation but since the unit can't be both "Cool" and "Fan" at the same time I assume there isn't a way to have the HomeKit UI reflect the mode as a drop down or something else that only allows a single status to be selected? If it has to stay as the switches, when you change modes is it possible to reset the other mode switches i.e. if you select "Energy Savor" it turns off "Cool", "Fan", and "Dry"?

Thanks again for making this awesome extension. I really thought all hope was lost for getting HomeKit support for my AC!

jbyerline commented 2 years ago

I also have a LW1019IVSM AC. I can confirm that Op_code 8 does work for energy saver. I wanted to ask about the fan speed controls because they don't seem to work for me. I also wanted to ask about the ac_led_control field. This AC has the ability to turn off all lights on its screen. Is that what this flag is supposed to enable? If so, it also does not work for my AC. any suggestions? Thank! Other than this, your plugin is awesome!