AI Tips
AI tips have finally made their way onto our test site, after having spent some time coding the hub to process the received data each second (using Python) and read from the files produced by this process when the tips dialog box is opened. The adjusted Python code for the hub is as follows: import os, pause from datetime import datetime def updateTips(): messages = ["outlet,message\n"] bad_usage = [] amazing_usage = [] rising_usage = [] lowering_usage = [] for file in os.listdir(os.fsencode("rates/daily")): outlet = os.fsdecode(file).replace(".csv", "") now = datetime.datetime.now() with open("totals/daily.csv", 'r') as file: data = file.readlines() line_number = [index for index, item in enumerate(data) if (outlet + ",") in item] daily_value = float(data[line_number[0]]) with open("totals/weekly.csv", 'r'