Files
Smartwave/orchestrateur/sensors/temp_hum.py
T
Ninluc 0671a37e0c
Build, push image, and notify Watchtower / build-image (push) Successful in 42s
Build, push image, and notify Watchtower / notify (push) Successful in 1m40s
Refactor into config file
2026-07-23 15:57:25 +02:00

23 lines
713 B
Python

import grovepi
import math
from sensors.lock import grove_lock
# Connect the Grove Temperature & Humidity Sensor Pro to digital port D3
# This example uses the blue colored sensor.
# SIG,NC,VCC,GND
sensor = 3 # The Sensor goes on digital port 3.
# temp_humidity_sensor_type
# Grove Base Kit comes with the blue sensor.
blue = 0 # The Blue colored sensor.
white = 1 # The White colored sensor.
def get_temperature_and_humidity():
with grove_lock:
[temp,humidity] = grovepi.dht(sensor,blue)
if math.isnan(temp) == False and math.isnan(humidity) == False:
return temp, humidity
else:
print("Error reading from DHT sensor")
return None, None