mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-21 22:48:16 +01:00
Merge pull request #58 from phylax2020/master
Add parameter in settings to slow down pipe animation in dashboard
This commit is contained in:
commit
635ea3649c
3 changed files with 29 additions and 3 deletions
|
@ -64,3 +64,7 @@ class DashboardController:
|
|||
async def set_current_dashboard(self, dashboard_id=1):
|
||||
await self.cbpi.config.set("current_dashboard_number", dashboard_id)
|
||||
return {"status": "OK"}
|
||||
|
||||
async def get_slow_pipe_animation(self):
|
||||
slow_pipe_animation = self.cbpi.config.get("slow_pipe_animation", "Yes")
|
||||
return slow_pipe_animation
|
|
@ -49,7 +49,8 @@ class ConfigUpdate(CBPiExtension):
|
|||
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)
|
||||
|
||||
slow_pipe_animation = self.cbpi.config.get("slow_pipe_animation", None)
|
||||
|
||||
if boil_temp is None:
|
||||
logger.info("INIT Boil Temp Setting")
|
||||
try:
|
||||
|
@ -299,11 +300,20 @@ class ConfigUpdate(CBPiExtension):
|
|||
if SENSOR_LOG_MAX_BYTES is None:
|
||||
logger.info("Init maximum size of sensor logfiles")
|
||||
try:
|
||||
await self.cbpi.config.add("SENSOR_LOG_MAX_BYTES", 100000, ConfigType.NUMBER, "Max. number of bytes in sensor logfiles")
|
||||
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')
|
||||
|
||||
|
||||
# Check if slow_pipe_animation is in config
|
||||
if slow_pipe_animation is None:
|
||||
logger.info("INIT slow_pipe_animation")
|
||||
try:
|
||||
await self.cbpi.config.add("slow_pipe_animation", "Yes", ConfigType.SELECT, "Slow down dashboard pipe animation taking up close to 100% of the CPU's capacity",
|
||||
[{"label": "Yes", "value": "Yes"},
|
||||
{"label": "No", "value": "No"}])
|
||||
except:
|
||||
logger.warning('Unable to update config')
|
||||
|
||||
def setup(cbpi):
|
||||
cbpi.plugin.register("ConfigUpdate", ConfigUpdate)
|
||||
pass
|
||||
|
|
|
@ -157,3 +157,15 @@ class DashBoardHttpEndpoints:
|
|||
dashboard_id = int(request.match_info['id'])
|
||||
return web.json_response(await self.cbpi.dashboard.set_current_dashboard(dashboard_id))
|
||||
|
||||
@request_mapping(path="/slowPipeAnimation", method="GET", auth_required=False)
|
||||
async def get_slow_pipe_animation(self, request):
|
||||
"""
|
||||
---
|
||||
description: Get slow down dashboard pipe animation (Yes/No)
|
||||
tags:
|
||||
- Dashboard
|
||||
responses:
|
||||
"200":
|
||||
description: successful operation
|
||||
"""
|
||||
return web.json_response(await self.cbpi.dashboard.get_slow_pipe_animation(), dumps=json_dumps)
|
||||
|
|
Loading…
Reference in a new issue