Compare commits
2 Commits
4704023e96
...
95a0f36bfa
Author | SHA1 | Date |
---|---|---|
Mike Cifelli | 95a0f36bfa | |
Mike Cifelli | 99810db877 |
7
main.py
7
main.py
|
@ -49,7 +49,7 @@ class SensorServer(Server):
|
||||||
|
|
||||||
if isWaterPresent != self.isWaterPresent:
|
if isWaterPresent != self.isWaterPresent:
|
||||||
self.isWaterPresent = isWaterPresent
|
self.isWaterPresent = isWaterPresent
|
||||||
self.ntfy.message(f'Water is {self.waterTextValue()}')
|
#self.ntfy.message(f'Water is {self.waterTextValue()}')
|
||||||
|
|
||||||
def handlePath(self, path):
|
def handlePath(self, path):
|
||||||
if path == 'index.json':
|
if path == 'index.json':
|
||||||
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue