Upload files to ''

This commit is contained in:
Neil Parikh 2022-06-25 17:07:15 -04:00
parent a58f4ba93a
commit 7355c332c4
1 changed files with 20 additions and 0 deletions

20
office-status.py Normal file
View File

@ -0,0 +1,20 @@
import serial
import time
ser = serial.Serial('/dev/ttyACM0', 9600)
html = '<meta name="viewport" content="width=device-width, initial-scale=1.0">\nThe office is currently '
data = ser.readline()
if data:
l = float(data.split("=")[1].strip())
if l > 1:
html += "open."
else:
html += "closed."
html += "<br>Updated At: " + time.strftime('%l:%M%p %Z on %b %d, %Y')
with open('/users/n3parikh/www/office-status.html', 'w') as f:
f.write(html)
else:
# TODO: print to log instead.
print("error")