37 lines
1.8 KiB
Python
37 lines
1.8 KiB
Python
days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
|
|
def default():
|
|
content = """ <h3> select item below </h3> """
|
|
return content
|
|
|
|
def config_datetime(rtc):
|
|
dt = rtc.datetime()
|
|
d = ("%04d-%02d-%02d" % (dt[0], dt[1], dt[2]))
|
|
t = ("%02d-%02d-%02d" % (dt[4], dt[5], dt[6]))
|
|
|
|
content = """
|
|
<form action="/config_dt" method="GET">
|
|
<h2>Date/Time (Only fill to update current date/time!)</h2>
|
|
<p>current date: """ + d + """ current time: """ + t + """ </p>
|
|
<input type="hidden" name="save" value="1" />
|
|
<p>new date: <input type="text" name="date" value="" />
|
|
new time: <input type="text" name="time" value="" /></p>
|
|
<p><input type="reset" value="reset"> <input type="submit" value="save" /></p>
|
|
</form>
|
|
"""
|
|
return content
|
|
|
|
def config_day(config, day):
|
|
content = """
|
|
<form action="/config_day" method="GET">
|
|
<h2>Power-on/off (hh-mm) </h2>
|
|
<h3> Selected: """ + days[day] + """</h3>
|
|
<input type="hidden" name="save" value="1" />
|
|
<input type="hidden" name="day" value=""" + ("%s" % day) + """ />
|
|
<p>P1-On <input type="text" name="p1_on" value=""" + ("%02d-%02d" % (config[day][1]["on"]["h"], config[day][1]["on"]["m"])) + """ />
|
|
P1-Off <input type="text" name="p1_off" value=""" + ("%02d-%02d" % (config[day][1]["off"]["h"], config[day][1]["off"]["m"])) + """ /> </p>
|
|
<p>P2-On <input type="text" name="p2_on" value=""" + ("%02d-%02d" % (config[day][2]["on"]["h"], config[day][2]["on"]["m"])) + """ />
|
|
P2-Off <input type="text" name="p2_off" value=""" + ("%02d-%02d" % (config[day][2]["off"]["h"], config[day][2]["off"]["m"])) + """ /> </p>
|
|
<p><input type="reset" value="reset"> <input type="submit" value="save" /></p>
|
|
</form>
|
|
"""
|
|
return content
|