This commit is contained in:
avollkopf 2023-03-25 13:19:02 +01:00
parent a8ec65b3e4
commit 5f24e2d149

View file

@ -36,7 +36,9 @@ class MQTTSensor(CBPiSensor):
self.reducedfrequency=int(self.props.get("ReducedLogging", 60)) self.reducedfrequency=int(self.props.get("ReducedLogging", 60))
self.kettleid=self.props.get("Kettle", None) self.kettleid=self.props.get("Kettle", None)
self.fermenterid=self.props.get("Fermenter", None) self.fermenterid=self.props.get("Fermenter", None)
self.reducedlogging=True if self.kettleid or self.fermenterid else False logging.info(self.kettleid)
logging.info(self.fermenterid)
self.reducedlogging = True if self.kettleid or self.fermenterid else False
if self.kettleid is not None and self.fermenterid is not None: if self.kettleid is not None and self.fermenterid is not None:
self.reducedlogging=False self.reducedlogging=False
@ -66,9 +68,10 @@ class MQTTSensor(CBPiSensor):
if isinstance(val, (int, float, str)): if isinstance(val, (int, float, str)):
self.value = float(val) self.value = float(val)
self.push_update(self.value) self.push_update(self.value)
if self.reducedlogging: if self.reducedlogging == True:
await self.logvalue() await self.logvalue()
else: else:
logging.info("MQTTSensor {} regular logging".format(self.sensor.name))
self.log_data(self.value) self.log_data(self.value)
self.lastlog = time.time() self.lastlog = time.time()