TP-Link HS220 Dimmer

I solved this in a slightly different manner, by creating a tplink-to-mqtt bridge. I wrote this to scratch my own itch, so insert all the proper disclaimers here (I’ve been using it for a whole two days now). It is rudimentary, and currently only supports relay state and brightness. However, if you wish to use it, you can find it here: https://github.com/codyprime/skeeter (and if you have any issues with it, you can let me know).

@teprrr
With the new tplink component, where do I put the name tag? The following does not work:

tplink:
  discovery: false
  switch:
    - host: 192.168.10.60
      name: "My Switch01"

The latest docker container / hass beta version (0.89.0b1) has all of the tplink code merged in and it works fine. This is what you would need to use in the config file – I have two dimmers:

tplink:
  discovery: false
  switch:
    - host: 192.168.1.xxx
    - host: 192.168.1.xxx

I changed the names of the dimmers through the UI.

Changing the name in the UI only affects the friendly name. Having the name option in the config allowed you to give the switch/light a meaningful name like switch.bedroom_light. Now I have the very unfriendly switch.tp_link_smart_switch_0011 (based on the device MAC).

Oh I see what you mean, I’ll take a look at what needs to be done to make the change.

You can set the name of the device either with the official TP-Link Kasa app, or alternatively with the pyhs100 console tool:

pyhs100 alias <new alias>

I’d rather not change the config of the devices themselves. Is this a difficult option to re-add?

I suppose it should be quite straightforward (adjusting the configuration in __init__.py to pass a name forward to the platforms, and check if one has been given and if not, fallback to read from the device info. If someone wants to give it a shot, please feel free to do so.

This is working great in version 89.1!

Glad to hear :slight_smile:

The UI does allow one to change the entity_id but it is now independent of the name and must be set separately. This is different but arguably more powerful than before and you don’t even have to restart after changing the name.

So does this mean we don’t have to update all our TP-Link automations due to the ability to edit the entity_id? I’m still not totally clear why the “name” parameter was removed as this seems like it is going to break many things and require lots of updating for those with lots ot TP-Link devices.

I had to update all my automatons by replacing new names after my latest upgrade. everything still works fine functionality wise which is the most important to me.

Using the latest version of home assistant 0.105.2 with an HS220 set as a dimmer, I can turn the light on an off from home assistant, but changing the brightness seems to be delayed.

Anytime the light turns on via an automation or script, it turns on to its previous brightness and then dims to the the set one over a couple seconds. Does any one know how to correct this behavior?

Thanks.

1 Like

That will require changes to the backend library I’m afraid. Alternatively you could try to change the order of those two method calls in your installation for testing: https://github.com/GadgetReactor/pyHS100/blob/59424d2738866a2bf88f8e256ece2baa06f0b024/pyHS100/smartplug.py#L110

I am looking at getting an HS220, does anyone here know if it supports the ‘Transition’ function in HA, as in making it slowly dim or brighten with automation?

how slow? maybe you could you make a flow to set the brightness % go down whatever time you want perhaps

The dimmers do support transition delays (no idea how long delays are available), but it is not currently implemented in the upcoming backend lib (https://github.com/python-kasa/python-kasa/issues/44) so no, there is currently no direct support for that.

If the switch isn’t working (no blinking Wifi LED), try switching the 2 black (red/black screws) wires.

Hi there! I have the hs220 set up as a switch and it toggles fine in node red. I can’t seem to figure out how to pass the brightness change to it. the brightness change works fine when I do it for my other lights but for the switch I get an API error. any ideas?