Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All tplink entities fail to load if one is offline #21779

Closed
asleeis opened this issue Mar 8, 2019 · 2 comments
Closed

All tplink entities fail to load if one is offline #21779

asleeis opened this issue Mar 8, 2019 · 2 comments

Comments

@asleeis
Copy link
Contributor

asleeis commented Mar 8, 2019

I just recently updated to 0.89 and found my tplink HS110 switches weren't loading. I had configured them manually with the new method of specifying them under tplink:. I also disabled the discovery. I have two of the HS110's currently. One is not in use at the moment. The other is plugged in and online. In the logs, it indicated there was a timeout error when connecting (didn't have details in logs as to which one, but I could guess). I changed my config to only have the one that was plugged in configured. It loaded up and all was back to normal. However, if I specified the other one in the config and restarted, neither would load.

I think it would be much better to still continue to load those that do not fail/timeout on connect. The current effect is that if one gets unplugged, they will all stop loading. I haven't tested what happens if both are plugged in and then one is unplugged (when not restarting HA). I'm not currently at home to test that scenario, but worth doing for sure.

This was not an issue prior to this update (0.88 worked), when the tplink hosts were referenced under the switch: section with platform: tplink . I can quite reliably create the issue.

Details:

Fails on: HA 0.89.0
Last worked on: HA 0.88.0
Hassio, running on Raspberry Pi
Component: https://www.home-assistant.io/components/tplink/

Config that fails with this issue:

tplink:
  discovery: false
  switch:
    - host: tplink01.example.com
    - host: tplink02.example.com

Config that works:

tplink:
  discovery: false
  switch:
#    - host: tplink01.example.com
    - host: tplink02.example.com

Logs...

Thu Mar 07 2019 17:13:13 GMT-0800 (Pacific Standard Time)
Error setting up entry TP-Link Smart Home for tplink
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pyHS100/smartdevice.py", line 116, in _query_helper
    request=request,
  File "/usr/local/lib/python3.7/site-packages/pyHS100/protocol.py", line 47, in query
    sock = socket.create_connection((host, port), timeout)
  File "/usr/local/lib/python3.7/socket.py", line 727, in create_connection
    raise err
  File "/usr/local/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
OSError: [Errno 113] Host is unreachable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/config_entries.py", line 283, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/tplink/__init__.py", line 120, in async_setup_entry
    await hass.async_add_executor_job(_fill_device_lists)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/tplink/__init__.py", line 110, in _fill_device_lists
    if dev.is_dimmable:  # Dimmers act as lights
  File "/usr/local/lib/python3.7/site-packages/pyHS100/smartplug.py", line 131, in is_dimmable
    return "brightness" in self.sys_info
  File "/usr/local/lib/python3.7/site-packages/pyHS100/smartdevice.py", line 185, in sys_info
    return defaultdict(lambda: None, self.get_sysinfo())
  File "/usr/local/lib/python3.7/site-packages/pyHS100/smartdevice.py", line 195, in get_sysinfo
    return self._query_helper("system", "get_sysinfo")
  File "/usr/local/lib/python3.7/site-packages/pyHS100/smartdevice.py", line 119, in _query_helper
    raise SmartDeviceException('Communication error') from ex
pyHS100.smartdevice.SmartDeviceException: Communication error

@awarecan
Copy link
Contributor

awarecan commented Mar 8, 2019

Duplicate of #21725

The fix is already merged (#21726)

@awarecan awarecan closed this as completed Mar 8, 2019
@asleeis
Copy link
Contributor Author

asleeis commented Mar 8, 2019

Thanks! I did a couple quick searches and hadn’t found it. Sorry for the duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants