From 82e834aafc8a7f28077b924681c569051803f40b Mon Sep 17 00:00:00 2001 From: happyleavesaoc Date: Thu, 16 Feb 2017 12:20:30 -0500 Subject: [PATCH] add gstreamer doc (#2060) --- .../media_player.gstreamer.markdown | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 source/_components/media_player.gstreamer.markdown diff --git a/source/_components/media_player.gstreamer.markdown b/source/_components/media_player.gstreamer.markdown new file mode 100644 index 00000000000..b3efea9dce1 --- /dev/null +++ b/source/_components/media_player.gstreamer.markdown @@ -0,0 +1,93 @@ +--- +layout: page +title: "Gstreamer" +description: "Instructions on how to integrate Gstreamer into Home Assistant." +date: 2017-02-016 10:00 +sidebar: true +comments: false +sharing: true +footer: true +ha_category: Media Player +featured: false +ha_release: 0.39 +ha_iot_class: "Local Push" +--- + +The `gstreamer` platform allows you to play audio via a gstreamer pipeline. Practically, this means you can play audio directly on the computer running Home Assistant. It is particularly suited for playing TTS. Advanced users can specify a pipeline to transform the audio stream and/or redirect it elsewhere. + +## Setup + +To add a `gstreamer` media player to your installation, add the following to your `configuration.yaml` file: + +```yaml +media_player: + - platform: gstreamer +``` + +And then install the following system dependencies: + +Debian/Ubuntu/Rasbian: + +```bash +sudo apt-get install python-gst-1.0 \ + gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 \ + gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly \ + gstreamer1.0-tools +``` + +Redhat/Centos/Fedora: + +```bash +sudo yum install -y python-gstreamer1 gstreamer1-plugins-good \ + gstreamer1-plugins-ugly +``` + +If you're running Home Assistant in a virtual environment, you'll need to symlink the system Python's `gst` module into your virtual environment: + +```bash +ln -s /path/to/your/installation/of/gst /path/to/your/venv/lib/python3.4/site-packages +``` + +On a Raspberry PI, you may need to add the Home Assistant user to the `audio` group: + +```bash +sudo usermod -a -G audio +``` + +## Configuration + +Configuration variables: + +- **name** (*Optional*): Name the player. +- **pipeline** (*Optional*): `gst` pipeline description. + +Only the `music` media type is supported. + +## Example Usage + +### Using with TTS + +To play TTS on your local computer (for example, if you have speakers attached to your Raspberry PI: + +```yaml +media_player: + - platform: gstreamer + +script: + tts: + sequence: + - service: tts.google_say # or amazon_polly, voicerss, etc + data: + entity_id: media_player.gstreamer + message: "example text-to-speech message" +``` + +### Using with Snapcast + +To play to a named pipe for consumption by Snapcast: + +```yaml +media_player: + - platform: gstreamer + pipeline: "audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapcast_gstreamer" +```