plasticrake / homebridge-tplink-smarthome

TP-Link Smarthome Plugin for Homebridge
MIT License
467 stars 70 forks source link

TP-Link Kasa Smart Dimmer Switch HS220 Error #312

Closed mishrao closed 7 months ago

mishrao commented 11 months ago

Is there an existing issue for this?

What happened?

I am getting an error for TP-Link Kasa Smart Dimmer Switch HS220an

What, if anything, has recently changed?

I am using home bridge first time

Version

homebridge-tplink-smarthome v7.0.1

Node Version

v18.16.0

Homebridge Version

v1.6.1

Which OS/Platform?

Linux

Relevant log output

[8/1/2023, 8:52:35 AM] [TPlink-Smarthome] [Living Two] set [Brightness]
[8/1/2023, 8:52:35 AM] [TPlink-Smarthome] [Living Two] ResponseError: err_code not zero response: {"err_code":-3,"err_msg":"invalid argument"} command: {"smartlife.iot.dimmer":{"set_brightness":{"brightness":0}}}

Configuration

{
            "name": "TPlink-Smarthome",
            "addCustomCharacteristics": true,
            "deviceTypes": [
                "plug",
                "bulb"
            ],
            "platform": "TplinkSmarthome",
            "_bridge": {
                "username": "0E:51:E2:F5:12:D1",
                "port": 49593
            }
        },
jlayman81 commented 8 months ago

Had the same issue. When using HomeKit scenes, they would throw an error. Homebridge log showed the invalid argument. The problem is that the Kasa api doesn’t like setting brightness to 0.

To turn off the lights without throwing the error simply tap the left side of the button in HomeKit to turn the light off.

Dimming to 0 will turn it off but throws the error.

Tapping the button on the left side on the actual little light bulb will turn off.

I fixed my scenes by using this method to turn the bulbs off when setting up the scene.

Hopefully this helps somebody.

plasticrake commented 7 months ago

Fixed in https://github.com/plasticrake/homebridge-tplink-smarthome/commit/d267e40ee0ab11f6182269dea16d5a0a2b328063 https://github.com/plasticrake/homebridge-tplink-smarthome/commit/deff0549eb7c9d419a259257aa053f800e57b24a homebridge-tplink-smarthome@8.0.1