alexmohr / media_player.sony

Custom component for Home Assistant to control Sony devices
Apache License 2.0
16 stars 8 forks source link

Add support for volume control for Home Cinema like BDV-E2100 #1

Closed ptimatth closed 4 years ago

ptimatth commented 4 years ago

Simply add support for the volume and mute control.

patrul commented 4 years ago

I do not know if I am doing something wrong or any missing step. The log reports:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 210, in handle_service
    self._platforms.values(), func, call, service_name, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 349, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 371, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 788, in async_volume_down
    await self.hass.async_add_job(self.volume_down)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sony/media_player.py", line 298, in volume_down
    self.sonydevice.volume_down()
AttributeError: 'SonyDevice' object has no attribute 'volume_down'
ptimatth commented 4 years ago

Did you have updated with my sony apilib PR ? https://github.com/alexmohr/sonyapilib/pull/40 (Oh, i have seen, i have a worst code coverage, i will update it later)

alexmohr commented 4 years ago

Error is due to the fact that I forgot to merge the corresponding pr in sonyapilib. Will be fixed when @ptimatth fixed the test coverage.

I'll think of a way to prevent such issues in the future...

Issue is tracked via #2

alexmohr commented 4 years ago

I've reverted the PR for now so master is compatible again. I'll re-merge the changes after the sonyapilib is merged.