Core: TP-Link Component: Failure to find one switch results in entire component failing

Created on 7 Mar 2019  路  7Comments  路  Source: home-assistant/core

Home Assistant release with the issue:

0.89

Last working Home Assistant release (if known):

0.87

Operating environment (Hass.io/Docker/Windows/etc.):

Docker on RHEL7

Component/platform:

TPLink

https://www.home-assistant.io/components/tplink/

Description of problem:

I have a number of TP-link switches, some of which are only used part of the year. For example, I keep one for my Christmas tree. They have static IP addresses, and I don't want to use discovery (I have a complex network configuration, HA is on a different network than the IoT stuff). If one switch is unavailable, then the entire component doesn't load.

I can comment them out, but I'd prefer not to.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

# IP addresses are masked
tplink:
  discovery: false
  switch:
    - host: 192.168.XX.XX
    - host: 192.168.XX.XX
    - host: 192.168.XX.XX
    - host: 192.168.XX.XX
    - host: 192.168.XX.XX
    - host: 192.168.XX.XX
    - host: 192.168.XX.XX

Traceback (if applicable):

2019-03-07 01:08:44 ERROR (MainThread) [homeassistant.config_entries] 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] No route to host
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/config_entries.py", line 283, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/app/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/src/app/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

Additional information:

bug tplink

Most helpful comment

any news about this ?

All 7 comments

according to the pyHS100 library, dev.is_dimmable calls get_sysinfo which raises SmartDeviceException.

I've submitted a pull request as I had this issue as well

https://github.com/home-assistant/home-assistant/pull/21726

I have the exact same setup and issue 馃槃

Fixed now in dev branch, thanks to @ljmerza!

Thanks 馃檹 That was fast!

any news about this ?

Merged in dev but not in 89.1 or 89.2 unfortunately....

Just pulled dev(0.90.0b1) and I'm getting this:

Mar 14 23:51:50 hassbian hass[675]: TypeError: 'NoneType' object is not subscriptable
Mar 14 23:51:50 hassbian hass[675]: 2019-03-14 23:51:50 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Mar 14 23:51:50 hassbian hass[675]: Traceback (most recent call last):
Mar 14 23:51:50 hassbian hass[675]:   File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
Mar 14 23:51:50 hassbian hass[675]:     result = coro.send(None)
Mar 14 23:51:50 hassbian hass[675]:   File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 257, in _async_add_entity
Mar 14 23:51:50 hassbian hass[675]:     if entity.unique_id is not None:
Mar 14 23:51:50 hassbian hass[675]:   File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/tplink/switch.py", line 62, in unique_id
Mar 14 23:51:50 hassbian hass[675]:     return self._sysinfo["mac"]
Mar 14 23:51:50 hassbian hass[675]: TypeError: 'NoneType' object is not subscriptable

Am I missing something?

Was this page helpful?
0 / 5 - 0 ratings