home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.41k stars 30.65k forks source link

Errors for Yeelight component after upgrade HA to 0.45.1 #7831

Closed bieniu closed 7 years ago

bieniu commented 7 years ago

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version): 0.45.1

Python release (python3 --version): Python 3.4.2

Component/platform: light/yeelight

Description of problem: I have two Xiaomi yeelight bulbs. After upgrade HA to 0.45.1 (from 0.44.1) when the power is cut off from the bulbs in the log errors appear

2017-05-28 15:37:41 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last): File "/home/homeassistant/.homeassistant/deps/yeelight/main.py", line 271, in send_command self._socket.send((json.dumps(command) + "\r\n").encode("utf8"))
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step result = coro.throw(exc) File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/core.py", line 1015, in _event_to_service_call yield from service_handler.func(service_call)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/__init__.py", line 265, in async_handle_light_service yield from light.async_turn_on(**params)
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/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/yeelight.py", line 302, in turn_on self._bulb.turn_on(duration=duration)
File "<decorator-gen-7>", line 2, in turn_on File "/home/homeassistant/.homeassistant/deps/yeelight/main.py", line 50, in _command result = self.send_command(method, params).get("result", [])
File "/home/homeassistant/.homeassistant/deps/yeelight/main.py", line 275, in send_command self.__socket.close() AttributeError: 'NoneType' object has no attribute 'close'

or

2017-05-28 21:55:03 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/deps/yeelight/main.py", line 288, in send_command data = self._socket.recv(16 * 1024)
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step result = coro.throw(exc)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/core.py", line 1015, in _event_to_service_call yield from service_handler.func(service_call)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/__init__.py", line 265, in async_handle_light_service yield from light.async_turn_on(**params)
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/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/yeelight.py", line 302, in turn_on self._bulb.turn_on(duration=duration)
File "<decorator-gen-7>", line 2, in turn_on
File "/home/homeassistant/.homeassistant/deps/yeelight/main.py", line 50, in _command result = self.send_command(method, params).get("result", [])
File "/home/homeassistant/.homeassistant/deps/yeelight/main.py", line 291, in send_command self.__socket.close() AttributeError: 'NoneType' object has no attribute 'close'

Expected: No errors when bulbs have no power.

Problem-relevant configuration.yaml entries and steps to reproduce:

light:
  platform: yeelight
  devices:
    192.168.1.240:
      name: yeelight color bulb salon 1
      transition: 500
      save_on_change: false
    192.168.1.250:
      name: yeelight color bulb salon 2
      transition: 500
      save_on_change: false
HydrelioxGitHub commented 7 years ago

Is the problem still here with the 0.46 update ?

bieniu commented 7 years ago

With HA 0.46 and 0.47 I don't have this issue.