mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-12-22 21:44:57 +01:00
Remove kettle and fermenter target temp logs and actor logs
This commit is contained in:
parent
f8024f3b49
commit
ab60c5c0fc
7 changed files with 2 additions and 38 deletions
|
@ -240,7 +240,6 @@ class FermentationController:
|
||||||
if item:
|
if item:
|
||||||
item.target_temp = target_temp
|
item.target_temp = target_temp
|
||||||
self.save()
|
self.save()
|
||||||
self.cbpi.log.log_data(item.id, target_temp)
|
|
||||||
self.push_update()
|
self.push_update()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("Failed to set Target Temp {} {}".format(id, e))
|
logging.error("Failed to set Target Temp {} {}".format(id, e))
|
||||||
|
|
|
@ -30,7 +30,6 @@ class KettleController(BasicController):
|
||||||
item = self.find_by_id(id)
|
item = self.find_by_id(id)
|
||||||
item.target_temp = target_temp
|
item.target_temp = target_temp
|
||||||
await self.save()
|
await self.save()
|
||||||
self.cbpi.log.log_data(item.id, target_temp)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("Failed to set Target Temp {} {}".format(id, e))
|
logging.error("Failed to set Target Temp {} {}".format(id, e))
|
||||||
|
|
||||||
|
|
|
@ -69,28 +69,7 @@ class LogController:
|
||||||
itemname=sensor.name.replace(" ", "_")
|
itemname=sensor.name.replace(" ", "_")
|
||||||
for char in chars:
|
for char in chars:
|
||||||
itemname = itemname.replace(char,chars[char])
|
itemname = itemname.replace(char,chars[char])
|
||||||
out="sensor,source=" + itemname + ",itemID=" + str(id) + " value="+str(value)
|
out="measurement,source=" + itemname + ",itemID=" + str(id) + " value="+str(value)
|
||||||
else:
|
|
||||||
actor=self.cbpi.actor.find_by_id(name)
|
|
||||||
if actor is not None:
|
|
||||||
itemname=actor.name.replace(" ", "_")
|
|
||||||
for char in chars:
|
|
||||||
itemname = itemname.replace(char,chars[char])
|
|
||||||
out="actor,source=" + itemname + ",itemID=" + str(id) + " value="+str(value)
|
|
||||||
else:
|
|
||||||
kettle=self.cbpi.kettle.find_by_id(name)
|
|
||||||
if kettle is not None:
|
|
||||||
itemname=kettle.name.replace(" ", "_")
|
|
||||||
for char in chars:
|
|
||||||
itemname = itemname.replace(char,chars[char])
|
|
||||||
out="kettle,source=" + itemname + ",itemID=" + str(id) + " value="+str(value)
|
|
||||||
else:
|
|
||||||
fermenter=self.cbpi.fermenter._find_by_id(name)
|
|
||||||
if fermenter is not None:
|
|
||||||
itemname=fermenter.name.replace(" ", "_")
|
|
||||||
for char in chars:
|
|
||||||
itemname = itemname.replace(char,chars[char])
|
|
||||||
out="fermenter,source=" + itemname + ",itemID=" + str(id) + " value="+str(value)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("InfluxDB ID Error: {}".format(e))
|
logging.error("InfluxDB ID Error: {}".format(e))
|
||||||
|
|
||||||
|
@ -101,7 +80,7 @@ class LogController:
|
||||||
http = urllib3.PoolManager()
|
http = urllib3.PoolManager()
|
||||||
req = http.request('POST',self.influxdburl, body=out, headers = header)
|
req = http.request('POST',self.influxdburl, body=out, headers = header)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("InfluxDB write Error: {}".format(e))
|
logging.error("InfluxDB cloud write Error: {}".format(e))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.influxdb = self.cbpi.config.get("INFLUXDB", "No")
|
self.influxdb = self.cbpi.config.get("INFLUXDB", "No")
|
||||||
|
|
|
@ -25,12 +25,10 @@ class DummyActor(CBPiActor):
|
||||||
await super().start()
|
await super().start()
|
||||||
|
|
||||||
async def on(self, power=0):
|
async def on(self, power=0):
|
||||||
self.log_data(100)
|
|
||||||
logger.info("ACTOR %s ON " % self.id)
|
logger.info("ACTOR %s ON " % self.id)
|
||||||
self.state = True
|
self.state = True
|
||||||
|
|
||||||
async def off(self):
|
async def off(self):
|
||||||
self.log_data(0)
|
|
||||||
logger.info("ACTOR %s OFF " % self.id)
|
logger.info("ACTOR %s OFF " % self.id)
|
||||||
|
|
||||||
self.state = False
|
self.state = False
|
||||||
|
|
|
@ -63,13 +63,11 @@ class GPIOActor(CBPiActor):
|
||||||
self.power = 100
|
self.power = 100
|
||||||
await self.set_power(self.power)
|
await self.set_power(self.power)
|
||||||
|
|
||||||
self.log_data(self.power)
|
|
||||||
logger.info("ACTOR %s ON - GPIO %s " % (self.id, self.gpio))
|
logger.info("ACTOR %s ON - GPIO %s " % (self.id, self.gpio))
|
||||||
GPIO.output(self.gpio, self.get_GPIO_state(1))
|
GPIO.output(self.gpio, self.get_GPIO_state(1))
|
||||||
self.state = True
|
self.state = True
|
||||||
|
|
||||||
async def off(self):
|
async def off(self):
|
||||||
self.log_data(0)
|
|
||||||
logger.info("ACTOR %s OFF - GPIO %s " % (self.id, self.gpio))
|
logger.info("ACTOR %s OFF - GPIO %s " % (self.id, self.gpio))
|
||||||
GPIO.output(self.gpio, self.get_GPIO_state(0))
|
GPIO.output(self.gpio, self.get_GPIO_state(0))
|
||||||
self.state = False
|
self.state = False
|
||||||
|
@ -95,8 +93,6 @@ class GPIOActor(CBPiActor):
|
||||||
|
|
||||||
async def set_power(self, power):
|
async def set_power(self, power):
|
||||||
self.power = power
|
self.power = power
|
||||||
if self.state == True:
|
|
||||||
self.log_data(self.power)
|
|
||||||
await self.cbpi.actor.actor_update(self.id,power)
|
await self.cbpi.actor.actor_update(self.id,power)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -135,7 +131,6 @@ class GPIOPWMActor(CBPiActor):
|
||||||
|
|
||||||
logging.info("PWM Final Power: {}".format(self.power))
|
logging.info("PWM Final Power: {}".format(self.power))
|
||||||
|
|
||||||
self.log_data(self.power)
|
|
||||||
logger.info("PWM ACTOR %s ON - GPIO %s - Frequency %s - Power %s" % (self.id, self.gpio,self.frequency,self.power))
|
logger.info("PWM ACTOR %s ON - GPIO %s - Frequency %s - Power %s" % (self.id, self.gpio,self.frequency,self.power))
|
||||||
try:
|
try:
|
||||||
if self.p is None:
|
if self.p is None:
|
||||||
|
@ -147,14 +142,12 @@ class GPIOPWMActor(CBPiActor):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def off(self):
|
async def off(self):
|
||||||
self.log_data(0)
|
|
||||||
logger.info("PWM ACTOR %s OFF - GPIO %s " % (self.id, self.gpio))
|
logger.info("PWM ACTOR %s OFF - GPIO %s " % (self.id, self.gpio))
|
||||||
self.p.ChangeDutyCycle(0)
|
self.p.ChangeDutyCycle(0)
|
||||||
self.state = False
|
self.state = False
|
||||||
|
|
||||||
async def set_power(self, power):
|
async def set_power(self, power):
|
||||||
if self.p and self.state == True:
|
if self.p and self.state == True:
|
||||||
self.log_data(self.power)
|
|
||||||
self.p.ChangeDutyCycle(power)
|
self.p.ChangeDutyCycle(power)
|
||||||
await self.cbpi.actor.actor_update(self.id,power)
|
await self.cbpi.actor.actor_update(self.id,power)
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -27,13 +27,11 @@ class GenericMqttActor(MQTTActor):
|
||||||
|
|
||||||
async def on(self, power=None):
|
async def on(self, power=None):
|
||||||
self.normalize_power_value(power)
|
self.normalize_power_value(power)
|
||||||
self.log_data(self.power)
|
|
||||||
formatted_payload = self.payload.format(switch_onoff = "on", switch_10 = 1, power = self.power)
|
formatted_payload = self.payload.format(switch_onoff = "on", switch_10 = 1, power = self.power)
|
||||||
await self.publish_mqtt_message(self.topic, formatted_payload)
|
await self.publish_mqtt_message(self.topic, formatted_payload)
|
||||||
self.state = True
|
self.state = True
|
||||||
|
|
||||||
async def off(self):
|
async def off(self):
|
||||||
self.log_data(0)
|
|
||||||
formatted_payload = self.payload.format(switch_onoff = "off", switch_10 = 0, power = self.power)
|
formatted_payload = self.payload.format(switch_onoff = "off", switch_10 = 0, power = self.power)
|
||||||
await self.publish_mqtt_message(self.topic, formatted_payload)
|
await self.publish_mqtt_message(self.topic, formatted_payload)
|
||||||
self.state = False
|
self.state = False
|
|
@ -29,7 +29,6 @@ class MQTTActor(CBPiActor):
|
||||||
power = min(100, power)
|
power = min(100, power)
|
||||||
power = max(0, power)
|
power = max(0, power)
|
||||||
self.power = round(power)
|
self.power = round(power)
|
||||||
self.log_data(self.power)
|
|
||||||
await self.cbpi.satellite.publish(self.topic, json.dumps(
|
await self.cbpi.satellite.publish(self.topic, json.dumps(
|
||||||
{"state": "on", "power": self.power}), True)
|
{"state": "on", "power": self.power}), True)
|
||||||
self.state = True
|
self.state = True
|
||||||
|
@ -37,7 +36,6 @@ class MQTTActor(CBPiActor):
|
||||||
|
|
||||||
async def off(self):
|
async def off(self):
|
||||||
self.state = False
|
self.state = False
|
||||||
self.log_data(0)
|
|
||||||
await self.cbpi.satellite.publish(self.topic, json.dumps(
|
await self.cbpi.satellite.publish(self.topic, json.dumps(
|
||||||
{"state": "off", "power": self.power}), True)
|
{"state": "off", "power": self.power}), True)
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue