GitXplorerGitXplorer
e

google-home-client-go

public
31 stars
4 forks
7 issues

Commits

List of commits on branch master.
Verified
b39a12aab79bc83f7edd84757ebac6d8d62c63b4

Handle panic error on client.Close() (#10)

eevalphobia committed 5 years ago
Verified
42e796fccc8df2ef20b83dbf6ae908dad2295bf4

Handle panic error on barnybug/go-cast (#9)

eevalphobia committed 5 years ago
Unverified
b2810964a8e2ab298100ee465d37c7ff9dd64280

PauseMedia added (#6)

DDontmindmes committed 6 years ago
Unverified
0c9fa9217df1b849ac85e38c3ad204e66a568c5d

Update all functionality of this Package (#2)

DDontmindmes committed 6 years ago
Unverified
33eef84c4e0d6ae48c2ab277885edb29e120242a

Fix tts url to use token.

eevalphobia committed 7 years ago
Unverified
7cd7e3b17c5d0dffe16df3e8f051ff41177fa63e

Create Google Home Client for golang

eevalphobia committed 7 years ago

README

The README file for this repository.

Google Home client for golang

GoDoc License: MIT Release Build Status Codecov Coverage Go Report Card Downloads

Quick Usage

package main

import (
	"github.com/evalphobia/google-home-client-go/googlehome"
)

func main() {
	cli, err := googlehome.NewClientWithConfig(googlehome.Config{
		Hostname: "192.168.0.1",
		Lang:     "en",
		Accent:   "GB",
	})
	if err != nil {
		panic(err)
	}

	// Speak text on Google Home.
	cli.Notify("Hello")

	// Change language
	cli.SetLang("ja")
	cli.Notify("こんにちは、グーグル。")

	// Or set language in Notify()
	cli.Notify("你好、Google。", "zh")

	//Play Audio
	cli.Play("http://127.0.0.1/night.mp3")

	//Stop Audio
	cli.StopMedia()

	//Min of 0.0 Max of 1.0 (Must be of type Float)
	cli.SetVolume(0.5)

	//Get Volume Google Home is running at
	cli.GetVolume()

	//Kills the running Application (Disconnects from Google Home)
	cli.QuitApp()

}

Environment variables

Name Description
GOOGLE_HOME_HOST Hostname or IP address of Google Home for speech feature.
GOOGLE_HOME_PORT Port number of Google Home. Default is 8009.
GOOGLE_HOME_LANG Speaking language of Google Home. Default is en.
GOOGLE_HOME_ACCENT Speaking accent of Google Home. Default is us.

Credit

This library is based on github.com/kunihiko-t/google-home-notifier-go by kunihiko-t and heavily depends on github.com/barnybug/go-cast.

This port version supports environment value config and some feature.