Volumio TTS via MPD

Hi there,

does anyone know if it is possible to setup the MPD integration (for TTS with Volumio) in Home Assistant such that Volumio pauses its previously played source, plays the TTS file and then resumes the previous source? Does anyone have an idea how to set it up?

Thank you!

Best regards,
Felix

1 Like

I have a similar question, so if you made any progress l would love to hear.

When I manually added the Volumio integration it created a lovelace card that seemingly works well, except for the TTS part which just throws an error: JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I’ve managed to set up a config entry for Volumio-MPD:

# Volumio
media_player:
  - platform: mpd
    name: volumio_mpd
    host: {insert_ip}

This sort of works for sending a TTS command via the Lovelace card but only if nothing is playing. If something is playing it seems to to try to, pause -> send TTS -> resume but it goes wrong. The timing is possibly out so the TTS audio doesn’t play and it also then skips to a different track too.

Any pointers welcome.

1 Like

To add to this, here is the log of the error:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/volumio/media_player.py:256
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 12:06:43 (1 occurrences)
Last logged: 12:06:43

[2765719104] Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1445, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 181, in async_say_handle
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1445, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 593, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 630, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/volumio/media_player.py", line 256, in async_play_media
    await self._volumio.replace_and_play(json.loads(media_id))
  File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
1 Like

I also noticed it tries to pause and then starts to play again without playing the TTS.

I tried to make a sequence with a script (Pause->playt tts->delay->Play) and it actually works great.
You have to tweek the delay to the length of the TTS.

You also can check with a condition if volumio is playing or not and determine if its neccesary to excecute the Play/Pause service

I hope this helps.