def getButtonsFunctions(self): '''A''' # Sets the fetcher functionsFetcher = IotFetcher('Buttons Functions',self.configFunctionsFileAddress, self.verbose) # Load Buttons Functions configuration from file return functionsFetcher.loadConfig()
def __init__(self, args): self.verbose = args.get('verbose') self.configFileAddress = args.get('configFileAddress') # Sets the fetcher fetcher = IotFetcher('Relays',self.configFileAddress, self.verbose) # Load Philips-Hue configuration from file self.configJson = fetcher.loadConfig() # Sets super super(IotRelays, self).__init__(self.verbose)
def getFunctions(self): '''A''' configFileAddress = self.addressConfig + self.filesAddresses[ 'functions'] fetcher = IotFetcher('Functions Dictionary', configFileAddress, self.verbose) # Parse the keys to int out = { int(key): value for key, value in fetcher.loadConfig().iteritems() } return out
def __init__(self, args): self.verbose = args.get('verbose') self.configFileAddress = args.get('configFileAddress') self.configFunctionsFileAddress = args.get('configFunctionsFileAddress') # Sets the fetcher fetcher = IotFetcher('Buttons',self.configFileAddress, self.verbose) # Load Buttons configuration from file self.configJson = fetcher.loadConfig() # Sets the buttons functions self.functions = self.getButtonsFunctions() # Sets super super(IotButtons, self).__init__(self.configJson, self.verbose)
def __init__(self, args): self.verbose = args.get('verbose') self.configFileAddress = args.get('configFileAddress') # Sets the fetcher fetcher = IotFetcher('Network Scan', self.configFileAddress, self.verbose) # Loads the Network Scanning configuration from file self.configJson = fetcher.loadConfig() # Updates the functionsDict with the Twitter module dictValues = { 'display_name': 'Network Scanning', 'display_description': 'Scans the Network for unknown connection', 'function': 'network_scanner' } fetcher.updatesFunctionsDict(args.get('functionsDict'), dictValues) # Sets super super(IotNetworkScanner, self).__init__(args, self.verbose)
def __init__(self, args): try: # Imports the IotFetcher from iot_fetcher import IotFetcher except ImportError: exit("This script requires to import the IoT shared functions\nThe file iot_fetcher.py was not found") self.verbose = args.get('verbose') self.configFileAddress = args.get('configFileAddress') # Sets the fetcher fetcher = IotFetcher('OLED Display',self.configFileAddress, self.verbose) # Load OLED Display configuration from file self.configJson = fetcher.loadConfig().get('oled_display') # Sets the values from parsed parsed = { 'rst_pin': args.get('rst_pin'), 'size': args.get('size'), } # Sets the parameters from parsed or fetched from file fetched = fetcher.setsFetcher(parsed, self.configJson) # Updates the Dictionary self.configJson['rst_pin'] = fetched.get('rst_pin') self.configJson['size'] = fetched.get('size') # Updates the functionsDict with the Twitter module dictValues = { 'display_name': 'OLED Display', 'display_description': 'Uses the OLED Display module', 'function': 'oled' } fetcher.updatesFunctionsDict(args.get('functionsDict'), dictValues) # Sets super super(IotOledDisplay, self).__init__(self.configJson, self.verbose)
def __init__(self, args): self.verbose = args.get('verbose') self.configFileAddress = args.get('configFileAddress') # Sets the fetcher fetcher = IotFetcher('Temperature Sensor', self.configFileAddress, self.verbose) # Load Philips-Hue configuration from file self.configJson = fetcher.loadConfig().get('temperature_sensor') # Sets the values from parsed parsed = { 'model': args.get('model'), 'gpio_pin': args.get('gpio_pin'), } # Sets the parameters from parsed or fetched from file fetched = fetcher.setsFetcher(parsed, self.configJson) # Updates the Dictionary self.configJson['model'] = fetched.get('model') self.configJson['gpio_pin'] = fetched.get('gpio_pin') # Sets the variables self.model = fetched.get('model') self.gpio_pin = fetched.get('gpio_pin') # Updates the functionsDict with the Twitter module dictValues = { 'display_name': 'Temperature Sensor', 'display_description': 'Uses the Temperature Sensor', 'function': 'temperature' } fetcher.updatesFunctionsDict(args.get('functionsDict'), dictValues) # Sets super super(IotTemperatureSensor, self).__init__(self.verbose)
def __init__(self, args): self.verbose = args.get('verbose') self.configFileAddress = args.get('configFileAddress') # Sets the fetcher fetcher = IotFetcher('Twitter', self.configFileAddress, self.verbose) # Load Twitter configuration from file self.configJson = fetcher.loadConfig() # Sets the values from parsed parsed = { 'twitter_user': args.get('twitter_user'), 'tweets_count': args.get('tweets_count'), } # Sets the parameters from parsed or fetched from file fetched = fetcher.setsFetcher(parsed, self.configJson.get('fetcher')) # Updates the Dictionary self.configJson['twitter_user'] = fetched.get('twitter_user') self.configJson['tweets_count'] = fetched.get('tweets_count') # Updates the functionsDict with the Twitter module dictValues = { 'display_name': 'Twitter', 'display_description': 'Uses the Twitter module', 'function': 'twitter' } fetcher.updatesFunctionsDict(args.get('functionsDict'), dictValues) # Sets the variables self.twitter_user = fetched.get('twitter_user') self.tweets_count = fetched.get('tweets_count') # Sets super super(IotTwitter, self).__init__(self.configJson.get('config'), self.verbose)
def __init__(self, args): self.verbose = args.get('verbose') self.configFileAddress = args.get('configFileAddress') # Sets the fetcher fetcher = IotFetcher('Philips-Hue', self.configFileAddress, self.verbose) # Load Philips-Hue configuration from file self.configJson = fetcher.loadConfig().get('philips_hue') # Sets the values from parsed parsed = { 'bridgeIP': args.get('bridgeIP'), 'username': args.get('username'), } # Sets the parameters from parsed or fetched from file fetched = fetcher.setsFetcher(parsed, self.configJson) # Updates the Dictionary self.configJson['bridgeIP'] = fetched.get('bridgeIP') self.configJson['username'] = fetched.get('username') # Updates the functionsDict with the Twitter module dictValues = { 'display_name': 'Hue', 'display_description': 'Uses the Philips-Hue', 'function': 'hue' } fetcher.updatesFunctionsDict(args.get('functionsDict'), dictValues) # Sets super super(IotPhilipsHue, self).__init__(self.configJson, self.verbose)
def getModulesEnable(default_folder_config): '''A''' filesAddresses = default_folder_config + 'config_modules_enable.json' fetcher = IotFetcher('Modules Enable', filesAddresses, False) return fetcher.loadConfig()
def getFilesAdresses(default_folder_config): '''A''' filesAddresses = default_folder_config + 'config_file_names.json' fetcher = IotFetcher('Files Addresses', filesAddresses, False) return fetcher.loadConfig()
def getFilesAdresses(self): '''A''' filesAddresses = self.addressConfig + 'config_file_names.json' fetcher = IotFetcher('Files Addresses', filesAddresses, self.verbose) return fetcher.loadConfig()