Exemple #1
0
def refresh_screenshot():
    config = utility.get_config_dict()
    display_index = config['display_index']
    base64_data = utility.get_screenshot(display_index)
    data = {
        'message': 'Successfully took a screenshot!',
        'base64_data': base64_data
    }
    return jsonify(data)
Exemple #2
0
def get_diagnostic_data():
    if request.method == 'POST':
        message = 'POOPSOCK'
        config = utility.get_config_dict()
        light_data = hue_interface.get_light_diagnostic_data(
            config['ip'], config['username'])

        data = {'message': message, 'data': light_data}
        return jsonify(data)
Exemple #3
0
def refresh_screenshot():
    config = utility.get_config_dict()
    display_index = config['display_index']
    base64_data = utility.get_screenshot(display_index)
    data = {
        'message': 'Successfully took a screenshot!',
        'base64_data': base64_data
    }
    return jsonify(data)
Exemple #4
0
def get_diagnostic_data():
    if request.method == 'POST':
        message = 'POOPSOCK'
        config = utility.get_config_dict()
        light_data = hue_interface.get_light_diagnostic_data(config['ip'], config['username'])

        data = {
            'message': message,
            'data': light_data
        }
        return jsonify(data)
Exemple #5
0
def update_bulbs():
    if request.method == 'POST':
        bulb_data = request.json
        bulbs = str(bulb_data['bulbs'])
        bulb_settings = bulb_data['bulbSettings']
        sb_config = utility.get_config_dict()

        lights_data = hue_interface.get_lights_data(sb_config['ip'],
                                                    sb_config['username'])
        for light in lights_data:
            bulb = bulb_settings[str(light[0])]
            bulb['model_id'] = light[4]
            bulb['gamut'] = hue_interface.get_gamut(bulb['model_id'])
            bulb['name'] = light[2]

        utility.write_config('Light Settings', 'active', bulbs)
        utility.write_config('Light Settings', 'bulb_settings',
                             json.dumps(bulb_settings))
        view_logic.restart_check()

        data = {'message': 'Bulbs updated', 'bulbs': bulbs}
        return jsonify(data)
Exemple #6
0
def update_bulbs():
    if request.method == 'POST':
        bulb_data = request.json
        bulbs = str(bulb_data['bulbs'])
        bulb_settings = bulb_data['bulbSettings']
        sb_config = utility.get_config_dict()

        lights_data = hue_interface.get_lights_data(sb_config['ip'], sb_config['username'])
        for light in lights_data:
            bulb = bulb_settings[str(light[0])]
            bulb['model_id'] = light[4]
            bulb['gamut'] = hue_interface.get_gamut(bulb['model_id'])
            bulb['name'] = light[2]

        utility.write_config('Light Settings', 'active', bulbs)
        utility.write_config('Light Settings', 'bulb_settings', json.dumps(bulb_settings))
        view_logic.restart_check()

        data = {
            'message': 'Bulbs updated',
            'bulbs': bulbs
        }
        return jsonify(data)