def get_current_light_settings(): config_dict = get_config_dict() lights_data = hue_interface.get_lights_data(config_dict['ip'], config_dict['username']) light_settings = {} for light in lights_data: light_settings[str(light[0])] = { 'name': light[2], 'model_id': light[4], 'gamut': hue_interface.get_gamut(light[4]) } return light_settings
def get_index_data(): config_dict = utility.get_config_dict() hue_ip = config_dict['ip'] username = config_dict['username'] auto_start = config_dict['autostart'] current_preset = config_dict['current_preset'] update = config_dict['update'] update_buffer = config_dict['update_buffer'] max_bri = config_dict['max_bri'] min_bri = config_dict['min_bri'] bulb_settings = json.loads(config_dict['bulb_settings']) zones = ast.literal_eval(config_dict['zones']) zone_state = config_dict['zone_state'] display_index = config_dict['display_index'] sat = config_dict['sat'] party_mode = config_dict['party_mode'] state = config_dict['app_state'] lights = hue_interface.get_lights_data(hue_ip, username) for light in lights: light.append(int(bulb_settings[unicode(light[0])]['max_bri'])) light.append(int(bulb_settings[unicode(light[0])]['min_bri'])) presets = utility.get_all_presets() icon_size = 10 if len(lights) > 3: icon_size = 4 data = { 'auto_start_state': auto_start, 'update': update, 'update_buffer': update_buffer, 'max_bri': max_bri, 'min_bri': min_bri, 'default': config_dict['default'], 'lights': lights, 'lights_number': len(lights), 'icon_size': icon_size, 'username': username, 'party_mode': party_mode, 'zones': zones, 'zone_state': zone_state, 'display_index': display_index, 'sat': sat, 'presets': presets, 'current_preset': current_preset, 'state': state, } return data
def get_hue_initial_state(ip, username): light_data = hue_interface.get_lights_data(ip, username) initial_lights_state = {} for light in light_data: initial_lights_state[light[0]] = { 'state': light[1], 'bri': light[5], 'xy': light[6], 'colormode': light[7] } return initial_lights_state
def get_index_data(): config = ConfigParser.RawConfigParser() config.read(utility.get_config_path()) state = config.get('App State', 'running') hue_ip = config.get('Configuration', 'hue_ip') username = config.get('Configuration', 'username') auto_start = config.getboolean('Configuration', 'auto_start') current_preset = config.get('Configuration', 'current_preset') update = config.get('Light Settings', 'update') update_buffer = config.get('Light Settings', 'update_buffer') max_bri = config.get('Light Settings', 'max_bri') min_bri = config.get('Light Settings', 'min_bri') bulb_settings = json.loads(config.get('Light Settings', 'bulb_settings')) default = config.get('Light Settings', 'default') black = config.get('Light Settings', 'black_rgb') zones = config.get('Light Settings', 'zones') zone_state = config.getboolean('Light Settings', 'zone_state') color_mode = config.get('Light Settings', 'color_mode') party_mode = config.getboolean('Party Mode', 'running') default_color = default.split(',') black_rgb = black.split(',') zones = ast.literal_eval(zones) lights = hue_interface.get_lights_data(hue_ip, username) for light in lights: light.append(int(bulb_settings[unicode(light[0])]['max_bri'])) light.append(int(bulb_settings[unicode(light[0])]['min_bri'])) display_index = config.get('Light Settings', 'display_index') filepath = utility.get_json_filepath() presets = [] if os.path.isfile(filepath): with open(filepath) as data_file: presets = json.load(data_file) icon_size = 10 if len(lights) > 3: icon_size = 4 data = { 'state': state, 'auto_start_state': auto_start, 'update': update, 'update_buffer': update_buffer, 'max_bri': max_bri, 'min_bri': min_bri, 'default': default, 'default_color': default_color, 'black_rgb': black_rgb, 'lights': lights, 'lights_number': len(lights), 'icon_size': icon_size, 'username': username, 'party_mode': party_mode, 'zones': zones, 'zone_state': zone_state, 'display_index': display_index, 'presets': presets, 'current_preset': current_preset, 'color_mode': color_mode } return data
def get_index_data(): config_dict = utility.get_config_dict() hue_ip = config_dict['ip'] username = config_dict['username'] auto_start = config_dict['autostart'] current_preset = config_dict['current_preset'] color_mode_enabled = config_dict['color_mode_enabled'] update = config_dict['update'] update_buffer = config_dict['update_buffer'] max_bri = config_dict['max_bri'] min_bri = config_dict['min_bri'] bulb_settings = json.loads(config_dict['bulb_settings']) default_color = config_dict['default'].split(',') default_color = Color(rgb=(int(default_color[0]) / 255.0, int(default_color[1]) / 255.0, int(default_color[2]) / 255.0)).hex black = config_dict['black_rgb'].split(',') zones = ast.literal_eval(config_dict['zones']) zone_state = config_dict['zone_state'] color_mode = config_dict['color_mode'] display_index = config_dict['display_index'] party_mode = config_dict['party_mode'] lights = hue_interface.get_lights_data(hue_ip, username) for light in lights: light.append(int(bulb_settings[unicode(light[0])]['max_bri'])) light.append(int(bulb_settings[unicode(light[0])]['min_bri'])) filepath = utility.get_json_filepath() presets = [] if os.path.isfile(filepath): with open(filepath) as data_file: presets = json.load(data_file) icon_size = 10 if len(lights) > 3: icon_size = 4 data = { 'auto_start_state': auto_start, 'color_mode_enabled': color_mode_enabled, 'update': update, 'update_buffer': update_buffer, 'max_bri': max_bri, 'min_bri': min_bri, 'default': config_dict['default'], 'default_color': default_color, 'black_rgb': black, 'lights': lights, 'lights_number': len(lights), 'icon_size': icon_size, 'username': username, 'party_mode': party_mode, 'zones': zones, 'zone_state': zone_state, 'display_index': display_index, 'presets': presets, 'current_preset': current_preset, 'color_mode': color_mode } return data