from workflow.modules import MySQLChatStore, ToyStatusStore from dotenv import load_dotenv import os, json load_dotenv() MYSQL_HOST = os.getenv("MYSQL_HOST") MYSQL_USER = os.getenv("MYSQL_USER") MYSQL_PASSWORD = os.getenv("MYSQL_PASSWORD") MYSQL_DATABASE = os.getenv("MYSQL_DATABASE") MYSQL_PORT = int(os.getenv("MYSQL_PORT")) chat_store = ToyStatusStore(MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE) history = chat_store.get_latest("rp_testUser119") print(history) # pattern = {"pattern": [{"duration": 50, "vibrate": 70}, {"duration": 50, "vibrate": 80}, {"duration": 50, "vibrate": 90}, {"duration": 50, "rotate": 30}, {"duration": 50, "rotate": 40}, {"duration": 50, "rotate": 50}, {"duration": 50, "vibrate": 60}, {"duration": 50, "vibrate": 70}, {"duration": 50, "vibrate": 80}, {"duration": 50, "rotate": 20}, {"duration": 50, "rotate": 30}, {"duration": 50, "rotate": 40}, {"duration": 50, "vibrate": 50}, {"duration": 50, "vibrate": 60}, {"duration": 50, "vibrate": 70}, {"duration": 50, "rotate": 10}, {"duration": 50, "rotate": 20}, {"duration": 50, "rotate": 30}, {"duration": 50, "vibrate": 40}, {"duration": 50, "vibrate": 50}, {"duration": 50, "vibrate": 60}]} # total_time = sum([item["duration"] for item in pattern["pattern"]]) # print(total_time)