First Version

This commit is contained in:
Manuel83
2017-06-11 17:12:22 +02:00
parent b03966562c
commit 58e927b0bf
57 changed files with 8540 additions and 1 deletions
+62
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/run.py
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
+97
View File
@@ -0,0 +1,97 @@
CREATE TABLE kettle
(
id INTEGER PRIMARY KEY NOT NULL,
name VARCHAR(80),
sensor VARCHAR(80),
heater VARCHAR(10),
automatic VARCHAR(255),
logic VARCHAR(50),
config VARCHAR(1000),
agitator VARCHAR(10),
target_temp INTEGER,
height INTEGER,
diameter INTEGER
);
CREATE TABLE step
(
id INTEGER PRIMARY KEY NOT NULL,
"order" INTEGER,
name VARCHAR(80),
type VARCHAR(100),
stepstate VARCHAR(255),
state VARCHAR(1),
start INTEGER,
end INTEGER,
config VARCHAR(255),
kettleid INTEGER
);
CREATE TABLE sensor
(
id INTEGER PRIMARY KEY NOT NULL,
type VARCHAR(100),
name VARCHAR(80),
config VARCHAR(500),
hide BOOLEAN
);
CREATE TABLE fermenter_step
(
id INTEGER PRIMARY KEY NOT NULL,
name VARCHAR(80),
hours INTEGER,
minutes INTEGER,
days INTEGER,
temp INTEGER,
direction VARCHAR(1),
"order" INTEGER,
state VARCHAR(1),
start INTEGER,
timer_start INTEGER,
end INTEGER,
fermenter_id INTEGER,
FOREIGN KEY (fermenter_id) REFERENCES fermenter (id)
);
CREATE TABLE fermenter
(
id INTEGER PRIMARY KEY NOT NULL,
name VARCHAR(80),
brewname VARCHAR(80),
sensor VARCHAR(80),
sensor2 VARCHAR(80),
sensor3 VARCHAR(80),
heater VARCHAR(10),
logic VARCHAR(50),
config VARCHAR(1000),
cooler VARCHAR(10),
target_temp INTEGER
);
CREATE TABLE config
(
name VARCHAR(50) PRIMARY KEY NOT NULL,
value VARCHAR(255),
type VARCHAR(50),
description VARCHAR(255),
options VARCHAR(255)
);
INSERT INTO config VALUES ('kettle_cols', 4, 'select', 'Adjust the width of a kettle widget on the brewing dashboard', '[1,2,3, 4, 5, 6, 7, 8, 9, 10, 11, 12]');
INSERT INTO config VALUES ('actor_cols', 4, 'select', 'Adjust the width of a actor widget on the brewing dashboard', '[1,2,3, 4, 5, 6, 7, 8, 9, 10, 11, 12]');
INSERT INTO config VALUES ('sensor_cols', 4, 'select', 'Adjust the width of a sensor widget on the brewing dashboard', '[1,2,3, 4, 5, 6, 7, 8, 9, 10, 11, 12]');
INSERT INTO config VALUES ('unit', 'C', 'select', 'Temperature Unit', '["C","F"]');
INSERT INTO config VALUES ('brewery_name', 'My Home Brewery', 'text', 'Your brewery name', NULL );
INSERT INTO config VALUES ('buzzer', 16, 'select', 'Buzzer GPIO', '[16,17,18,19,20]');
INSERT INTO config VALUES ('setup', 'YES', 'select', 'Show the Setup dialog', '["YES","NO"]');
CREATE TABLE actor
(
id INTEGER PRIMARY KEY NOT NULL,
name VARCHAR(50),
type VARCHAR(100),
config VARCHAR(500),
hide BOOLEAN
);