mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-09 17:07:43 +01:00
Merge pull request #12 from avollkopf/development
Merge from development
This commit is contained in:
commit
127354c834
7 changed files with 184 additions and 14 deletions
100
.github/workflows/build.yml
vendored
Normal file
100
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
name: 'Build CraftBeerPi4'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
- development
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
image-name: ghcr.io/${{ github.repository_owner }}/craftbeerpi4
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
name: Builds the source distribution package
|
||||
steps:
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup python environment
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.7'
|
||||
|
||||
- name: Clean
|
||||
run: python setup.py clean --all
|
||||
|
||||
# - name: Run tests
|
||||
# run: python -m unittest tests
|
||||
|
||||
- name: Build source distribution package for CraftBeerPi
|
||||
run: python setup.py sdist
|
||||
|
||||
- name: Upload CraftBeerPi package to be used in next step
|
||||
uses: actions/upload-artifact@v2.2.4
|
||||
with:
|
||||
name: craftbeerpi4
|
||||
path: dist/cbpi-*.tar.gz
|
||||
if-no-files-found: error
|
||||
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
name: Builds the docker image(s)
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare docker image and tag names
|
||||
id: prep
|
||||
run: |
|
||||
|
||||
PUBLISH_IMAGE=false
|
||||
TAGS="${{ env.image-name }}:dev"
|
||||
|
||||
if [[ $GITHUB_REF_NAME == master ]] || [[ $GITHUB_REF_NAME == main ]]; then
|
||||
# when building master/main use :latest tag and the version number
|
||||
# from the cbpi/__init__.py file
|
||||
VERSION=$(grep -o -E "(([0-9]{1,2}[.]?){3}[0-9]+)" cbpi/__init__.py)
|
||||
TAGS="${{ env.image-name }}:latest,${{ env.image-name }}:v${VERSION}"
|
||||
PUBLISH_IMAGE=true
|
||||
elif [[ $GITHUB_REF_NAME == development ]]; then
|
||||
PUBLISH_IMAGE=true
|
||||
fi
|
||||
|
||||
# Set output parameters.
|
||||
echo ::set-output name=tags::${TAGS}
|
||||
echo ::set-output name=publish_image::${PUBLISH_IMAGE}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@master
|
||||
with:
|
||||
platforms: all
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@master
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ steps.prep.outputs.publish_image }}
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
labels: |
|
||||
org.opencontainers.image.title=${{ github.event.repository.name }}
|
||||
org.opencontainers.image.description=${{ github.event.repository.description }}
|
||||
org.opencontainers.image.url=${{ github.event.repository.html_url }}
|
||||
org.opencontainers.image.revision=${{ github.sha }}
|
43
Dockerfile
43
Dockerfile
|
@ -1,14 +1,43 @@
|
|||
FROM python:3.5.6-stretch
|
||||
FROM alpine:latest as download
|
||||
RUN apk --no-cache add curl && mkdir /downloads
|
||||
# Download installation files
|
||||
RUN curl https://github.com/avollkopf/craftbeerpi4-ui/archive/main.zip -L -o ./downloads/cbpi-ui.zip
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
FROM python:3.7
|
||||
|
||||
COPY dist/cbpi-0.0.1.tar.gz ./
|
||||
RUN pip install cbpi-0.0.1.tar.gz --no-cache-dir
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get upgrade -y
|
||||
RUN apt-get install --no-install-recommends -y \
|
||||
libatlas-base-dev \
|
||||
libffi-dev \
|
||||
python3-pip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY . .
|
||||
RUN python -m pip install --upgrade pip setuptools wheel
|
||||
|
||||
EXPOSE 8080
|
||||
WORKDIR /cbpi
|
||||
# Create non-root user working directory
|
||||
RUN groupadd -g 1000 -r craftbeerpi \
|
||||
&& useradd -u 1000 -r -s /bin/false -g craftbeerpi craftbeerpi \
|
||||
&& chown craftbeerpi:craftbeerpi /cbpi
|
||||
|
||||
CMD [ "cbpi" ]
|
||||
# Install craftbeerpi from source
|
||||
COPY . /cbpi-src
|
||||
RUN pip3 install --no-cache-dir /cbpi-src
|
||||
|
||||
# Install craftbeerpi-ui
|
||||
COPY --from=download /downloads /downloads
|
||||
RUN pip3 install --no-cache-dir /downloads/cbpi-ui.zip
|
||||
|
||||
# Clean up installation files
|
||||
RUN rm -rf /downloads /cbpi-src
|
||||
|
||||
USER craftbeerpi
|
||||
|
||||
RUN cbpi setup
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# Start cbpi
|
||||
CMD ["cbpi", "start"]
|
27
README.md
27
README.md
|
@ -1,4 +1,27 @@
|
|||
# CraftBeerPi
|
||||
# CraftBeerPi 4
|
||||
|
||||
You will finde the documentation here: https://craftbeerpi.gitbook.io/craftbeerpi4/
|
||||
[![Build](https://github.com/avollkopf/craftbeerpi4/actions/workflows/build.yml/badge.svg)](https://github.com/avollkopf/craftbeerpi4/actions/workflows/build.yml)
|
||||
[![GitHub license](https://img.shields.io/github/license/avollkopf/craftbeerpi4)](https://github.com/avollkopf/craftbeerpi4/blob/master/LICENSE)
|
||||
![GitHub issues](https://img.shields.io/github/issues-raw/Manuel83/craftbeerpi4)
|
||||
![PyPI](https://img.shields.io/pypi/v/cbpi)
|
||||
![Happy Brewing](https://img.shields.io/badge/CraftBeerPi%204-Happy%20Brewing-%23FBB117)
|
||||
|
||||
<p align="center">
|
||||
<img src="https://github.com/Manuel83/craftbeerpi4-ui/blob/main/cbpi4ui/public/logo192.png?raw=true" alt="CraftBeerPi Logo"/>
|
||||
</p>
|
||||
|
||||
CraftBeerPi 4 is an open source software solution to control the brewing and
|
||||
fermentation of beer :beer:.
|
||||
|
||||
## 📚 Documentation
|
||||
Instructions on how to install CraftBeerPi and use its plugins is described
|
||||
in the documentation, that can be found here: [gitbook.io](https://openbrewing.gitbook.io/craftbeerpi4_support/).
|
||||
|
||||
### Plugins
|
||||
Plugins extend the base functionality of CraftBeerPi 4.
|
||||
You can find a list of available plugins [here](https://openbrewing.gitbook.io/craftbeerpi4_support/master/plugin-installation#plugin-list).
|
||||
|
||||
## 🧑🤝🧑 Contributers
|
||||
Thanks to all the people who have contributed
|
||||
|
||||
[![contributors](https://contributors-img.web.app/image?repo=avollkopf/craftbeerpi4)](https://github.com/avollkopf/craftbeerpi4/graphs/contributors)
|
||||
|
|
|
@ -1 +1 @@
|
|||
__version__ = "4.0.0.54"
|
||||
__version__ = "4.0.0.55"
|
||||
|
|
6
cbpi/config/chromium.desktop
Normal file
6
cbpi/config/chromium.desktop
Normal file
|
@ -0,0 +1,6 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Chromium
|
||||
Comment=Chromium Webbrowser
|
||||
NoDisplay=false
|
||||
Exec=chromium-browser --noerrordialogs --disable-session-crashed-bubble --disable-infobars --force-device-scale-factor=1.00 --start-fullscreen "http://localhost:8000"
|
|
@ -9,10 +9,15 @@ class ActorController(BasicController):
|
|||
self.update_key = "actorupdate"
|
||||
|
||||
async def on(self, id, power=None):
|
||||
logging.info("Controller_power: {}".format(power))
|
||||
try:
|
||||
item = self.find_by_id(id)
|
||||
if item.power:
|
||||
power = item.power
|
||||
if power is None:
|
||||
logging.info("Power is none")
|
||||
if item.power:
|
||||
power = item.power
|
||||
else:
|
||||
power = 100
|
||||
if item.instance.state is False:
|
||||
await item.instance.on(power)
|
||||
await self.push_udpate()
|
||||
|
|
|
@ -48,7 +48,7 @@ class GPIOActor(CBPiActor):
|
|||
return 0 if self.inverted == False else 1
|
||||
|
||||
async def on_start(self):
|
||||
self.power = 100
|
||||
self.power = None
|
||||
self.gpio = self.props.GPIO
|
||||
self.inverted = True if self.props.get("Inverted", "No") == "Yes" else False
|
||||
self.sampleTime = int(self.props.get("SamplingTime", 5))
|
||||
|
@ -59,6 +59,8 @@ class GPIOActor(CBPiActor):
|
|||
async def on(self, power = None):
|
||||
if power is not None:
|
||||
self.power = power
|
||||
else:
|
||||
self.power = 100
|
||||
await self.set_power(self.power)
|
||||
|
||||
logger.info("ACTOR %s ON - GPIO %s " % (self.id, self.gpio))
|
||||
|
@ -116,13 +118,18 @@ class GPIOPWMActor(CBPiActor):
|
|||
GPIO.setup(self.gpio, GPIO.OUT)
|
||||
GPIO.output(self.gpio, 0)
|
||||
self.state = False
|
||||
self.power = 100
|
||||
self.power = None
|
||||
self.p = None
|
||||
pass
|
||||
|
||||
async def on(self, power = None):
|
||||
logging.info("PWM Actor Power: {}".format(power))
|
||||
if power is not None:
|
||||
self.power = power
|
||||
else:
|
||||
self.power = 100
|
||||
|
||||
logging.info("PWM Final Power: {}".format(self.power))
|
||||
|
||||
logger.info("PWM ACTOR %s ON - GPIO %s - Frequency %s - Power %s" % (self.id, self.gpio,self.frequency,self.power))
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue