Companion App as Media Player

Subject: Feature Request - Integration of Companion App Device as a Media Player for Piper TTS Output

Feature Request

I kindly request the implementation of a new feature that allows users to designate their Home Assistant Companion App Device as a media player. This integration would enable the routing of Text-to-Speech (TTS) output generated by the Piper TTS system to the Home Assistant Companion App Device, turning it into a convenient and flexible audio output option.

While I currently make use of the TTS notification service that utilizes the embedded TTS on my Android device, I would love to be able to make full use of the awesome Piper TTS service with the Home Assistant Companion App.

Thank you for your continued dedication to improving Home Assistant. I believe that this addition would greatly benefit the community and contribute to the platform’s ongoing success.

Please feel free to reach out if you have any questions or require further clarification on this feature request.

:blush:

Looks like theres an open issue on Github as of last year, Companion app as media_player entity · Issue #2512 · home-assistant/android · GitHub

so this request will require changes to HA core before the apps can make use of it.

Currently there are no entities provided by the mobile_app integration that allow for control. A similar request was made here to allow for the switch domain.

https://community.home-assistant.io/t/using-switches-instead-of-calling-a-service-on-android-companion-app/418004

The real question is how do we manage the communication from server to device for this, websockets is going to be battery intensive. The alternative is to use the existing notification command structure so we remain battery friendly. Not really sure whats the best way but I am not a core developer and can only speak from the android side :slight_smile:

Edit: also might be a duplicate of https://community.home-assistant.io/t/phone-becomes-portable-media-player-for-tts-notifications/467160 ?

1 Like

I don’t think this requires a core change. I can make an API call to request the assist pipeline render a TTS and output a url to a wav file

We should be able to simply send a companion notification with a accessible url to an audio file, in the case of TTS a wav, and the companion app could just “play” that sound from the url. weather it’s a TTS or an alert tone.

This is not the same as the actual request for a media_player domain entity provided by the companion app, that 100% requires HA core changes.

What you are asking for is a service call to be used instead of TTS however that has an issue where the app must use a media service to play the file instead of TTS the way it is today which uses on device engine and does not need to be tied to media service as its native to android.

Ok, i see your point. I was just suggesting that the desired effect, weather or not its a media_player entity could be achieved by adding this functionality to companion. I.e. companion could play arbitrary audio url provided in the notify service call data (instead of setting the message to “TTS”, set it to MEDIA_URL, and set media_url: http://homeassistant/local/tts.wqv )
The issue i have with current TTS is my assist pipeline has a “personality” using the voice ive selected, but when i get a TTS notice away from home, it breaks immersion hearing some stranger tell me the cats water is empty.

feel free to submit a feature request for this, we actually already have the backend code for this as we use TTS for Assist already.

also if you havent already you can check to see if there is an android TTS engine with the voice you want already existing because that would give the same effect. There are multiple TTS engines you can install and select on the device. Anything you adjust in your devices TTS settings gets respected by the app, including changing the pitch and voice etc…

Ok, ill make a new req. I thought id piggy back on a similar one but that was ill-conceived

After seeing this thread, I found a project which packages APKs that run Piper locally on Android. This allows you to put the same voice on the device in its TTS settings. Bonus is that all TTS on your device then gets processed locally with Piper, not just HA.

It doesn’t function as a Media Player, as the OP requested, but it solves the same problem for me.

The “medium” voice I installed was 84MB, and works pretty well.

1 Like

@cabinlab

Any chance you know which apk you installed? Release v1.9.14 · k2-fsa/sherpa-onnx · GitHub