fgebhart / smart_alarm

IoT Open Source Alarm Clock
Apache License 2.0
16 stars 4 forks source link

LED rainbow loading regardless if running LEDs or not #13

Open mathisoneric opened 6 years ago

mathisoneric commented 6 years ago

https://github.com/fgebhart/smart_alarm/blob/44e684cc3541109a76f7a6986a2c6938234dfa3a/smart_alarm/smart_alarm#L530

Bug:

Traceback (most recent call last):
  File "smart_alarm", line 533, in <module>
    v = threading.Thread(target=led.rainbow, args=(10, 1,))
AttributeError: 'NoneType' object has no attribute 'rainbow'

Issue:

For people like me who aren't running LEDs, your code still attempts to perform an LED rainbow upon loading:

# one quick led rainbow
v = threading.Thread(target=led.rainbow, args=(10, 1,))
v.start()

Fix:

Only run the LED rainbow if the check_if_smartalarm_is_running_leds() function returns true:

# one quick led rainbow
if check_if_smartalarm_is_running_leds():
    v = threading.Thread(target=led.rainbow, args=(10, 1,))
    v.start()
fgebhart commented 6 years ago

Hey, thanks a lot for your contribution! I'm happy to see that someone is still interested in what we built. Sadly I did not work on this project for a longer time. If you can submit a pull request, otherwise I'll try to fix the issues as soon as possible.