Fixed missing code from removing abstraction

This commit is contained in:
Maximilian Giller 2024-03-03 16:00:18 +01:00
parent 075e7d277a
commit eab3a825f2

View file

@ -1,11 +1,17 @@
import Adafruit_DHT
class Dht22Climate():
def __init__(self, pin):
super().__init__()
class Dht22Climate:
def __init__(self, pin: int):
self.sensor = Adafruit_DHT.AM2302
self.pin = pin
self.last_read = None
def get_last_read(self):
if self.last_read is None:
return self.read()
return self.last_read
def read(self):
humidity, temperature = Adafruit_DHT.read_retry(self.sensor, self.pin)