fix gpio read

This commit is contained in:
Nicolò Balzarotti 2023-01-05 15:47:31 +01:00
parent b75b306726
commit bd96ca95a6
1 changed files with 9 additions and 1 deletions

View File

@ -29,8 +29,16 @@ class GPIOState(Sensor):
self.pin = pin
self.transform = transform
self.value = GPIO.input(self.pin)
self.update_time()
def update_time(self):
self.time = perf_counter()
def read(self):
return self.transform(GPIO.input(self.pin))
self.value = GPIO.input(self.pin)
return (self.time, self.transform(self.value))
class Temperature1W(Sensor):
def __init__(self, address):