core: Volumio Integration - TTS broken

The problem

Invoking the TTS function of the Volumio Lovelace Card produces the following error:

Failed to call service tts/google_translate_say. Expecting value: line 1 column 1 (char 0)

All other functions of the Volumio Card seem to work correctly (although there are some display issues with the prev/next buttons).

Environment

  • Home Assistant Core release with the issue: 2021.1.4
  • Last working Home Assistant Core release (if known): Unknown
  • Operating environment (OS/Container/Supervised/Core): Home Assistant OS 5.10
  • Integration causing this issue: Volumio
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/volumio/

Problem-relevant configuration.yaml

# Text to speech
tts:
  - platform: google_translate

Traceback/Error logs

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

[2905393976] 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)

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 46 (5 by maintainers)

Most upvoted comments

Not much of a programmer myself in python (yet 😬), but if I can help with some testing I’m at your disposal

@OnFreund Ok. If @volumio offers a way to do with socket.io I will try to implement the TTS story.

@volumio @schnabel In my opinion, it would be best if Volumio had a built-in TTS and so that you could send text directly to Volumio e.g. via JSON with a predefined volume level, then it would know to play the message and then go back to playing the interrupted track at the previous volume. I know you can’t do unfortunately current track mute while playing TTS.

@schnabel @fraserp Maybe it is possible to play TTS without pausing while playing music only by turning it down to e.g. 30% as it is in android with the use of a mixer?

The problem is still here. A temporary solution is to add a new media player in configuration.yaml with platform “mpd” and with the IP of volumio in “host”. You can send TTS commands to this media player

@eWuPi From the HASS perspective I would not agree that volumio should do the integration. All components, HASS TTS service, the TTS providers, a HASS media player integration and HASS as the integrating platform, are available. That way we have a loosely coupled system. The only challenge in this case is that volumio api does not offer a ‘clean’ way to play remote audio files (as discussed above). From a volumio perspective (without HASS) on the other hand I does make a lot of sense as mentioned by you and @volumio . My bottom line is that both ways have pros and cons. @volumio irrespective of that it would be great if volumio would be able to play remote audio files (not only web radio).

@fraserp Thank you for the feedback. Yes that is what I meant. At the moment I think about splitting up the solution like the sonos implementation does. That way I could keep the current fix small and we do not have to wait for the pyvolumio pull request.

Hi,

I have been looking at this briefly. Here are some of my findings:

  1. Volumio integration expects media_id to be json. It uses json internally because it sends commands to volumio via REST.
  2. Volumio is not able to play remote (static) contents via api. It offers playback for dlna and local files (volumio mounts), spotify and webradio. (webradio service may be used for remote content, but it plays the file in a loop)
  3. The good news is, volumio uses mpd. Volumio integration could use mpd client library to enable TTS.

I would like to implement it but I am not sure about the expectations.

  • Should the current playback stop and only playback TTS result?
  • Should the current playback pause for the TTS playback?
  • Should TTS result be inserted in the current playback queue (not sure if that is possible)?

I prefer to pause current playback but other implementations like sonos replace the current queue. Please give feedback 😃.

any updates? for me it still does not work with version core-2021.9.4

Failed to call service tts/cloud_say. Expecting value: line 1 column 1 (char 0)

Still present in Home Assistant 2021.8.8 😦.

Please, help. I love Volumio and Home Assistant 😃.

Following: 2021.7.4 still present.