Core: TTS fails after update to 0.116.0.dev20200928 / 0.115.4

Created on 28 Sep 2020  路  22Comments  路  Source: home-assistant/core

The problem

I try to announce a tts message over my Home Mini, it isn't cached it fails after updating to 0.116.0.dev20200928 with 0.116.0.dev20200927 this problem doesn't exist.

Environment

  • Home Assistant Core release with the issue: 0.116.0.dev20200928
  • Last working Home Assistant Core release (if known): 0.116.0.dev20200927
  • Operating environment (OS/Container/Supervised/Core):

arch | armv7l
-- | --
dev | true
docker | true
hassio | false
installation_type | Home Assistant Container
os_name | Linux
os_version | 5.4.51-v7l+
python_version | 3.8.5
timezone | Europe/Berlin
version | 0.116.0.dev20200928
virtualenv | false

Problem-relevant configuration.yaml

tts:
  - platform: google_translate
    service_name: google_say
    language: 'de'

Traceback/Error logs

Logger: homeassistant.components.websocket_api.http.connection.2941559352
Source: components/tts/__init__.py:471
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 11:22:01 (2 occurrences)
Last logged: 11:23:05
Invalid MultiSpec data: TextFrame(encoding=<Encoding.UTF8: 3>, text=['de'])

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/mutagen/easyid3.py", line 124, in setter
    frame = id3[frameid]
  File "/usr/local/lib/python3.8/site-packages/mutagen/_util.py", line 537, in __getitem__
    return self.__dict[key]
KeyError: 'TPE1'

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 138, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1338, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1373, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 168, in async_say_handle
    url = await tts.async_get_url(
  File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 341, in async_get_url
    filename = await self.async_get_tts_audio(
  File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 368, in async_get_tts_audio
    data = self.write_tags(filename, data, provider, message, language, options)
  File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 471, in write_tags
    tts_file["artist"] = ID3Text(encoding=3, text=artist)
  File "/usr/local/lib/python3.8/site-packages/mutagen/_file.py", line 74, in __setitem__
    self.tags[key] = value
  File "/usr/local/lib/python3.8/site-packages/mutagen/easyid3.py", line 222, in __setitem__
    return func(self.__id3, key, value)
  File "/usr/local/lib/python3.8/site-packages/mutagen/easyid3.py", line 126, in setter
    id3.add(mutagen.id3.Frames[frameid](encoding=3, text=value))
  File "/usr/local/lib/python3.8/site-packages/mutagen/id3/_frames.py", line 65, in __init__
    setattr(self, checker.name,
  File "/usr/local/lib/python3.8/site-packages/mutagen/id3/_frames.py", line 76, in __setattr__
    self._setattr(name, checker.validate(self, value))
  File "/usr/local/lib/python3.8/site-packages/mutagen/id3/_specs.py", line 533, in validate
    raise ValueError('Invalid MultiSpec data: %r' % value)
ValueError: Invalid MultiSpec data: TextFrame(encoding=<Encoding.UTF8: 3>, text=['de'])

Additional information

The configuration where not changed just the version update. Be sure to test with a message that is not cached

in progress google_translate tts

Most helpful comment

same issue on 0.115.4

All 22 comments

tts documentation
tts source
(message by IssueLinks)

Hey there @pvizeli, mind taking a look at this issue as its been labeled with an integration (tts) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@digitallyserviced could you please take a look at this issue since it seems to be caused by https://github.com/home-assistant/core/pull/40666?

same issue on 0.115.4

MY Problems on updates
114.4
Ok I send text messages to google-mini,
OK send stream camera with "camera.Play_stream"
115
Ok I send text messages to google-mini,
KO sending stream camera with "camera.Play_stream"
115.4
KO sending text messages to google-mini,
KO sending stream camera with "camera.Play_stream"
Thanks!

I receive the mentioned Error: Invalid MultiSpec data: TextFrame(encoding=<Encoding.UTF8: 3>, text=['en']) also when I'm using the google_cloud tts integration and - as already mentioned - also for the google_translate integration.

tts:
  - platform: google_translate
    base_url: https://....:443

# tts:
#   - platform: google_cloud
#     base_url: https://...:443
#     key_file: googlecloud.json
#     language: de-DE
#     gender: female
#     voice: de-DE-Wavenet-C

key| value
-- | --
arch | armv7l
chassis | embedded
dev | false
docker | true
docker_version | 19.03.11
hassio | true
host_os | HassOS 4.13
installation_type | Home Assistant OS
os_name | Linux
os_version | 4.19.127-v7l
python_version | 3.8.5
supervisor | 245
timezone | Europe/Zurich
version | 0.115.4
virtualenv | false

the exception seems to be the same for both tts integrations

2020-09-28 19:06:36 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2780351000] Invalid MultiSpec data: TextFrame(encoding=<Encoding.UTF8: 3>, text=['en-US'])
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/mutagen/easyid3.py", line 124, in setter
    frame = id3[frameid]
  File "/usr/local/lib/python3.8/site-packages/mutagen/_util.py", line 537, in __getitem__
    return self.__dict[key]
KeyError: 'TPE1'

same problem on 0.115.4 me too

same problem on 0.115.4 me too Invalid MultiSpec data: TextFrame(encoding=, text=['cs'])

as a reminder as seen in the issue https://github.com/home-assistant/core/issues/40148#issuecomment-699663242 :)

Adding response with just "It is broken for me too", isn't adding value. Instead add a 馃憤 to the top issue description.

Found a workaround for now:
Google cloud with

encoding: linear16

runs without problems

mhhh when I try the following:

tts:
  - platform: google_cloud
    key_file: googlecloud.json
    base_url: 'https://my-duckdns.duckdns.org:443'
    service_name: google_cloud_say
    encoding: linear16
    # already tried with or without any of the following entries
    language: de-DE 
    gender: female
    voice: 'de-DE-Wavenet-C'

...and then call the service - whereas media_player.default_room is a sonos player:

tts.google_cloud_say
data:
  entity_id: "media_player.default_room"
  message: "Hallo Welt"
````

I receive the following error:  `Error on play_media with UPnP Error 714 received: Illegal MIME-Type from <IP_OF_SONOS_PLAYER_ABOVE>`

...but using the same service and config on a **chromecast** playback device works 馃槙 

tts.google_cloud_say
data:
entity_id: "media_player.living_room_tv"
message: "Hallo Welt"
````

I get this error when using voicerss

  - platform: voicerss
    api_key: !secret voicerss_api_key
    language: 'pt-pt'
    codec: mp3
    format: '8khz_8bit_mono'
tts.voicerss_say
data:
  entity_id: "media_player.google_sala"
  message: "Teste"



md5-26ff4f0b695f94afb8e3d365ebade849



  - platform: google_translate
    language: 'pt'
    cache: true
    time_memory: 600
    base_url: "https://xxxx.duckdns.org:8123"

I get

Invalid MultiSpec data: TextFrame(encoding=<Encoding.UTF8: 3>, text=['pt'])

Something to do with the language selection?

I'm on 0.115.4

鈩癸笍 Please note

If you have the same issue, just hitting the 馃憤 on the original post _at the top of this page_ is enough. Adding another "I have the same issue" doesn't add to debugging the issue.

Thanks 馃憤

same issue after upgrading to 115.4: "Invalid MultiSpec data: TextFrame(encoding=, text=['en'])"

This seems to be that some artist, album, title ID3 tags being set on the files are not simply strings. I was not getting the same error. However the message I see people are receiving is that the artist (actually language) is not a string but a [].

I am going to look into a best fix. I will propose a fix probably that if it detects an array it will be like a [].join("_") so if there is more than one element it becomes a string of el1_el2. Although I do not see a reason it would have multiple elements for language, the other tags may have. Single element arrays will just be el1.

One reason I am not getting the error may be due to the fact that my tts config does NOT use the language key. Since I am using wavenet on Google Cloud, the voice overrides the language and gender making it unnecessary.

Further investigation shows providing a language key causes the error.

tts:
  - platform: google_cloud
    key_file: shaderpaper-2436f75b7bfb.json
    cache: true
    cache_dir: /tmp/tts
    base_url: 'https://xzhass.duckdns.org'
    voice: en-US-Wavenet-H
    encoding: linear16
    speed: 0.9
    pitch: -2.5
    gain: 5.0
    profiles:
      - small-bluetooth-speaker-class-device
    # language: en-US
    # gender: female

Why on earth does anybody need to read Id3 tags of a TTS message?

just to be sure, see https://github.com/home-assistant/core/issues/40731

this happened on 115.4 release, updating from 115.3 release. Just adding that info, since it seems a bit different from the OP here mentioning 116.dev

@Mariusthvdb it isn't different.

cool. hope you can fix it with all provided info.
thx!

@nagyrobi with media browser it would make seense if for some reason the resulting messages are stored locally and visible with the browser for future use or saving or something... I do not see it being necessary with things like tts that are most likely dynamic but someone had a reason at some point. maybe ask them.

@Mariusthvdb the resulting fix that I provided for 0.115.4 that resolved the original ID3 tag issue caused the error for some people who were using a language key in their tts configs. It just means that my fix broke people with that kind of config.

@frenck thanks for getting a fix in, I had a bunch of other system issues the past few days that made it difficult for me to even get booting proper. the odd part of your fix is i tried to turn on and off easymp3/easyid3 for the original issue with 'not valid frame' and never worked. for some reason it always goes about it with the non-easy method.

the resulting fix that I provided for 0.115.4 that resolved the original ID3 tag issue caused the error for some people who were using a language key in their tts configs. It just means that my fix broke people with that kind of config.

Yes, that exactly the same issue I have, I've updated to latest beta today ( supervisor - 0.116.0b5) and still i can see the issue:
Bom dia Camilla: Error executing script. Unexpected error for call_service at pos 1: 'en' not a Frame instance While executing automation automation.bom_dia_camilla Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 247, in _async_step await getattr( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 454, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1335, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1370, in _execute_service await handler.func(service_call) File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 168, in async_say_handle url = await tts.async_get_url( File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 341, in async_get_url filename = await self.async_get_tts_audio( File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 368, in async_get_tts_audio data = self.write_tags(filename, data, provider, message, language, options) File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 476, in write_tags tts_file["artist"] = artist File "/usr/local/lib/python3.8/site-packages/mutagen/_file.py", line 74, in __setitem__ self.tags[key] = value File "/usr/local/lib/python3.8/site-packages/mutagen/id3/_tags.py", line 339, in __setitem__ raise TypeError("%r not a Frame instance" % tag) TypeError: 'en' not a Frame instance

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moskovskiy82 picture moskovskiy82  路  3Comments

missedtheapex picture missedtheapex  路  3Comments

Konstigt picture Konstigt  路  3Comments

MartinHjelmare picture MartinHjelmare  路  3Comments

neonandu picture neonandu  路  3Comments