Author SHA1 Message Date
dependabot[bot]andGitHub 37fa42cfbc Bump eventlet from 0.19.0 to 0.31.0
Bumps [eventlet](https://github.com/eventlet/eventlet) from 0.19.0 to 0.31.0.
- [Release notes](https://github.com/eventlet/eventlet/releases)
- [Changelog](https://github.com/eventlet/eventlet/blob/master/NEWS)
- [Commits](https://github.com/eventlet/eventlet/compare/v0.19.0...v0.31.0)

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