added brightness level

This commit is contained in:
Justin 2023-04-26 14:39:59 +08:00 committed by GitHub
parent abf3ada95e
commit f093df85ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -246,7 +246,7 @@ def index():
scheduler_settings = json.load(f) scheduler_settings = json.load(f)
f.close() f.close()
except: except:
scheduler_settings = {"shutdown": {"hour": "00", "minute": "00", "enabled": False}, "reboot":{"hour": "00", "minute": "00", "enabled": False}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "enabled": False}, "brightness2":{"hour": "00", "minute": "00", "enabled": False}, "brightness3":{"hour": "00", "minute": "00", "enabled": False}, "brightness4":{"hour": "00", "minute": "00", "enabled": False}} scheduler_settings = {"shutdown": {"hour": "00", "minute": "00", "enabled": False}, "reboot":{"hour": "00", "minute": "00", "enabled": False}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}}
try: # incase this doesnt exist try: # incase this doesnt exist
api_keys = api_key2[1] api_keys = api_key2[1]
@ -1174,7 +1174,7 @@ def saveSchedulerSettings():
data= request.data.decode('utf-8') data= request.data.decode('utf-8')
input_settings = json.loads(data) input_settings = json.loads(data)
initialize_json = '{"shutdown": {"hour": "00", "minute": "00", "enabled": false}, "reboot":{"hour": "00", "minute": "00", "enabled": false}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "enabled": false}, "brightness2":{"hour": "00", "minute": "00", "enabled": false}, "brightness3":{"hour": "00", "minute": "00", "enabled": false}, "brightness4":{"hour": "00", "minute": "00", "enabled": false}}' initialize_json = '{"shutdown": {"hour": "00", "minute": "00", "enabled": false}, "reboot":{"hour": "00", "minute": "00", "enabled": false}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}}'
if 'scheduler.json' not in os.listdir('csv/'): if 'scheduler.json' not in os.listdir('csv/'):
with open('csv/scheduler.json', 'w') as f: with open('csv/scheduler.json', 'w') as f:
@ -1184,7 +1184,7 @@ def saveSchedulerSettings():
with open('csv/scheduler.json','r') as f: with open('csv/scheduler.json','r') as f:
scheduler_settings = json.load(f) scheduler_settings = json.load(f)
except: except:
scheduler_settings = {"shutdown": {"hour": "00", "minute": "00", "enabled": False}, "reboot":{"hour": "00", "minute": "00", "enabled": False}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "enabled": False}, "brightness2":{"hour": "00", "minute": "00", "enabled": False}, "brightness3":{"hour": "00", "minute": "00", "enabled": False}, "brightness4":{"hour": "00", "minute": "00", "enabled": False}} scheduler_settings = {"shutdown": {"hour": "00", "minute": "00", "enabled": False}, "reboot":{"hour": "00", "minute": "00", "enabled": False}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}}
scheduler_settings['shutdown']['hour'] = input_settings['shutdown_hour'] scheduler_settings['shutdown']['hour'] = input_settings['shutdown_hour']
scheduler_settings['shutdown']['minute'] = input_settings['shutdown_minute'] scheduler_settings['shutdown']['minute'] = input_settings['shutdown_minute']
@ -1196,19 +1196,23 @@ def saveSchedulerSettings():
scheduler_settings['brightness1']['hour'] = input_settings['brightness1_hour'] scheduler_settings['brightness1']['hour'] = input_settings['brightness1_hour']
scheduler_settings['brightness1']['minute'] = input_settings['brightness1_minute'] scheduler_settings['brightness1']['minute'] = input_settings['brightness1_minute']
scheduler_settings['brightness1']['enabled'] = input_settings['brightness1_enabled'] scheduler_settings['brightness1']['enabled'] = input_settings['brightness1_enabled']
scheduler_settings['brightness1']['bright'] = input_settings['brightness1_bright']
scheduler_settings['brightness2']['hour'] = input_settings['brightness2_hour'] scheduler_settings['brightness2']['hour'] = input_settings['brightness2_hour']
scheduler_settings['brightness2']['minute'] = input_settings['brightness2_minute'] scheduler_settings['brightness2']['minute'] = input_settings['brightness2_minute']
scheduler_settings['brightness2']['enabled'] = input_settings['brightness2_enabled'] scheduler_settings['brightness2']['enabled'] = input_settings['brightness2_enabled']
scheduler_settings['brightness2']['bright'] = input_settings['brightness2_bright']
scheduler_settings['brightness3']['hour'] = input_settings['brightness3_hour'] scheduler_settings['brightness3']['hour'] = input_settings['brightness3_hour']
scheduler_settings['brightness3']['minute'] = input_settings['brightness3_minute'] scheduler_settings['brightness3']['minute'] = input_settings['brightness3_minute']
scheduler_settings['brightness3']['enabled'] = input_settings['brightness3_enabled'] scheduler_settings['brightness3']['enabled'] = input_settings['brightness3_enabled']
scheduler_settings['brightness3']['bright'] = input_settings['brightness3_bright']
scheduler_settings['brightness4']['hour'] = input_settings['brightness4_hour'] scheduler_settings['brightness4']['hour'] = input_settings['brightness4_hour']
scheduler_settings['brightness4']['minute'] = input_settings['brightness4_minute'] scheduler_settings['brightness4']['minute'] = input_settings['brightness4_minute']
scheduler_settings['brightness4']['enabled'] = input_settings['brightness4_enabled'] scheduler_settings['brightness4']['enabled'] = input_settings['brightness4_enabled']
scheduler_settings['brightness4']['bright'] = input_settings['brightness4_bright']
scheduler_settings['timezone'] = input_settings['timezone'] scheduler_settings['timezone'] = input_settings['timezone']