Fixed config loading bugs

fetchIP
E. Almqvist 4 years ago
parent 60dbe4dae7
commit dc1d37e689
  1. 4
      modules/hue/config.py
  2. 8
      modules/hue/default-config.py
  3. 44
      modules/hue/presets.py
  4. 30
      speech_daemon.py

@ -1,4 +0,0 @@
# Hue Remote Settings
class hue_config:
address = "192.168.0.3"
username = "E0ru0AeVFKEH1E30X40JAJfovg4Uu1aTkdrKQ2Oi"

@ -1,8 +0,0 @@
##################################
# RENAME THIS FILE TO "config.py"#
##################################
# Hue Remote Settings
class hue_config:
address = "" # Local IPv4 address to the HUE bridge
username = "" # Username for the bridge

@ -1,44 +0,0 @@
# Presets goes in here
PRESETS = {
"default": {
"color": (178, 199, 255),
"brightness": 255
},
"dim": {
"color": (178, 199, 255),
"brightness": 111
},
"dim": {
"color": (178, 199, 255),
"brightness": 80
},
"red": {
"color": (255, 0, 0),
"brightness": 255
},
"green": {
"color": (0, 255, 0),
"brightness": 255
},
"blue": {
"color": (0, 0, 255),
"brightness": 255
},
"ice" : {
"color": ( 80, 100, 255 ),
"brightness": 120
},
"sleep": {
"color": (185, 155, 25),
"brightness": 60
}
}

@ -1,24 +1,47 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys
from modules.hue.hue_remote import parseCommandline from modules.hue.hue_remote import parseCommandline
from modules.hue.hue_controller import controller from modules.hue.hue_controller import controller
from modules.speech.speech import voiceInput from modules.speech.speech import voiceInput
prefixes = ["computer", "computers"] from modules.configloader.loader import readconfig
from os.path import expanduser
homedir = expanduser("~")
CONFIG = {}
class speech_daemon(object): class speech_daemon(object):
voiceInpObj = None voiceInpObj = None
deviceIndex = 30
def __init__(self, deviceIndex=30): def __init__(self, deviceIndex=30):
self.voiceInpObj = voiceInput() self.voiceInpObj = voiceInput()
self.voiceInpObj.setMuted(False) self.voiceInpObj.setMuted(False)
self.deviceIndex = deviceIndex
def loadconfig(self):
path = homedir + "/.config/roomcomputer/config.json"
# if no config path is
# specified then choose the users default
if( len(sys.argv) > 1 ):
path = sys.argv[1]
cfg = readconfig(path) # read the config
global CONFIG
CONFIG = cfg
def start(self): def start(self):
controller.init() controller.init()
for inp in self.voiceInpObj.start(): for inp in self.voiceInpObj.start( self.deviceIndex ):
cmdBuf = inp.lower().split(" ") cmdBuf = inp.lower().split(" ")
if( cmdBuf[0] in prefixes ): if( cmdBuf[0] in CONFIG["speech"]["prefixes"] ):
print("CMD:", cmdBuf) print("CMD:", cmdBuf)
parseCommandline( cmdBuf, False ) parseCommandline( cmdBuf, False )
@ -26,4 +49,5 @@ class speech_daemon(object):
if __name__ == "__main__": if __name__ == "__main__":
daemon = speech_daemon() daemon = speech_daemon()
daemon.loadconfig()
daemon.start() daemon.start()

Loading…
Cancel
Save