rotx / homeassistant-components

Apache License 2.0
1 stars 0 forks source link

Media ID must be Spotify uri? #2

Open fmonday opened 4 years ago

fmonday commented 4 years ago

This looks very promising, but after properly installing and restarting, I tried to call tts.macos_tts_say as per your component test, and it fails with the below error. Very unexpected.

tts:
  - platform: macos_tts
    voice: 'Samantha'

media_player:
  - platform: macos_tts
2019-10-29 19:52:02 ERROR (SyncWorker_12) [homeassistant.components.spotify.media_player] media id must be spotify uri
Error: AudioFileOpen failed ('dta?')

OS: 10.15 (mac mini) HA: 0.100.3

rotx commented 4 years ago

Sorry, I don't have Spotify. It does sound like the selected media player is Spotify, and that Spotify doesn't want to play anything that it doesn't know about (such as local files?). The last version these plugins were tested on was HA 0.96 under macOS 10.13.6.

fmonday commented 4 years ago

I have four media players defined, one of which is indeed Spotify. Is there something to do to specify that the tts.macos_tts_say service uses the macos_tts media player platform?

rotx commented 4 years ago

It looks like this can be done by specifying the entity_id when defining the service. The Home Assistant docs show the following example for Polly TTS. This method might work for the macOS TTS as well (not tested). Let me know what you find out.

- service: tts.amazon_polly_say
  data_template:
    entity_id: media_player.living_room
    message: '<speak>Hello from Amazon Polly</speak>'
fmonday commented 4 years ago

I was back to work on this some more, but having updated HA a few times (now on 0.103.0) I have lost the service:

Error setting up platform: macos_tts
Traceback (most recent call last):
  File "/Users/username/homeassistant/lib/python3.7/site-packages/homeassistant/components/tts/__init__.py", line 133, in async_setup_platform
    hass, p_config, discovery_info
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/coroutines.py", line 120, in coro
    res = func(*args, **kw)
TypeError: async_get_engine() takes 2 positional arguments but 3 were given