Convert boolean to int for Adafruit IO

This commit is contained in:
Mike Cifelli 2023-07-15 11:13:15 -04:00
parent 99810db877
commit 95a0f36bfa
Signed by: mike
GPG Key ID: 6B08C6BE47D08E4C
1 changed files with 4 additions and 1 deletions

View File

@ -75,9 +75,12 @@ class SensorServer(Server):
) )
def getReading(self): def getReading(self):
readings = self.getState()
readings['is-water-present'] = 1 if readings['is-water-present'] else 0
return { return {
'timestamp': util.datetimeISO8601(), 'timestamp': util.datetimeISO8601(),
'readings': self.getState() 'readings': readings
} }
def getState(self): def getState(self):