removed some ai garbage, moved json output to new json folder.

!!! temperaturSensor.py is incompatible with the webserver !!!
!!! fix asap !!!
This commit is contained in:
mia 2025-06-15 23:13:08 +02:00
parent 3226ed29ec
commit 9bf8f089b6
6 changed files with 9 additions and 15 deletions

View file

@ -13,7 +13,7 @@ light_pin.direction = digitalio.Direction.INPUT
data_template = {
"id": "sensor_004",
"type": "light",
"unit": "state",
"unit": "bool",
"reading": []
}
@ -32,10 +32,7 @@ def capture_and_store(state):
timestamp = int(time.time())
data = load_data()
data["reading"].append({
"ts": timestamp,
"state": state
})
data["reading"].append({"ts": timestamp,"value": state})
if len(data["reading"]) > MAX_ENTRIES:
data["reading"] = data["reading"][-MAX_ENTRIES:]
@ -45,9 +42,9 @@ def capture_and_store(state):
try:
while True:
if light_pin.value:
light_state = "hell"
light_state = True
else:
light_state = "dunkel"
light_state = False
print(f"Lichtzustand: {light_state}")
capture_and_store(light_state)

View file

@ -33,12 +33,9 @@ def save_data(data):
def capture_and_store():
state = GPIO.input(SENSOR_PIN)
timestamp = int(time.time()) # Unix-Zeitstempel (int)
noise = 1 if state == 0 else 0
noise = True if state == 0 else False
entry = {
"ts": timestamp,
"value": noise
}
entry = { "ts": timestamp, "value": noise}
data = load_data()
data["readings"].append(entry)

View file

@ -7,7 +7,7 @@ import os
dhtDevice = adafruit_dht.DHT11(board.D23)
json_file = "ky015_data.json"
json_file = "json/ky015_data.json"
datatemphum = {
"id": "sensor_002/3",