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
72.35k stars 30.28k forks source link

pandora media player error #38051

Closed cithraul closed 3 years ago

cithraul commented 4 years ago

The problem

Added pandora integration. When trying to turn on the mediaplayer, the following error occurs in the log file: The container is set to run privileged. Running pianobar directly from the docker container (root user) works without issues.

2020-07-21 18:47:24 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall media_player.turn_on (c:af0137ae93e34564ad158e264f681986): entity_id=['media_player.pandora']>

(Complete error trace below)

Environment

Problem-relevant configuration.yaml

media_player:
  - platform: pandora
    name: "Pandora"

Traceback/Error logs

2020-07-21 18:47:24 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall media_player.turn_on (c:af0137ae93e34564ad158e264f681986): entity_id=['media_player.pandora']>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 111, in expect_loop
    incoming = spawn.read_nonblocking(spawn.maxread, timeout)
  File "/usr/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 482, in read_nonblocking
    raise TIMEOUT('Timeout exceeded.')
pexpect.exceptions.TIMEOUT: Timeout exceeded.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1276, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1295, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    self._platforms.values(), func, call, required_features
  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 595, 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.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/pandora/media_player.py", line 113, in turn_on
    ["Receiving new playlist", "Select station:", "Email:"]
  File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 341, in expect
    timeout, searchwindowsize, async_)
  File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 369, in expect_list
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 119, in expect_loop
    return self.timeout(e)
  File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 82, in timeout
    raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7f56ca6f2750>
command: /usr/bin/pianobar
args: ['/usr/bin/pianobar']
buffer (last 100 chars): b'nobar/config:8\r\nWelcome to pianobar (2019.02.14)! Press ? for a list of commands.\r\n\x1b[2K(i) Login... '
before (last 100 chars): b'nobar/config:8\r\nWelcome to pianobar (2019.02.14)! Press ? for a list of commands.\r\n\x1b[2K(i) Login... '
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 355
child_fd: 39
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile(b'Receiving new playlist')
    1: re.compile(b'Select station:')
    2: re.compile(b'Email:')

Additional information

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

kbowman-newedenconsultinggroup commented 2 years ago

This issue still exists as of 2021.11 docker install.

kbowman-newedenconsultinggroup commented 2 years ago

FWIW - I see a EOF error in spawn, rather than the TIMEOUT error logged by cithraul. As if pianobar is exiting abnormally. It does start apparently. I can confirm as well that pianobar runs fine from the command line.

2021-11-27 11:25:26 INFO (SyncWorker_8) [homeassistant.components.pandora.media_player] Started pianobar subprocess
2021-11-27 11:25:27 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140410749214000] End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7fb3ee0a7ee0>
command: /usr/bin/pianobar
args: ['/usr/bin/pianobar']
buffer (last 100 chars): b''
before (last 100 chars): b'Welcome to pianobar (2020.11.28)! Press ? for a list of commands.\r\n\x1b[2K(i) Login... '
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 6611
child_fd: 41
closed: False
timeout: 5
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 10000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile(b'Receiving new playlist')
    1: re.compile(b'Select station:')
    2: re.compile(b'Email:')
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pexpect/spawnbase.py", line 166, in read_nonblocking
    s = os.read(self.child_fd, size)
OSError: [Errno 5] I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pexpect/expect.py", line 111, in expect_loop
    incoming = spawn.read_nonblocking(spawn.maxread, timeout)
  File "/usr/local/lib/python3.9/site-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
    return super(spawn, self).read_nonblocking(size)
  File "/usr/local/lib/python3.9/site-packages/pexpect/spawnbase.py", line 171, in read_nonblocking
    raise EOF('End Of File (EOF). Exception style platform.')
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 667, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 863, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 704, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 614, in async_turn_on
    await self.hass.async_add_executor_job(self.turn_on)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/pandora/media_player.py", line 107, in turn_on
    mode = self._pianobar.expect(
  File "/usr/local/lib/python3.9/site-packages/pexpect/spawnbase.py", line 340, in expect
    return self.expect_list(compiled_pattern_list,
  File "/usr/local/lib/python3.9/site-packages/pexpect/spawnbase.py", line 369, in expect_list
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python3.9/site-packages/pexpect/expect.py", line 117, in expect_loop
    return self.eof(e)
  File "/usr/local/lib/python3.9/site-packages/pexpect/expect.py", line 63, in eof
    raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7fb3ee0a7ee0>
command: /usr/bin/pianobar
args: ['/usr/bin/pianobar']
buffer (last 100 chars): b''
before (last 100 chars): b'Welcome to pianobar (2020.11.28)! Press ? for a list of commands.\r\n\x1b[2K(i) Login... '
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 6611
child_fd: 41
closed: False
timeout: 5
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 10000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile(b'Receiving new playlist')
    1: re.compile(b'Select station:')
    2: re.compile(b'Email:')
Rydcal commented 2 years ago

Also seeing this (as well as a few others https://community.home-assistant.io/t/pianobar-configuration-in-docker/159111/19) I wonder if we need a new issue since this is closed?

cithraul commented 2 years ago

Yep, this issue is back in 2021.11. It was working in 2021.1 though. Getting the EOF error as well this time around.

cithraul commented 2 years ago

Still present in 2021.12.2 :

Logger: homeassistant.components.websocket_api.http.connection Source: components/pandora/media_player.py:107 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 5:52:13 PM (1 occurrences) Last logged: 5:52:13 PM

[140128491580912] End Of File (EOF). Exception style platform. <pexpect.pty_spawn.spawn object at 0x7f7217edf880> command: /usr/bin/pianobar args: ['/usr/bin/pianobar'] buffer (last 100 chars): b'' before (last 100 chars): b'Welcome to pianobar (2020.11.28)! Press ? for a list of commands.\r\n\x1b[2K(i) Login... ' after: <class 'pexpect.exceptions.EOF'> match: None match_index: None exitstatus: None flag_eof: True pid: 5109 child_fd: 64 closed: False timeout: 30 delimiter: <class 'pexpect.exceptions.EOF'> logfile: None logfile_read: None logfile_send: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.05 delayafterclose: 0.1 delayafterterminate: 0.1 searcher: searcher_re: 0: re.compile(b'Receiving new playlist') 1: re.compile(b'Select station:') 2: re.compile(b'Email:') Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/pexpect/spawnbase.py", line 166, in read_nonblocking s = os.read(self.child_fd, size) OSError: [Errno 5] I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/pexpect/expect.py", line 111, in expect_loop incoming = spawn.read_nonblocking(spawn.maxread, timeout) File "/usr/local/lib/python3.9/site-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking return super(spawn, self).read_nonblocking(size) File "/usr/local/lib/python3.9/site-packages/pexpect/spawnbase.py", line 171, in read_nonblocking raise EOF('End Of File (EOF). Exception style platform.') pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/media_player/init.py", line 638, in async_turn_on await self.hass.async_add_executor_job(self.turn_on) File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/pandora/media_player.py", line 107, in turn_on mode = self._pianobar.expect( File "/usr/local/lib/python3.9/site-packages/pexpect/spawnbase.py", line 340, in expect return self.expect_list(compiled_pattern_list, File "/usr/local/lib/python3.9/site-packages/pexpect/spawnbase.py", line 369, in expect_list return exp.expect_loop(timeout) File "/usr/local/lib/python3.9/site-packages/pexpect/expect.py", line 117, in expect_loop return self.eof(e) File "/usr/local/lib/python3.9/site-packages/pexpect/expect.py", line 63, in eof raise EOF(msg) pexpect.exceptions.EOF: End Of File (EOF). Exception style platform. <pexpect.pty_spawn.spawn object at 0x7f7217edf880> command: /usr/bin/pianobar args: ['/usr/bin/pianobar'] buffer (last 100 chars): b'' before (last 100 chars): b'Welcome to pianobar (2020.11.28)! Press ? for a list of commands.\r\n\x1b[2K(i) Login... ' after: <class 'pexpect.exceptions.EOF'> match: None match_index: None exitstatus: None flag_eof: True pid: 5109 child_fd: 64 closed: False timeout: 30 delimiter: <class 'pexpect.exceptions.EOF'> logfile: None logfile_read: None logfile_send: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.05 delayafterclose: 0.1 delayafterterminate: 0.1 searcher: searcher_re: 0: re.compile(b'Receiving new playlist') 1: re.compile(b'Select station:') 2: re.compile(b'Email:')

Rydcal commented 2 years ago

I noticed that too- opened a new issue here: https://github.com/home-assistant/core/issues/62156.

janstadt commented 2 years ago

Has anyone had any luck with this? Im running into this issue as well running the latest homeassistant docker container. have the config files in the correct location and can auto login with pianobar via docker exec.

huliz commented 2 years ago

issue still present

Erudition commented 7 months ago

Welcome to pianobar (2020.11.28)! Press ? for a list of commands.\r\n\x1b[2K(i) Login...

If pianobar is offering the login screen, it won't ever get to playing, and thus will time out, so maybe you didn't define your credentials?