mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-21 22:48:16 +01:00
Logfile size and backup logfile count in config.json
This commit is contained in:
parent
8621888d81
commit
abe87b4218
2 changed files with 21 additions and 17 deletions
|
@ -144,19 +144,5 @@
|
|||
"options": null,
|
||||
"type": "step",
|
||||
"value": "NotificationStep"
|
||||
},
|
||||
"SENSOR_LOG_BACKUP_COUNT": {
|
||||
"description": "Max. number of backup logs",
|
||||
"name": "SENSOR_LOG_BACKUP_COUNT",
|
||||
"options": null,
|
||||
"type": "number",
|
||||
"value": 3
|
||||
},
|
||||
"SENSOR_LOG_MAX_BYTES": {
|
||||
"description": "Max. number of bytes in sensor logs",
|
||||
"name": "SENSOR_LOG_MAX_BYTES",
|
||||
"options": null,
|
||||
"type": "number",
|
||||
"value": "100000"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,8 +47,9 @@ class ConfigUpdate(CBPiExtension):
|
|||
influxdbcloud = self.cbpi.config.get("INFLUXDBCLOUD", None)
|
||||
mqttupdate = self.cbpi.config.get("MQTTUpdate", None)
|
||||
PRESSURE_UNIT = self.cbpi.config.get("PRESSURE_UNIT", None)
|
||||
|
||||
|
||||
SENSOR_LOG_BACKUP_COUNT = self.cbpi.config.get("SENSOR_LOG_BACKUP_COUNT", None)
|
||||
SENSOR_LOG_MAX_BYTES = self.cbpi.config.get("SENSOR_LOG_MAX_BYTES", None)
|
||||
|
||||
if boil_temp is None:
|
||||
logger.info("INIT Boil Temp Setting")
|
||||
try:
|
||||
|
@ -285,6 +286,23 @@ class ConfigUpdate(CBPiExtension):
|
|||
{"label": "PSI", "value": "PSI"}])
|
||||
except:
|
||||
logger.warning('Unable to update config')
|
||||
|
||||
# check if SENSOR_LOG_BACKUP_COUNT exists in config
|
||||
if SENSOR_LOG_BACKUP_COUNT is None:
|
||||
logger.info("INIT SENSOR_LOG_BACKUP_COUNT")
|
||||
try:
|
||||
await self.cbpi.config.add("SENSOR_LOG_BACKUP_COUNT", 3, ConfigType.NUMBER, "Max. number of backup logs")
|
||||
except:
|
||||
logger.warning('Unable to update database')
|
||||
|
||||
# check if SENSOR_LOG_MAX_BYTES exists in config
|
||||
if SENSOR_LOG_MAX_BYTES is None:
|
||||
logger.info("INIT SENSOR_LOG_MAX_BYTES")
|
||||
try:
|
||||
await self.cbpi.config.add("SENSOR_LOG_MAX_BYTES", 100000, ConfigType.NUMBER, "Max. number of bytes in sensor logs")
|
||||
except:
|
||||
logger.warning('Unable to update database')
|
||||
|
||||
|
||||
def setup(cbpi):
|
||||
cbpi.plugin.register("ConfigUpdate", ConfigUpdate)
|
||||
|
|
Loading…
Reference in a new issue