Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash shortly after startup - index out of range in lightstate.go #3

Closed
MichaelDepner opened this issue Mar 29, 2017 · 6 comments
Closed
Assignees
Labels

Comments

@MichaelDepner
Copy link

MichaelDepner commented Mar 29, 2017

Windows 64 bit. Extracted release v0.0.8 and ran the .exe file. Registration to hub went well, lamps were found. Color temperature was set correctly, then the program crashes with the following error:

2017/03/29 22:39:14 Kelvin v0.0.8 starting up... 🚀
2017/03/29 22:39:14 Looking for updates...
2017/03/29 22:39:14 ⚙ Default configuration generated
2017/03/29 22:39:14 ⌘ No bridge configuration found. Starting local discovery...
2017/03/29 22:39:18 ⌘ Found bridge. Starting user registration.
PLEASE PUSH THE BLUE BUTTON ON YOUR HUE BRIDGE.... Success!
2017/03/29 22:39:33 💡 Devices found on current bridge:
2017/03/29 22:39:33 | Name                 |  ID | Reachable | On    | Dimmable | Temperature | Color | Cur. Temp | Cur. Bri |
2017/03/29 22:39:33 | Hue ambiance lamp 1  |   1 | true      | true  | true     | true        | false |     2202K |       79 |
2017/03/29 22:39:33 | Hue ambiance lamp 2  |   2 | true      | true  | true     | true        | false |     2202K |       79 |
2017/03/29 22:39:33 🌍 Location not configured. Detecting by IP
2017/03/29 22:39:33 🌍 Detected location: Copenhagen, Denmark (55.6759, 12.5655).
2017/03/29 22:39:33 Configuring intervals for Wednesday March 29 2017
2017/03/29 22:39:33 💡 Starting cyclic update for Hue ambiance lamp 2
2017/03/29 22:39:33 💡 Starting cyclic update for Hue ambiance lamp 1
2017/03/29 22:39:33 Managing lights for interval 22:00 to 23:59
2017/03/29 22:39:35 💡 Light Hue ambiance lamp 2 just appeared. Initializing state to 2000K at 60%
2017/03/29 22:39:35 💡 Light Hue ambiance lamp 1 just appeared. Initializing state to 2000K at 60%
panic: runtime error: index out of range

goroutine 82 [running]:
panic(0x69eb00, 0xc04200c080)
        /home/travis/.gimme/versions/go1.7.4.linux.amd64/src/runtime/panic.go:500 +0x1af
main.(*LightState).equals(0xc0422f8368, 0x89a, 0x849d00, 0x0, 0x0, 0x3b, 0x89a)
        /home/travis/gopath/src/github.com/stefanwichmann/kelvin/lightstate.go:36 +0x1c4
main.(*Light).update(0xc0422f8300, 0xc0422c3f48, 0xc0422c3ecf)
        /home/travis/gopath/src/github.com/stefanwichmann/kelvin/light.go:150 +0x4fb
main.(*Light).updateCyclic(0xc0422f8300, 0xc04218b860)
        /home/travis/gopath/src/github.com/stefanwichmann/kelvin/light.go:71 +0x2f4
created by main.main
        /home/travis/gopath/src/github.com/stefanwichmann/kelvin/kelvin.go:86 +0x599

Quick look at the source reveals that the offending line in lightstate.go reads:

if (lightstate.color[0] != 0 && lightstate.color[1] != 0) || (state.color[0] != 0 && state.color[1] != 0)

I don't have time to properly dig into this right now, but will probably have a look tomorrow if nobody's fixed it by then - or if it turns out that it's only reproducible on my setup :)

@johnboyle87
Copy link

Same thing happens to me! Here's text from my log:

`C:\Users\John\Desktop\kelvin-windows-amd64-v0.0.8>kelvin.exe > log.txt
2017/03/29 20:02:05 Kelvin v0.0.8 starting up... 🚀
2017/03/29 20:02:05 Looking for updates...
2017/03/29 20:02:05 ⚙ Configuration config.json loaded
2017/03/29 20:02:05 ⌘ Initializing bridge from configuration
2017/03/29 20:02:05 ⌘ Connection to bridge established
2017/03/29 20:02:05 💡 Devices found on current bridge:
2017/03/29 20:02:05 | Name | ID | Reachable | On | Dimmable | Temperature | Color | Cur. Temp | Cur. Bri |
2017/03/29 20:02:05 | living couch lamp | 4 | true | true | true | true | true | 2314K | 79 |
2017/03/29 20:02:05 | living reading | 5 | true | true | true | true | true | 2314K | 79 |
2017/03/29 20:02:05 | kitchen white | 7 | true | true | true | false | false | - | 79 |
2017/03/29 20:02:05 | living room corner lamp | 9 | true | true | true | true | true | 2314K | 79 |
2017/03/29 20:02:05 | Living Overhead | 10 | true | true | true | true | true | 2314K | 79 |
2017/03/29 20:02:05 | kitchen color | 6 | true | true | true | true | true | 2314K | 79 |
2017/03/29 20:02:05 | Hanging Table | 8 | true | true | true | true | true | 2314K | 79 |
2017/03/29 20:02:05 | John Room | 11 | true | true | true | true | false | 2298K | 79 |
2017/03/29 20:02:05 | Bathroom | 12 | false | true | true | true | false | 2732K | 100 |
2017/03/29 20:02:05 🌍 Working with location: 40.8504, -73.9369 from configuration
2017/03/29 20:02:05 💡 Starting cyclic update for Living Overhead
2017/03/29 20:02:05 Configuring intervals for Wednesday March 29 2017
2017/03/29 20:02:05 Managing lights for interval 20:00 to 22:00
2017/03/29 20:02:05 💡 Starting cyclic update for kitchen color
2017/03/29 20:02:05 💡 Starting cyclic update for kitchen white
2017/03/29 20:02:05 💡 Starting cyclic update for Hanging Table
2017/03/29 20:02:05 💡 Starting cyclic update for living room corner lamp
2017/03/29 20:02:05 💡 Starting cyclic update for John Room
2017/03/29 20:02:05 💡 Starting cyclic update for living couch lamp
2017/03/29 20:02:05 💡 Starting cyclic update for living reading
2017/03/29 20:02:05 💡 Starting cyclic update for Bathroom
2017/03/29 20:02:07 💡 Light Living Overhead just appeared. Initializing state to 2295K at 80%
2017/03/29 20:02:07 💡 Light kitchen color just appeared. Initializing state to 2295K at 80%
2017/03/29 20:02:07 💡 Light kitchen white just appeared. Initializing state to 2295K at 80%
2017/03/29 20:02:07 💡 Light living room corner lamp just appeared. Initializing state to 2295K at 80%
2017/03/29 20:02:07 💡 Light Hanging Table just appeared. Initializing state to 2295K at 80%
2017/03/29 20:02:07 💡 Light John Room just appeared. Initializing state to 2295K at 80%
2017/03/29 20:02:07 💡 Light living reading just appeared. Initializing state to 2295K at 80%
2017/03/29 20:02:07 💡 Light living couch lamp just appeared. Initializing state to 2295K at 80%
panic: runtime error: index out of range

goroutine 44 [running]:
panic(0x692c80, 0x10f3e008)
/home/travis/.gimme/versions/go1.7.4.linux.amd64/src/runtime/panic.go:500 +0x331
main.(*LightState).equals(0x11138264, 0x8fa, 0x7dd8e8, 0x0, 0x0, 0x4f, 0x8fa)
/home/travis/gopath/src/github.com/stefanwichmann/kelvin/lightstate.go:36 +0x233
main.(*Light).update(0x11138230, 0x0, 0x0)
/home/travis/gopath/src/github.com/stefanwichmann/kelvin/light.go:150 +0x470
main.(*Light).updateCyclic(0x11138230, 0x11060840)
/home/travis/gopath/src/github.com/stefanwichmann/kelvin/light.go:71 +0x237
created by main.main
/home/travis/gopath/src/github.com/stefanwichmann/kelvin/kelvin.go:86 +0xc65`

@stefanwichmann
Copy link
Owner

Thanks for reporting these.

My guess is this happens with lamps only supporting color temperature but no real colors. In this case the lightstate isn't initialized properly.

A fix is on the way...

@stefanwichmann stefanwichmann self-assigned this Mar 30, 2017
@johnboyle87
Copy link

I do have two color temp only bulbs so that could definitely be the problem. Let me know when fixed and I'll test for you. Looking forward to an update!

@stefanwichmann
Copy link
Owner

Ok, after some trouble with travis I finally pushed a new build with a fix. Please feel free to try again.

@johnboyle87
Copy link

downloaded and currently running, no crash, will keep you updated. thanks for the quick fix, looking forward to using it!

@MichaelDepner
Copy link
Author

Works for me too, nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants