Fixed missing code from removing abstraction
This commit is contained in:
parent
075e7d277a
commit
eab3a825f2
1 changed files with 9 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue