web-monitor/TableLaptop.py

22 lines
538 B
Python

from networktables import NetworkTables
from time import sleep
import configparser
NetworkTables.initialize()
NetworkTables.startServer()
config = configparser.ConfigParser()
config.read('config.ini')
table = config.get('settings', 'tables')
table = NetworkTables.getTable(table)
print("Server started, waiting for data...")
while True:
cpu = table.getNumber("CPU Usage", -1)
temp = table.getNumber("Temperature", -1)
mem = table.getNumber("Memory", -1)
print(f"CPU: {cpu}%, Temp: {temp}C Mem:{mem} MB")
sleep(1)