Browse Source

Stop serving html and only serve the value in text

master
Elis Hirwing 6 months ago
parent
commit
63cb12ec65
Signed by: Elis Hirwing <elis@hirwing.se> GPG Key ID: D57EFA625C9A925F
1 changed files with 1 additions and 16 deletions
  1. 1
    16
      src/main.py

+ 1
- 16
src/main.py View File

@@ -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