Problem with TP-Link HS200 switch

I’m running the latest version of HA (0.33.4) and today I tried to add a TP-Link HS200 switch. I got these errors in the logs.

16-11-30 17:15:32 homeassistant.components.switch: Error while setting up platform tplink
Traceback (most recent call last):
  File "/srv/hass/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 150, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/lib/python3.5/site-packages/homeassistant/components/switch/tplink.py", line 43, in setup_platform
    add_devices([SmartPlugSwitch(SmartPlug(host), name)], True)
  File "/home/hass/.homeassistant/deps/pyHS100/pyHS100.py", line 35, in __init__
    self.model = self._identify_model()
  File "/home/hass/.homeassistant/deps/pyHS100/pyHS100.py", line 261, in _identify_model
    return model

I found this - https://github.com/home-assistant/home-assistant/pull/4364

So my question is (maybe stupid of me), do I just wait for a new version where the fix may be included or is there something I should do to fix my installation?

Just in case somebody has the same problem, I have rolled-back to 0.30.2 for now and got the HS200s working.

I’m having the same issue with my HS200 switches. I’m on 33.4. What make you chose 30.2 for the version where the hs200s worked? Note that my hs100 and 110s work in 33.4.

Thanks for your help in posting your fix.

This post mentioned that the issue started in 0.31.1 - https://github.com/home-assistant/home-assistant/issues/4045

So I went back to the last release before the 0.31 base. Maybe 0.31 will work but I didn’t try.

Good to know! Also, I saw that home-assistant is pulling down pyHS100 2.0 and not 2.1 which has also updated support for HS200 devices.

You can put the blame for this on me. Since the HS200 was never mentioned in the documentation, I added extra functionality for the energy monitoring in the HS110 plugs in the underlying module responsible for handling the plugs (and apparently the HS200 wall switches).

A pull request was accepted in the library to bring back HS200 functionality, and in HA but the person who opened the pull request on HA didn’t update his dependency. The fix should be available with the next HA release.

If you roll back to 0.30.2 your switches should be working again.

Thanks, kirichkov. I will wait for the new release before upgrading.

Thank you for the update!

I upgraded to 34 and while the HS200 now appears in HA, it does not show the correct state. I can turn the switch on but it returns to off state. Rolled-back to 30.2 again to regain the HS200 functionality.

Hopefully, they can be fixed in the next release.

My HS100 switches are doing the same as @linodavid . They show Off and when I switch them to On they switch right back to Off with no actual state change of the switch.

@kirichkov, HS200 still not working with 34.0, 34.1 and 34.2. Rolled-back to 30.2.

My HS100 is working again on .34.2. Thanks!

The code to fix HS200 was included in 0.34.0 but reversed in 0.34.1 because instead of fixing HS200 it broke the HS100 plugs. A fix is planned for the current version (0.34). HS100/110 plugs should be working with 0.34.1

Thanks! Really appreciate the responsiveness of everybody involved with HA.

Any update on updated code that works with hs200 getting added to a .34 version?

Unfortunately not, follow this issue, it should get updated when the code is fixed.

Thank you! I have subscribed to the issue thread on github.

Functionality for the HS200 switches should be restored in the upcoming version 0.35!

If you have any problems please open an issue on GitHub.

@kirichov, HS200 state does not get updated when switched on or off from the switch itself or from the Kasa app. Had to downgrade to 30.2.

Hi,

I am pretty new with HA and I have the same problem with the HS100. Switching it from the switch or Kasa is not updated in HA. Is there any solution?

I am on 0.35.3

Thanks