deblockt / google-home-push

python lib to push message on google case device
MIT License
15 stars 8 forks source link

PyPI version

Google home push

Library for Python 3.4+ to push text message or audio file with the Google Home.

Installation

pip install googlehomepush

Dependencies

PyChromecast depends on the Python packages gTTS, pychromecast. Make sure you have these dependencies installed using pip install -r requirements.txt

How to use

from googlehomepush import GoogleHome

GoogleHome("LivingRoom").say("test")
GoogleHome("LivingRoom").play("http://www.hubharp.com/web_sound/BachGavotteShort.mp3")

API

GoogleHome(devicename = None, host = None, port = None, tts_builder = googleTTS_Builder)

Create a new Google Home instance (a device name or host is mandatory).

.say(text, lang = 'en-US')

Push a message on Google home

.play(url, contentType = 'audio/mp3'):

Push a sond to Google home

You can play a local file using http_server

from googlehomepush.http_server import serve_file

file_url = serve_file("/path/to/file", "audio/mp3")
GoogleHome("LivingRoom").play(file_url, "audio/mp3")

Maintainers