Starting anew, before I changed to a custom chart

This commit is contained in:
Daniel Ledda
2021-03-14 18:42:25 +01:00
commit 50362860ae
47 changed files with 13982 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#!/usr/bin/python3
import adafruit_dht
import mh_z19
import sys
from board import D4
from datetime import datetime
try:
dhtDevice = adafruit_dht.DHT22(D4)
temp = dhtDevice.temperature
humidity = dhtDevice.humidity
co2 = mh_z19.read()
if co2 is not None:
co2 = co2['co2']
else:
raise RuntimeError()
print(
'Time:', str(datetime.isoformat(datetime.now())),
'\nTemp:', temp,
'\nHumidity:', humidity,
'\nCO2:', co2,
sep='\t',
)
except Exception as error:
print('err:', error, file=sys.stderr)
sys.stdout = None
dhtDevice.exit()

View File

@@ -0,0 +1,9 @@
from datetime import datetime
print(
'Time:', str(datetime.isoformat(datetime.now())),
'\nTemp:', 20,
'\nHumidity:', 60,
'\nCO2:', 500,
sep='\t',
)

1282
app-dist/static/dashboard.js Normal file

File diff suppressed because one or more lines are too long

12
app-dist/static/index.ejs Normal file
View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ledda's Room Climate</title>
<link type="text/css" href="<%= rootUrl %>/static/styles.css" rel="stylesheet" />
<script type="application/javascript" src="<%= rootUrl %>/static/dashboard.js"></script>
</head>
<body>
<div id="root"></div>
</body>
</html>

130
app-dist/static/styles.css Normal file
View File

@@ -0,0 +1,130 @@
html, body {
margin: 0;
height: 100%;
background-color: #fff1de;
}
.overlay {
background-color: rgba(255, 255, 255, 0.5);
transition: opacity 1s;
opacity: 100%;
}
.main-content-grid {
height: 80%;
width: 80%;
display: grid;
text-align: center;
}
.main-content-grid > * {
display: block;
}
.center {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
margin: auto;
align-items: center;
justify-content: center;
}
.center > * {
align-content: center;
}
.hidden {
opacity: 0;
z-index: -1;
}
h1 {
display: block;
font-family: "Georgia", serif;
font-weight: normal;
color: #7b5b2f;
}
.widget {
display: flex;
justify-content: space-around;
flex-direction: column;
margin: 1em;
padding: 1em;
border-radius: 1em;
border: 0.2em #c7ab82 solid;
background-color: white;
}
.widget h2 {
font-family: "Georgia", serif;
font-weight: normal;
color: #7b5b2f;
font-size: 1em;
display: block;
}
.widget-body {
margin: auto;
}
.minus-button,
.plus-button {
display: inline-block;
opacity: 50%;
font-size: 20px;
}
.display-mode-widget-mins .minus-button,
.display-mode-widget-mins .plus-button {
font-size: 30px;
}
.minus-button:hover,
.plus-button:hover {
opacity: 100%;
}
.minus-button:active,
.plus-button:active {
color: red;
}
.minus-button::before {
content: "";
}
.plus-button::before {
content: "+";
}
.display-mode-widget-mins .min-count {
display: inline-block;
font-size: 30px;
margin: 10px 0 10px 0;
}
.display-mode-widget-mins input {
border: none;
display: inline-block;
font-size: 30px;
width: 64px;
text-align: center;
margin: 10px 0 10px 0;
background-color: white;
}
.display-mode-widget-date {
display: inline-block;
font-size: 12px;
line-height: 20px;
margin: 5px 0 5px 0;
}
.countdown {
font-size: 20px;
}
.timer-widget .last-update {
margin-top: 20px;
color: gray;
font-size: 12px;
}