amimof / huego

An extensive Philips Hue client library for Go with an emphasis on simplicity
MIT License
250 stars 36 forks source link

Post "http:///api": http: no Host in request URL #30

Open aep opened 3 years ago

aep commented 3 years ago

the create user example in README.md doesnt work for me. bridge.CreateUser fails with

Post "http:///api": http: no Host in request URL
amimof commented 3 years ago

Hi @aep thanks for reporting. The example omits any errors that CreateUser may return. Try to see what those errors are by capturing them:

func main() {
  bridge, err := huego.Discover()
  if err != nil {
    panic(err)
  }
  user, err := bridge.CreateUser("my awesome hue app") // Link button needs to be pressed
  if err != nil {
    panic(err)
  }
  bridge = bridge.Login(user)
  light, err := bridge.GetLight(3)
  if err != nil {
    panic(err)
  }
  light.Off()
}