New here so sorry if I put this question in the wrong place.
I am trying to use TTS together with Bluesound I get this error in my log:
2017-10-22 15:32:33 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
result = coro.throw(exc)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1025, in _event_to_service_call
yield from service_handler.func(service_call)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/media_player/__init__.py", line 408, in async_service_handler
yield from getattr(player, method['method'])(**params)
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/media_player/__init__.py", line 707, in play_media
raise NotImplementedError()
NotImplementedError
Play_media is not implemented in the Bluesound component and it is required by TTS. I will look into it, hopefully I will be able to fix this before next release of HA
It seems that in order to play an url for Bluesound you should post to endpoint /playurl.
The post should be HTML Form URL Encoded: (application/x-www-form-urlencoded). Content shall be: Key: url, value: <url to play>
To test with curl:
curl -X POST -F 'url=<url to mp3>>' http://<bluesound ip address>/playurl
Note, just default port 80 shall be used for this.
As a work-around I use pre recorded sound from internet:
Loading the endpoint into a shell_command works for me.
shell_command:
playmp3: "curl -X POST -F 'url=http://www.orangefreesounds.com/wp-content/uploads/2017/10/Horror-creepy-whoosh-sound.mp3' http://<your IP>:11000/Play"
then you can use it in an automation
action:
service: shell_command.playmp3
The only drawback is that if the speaker is playing something, it stops the current track, and plays the ānewā url. After this, the speaker does not revert back to playing the āoldā track.
It seems that both urls is working. The one i proposed above is working with latest Bluesound software and is used by the Windows app, that is how I reveresed engineered that one. Note that the one I propsed are using port 80, not the api port 1100. Interesting enough there is a mini-web-server in any bluesound device at port 80. (Without any security at allā¦)
Thanks for the easy integration example, I will try it. But still it would be nice with the built in functionality so that TTS could work. Maybe I will try to do it myself if not @Anders_Karlstrom is already at it . I also think that it then might be possible to revert back to the old source - at least if that was a preset.
I will look into this next week. It shouldnāt be a problem to fix this. The only problem with it is that it will be stopping what ever is playing and not continue with the played track after the TTS sound is played. To fix this I need ro implement a snapshot feature just as the sonos component. But that is more time consuming. I wont have time to implement that this year (I also promised to make a separate Python lib when Iām implementing the next big feature, and since Iām not a Python developer it takes som extra time)
Sorry about the delay, but I have now submitted a pull request with a fix for this. The PR also handles grouping of players and sleep timers.
When using TTS you have to clear the playlist of the device first. Bluesound will continue playing the playlist after the TTS sound if the playlist is not cleared. I didnār find a workaround for this.
I will at some time try to mimic to snapshot/restore feature that the Sonos library supports, this will be a dealbreaker for TTS-use with Bluesound I think.
But this will take som time. First of I have promised to move a lot of the code in the component to a separate library, and since Iām not a python developer this will take a lot of time for me. I will have to learn some python patterns before doing this (this is much easier in HA since I only needed to learn the pattern of HA to develop the component).
And after Iāve learned python, I will have to develop the snapshot/restore feature which also will be time consuming, I have to figure out all parameters that will have to be stored.
Sorry to necro this topic but I didnāt want to create another topic for this snapshotting of bluesound. How far is the bluesound lib developed? Is taking a snapshot already possible like with Sonos?
Iām considering investing in the bluesound/bluos as a replacement for LMS/Squeezebox/Squeezelite
@M4tthijs@Cezus@Anders_Karlstrom How is the Bluesound integration in HA today in 2021? Is TTS working? Any pain points? From a programmers perspective, how is it working with the bluesound APIs? Is it an open or closed system?
Hmmm I use the google home mini for tts. As far as I know the integration does not support pauze yet. I only set the source and volume with automations.
TTS is working, but Iām not able to automatically restart the music after the TTS message ended. Would like to have a snapshot or scene functionality with the āintegrationāā¦
sorry for the late response. For me it still work well. It doesnāt support snapshot, but that is not something that is natively supported by Bluesound and would be needed to be part of the integration.
The bluesound API is āclosedā, as far as I havenāt found any documentation. I had to listen to network traffic when making the integration.
The biggest problem for me if I were to continue develop the integration is that the API-calls would need to be extracted to a separate lib, HA-team will most probably not accept any major code changes since I barely got it through code review last time. And I donāt have the time to do this, I donāt know python well enough and it would take to long for me right now.
This and the fact that I donāt have access to all products for āreverse engineringā is a problem right now.
I really really would like to fix the integration to make it better, but when it still work I find it hard to justify me putting time into this.
I understand, the TTS isnāt a high priority for me anyways.
A month ago I submitted a bug report to about the bluesound integration. Itās my first bugreport to HA, so Iām not 100% sure how to get visibility on it. It hasnāt received any replies at all.
Maybe you could take a look at it? Iāve poked around but donāt have a good enough understanding of the HA internals:
ItĀ“s a good thing you wrote here to let me know. I will add myself as codeowner of bluesound so that next time a bug is submitted I will get notified.
I have submitted a bugfix for this issue. Letās hope it will be approved quickly
Yeah, it has been this way for a long time, but I have so many things I would like todo, I Will have to find some for this soon enough
Anyway, the fix has been included in this release (2021.11) please let me now if it works or not. I have no reason to believe i doesnāt but I didnāt have the hardware to test different ports.
(You donāt need to use different hostnames if you donāt want to)