diff --git a/cbpi/__init__.py b/cbpi/__init__.py index bb49fd2..ec21018 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1 +1 @@ -__version__ = "4.0.0.19" \ No newline at end of file +__version__ = "4.0.0.20" \ No newline at end of file diff --git a/cbpi/config/craftbeerpiboot b/cbpi/config/craftbeerpiboot new file mode 100644 index 0000000..9c4ca4b --- /dev/null +++ b/cbpi/config/craftbeerpiboot @@ -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 \ No newline at end of file diff --git a/cbpi/controller/notification_controller.py b/cbpi/controller/notification_controller.py index 93f79db..8686e3a 100644 --- a/cbpi/controller/notification_controller.py +++ b/cbpi/controller/notification_controller.py @@ -16,6 +16,6 @@ class NotificationController(object): 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)) diff --git a/cbpi/controller/step_controller.py b/cbpi/controller/step_controller.py index 0da53bc..5d05f99 100644 --- a/cbpi/controller/step_controller.py +++ b/cbpi/controller/step_controller.py @@ -100,7 +100,7 @@ class StepController: await self.start_step(step) await self.save() return - + await self.cbpi.notification.notify(message="HALLO") logging.info("BREWING COMPLETE") async def next(self): diff --git a/cbpi/extension/mashstep/__init__.py b/cbpi/extension/mashstep/__init__.py index dea23fd..564a191 100644 --- a/cbpi/extension/mashstep/__init__.py +++ b/cbpi/extension/mashstep/__init__.py @@ -26,7 +26,7 @@ class MashStep(CBPiStep): def start_timer(self): 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.start() @@ -83,7 +83,7 @@ class WaitStep(CBPiStep): def start_timer(self): 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.start() @@ -112,7 +112,7 @@ class WaitStep(CBPiStep): while True: 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")]) class ActorStep(CBPiStep): @@ -131,7 +131,7 @@ class ActorStep(CBPiStep): def start_timer(self): 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.start() diff --git a/config/cbpi_dashboard_1.json b/config/cbpi_dashboard_1.json index 476f7bd..568e6fe 100644 --- a/config/cbpi_dashboard_1.json +++ b/config/cbpi_dashboard_1.json @@ -8,7 +8,7 @@ "width": "100" }, "type": "Kettle", - "x": 120, + "x": 105, "y": 55 }, { @@ -20,7 +20,7 @@ }, "type": "Kettle", "x": 360, - "y": 55 + "y": 60 }, { "id": "d07d7f84-5bc8-42d5-9ef5-9d5be1ff4584", @@ -48,11 +48,11 @@ "props": { "color": "#fff", "kettle": "oHxKz3z5RjbsxfSz6KUgov", - "size": "12", + "size": "30", "unit": "\u00b0" }, "type": "TargetTemp", - "x": 160, + "x": 135, "y": 75 }, { @@ -70,11 +70,11 @@ "name": "KettleControl", "props": { "kettle": "oHxKz3z5RjbsxfSz6KUgov", - "orientation": "vertical" + "orientation": "horizontal" }, "type": "KettleControl", - "x": 70, - "y": 80 + "x": 100, + "y": 20 } ], "pathes": [ diff --git a/config/kettle.json b/config/kettle.json index b7e96a9..ebd8d26 100644 --- a/config/kettle.json +++ b/config/kettle.json @@ -10,8 +10,10 @@ "OffsetOn": "22" }, "sensor": "RedQfuxfy4mYe6PwioY95y", - "state": {}, - "target_temp": 73, + "state": { + "running": false + }, + "target_temp": 80, "type": "Hysteresis" } ] diff --git a/config/step_data.json b/config/step_data.json index a2f2056..7e96c12 100644 --- a/config/step_data.json +++ b/config/step_data.json @@ -10,7 +10,7 @@ "Actor": "YwGzXvWMpmbLb6XobesL8n", "Timer": "5" }, - "status": "D", + "status": "P", "type": "ActorStep" }, { @@ -23,7 +23,7 @@ "Temp": "2", "Timer": "5" }, - "status": "P", + "status": "I", "type": "ActorStep" } ] diff --git a/sample.py b/sample.py new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py index 067e8a5..facae91 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,7 @@ setup(name='cbpi', 'tabulate==0.8.7', 'asyncio-mqtt', 'cbpi4ui', + 'RPi.GPIO; sys_platform == "linux"' ], dependency_links=[ 'https://testpypi.python.org/pypi',