mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-23 15:38:14 +01:00
fixed another bug in case of no logging during inactivity
This commit is contained in:
parent
7df48bdf08
commit
0364769573
3 changed files with 78 additions and 78 deletions
|
@ -86,7 +86,6 @@ class HTTPSensor(CBPiSensor):
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|
||||||
async def logvalue(self):
|
async def logvalue(self):
|
||||||
if self.reducedfrequency != 0:
|
|
||||||
now=time.time()
|
now=time.time()
|
||||||
if self.kettle is not None:
|
if self.kettle is not None:
|
||||||
try:
|
try:
|
||||||
|
@ -99,6 +98,7 @@ class HTTPSensor(CBPiSensor):
|
||||||
self.lastlog = time.time()
|
self.lastlog = time.time()
|
||||||
else:
|
else:
|
||||||
logging.info("Kettle Inactive")
|
logging.info("Kettle Inactive")
|
||||||
|
if self.reducedfrequency != 0:
|
||||||
if now >= self.lastlog + self.reducedfrequency:
|
if now >= self.lastlog + self.reducedfrequency:
|
||||||
self.log_data(self.value)
|
self.log_data(self.value)
|
||||||
self.lastlog = time.time()
|
self.lastlog = time.time()
|
||||||
|
@ -116,14 +116,12 @@ class HTTPSensor(CBPiSensor):
|
||||||
self.lastlog = time.time()
|
self.lastlog = time.time()
|
||||||
else:
|
else:
|
||||||
logging.info("Fermenter Inactive")
|
logging.info("Fermenter Inactive")
|
||||||
|
if self.reducedfrequency != 0:
|
||||||
if now >= self.lastlog + self.reducedfrequency:
|
if now >= self.lastlog + self.reducedfrequency:
|
||||||
self.log_data(self.value)
|
self.log_data(self.value)
|
||||||
self.lastlog = time.time()
|
self.lastlog = time.time()
|
||||||
logging.info("Logged with reduced freqency")
|
logging.info("Logged with reduced freqency")
|
||||||
pass
|
pass
|
||||||
else:
|
|
||||||
logging.warning("No logging")
|
|
||||||
pass
|
|
||||||
|
|
||||||
def get_state(self):
|
def get_state(self):
|
||||||
# return the current state of the sensor
|
# return the current state of the sensor
|
||||||
|
|
|
@ -79,7 +79,6 @@ class MQTTSensor(CBPiSensor):
|
||||||
logging.error("MQTT Sensor Error {}".format(e))
|
logging.error("MQTT Sensor Error {}".format(e))
|
||||||
|
|
||||||
async def logvalue(self):
|
async def logvalue(self):
|
||||||
if self.reducedfrequency != 0:
|
|
||||||
self.kettle = self.get_kettle(self.kettleid) if self.kettleid is not None else None
|
self.kettle = self.get_kettle(self.kettleid) if self.kettleid is not None else None
|
||||||
self.fermenter = self.get_fermenter(self.fermenterid) if self.fermenterid is not None else None
|
self.fermenter = self.get_fermenter(self.fermenterid) if self.fermenterid is not None else None
|
||||||
now=time.time()
|
now=time.time()
|
||||||
|
@ -94,6 +93,7 @@ class MQTTSensor(CBPiSensor):
|
||||||
self.lastlog = time.time()
|
self.lastlog = time.time()
|
||||||
else:
|
else:
|
||||||
logging.info("MQTTSensor {} Kettle Inactive".format(self.sensor.name))
|
logging.info("MQTTSensor {} Kettle Inactive".format(self.sensor.name))
|
||||||
|
if self.reducedfrequency != 0:
|
||||||
if now >= self.lastlog + self.reducedfrequency:
|
if now >= self.lastlog + self.reducedfrequency:
|
||||||
self.log_data(self.value)
|
self.log_data(self.value)
|
||||||
self.lastlog = time.time()
|
self.lastlog = time.time()
|
||||||
|
@ -111,6 +111,7 @@ class MQTTSensor(CBPiSensor):
|
||||||
self.lastlog = time.time()
|
self.lastlog = time.time()
|
||||||
else:
|
else:
|
||||||
logging.info("MQTTSensor {} Fermenter Inactive".format(self.sensor.name))
|
logging.info("MQTTSensor {} Fermenter Inactive".format(self.sensor.name))
|
||||||
|
if self.reducedfrequency != 0:
|
||||||
if now >= self.lastlog + self.reducedfrequency:
|
if now >= self.lastlog + self.reducedfrequency:
|
||||||
self.log_data(self.value)
|
self.log_data(self.value)
|
||||||
self.lastlog = time.time()
|
self.lastlog = time.time()
|
||||||
|
|
|
@ -123,7 +123,6 @@ class OneWire(CBPiSensor):
|
||||||
await asyncio.sleep(self.interval)
|
await asyncio.sleep(self.interval)
|
||||||
|
|
||||||
async def logvalue(self):
|
async def logvalue(self):
|
||||||
if self.reducedfrequency != 0:
|
|
||||||
now=time.time()
|
now=time.time()
|
||||||
logging.info("OneWire {} logging subroutine".format(self.sensor.name))
|
logging.info("OneWire {} logging subroutine".format(self.sensor.name))
|
||||||
if self.kettle is not None:
|
if self.kettle is not None:
|
||||||
|
@ -137,6 +136,7 @@ class OneWire(CBPiSensor):
|
||||||
self.lastlog = time.time()
|
self.lastlog = time.time()
|
||||||
else:
|
else:
|
||||||
logging.info("OneWire {} Kettle Inactive".format(self.sensor.name))
|
logging.info("OneWire {} Kettle Inactive".format(self.sensor.name))
|
||||||
|
if self.reducedfrequency != 0:
|
||||||
if now >= self.lastlog + self.reducedfrequency:
|
if now >= self.lastlog + self.reducedfrequency:
|
||||||
self.log_data(self.value)
|
self.log_data(self.value)
|
||||||
self.lastlog = time.time()
|
self.lastlog = time.time()
|
||||||
|
@ -154,6 +154,7 @@ class OneWire(CBPiSensor):
|
||||||
self.lastlog = time.time()
|
self.lastlog = time.time()
|
||||||
else:
|
else:
|
||||||
logging.info("OneWire {} Fermenter Inactive".format(self.sensor.name))
|
logging.info("OneWire {} Fermenter Inactive".format(self.sensor.name))
|
||||||
|
if self.reducedfrequency != 0:
|
||||||
if now >= self.lastlog + self.reducedfrequency:
|
if now >= self.lastlog + self.reducedfrequency:
|
||||||
self.log_data(self.value)
|
self.log_data(self.value)
|
||||||
self.lastlog = time.time()
|
self.lastlog = time.time()
|
||||||
|
|
Loading…
Reference in a new issue