pborges / gbridge Goto Github PK
View Code? Open in Web Editor NEWGoogle Home Actions on Google Smart Home integration library
License: MIT License
Google Home Actions on Google Smart Home integration library
License: MIT License
While registering a device the ```TraitName``s need to be unique
Go 1.11 and 1.12 include preliminary support for modules, Go’s new dependency management system that makes dependency version information explicit and easier to manage.
This libary should support GoLang Modules too.
To improve the usability of this libary, one should create a GoDoc. This could also improve adoption.
Currently all librarys, even the ones from Google are badly documented and hard to understand. Our goal should be to provide a simple and well documented library.
Move traits/commands to new package
Would be nice to have a logo for this project.
Commands like "turn on all the lights" can fire off many requests that take too long and time out, making google say gbridge failed, so lets execute all the Executions in parallel.
Hi, it doesn't work, seems it need certificate files for SSL and aouth.
Make SimpleAuthenticationProvider store tokens on disk so tokens can survive reboot of the service
Under which terms/conditions can people use this project?
An MIT License would be great.
source the states for the requested devices and respond to QUERY requests
Hey @pborges ,
thank you for creating this libary. I'm currently trying to create a simple Google Actions Skill with it.
However i'm not able to get your example to work. The Action shows up on my Google Home Skill and i can get an Oauth Token from it. But after that, nothing happens. I expected the defined devices to show up in the Google Home App. The gBridge did not log an SYNC Request either.
Would be great if you could take a look at my code. I'm using a ngrok Tunnel for communication between the cloud and my pc.
package main
import (
"fmt"
"log"
"net/http"
"os"
"github.com/gorilla/mux"
"github.com/pborges/gbridge"
)
var addr = ":8081"
func main() {
log.SetOutput(os.Stdout)
log.SetFlags(log.LstdFlags | log.Lshortfile)
r := mux.NewRouter()
r.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log.Println("UNKKNOWN:", r.RequestURI)
})
r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
log.Println("/")
fmt.Fprint(w, "gAssistant Translator for S.A.M Online")
})
b := gbridge.Bridge{
ClientId: "950e4dcfe43dc656bd7caa4f8da05fb0", //as long as this matches the settings "Account linking" on actions console it works
ClientSecret: "759568585e122274798c900839929486", //as long as this matches the settings "Account linking" on actions console it works
}
b.HandleExec(NewLight("1", "Testlampe"), func(dev gbridge.Device, req gbridge.CommandRequest, res *gbridge.CommandResponse) {
log.Printf("DEBUG: Intent received.")
log.Printf("Exec Cmd: %+v\n", req)
res.Status = gbridge.CommandStatusSuccess
res.States.Online = true
res.States.On = req.Params.On
log.Printf("Exec Res: %+v\n", res)
})
r.HandleFunc("/oauth", b.HandleOauth)
r.HandleFunc("/token", b.HandleToken)
r.HandleFunc("/smarthome", b.HandleSmartHome)
log.Println("Listening:", addr)
log.Println(http.ListenAndServe(addr, r))
}
func NewLight(id string, name string) gbridge.Device {
d := gbridge.Device{
Id: id,
Type: gbridge.DeviceTypeLight,
Traits: []gbridge.DeviceTrait{gbridge.DeviceTraitOnOff},
Name: gbridge.DeviceName{
DefaultNames: []string{name},
Name: name,
Nicknames: []string{name},
},
}
return d
}
func NewSwitch(id string, name string) gbridge.Device {
d := gbridge.Device{
Id: id,
Type: gbridge.DeviceTypeSwitch,
Traits: []gbridge.DeviceTrait{gbridge.DeviceTraitOnOff},
Name: gbridge.DeviceName{
DefaultNames: []string{name},
Name: name,
Nicknames: []string{name},
},
}
return d
}
Resync seems to fail if this is empty
This lib not use API key and Homegraph?
When a device is defined, a list of traits this device supports is passed in, when a response comes back it should include a map of the requested traits and their values
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.