"fix mash step time to minutes"

This commit is contained in:
Manuel Fritsch 2021-02-12 00:03:18 +01:00
parent 5f18e7a7b8
commit 2468dab6dd
10 changed files with 83 additions and 18 deletions

View file

@ -1 +1 @@
__version__ = "4.0.0.19" __version__ = "4.0.0.20"

View file

@ -0,0 +1,62 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: craftbeerpi
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Put a short description of the service here
# Description: Put a long description of the service here
### END INIT INFO
# Change the next 3 lines to suit where you install your script and what you want to call it
DIR=#DIR#
DAEMON=$DIR/cbpi
DAEMON_NAME=CraftBeerPI
# Add any command line options for your daemon here
DAEMON_OPTS=""
# This next line determines what user the script runs as.
# Root generally not recommended but necessary if you are using the Raspberry Pi GPIO from Python.
DAEMON_USER=root
# The process ID of the script when it runs is stored here:
PIDFILE=/var/run/$DAEMON_NAME.pid
. /lib/lsb/init-functions
do_start () {
log_daemon_msg "Starting system $DAEMON_NAME daemon"
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --chdir $DIR --startas $DAEMON -- $DAEMON_OPTS
log_end_msg $?
}
do_stop () {
log_daemon_msg "Stopping system $DAEMON_NAME daemon"
start-stop-daemon --stop --pidfile $PIDFILE --retry 10
log_end_msg $?
}
case "$1" in
start|stop)
do_${1}
;;
restart|reload|force-reload)
do_stop
do_start
;;
status)
status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"
exit 1
;;
esac
exit 0

View file

@ -16,6 +16,6 @@ class NotificationController(object):
self.cbpi.register(self) self.cbpi.register(self)
async def notify(self, key, message, type=None): async def notify(self, message, type=None):
self.cbpi.ws.send(dict(topic="notifiaction", type=type, message=message)) self.cbpi.ws.send(dict(topic="notifiaction", type=type, message=message))

View file

@ -100,7 +100,7 @@ class StepController:
await self.start_step(step) await self.start_step(step)
await self.save() await self.save()
return return
await self.cbpi.notification.notify(message="HALLO")
logging.info("BREWING COMPLETE") logging.info("BREWING COMPLETE")
async def next(self): async def next(self):

View file

@ -26,7 +26,7 @@ class MashStep(CBPiStep):
def start_timer(self): def start_timer(self):
if self.timer is None: if self.timer is None:
self.time = int(self.props.get("Timer", 0)) self.time = int(self.props.get("Timer", 0)) * 60
self.timer = Timer(self.time, self.timer_done, self.timer_update) self.timer = Timer(self.time, self.timer_done, self.timer_update)
self.timer.start() self.timer.start()
@ -83,7 +83,7 @@ class WaitStep(CBPiStep):
def start_timer(self): def start_timer(self):
if self.timer is None: if self.timer is None:
self.time = int(self.props.get("Timer", 0)) self.time = int(self.props.get("Timer", 0)) * 60
self.timer = Timer(self.time, self.timer_done, self.timer_update) self.timer = Timer(self.time, self.timer_done, self.timer_update)
self.timer.start() self.timer.start()
@ -112,7 +112,7 @@ class WaitStep(CBPiStep):
while True: while True:
await asyncio.sleep(1) await asyncio.sleep(1)
@parameters([Property.Number(label="Timer", description="Time in Seconds", configurable=True), @parameters([Property.Number(label="Timer", description="Time in Minutes", configurable=True),
Property.Actor(label="Actor")]) Property.Actor(label="Actor")])
class ActorStep(CBPiStep): class ActorStep(CBPiStep):
@ -131,7 +131,7 @@ class ActorStep(CBPiStep):
def start_timer(self): def start_timer(self):
if self.timer is None: if self.timer is None:
self.time = int(self.props.get("Timer", 0)) self.time = int(self.props.get("Timer", 0)) * 60
self.timer = Timer(self.time, self.timer_done, self.timer_update) self.timer = Timer(self.time, self.timer_done, self.timer_update)
self.timer.start() self.timer.start()

View file

@ -8,7 +8,7 @@
"width": "100" "width": "100"
}, },
"type": "Kettle", "type": "Kettle",
"x": 120, "x": 105,
"y": 55 "y": 55
}, },
{ {
@ -20,7 +20,7 @@
}, },
"type": "Kettle", "type": "Kettle",
"x": 360, "x": 360,
"y": 55 "y": 60
}, },
{ {
"id": "d07d7f84-5bc8-42d5-9ef5-9d5be1ff4584", "id": "d07d7f84-5bc8-42d5-9ef5-9d5be1ff4584",
@ -48,11 +48,11 @@
"props": { "props": {
"color": "#fff", "color": "#fff",
"kettle": "oHxKz3z5RjbsxfSz6KUgov", "kettle": "oHxKz3z5RjbsxfSz6KUgov",
"size": "12", "size": "30",
"unit": "\u00b0" "unit": "\u00b0"
}, },
"type": "TargetTemp", "type": "TargetTemp",
"x": 160, "x": 135,
"y": 75 "y": 75
}, },
{ {
@ -70,11 +70,11 @@
"name": "KettleControl", "name": "KettleControl",
"props": { "props": {
"kettle": "oHxKz3z5RjbsxfSz6KUgov", "kettle": "oHxKz3z5RjbsxfSz6KUgov",
"orientation": "vertical" "orientation": "horizontal"
}, },
"type": "KettleControl", "type": "KettleControl",
"x": 70, "x": 100,
"y": 80 "y": 20
} }
], ],
"pathes": [ "pathes": [

View file

@ -10,8 +10,10 @@
"OffsetOn": "22" "OffsetOn": "22"
}, },
"sensor": "RedQfuxfy4mYe6PwioY95y", "sensor": "RedQfuxfy4mYe6PwioY95y",
"state": {}, "state": {
"target_temp": 73, "running": false
},
"target_temp": 80,
"type": "Hysteresis" "type": "Hysteresis"
} }
] ]

View file

@ -10,7 +10,7 @@
"Actor": "YwGzXvWMpmbLb6XobesL8n", "Actor": "YwGzXvWMpmbLb6XobesL8n",
"Timer": "5" "Timer": "5"
}, },
"status": "D", "status": "P",
"type": "ActorStep" "type": "ActorStep"
}, },
{ {
@ -23,7 +23,7 @@
"Temp": "2", "Temp": "2",
"Timer": "5" "Timer": "5"
}, },
"status": "P", "status": "I",
"type": "ActorStep" "type": "ActorStep"
} }
] ]

0
sample.py Normal file
View file

View file

@ -33,6 +33,7 @@ setup(name='cbpi',
'tabulate==0.8.7', 'tabulate==0.8.7',
'asyncio-mqtt', 'asyncio-mqtt',
'cbpi4ui', 'cbpi4ui',
'RPi.GPIO; sys_platform == "linux"'
], ],
dependency_links=[ dependency_links=[
'https://testpypi.python.org/pypi', 'https://testpypi.python.org/pypi',