antonioparraga / braviarc

Python library for Sony Bravia TV remote control
MIT License
79 stars 41 forks source link

Add fallback TvPower command #27

Closed azuwis closed 5 years ago

azuwis commented 6 years ago

Should fix this error:

Traceback (most recent call last):
  File "/home/hass/venv/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 224, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/hass/venv/lib/python3.6/site-packages/homeassistant/components/media_player/braviatv.py", line 309, in turn_on
    self._braviarc.turn_on()
  File "/home/hass/venv/lib/python3.6/site-packages/braviarc/braviarc.py", line 257, in turn_on
    self.send_req_ircc(self.get_command_code('TvPower'))
  File "/home/hass/venv/lib/python3.6/site-packages/braviarc/braviarc.py", line 229, in get_command_code
    self._refresh_commands()
  File "/home/hass/venv/lib/python3.6/site-packages/braviarc/braviarc.py", line 222, in _refresh_commands
    if not resp.get('error'):
AttributeError: 'NoneType' object has no attribute 'get'

Discussion https://github.com/home-assistant/home-assistant/issues/12577