Exemplo n.º 1
0
def main():
	_logger.info('Starting Snips Led Control')

	signal.signal(signal.SIGINT, stopHandler)
	signal.signal(signal.SIGTERM, stopHandler)

	parser = argparse.ArgumentParser(prog='Snips Led Control')
	parser.add_argument('--mqttServer', help='Defines to what mqtt server SLC should connect. Overrides snips.toml', type=str)
	parser.add_argument('--mqttPort', help='Defines what port t use to connect to mqtt. Overrides snips.toml', type=str)
	parser.add_argument('--clientId', help='Defines a client id. Overrides snips.toml', type=str)
	parser.add_argument('--hardware', help='Type of hardware in use', type=str, default='respeaker2',
						choices=[
							"respeaker2",
							"respeaker4",
							"respeakerMicArrayV2",
							"neoPixels12leds",
							"matrixvoice"
						])
	parser.add_argument('--leds', help='Override the amount of leds on your hardware', type=int)
	parser.add_argument('--defaultBrightness', help='Set a default brightness for your leds', type=int, default=50)
	parser.add_argument('--pattern', help='The pattern to be used by SLC (google / alexa / custom)', type=str, choices=['google', 'alexa', 'custom'], default='custom')
	parser.add_argument('--offListener', help='Allows you to define which topics will trigger the off pattern', type=str, default='hermes/hotword/toggleOn',
						choices=[
							'hermes/hotword/toggleOn',
							'hermes/tts/sayFinished',
							'hermes/audioServer/playFinished'
						])
	parser.add_argument('--offPattern', help='Define an off led pattern', type=str)
	parser.add_argument('--idlePattern', help='Define an idle led pattern', type=str)
	parser.add_argument('--wakeupPattern', help='Define a wakeup led pattern', type=str)
	parser.add_argument('--speakPattern', help='Define a speak led pattern', type=str)
	parser.add_argument('--thinkPattern', help='Define a think led pattern', type=str)
	parser.add_argument('--listenPattern', help='Define a listen led pattern', type=str)
	parser.add_argument('--errorPattern', help='Define an error led pattern', type=str)
	parser.add_argument('--successPattern', help='Define a success led pattern', type=str)
	parser.add_argument('--defaultState', help='Define if the leds should be active or not by default', type=str, choices=['on', 'off'], default='on')
	parser.add_argument('--gpioPin', help='Define the gpio pin wiring number to use when your leds use gpio', type=int)
	parser.add_argument('--vid', help='Define the vid pin wiring number to use when your leds use usb', type=str)
	parser.add_argument('--pid', help='Define the pid pin wiring number to use when your leds use usb', type=str)
	parser.add_argument('--matrixIp', help='[Matrix Voice] - Define the ip of your matrix voice', type=str, default='127.0.0.1')
	parser.add_argument('--everloopPort', help='[Matrix Voice] - Define the everloop port', type=int, default=20021)
	args = parser.parse_args()

	slc = SnipsLedControl(args)
	slc.onStart()

	try:
		while RUNNING:
			time.sleep(0.1)
	except KeyboardInterrupt:
		pass
	finally:
		_logger.info('Shutting down Snips Led Control')
		slc.onStop()
Exemplo n.º 2
0
def main():
	_logger.info('Starting Snips Led Control v. 1.9.7')

	signal.signal(signal.SIGINT, stopHandler)
	signal.signal(signal.SIGTERM, stopHandler)

	parser = argparse.ArgumentParser(prog='Snips Led Control')
	parser.add_argument('--mqttServer', help='Defines to what mqtt server SLC should connect. Overrides snips.toml', type=str)
	parser.add_argument('--mqttPort', help='Defines what port to use to connect to mqtt. Overrides snips.toml', type=str)
	parser.add_argument('--mqttUsername', help='Mqtt username if required. Overrides snips.toml', type=str)
	parser.add_argument('--mqttPassword', help='Mqtt password if required. Overrides snips.toml', type=str)
	parser.add_argument('--clientId', help='Defines a client id. Overrides snips.toml', type=str)
	parser.add_argument('--hardware', help='Type of hardware in use', type=str, default='respeaker2',
						choices=[
							"respeaker2",
							"respeaker4",
							"respeakerMicArrayV2",
							"respeakerCoreV2",
							"respeaker6MicArray",
							"respeaker7MicArray",
							"matrixvoice",
							"matrixcreator",
							"neoPixelsSK6812RGBW",
							"neoPixelsWS2812RGB",
							"googleAIY",
							"puregpio"
						])
	parser.add_argument('--leds', help='Override the amount of leds on your hardware', type=int)
	parser.add_argument('--defaultBrightness', help='Set a default brightness for your leds', type=int, default=50)
	parser.add_argument('--endFrame', help='Respeakers, or apa102 led systems need an end frame. If your device is not working try either 255 or 0', type=int)
	parser.add_argument('--pattern', help='The pattern to be used', type=str, default='google',
						choices=[
							'google',
							'alexa',
							'kiboost',
							'projectalice',
							'custom'
						])
	parser.add_argument('--offListener', help='Allows you to define which topics will trigger the off pattern', type=str, default='hermes/hotword/toggleOn',
						choices=[
							'hermes/hotword/toggleOn',
							'hermes/tts/sayFinished',
							'hermes/audioServer/playFinished'
						])
	parser.add_argument('--startPattern', help='Define a program start led pattern', type=str)
	parser.add_argument('--stopPattern', help='Define a prorgam stop led pattern', type=str)
	parser.add_argument('--offPattern', help='Define an off led pattern', type=str)
	parser.add_argument('--idlePattern', help='Define an idle led pattern', type=str)
	parser.add_argument('--wakeupPattern', help='Define a wakeup led pattern', type=str)
	parser.add_argument('--speakPattern', help='Define a speak led pattern', type=str)
	parser.add_argument('--thinkPattern', help='Define a think led pattern', type=str)
	parser.add_argument('--listenPattern', help='Define a listen led pattern', type=str)
	parser.add_argument('--errorPattern', help='Define an error led pattern', type=str)
	parser.add_argument('--successPattern', help='Define a success led pattern', type=str)
	parser.add_argument('--updatingPattern', help='Define an updating led pattern', type=str)
	parser.add_argument('--callPattern', help='Define a call led pattern', type=str)
	parser.add_argument('--setupModePattern', help='Define a setup mode led pattern', type=str)
	parser.add_argument('--conErrorPattern', help='Define a connection error led pattern', type=str)
	parser.add_argument('--messagePattern', help='Define a message led pattern', type=str)
	parser.add_argument('--dndPattern', help='Define a do not disturb led pattern', type=str)
	parser.add_argument('--defaultState', help='Define if the leds should be active or not by default', type=str, choices=['on', 'off'], default='on')
	parser.add_argument('--gpioPin', help='Define the gpio pin wiring number to use when your leds use gpio', type=int)
	parser.add_argument('--vid', help='Define the vid pin wiring number to use when your leds use usb', type=str)
	parser.add_argument('--pid', help='Define the pid pin wiring number to use when your leds use usb', type=str)
	parser.add_argument('--matrixIp', help='[Matrix Voice] - Define the ip of your matrix voice', type=str, default='127.0.0.1')
	parser.add_argument('--everloopPort', help='[Matrix Voice] - Define the everloop port', type=int, default=20021)
	parser.add_argument('--pureGpioPinout', help='[Pure GPIO] - Define the broadcom gpio number of your leds, in the order you want them', type=list, default=[])
	parser.add_argument('--activeHigh', help='[Pure GPIO] - Define how your leds are controlled', type=bool, default=True)
	parser.add_argument('--debug', help='Enable the debug mode for the console to return more informations', type=bool, default=False)
	args = parser.parse_args()

	slc = SnipsLedControl(args)
	slc.onStart()

	try:
		while RUNNING:
			time.sleep(0.1)
	except KeyboardInterrupt:
		pass
	finally:
		_logger.info('Shutting down Snips Led Control')
		slc.onStop()