TP-Link HS100 Help

I’m hoping someone can help with this:

I’m new to Home Assistant and have just bought a TP-Link HS100 smart switch. I’ve got it set up and working with it’s own app so I know it works, but i can’t get it to work in home assistant.

I’ve added the switch code to the configuration.yaml file and i think i have the correct ip address for it, although i can’t be sure as it isn’t showing up as a connected device on my network and the only way i found it was the mac address is listed on my ARP binding page on my router with an ip address next to it. Anyway, I can’t get it to show up in Home Assistant at all, here’s my error log if anyone can point me in the right direction. Thanks:

16-11-11 16:58:26 homeassistant.components.switch: Error while setting up platform tplink
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 148, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/switch/tplink.py", line 40, 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 254, in _identify_model
    sys_info = self.get_info()
  File "/home/hass/.homeassistant/deps/pyHS100/pyHS100.py", line 70, in get_info
    return self._send_command('{"system":{"get_sysinfo":{}}}')
  File "/home/hass/.homeassistant/deps/pyHS100/pyHS100.py", line 244, in _send_command
    s.connect((self.ip, self.port))
socket.gaierror: [Errno -2] Name or service not known
16-11-11 16:58:29 homeassistant.components.mqtt: Unable to connect to the MQTT broker: Not authorised

Sorry, ignore this post, I’ve solved it. If anyone else has this problem it was because i had entered the ip address in the config file as http://xxx.xxx.xxx.xxx and it needs to be just xxx.xxx.xxx.xxx

Is it working for you in the last release ?

It hangs up on me while installing

Thanks

yes it’s working now on the latest release once i put the ip address in the correct format.

Bri,

Can you share your config for the HS100. I am struggling to get mine to work.

Thanks,

R

Ignore me : syntax error.

For information : YAML file is case sensitive and I had put Switch instead of switch.

My TP-link HS100 came in today. Got it set up through the kasa app no problem. But I also can’t get it visible on home assistant…
I’ve checked the validity of the yaml file (the demo buttons for switches work fine) also removed the HTTP:// from the host … To no avail…
The switch shows up as connected on my router and I’ve quintuple checked the IP address.
I’m on 0.36 home assistant, can anyone please help? :s

Not sure if this is any use, but I’m running my home assistant on a Pi and if I restart the whole Pi the HS100s don’t show up for some reason, I need to just restart home assistant using the services menu to get them to show up.

@Bri Thnx for the quick response!
Unfortunately, I’ve tried restarting my laptop and home assistant multiple times.
This does nog seem to help.
I’m currently running Home assistant on a windows 10 laptop, if that should matter in any case.
The idea is to bring it over to a raspberry pi once I’ve got most of the configuration as I want it.

What error messages are you getting in the log?

Is that the …\AppData\Roaming.homeassistant\home-assistant.log?
Because in that case… non at all…

Just to be sure, here is my configuration.yaml:

switch:
  - platform: demo
  - platform: tplink
    host: 192.168.178.48
    name: ThisSwitch

the ‘demo’ platform gives me the 2 demo switches: AC & Decorative Lights, but the TP-Link switch won’t show up.
This doesn’t change when I quote out the demo switches. Then no switches are shown…

It’s a different location for me on the pi but that sounds like the right file, and your configuration looks fine to me. I’m not at home at the moment but I’ll check it against mine tonight to see if I’ve done anything different but I don’t think so.

The only other thing I can think that I did which might help is that I used he dhcp settings on my router to reserve the IP address for use by that switch, and then powered the switch on and off to make sure it was always assigned to that IP address and restart home assistant. It shouldn’t really make any difference if your ip address is correct but it can’t hurt to try.

Thank you very much, it might be that it is just my own wifi network that is the issue.
The router provided by my provider is absolute crap… So an update in hardware is also in the planning.
But I just want to make sure it is nowhere in the configuration, before I turn the house upside-down :slight_smile:

Actually, try changing:

name: ThisSwitch

To:

name: "ThisSwitch"

I’m not certain without checking but I think the name needs to be in speech marks.

oke, I changed it in the config, will try as soon as I get home!

I was wrong, it doesn’t need to be in speech marks, here’s my config and it looks the same as yours so it should be working fine based on the config:

switch:
  - platform: tplink
    host: 192.168.0.187
    name: lamp

I’d maybe try reserving the ip address for your switch if your router allows it, and then restarting the switch and home assistant again. Also if you have a firewall on your laptop maybe try temporarily disabling that in case it’s blocking it? other than that, if you’re not getting any errors in the log then i’m out of ideas i’m afraid.

Wasn’t able to try it last night, but I did just now and no luck unfortunately…
But something did seem to have changed… as I know have the following error in the log:

17-01-24 20:47:29 homeassistant.components.switch: Error while setting up platform tplink
Traceback (most recent call last):
  File "C:\Users\MyName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\helpers\entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "C:\Users\MyName\AppData\Local\Programs\Python\Python35-32\lib\asyncio\futures.py", line 361, in __iter__
    yield self  # This tells Task to wait for completion.
  File "C:\Users\MyName\AppData\Local\Programs\Python\Python35-32\lib\asyncio\tasks.py", line 296, in _wakeup
    future.result()
  File "C:\Users\MyName\AppData\Local\Programs\Python\Python35-32\lib\asyncio\futures.py", line 274, in result
    raise self._exception
  File "C:\Users\MyName\AppData\Local\Programs\Python\Python35-32\lib\concurrent\futures\thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\MyName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\homeassistant\components\switch\tplink.py", line 36, in setup_platform
    from pyHS100 import SmartPlug
  File "C:\Users\MyName\AppData\Roaming\.homeassistant\deps\pyHS100\__init__.py", line 4, in <module>
    from pyHS100.pyHS100 import SmartBulb, SmartPlug, TPLinkSmartHomeProtocol, SmartPlugException
  File "C:\Users\MyName\AppData\Roaming\.homeassistant\deps\pyHS100\pyHS100.py", line 20, in <module>
    from future.utils import raise_from
ImportError: No module named 'future'

And I unfortunately have no idea what to make of this…
@bri Thanks very much for the effort!

That looks very similar to the error I get if I start home assistant while my HS100 is switched off at the wall so if that is the same error (and your HS100 was powered on when you got it) I’d guess that either your IP address for your HS100 is wrong (doubtful if you’ve repeatedly checked it as you stated) or something on your laptop or router is blocking the signal. Shouldn’t be your router blocking anything if the Kasa app is working so I’d guess it was your laptop - either windows defender or some other firewall potentially blocking it?

hi…
could some one tell me what else need to be done besides the config.yaml entries.

I want to know if any .py file to be copied to custom_components folder for this tp smartplus to work.

I cannot see it in the front page [dashboard] for the homeassistant.

thanks in advance.

Hello,

srry I’ve been out for a while and this kinda slipped my mind.
But the new home assistant update came today which I installed.
I just tried the switch and now it works!
So maybe something with the versioning?
Anyhow, standard settings, it works!