I am using a remote cmus instance and it works when:
- cmus is running on the remote server
cmus --listen 0.0.0.0:3000
- Then I start Home Assistant Core
My config is as follows:
media_player:
...
- platform: cmus
name: cmus
host: 192.168.0.100
port: 3000
password: SomePassword
I can play, pause and change tracks… even volume changing works as far as muting the sound (another issue is that it won’t set the volume at all).
Problem #1 - Starting cmus after Home Assistant
But when I start the applications in the wrong order it doesn’t work e.g.:
- Start Home Assistant Core
- Start cmus
In this case, the media player remains disconnected and the logs show an error:
Log Details (ERROR)
Logger: homeassistant.components.media_player
Source: components/cmus/media_player.py:83
Integration: Media player (documentation, issues)
First occurred: 8:11:12 PM (1 occurrences)
Last logged: 8:11:12 PM
Error while setting up cmus platform for media_player
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 184, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/cmus/media_player.py", line 68, in setup_platform
cmus_remote = CmusDevice(host, password, port, name)
File "/usr/src/homeassistant/homeassistant/components/cmus/media_player.py", line 83, in __init__
self.cmus = remote.PyCmus(server=server, password=password, port=port)
File "/usr/local/lib/python3.8/site-packages/pycmus/remote.py", line 78, in __init__
raise exceptions.ConfigurationError(
pycmus.exceptions.ConfigurationError: A configuration error occured
Details: Unable to connect to server 192.168.0.100
No matter how long I wait, Home Assistant Core never reconnects the integration.
Problem #2 - Restarting cmus whilst connected to Home Assistant
When I restart cmus after it is successfully connected to Home Assistant, any future actions, like playing or pausing triggers a series of errors:
Log Details (WARNING)
Logger: homeassistant.components.cmus.media_player
Source: components/cmus/media_player.py:95
Integration: cmus (documentation, issues)
First occurred: 8:47:16 PM (1 occurrences)
Last logged: 8:47:16 PM
Received no status from cmus
And…
Log Details (ERROR)
Logger: homeassistant.components.websocket_api.http.connection.140450245543248
Source: components/cmus/media_player.py:175
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 8:47:21 PM (1 occurrences)
Last logged: 8:47:21 PM
[Errno 32] Broken pipe
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 125, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1308, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1343, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 208, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 523, in async_turn_on
await self.hass.async_add_job(self.turn_on)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
And finally:
Log Details (ERROR)
Logger: homeassistant.helpers.entity
Source: components/cmus/media_player.py:93
First occurred: 8:47:26 PM (1 occurrences)
Last logged: 8:47:26 PM
Update for media_player.cmus fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 263, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 456, in async_device_update
await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/cmus/media_player.py", line 93, in update
status = self.cmus.get_status_dict()
File "/usr/local/lib/python3.8/site-packages/pycmus/remote.py", line 225, in get_status_dict
status_str = self.status()
File "/usr/local/lib/python3.8/site-packages/pycmus/remote.py", line 216, in status
return self.send_cmd('status\n')
File "/usr/local/lib/python3.8/site-packages/pycmus/remote.py", line 123, in send_cmd
self.socket.sendall(six.binary_type(passwd_str.encode('utf8')))
BrokenPipeError: [Errno 32] Broken pipe
Anyone else experiencing more issues around this?