Browse Source

Stop serving html and only serve the value in text

master
Elis Hirwing 2 years ago
parent
commit
63cb12ec65
Signed by: etu GPG Key ID: D57EFA625C9A925F
  1. 17
      src/main.py

17
src/main.py

@ -33,20 +33,6 @@ def server():
addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1]
sensor = CSMS12()
html = """
<!DOCTYPE html>
<html>
<head>
<title>ESP8266 Moisture Sensor v1.2</title>
<meta http-equiv="refresh" content="1">
</head>
<body>
<h1>Current moisture classification</h1>
<h2>%s</h2>
</body>
</html>
"""
s = socket.socket()
s.bind(addr)
s.listen(1)
@ -63,6 +49,5 @@ def server():
if not line or line == b'\r\n':
break
response = html % sensor.getInterval()
cl.send(response)
cl.send(sensor.getInterval())
cl.close()

Loading…
Cancel
Save