diff options
author | Collin Guarino <collin.guarino@gmail.com> | 2016-02-18 23:30:40 -0500 |
---|---|---|
committer | Collin Guarino <collin.guarino@gmail.com> | 2016-02-18 23:30:40 -0500 |
commit | a95deb0690428f3c793ae7b4e2401ff56de72343 (patch) | |
tree | f16db5adb2f62fa034f962445ccb3179905d2bb7 /light.go | |
parent | 4715205f959490a55b8a2ad8aef56ce503709dbb (diff) |
Implemented Bridge.Login() func that will assign Bridge.Username and create the user if it does not exist. Also convered more functions to Bridge.func()
Diffstat (limited to 'light.go')
-rw-r--r-- | light.go | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -172,7 +172,7 @@ func (light *Light) SetState(newState LightState) error { } // GetAllLights retreives the state of all lights that the bridge is aware of. -func GetAllLights(bridge *Bridge) ([]Light, error) { +func (bridge *Bridge) GetAllLights() ([]Light, error) { // Loop through all light indicies to see if they exist // and parse their values. Supports 100 lights. var lights []Light @@ -212,8 +212,8 @@ func GetLightByIndex(bridge *Bridge, index int) (Light, error) { } // GetLight returns a light struct containing data on a given name. -func GetLightByName(bridge *Bridge, name string) (Light, error) { - lights, _ := GetAllLights(bridge) +func (bridge *Bridge) GetLightByName(name string) (Light, error) { + lights, _ := bridge.GetAllLights() for _, light := range lights { if light.Name == name { return light, nil |