Author SHA1 Message Date
dependabot[bot]andGitHub 83e35aef06 Bump pyyaml from 4.2b1 to 5.4
Bumps [pyyaml](https://github.com/yaml/pyyaml) from 4.2b1 to 5.4.
- [Release notes](https://github.com/yaml/pyyaml/releases)
- [Changelog](https://github.com/yaml/pyyaml/blob/master/CHANGES)
- [Commits](https://github.com/yaml/pyyaml/commits/5.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-25 21:44:49 +00:00
Manuel83andGitHub 2b095c8c77 Update install.sh
WiringPi Removed
2019-08-20 21:17:46 +02:00
27 changed files with 84 additions and 65 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ craftbeerpi.db
**/node_modules/*
*.pyc
*.templog
venv/
modules/plugins/*
!modules/plugins/__init__.py
*.pyc
-1
View File
@@ -35,7 +35,6 @@ show_menu () {
apt-get -y update; apt-get -y upgrade;
fi
apt-get -y install python-setuptools
easy_install pip
apt-get -y install python-dev
+12 -5
View File
@@ -1,9 +1,16 @@
import json
import pprint
import sys, os
from flask import Flask, render_template, redirect
from flask_socketio import SocketIO, emit
import logging
# Define the WSGI application object
from app_config import *
import pprint
from modules.core.db import get_db
from .app_config import *
@app.route('/')
@@ -23,15 +30,15 @@ import modules.actor
import modules.notification
import modules.fermenter
from modules.addon.endpoints import initPlugins
import modules.ui.endpoints
import modules.system.endpoints
import modules.ui
import modules.system
import modules.buzzer
import modules.stats
import modules.kettle
import modules.recipe_import
import modules.core.db_mirgrate
from .app_config import cbpi
from app_config import cbpi
# Build the database:
# This will create the database file using SQLAlchemy
@@ -40,7 +47,7 @@ pp = pprint.PrettyPrinter(indent=6)
def init_db():
print("INIT DB")
print "INIT DB"
with app.app_context():
db = get_db()
+1
View File
@@ -0,0 +1 @@
import endpoints
+1 -1
View File
@@ -134,7 +134,7 @@ def plugins():
"""
response = requests.get("https://raw.githubusercontent.com/Manuel83/craftbeerpi-plugins/master/plugins.yaml")
cbpi.cache["plugins"] = merge(yaml.load(response.text), cbpi.cache["plugins"])
for key, value in cbpi.cache["plugins"].items():
for key, value in cbpi.cache["plugins"].iteritems():
value["installed"] = os.path.isdir("./modules/plugins/%s/" % (key))
return json.dumps(cbpi.cache["plugins"])
+2
View File
@@ -8,6 +8,8 @@ from flask_socketio import SocketIO, emit
import logging
from modules.core.core import CraftBeerPi, ActorBase, SensorBase
from modules.core.db import DBModel
+1 -1
View File
@@ -15,7 +15,7 @@ class DummyTempSensor(SensorActive):
@cbpi.action("My Custom Action")
def my_action(self):
print "HELLO WORLD"
pass
def get_unit(self):
+6 -6
View File
@@ -10,7 +10,7 @@ try:
GPIO.setmode(GPIO.BCM)
except Exception as e:
print(e)
print e
pass
@@ -25,11 +25,11 @@ class GPIOSimple(ActorBase):
GPIO.output(int(self.gpio), 0)
def on(self, power=0):
print("GPIO ON %s" % str(self.gpio))
print "GPIO ON %s" % str(self.gpio)
GPIO.output(int(self.gpio), 1)
def off(self):
print("GPIO OFF")
print "GPIO OFF"
GPIO.output(int(self.gpio), 0)
@cbpi.actor
@@ -67,7 +67,7 @@ class GPIOPWM(ActorBase):
self.p.ChangeDutyCycle(self.power)
def off(self):
print("GPIO OFF")
print "GPIO OFF"
self.p.stop()
@@ -98,10 +98,10 @@ class Dummy(ActorBase):
:param power: int value between 0 - 100
:return:
'''
print("ON")
print "ON"
def off(self):
print("OFF")
print "OFF"
+3 -3
View File
@@ -1,5 +1,5 @@
import time
#from threading import start_new_thread
from thread import start_new_thread
from modules import cbpi
try:
@@ -44,8 +44,8 @@ class Buzzer(object):
time.sleep(i)
except Exception as e:
pass
## TODO
#start_new_thread(play, (self.sound,))
start_new_thread(play, (self.sound,))
@cbpi.initalizer(order=1)
def init(cbpi):
+1 -1
View File
@@ -46,7 +46,7 @@ class ConfigView(BaseView):
with cls.api.app.app_context():
cls.api.cache[cls.cache_key] = {}
for key, value in cls.model.get_all().items():
for key, value in cls.model.get_all().iteritems():
cls.post_init_callback(value)
cls.api.cache[cls.cache_key][value.name] = value
+1 -1
View File
@@ -104,6 +104,6 @@ class BaseView(FlaskView):
cls.api.cache[cls.cache_key].append(value)
else:
cls.api.cache[cls.cache_key] = {}
for key, value in cls.model.get_all().items():
for key, value in cls.model.get_all().iteritems():
cls.post_init_callback(value)
cls.api.cache[cls.cache_key][key] = value
+1 -1
View File
@@ -42,7 +42,7 @@ class ControllerBase(object):
@staticmethod
def init_global():
print("GLOBAL CONTROLLER INIT")
print "GLOBAL CONTROLLER INIT"
def notify(self, headline, message, type="success", timeout=5000):
self.api.notify(headline, message, type, timeout)
+10 -7
View File
@@ -12,9 +12,9 @@ from time import localtime, strftime
from functools import wraps, update_wrapper
from .props import *
from props import *
from .hardware import *
from hardware import *
import time
import uuid
@@ -28,7 +28,7 @@ class ActorAPI(object):
def init_actors(self):
self.app.logger.info("Init Actors")
t = self.cache.get("actor_types")
for key, value in t.items():
for key, value in t.iteritems():
value.get("class").api = self
value.get("class").init_global()
@@ -89,7 +89,7 @@ class SensorAPI(object):
self.app.logger.info("Init Sensors")
t = self.cache.get("sensor_types")
for key, value in t.items():
for key, value in t.iteritems():
value.get("class").init_global()
for key in self.cache.get("sensors"):
@@ -292,7 +292,7 @@ class CraftBeerPi(ActorAPI, SensorAPI):
t = tmpObj.__getattribute__(m)
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable, "description": t.description})
for name, method in cls.__dict__.items():
for name, method in cls.__dict__.iteritems():
if hasattr(method, "action"):
label = method.__getattribute__("label")
self.cache[key][cls.__name__]["actions"].append({"method": name, "label": label})
@@ -309,7 +309,10 @@ class CraftBeerPi(ActorAPI, SensorAPI):
def actor2(self, description="", power=True, **options):
def decorator(f):
print f()
print f
print options
print description
return f
return decorator
@@ -366,7 +369,7 @@ class CraftBeerPi(ActorAPI, SensorAPI):
t = tmpObj.__getattribute__(m)
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable, "description": t.description})
for name, method in cls.__dict__.items():
for name, method in cls.__dict__.iteritems():
if hasattr(method, "action"):
label = method.__getattribute__("label")
self.cache[key][cls.__name__]["actions"].append({"method": name, "label": label})
+1 -1
View File
@@ -79,7 +79,7 @@ class DBModel(object):
cur = get_db().cursor()
if cls.__priamry_key__ is not None and cls.__priamry_key__ in kwargs:
if cls.__priamry_key__ is not None and kwargs.has_key(cls.__priamry_key__):
query = "INSERT INTO %s (%s, %s) VALUES (?, %s)" % (
cls.__table_name__,
cls.__priamry_key__,
+3 -6
View File
@@ -1,15 +1,12 @@
import sqlite3
import os
from modules import cbpi
from .db import get_db
from db import get_db
def execute_file(curernt_version, data):
# TODO add if block
'''
if curernt_version >= data["version"]:
cbpi.app.logger.info("SKIP DB FILE: %s" % data["file"])
return
'''
try:
with sqlite3.connect("craftbeerpi.db") as conn:
with open('./update/%s' % data["file"], 'r') as f:
@@ -22,8 +19,8 @@ def execute_file(curernt_version, data):
conn.commit()
except sqlite3.OperationalError as err:
print("EXCEPT")
print(err)
print "EXCEPT"
print err
@cbpi.initalizer(order=-9999)
def init(app=None):
+8 -4
View File
@@ -40,16 +40,18 @@ class Base(object):
class SensorBase(Base):
last_value = 0
def init(self):
print("INIT Base SENSOR")
print "INIT Base SENSOR"
def stop(self):
print("STOP SENSOR")
print "STOP SENSOR"
def data_received(self, data):
self.last_value = data
self.api.receive_sensor_value(self.id, data)
@@ -63,11 +65,12 @@ class SensorBase(Base):
return {"value": self.last_value, "unit": self.get_unit()}
class SensorActive(SensorBase):
__running = False
def is_running(self):
return self.__running
def init(self):
@@ -76,13 +79,14 @@ class SensorActive(SensorBase):
def stop(self):
self.__running = False
def execute(self):
pass
class SensorPassive(SensorBase):
def init(self):
print("INIT PASSIV SENSOR")
print "INIT PASSIV SENSOR"
pass
def read(self):
+4 -4
View File
@@ -109,10 +109,10 @@ class StepBase(Timer, ActorAPI, SensorAPI, KettleAPI):
pass
def execute(self):
print("-------------")
print("Step Info")
print("Kettle ID: %s" % self.kettle_id)
print("ID: %s" % self.id)
print "-------------"
print "Step Info"
print "Kettle ID: %s" % self.kettle_id
print "ID: %s" % self.id
def __init__(self, *args, **kwds):
+4 -4
View File
@@ -210,7 +210,7 @@ class FermenterView(BaseView):
def toggle(self, id):
fermenter = cbpi.cache.get(self.cache_key)[id]
try:
print(fermenter.state)
print fermenter.state
if fermenter.state is False:
# Start controller
if fermenter.logic is not None:
@@ -236,7 +236,7 @@ class FermenterView(BaseView):
cbpi.emit("UPDATE_FERMENTER", cbpi.cache.get(self.cache_key).get(id))
except Exception as e:
print(e)
print e
cbpi.notify("Toogle Fementer Controller failed", "Pleae check the %s configuration" % fermenter.name,
type="danger", timeout=None)
return ('', 500)
@@ -261,7 +261,7 @@ class FermenterView(BaseView):
cbpi.emit("UPDATE_FERMENTER", cbpi.cache.get(self.cache_key)[id])
def check_step(self):
for key, value in cbpi.cache["fermenter_task"].items():
for key, value in cbpi.cache["fermenter_task"].iteritems():
try:
fermenter = self.get_fermenter(key)
@@ -292,7 +292,7 @@ def read_target_temps(api):
:return: None
"""
result = {}
for key, value in cbpi.cache.get("fermenter").items():
for key, value in cbpi.cache.get("fermenter").iteritems():
cbpi.save_to_file(key, value.target_temp, prefix="fermenter")
+1 -1
View File
@@ -86,7 +86,7 @@ def read_target_temps(api):
:return: None
"""
result = {}
for key, value in cbpi.cache.get("kettle").items():
for key, value in cbpi.cache.get("kettle").iteritems():
cbpi.save_to_file(key, value.target_temp, prefix="kettle")
@cbpi.initalizer()
+1
View File
@@ -0,0 +1 @@
import endpoints
+3
View File
@@ -0,0 +1,3 @@
import beerxml
import kbh
import restapi
+1 -1
View File
@@ -29,7 +29,7 @@ class KBH(FlaskView):
result.append({"id": row[0], "name": row[1], "brewed": row[2]})
return json.dumps(result)
except Exception as e:
print(e)
print e
self.api.notify(headline="Failed to load KHB database", message="ERROR", type="danger")
return ('', 500)
finally:
+1 -1
View File
@@ -43,6 +43,6 @@ def read_passive_sensor(api):
:return: None
"""
for key, value in cbpi.cache.get("sensors").items():
for key, value in cbpi.cache.get("sensors").iteritems():
if value.mode == "P":
value.instance.read()
+1
View File
@@ -0,0 +1 @@
import endpoints
+1 -1
View File
@@ -109,7 +109,7 @@ class SystemView(FlaskView):
vf = self.api.app.view_functions
for f in self.api.app.view_functions:
print(f)
print f
endpoints = {}
re = {
"swagger": "2.0",
+1
View File
@@ -0,0 +1 @@
import endpoints
Executable → Regular
+14 -14
View File
@@ -1,14 +1,14 @@
eventlet==0.25.0
Flask==1.1.1
Flask-Classy==0.6.10
Flask-SocketIO==4.2.1
GitPython==3.0.1
greenlet==0.4.15
httplib2==0.13.1
python-dateutil==2.8.0
python-engineio==3.9.3
python-mimeparse==1.6.0
python-socketio==4.3.1
PyYAML==5.1.2
requests==2.22.0
Werkzeug==0.15.5
Flask==0.12.4
Flask-SocketIO==2.6.2
eventlet==0.19.0
greenlet==0.4.10
python-dateutil==2.5.3
python-engineio==0.9.2
python-mimeparse==1.5.2
python-socketio==1.4.4
PyYAML==5.4
requests==2.20.0
Werkzeug==0.11.10
httplib2==0.9.2
flask-classy==0.6.10
GitPython==2.1.3