This commit is contained in:
marcus 2022-02-17 15:55:10 +01:00
parent 9933cafba5
commit 149d96b8a0
3 changed files with 24 additions and 5 deletions

View File

@ -1,4 +1,4 @@
host = '192.168.0.19' # ur device ip, where u upload the matrix.ino host = 'Device IP' # ur device ip, where u upload the matrix.ino
#Edit the Events, decide what u wanna show on you Led Matrix #Edit the Events, decide what u wanna show on you Led Matrix
garbage = 'true' garbage = 'true'

22
digit_converter.py Normal file
View File

@ -0,0 +1,22 @@
# Digit converter
import json
def digit_convert(filename):
with open(filename, 'r') as file:
data = json.load(file)
for i in data:
if len(i['date']['day']) != 2:
i['date']['day'] = str('{:02d}'.format(i['date']['day']))
with open('events.json', 'w') as file:
json.dump(data, file, indent=2)
if len(i['date']['month']) != 2:
i['date']['month'] = str('{:02d}'.format(i['date']['month']))
with open('events.json', 'w') as file:
json.dump(data, file, indent=2)
digit_convert('events.json')

View File

@ -38,7 +38,6 @@ def create_Message():
if day == get_current_date()[0] and month == get_current_date()[1]: if day == get_current_date()[0] and month == get_current_date()[1]:
message = message + ' ' + i['name'] message = message + ' ' + i['name']
if config.events == 'true': if config.events == 'true':
filename = 'events.json' filename = 'events.json'
for i in read_JSON(filename): for i in read_JSON(filename):
@ -56,12 +55,10 @@ def create_Message():
message = message + ' ' + i['message'] message = message + ' ' + i['message']
# Send Message to the Device # Send Message to the Device
def matrixRequest(): def matrixRequest():
requests.get('http://' + config.host + config.get_request + str(create_Message())) requests.get('http://' + config.host + config.get_request + str(create_Message()))
# Main
matrixRequest() matrixRequest()