fetchIP
E. Almqvist 4 years ago
parent cc963ef57c
commit 57f6fa55ea
  1. 3
      hue_controller.py
  2. 3
      hue_remote.py

@ -126,11 +126,14 @@ class controller:
print("Error: Light index '" + str(index) + "' out of range") print("Error: Light index '" + str(index) + "' out of range")
def setPreset( presetID:str, index:int=-1 ): def setPreset( presetID:str, index:int=-1 ):
if( PRESETS.get(presetID) ):
if( index == -1 ): if( index == -1 ):
for key in LIGHTS: for key in LIGHTS:
controller.setLightPreset( key, presetID ) controller.setLightPreset( key, presetID )
else: else:
controller.setLightPreset( index, presetID ) controller.setLightPreset( index, presetID )
else:
print("Error: Unknown preset '" + presetID + "'")
def countLights(): def countLights():
return len(LIGHTS) return len(LIGHTS)

@ -81,8 +81,9 @@ def parseCommand( cmd:list, pos:int, i=-1 ):
return return
help() # display help if function did nothing help() # display help if function did nothing
except (RuntimeError, TypeError, NameError, IndexError): except (RuntimeError, TypeError, NameError, IndexError) as err:
help() # display the help page if parameters are missing (it will give out an IndexError) help() # display the help page if parameters are missing (it will give out an IndexError)
print( "\n\nError: " + str(err) )
def parseCommandline(): def parseCommandline():

Loading…
Cancel
Save