From 345d75da1be9ed450d2d390b7a9d93125aca4114 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 23 Apr 2024 10:24:39 +0100 Subject: [PATCH 01/11] Gas: Fix gpiodevice.get_pin. --- enviroplus/gas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enviroplus/gas.py b/enviroplus/gas.py index 3583428a..1e78010f 100644 --- a/enviroplus/gas.py +++ b/enviroplus/gas.py @@ -64,7 +64,7 @@ def setup(): else: adc.set_sample_rate(1600) - _heater = gpiodevice.get_pin("GPIO24") + _heater = gpiodevice.get_pin("GPIO24", "EnviroPlus", OUTH) atexit.register(cleanup) From cbfd4418836e03fce4a8711cd909863414340de0 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 23 Apr 2024 11:18:33 +0100 Subject: [PATCH 02/11] Prep for v1.0.2. --- CHANGELOG.md | 9 ++++++++- enviroplus/__init__.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d28efc61..47cb04d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ +1.0.2 +----- + +* README.md: Update install instructions +* Fix installer to enable serial +* Fix gas sensor heater pin + 1.0.1 ------------ +----- * README.md: Fix images diff --git a/enviroplus/__init__.py b/enviroplus/__init__.py index 5c4105cd..7863915f 100644 --- a/enviroplus/__init__.py +++ b/enviroplus/__init__.py @@ -1 +1 @@ -__version__ = "1.0.1" +__version__ = "1.0.2" From 7972ca33859bd516a49393be2b50ae36505b2ac3 Mon Sep 17 00:00:00 2001 From: Hel Gibbons <50950368+helgibbons@users.noreply.github.com> Date: Tue, 23 Apr 2024 12:35:11 +0100 Subject: [PATCH 03/11] Update README.md Remove outdated mention of one line installer --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index c3e492de..d76de497 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,6 @@ Designed for environmental monitoring, Enviro+ lets you measure air quality (pol # Installing -You are best using the "One-line" install method if you want all of the UART serial configuration for the PMS5003 particulate matter sensor to run automatically. - **Note** The code in this repository supports both the Enviro+ and Enviro Mini boards. _The Enviro Mini board does not have the Gas sensor or the breakout for the PM sensor._ ![Enviro Plus pHAT](https://raw.githubusercontent.com/pimoroni/enviroplus-python/main/Enviro-Plus-pHAT.jpg) From d283e14dd7608f1f92a43456c21214887f97b53f Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Wed, 24 Apr 2024 15:15:48 +0100 Subject: [PATCH 04/11] Bump PMS5003 to v1.0.1. Includes better support for Pi devices, defaults to Pi-compatible pins and includes support for custom GPIO pins. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 25179f4d..7c565bb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ dependencies = [ "gpiod >= 2.1.3", "gpiodevice >= 0.0.3", "pimoroni-bme280 >= 1.0.0", - "pms5003 >= 1.0.0", + "pms5003 >= 1.0.1", "ltr559 >= 1.0.0", "st7735 >= 1.0.0", "ads1015 >= 1.0.0", From 655f9f39b865b799e78afff5ebdbce172d1eaf0b Mon Sep 17 00:00:00 2001 From: idotj Date: Thu, 23 May 2024 10:49:34 +0200 Subject: [PATCH 05/11] Fix path for Bookworm Fix path for config.txt changes in Bookworm --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d76de497..b2033326 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ And if you're using a PMS5003 sensor you will need to: * Enable serial: `raspi-config nonint do_serial_hw 0` * Disable serial terminal: `raspi-config nonint do_serial_cons 1` -* Add `dtoverlay=pi3-miniuart-bt` to your `/boot/config.txt` +* Add `dtoverlay=pi3-miniuart-bt` to your `/boot/firmware/config.txt` ### Bullseye From 72267be957c4fe21cf46b420922bf06282dac9fe Mon Sep 17 00:00:00 2001 From: Alexandre Esse Date: Tue, 11 Jun 2024 01:21:41 +0200 Subject: [PATCH 06/11] examples: add shebang Signed-off-by: Alexandre Esse --- examples/noise-amps-at-freqs.py | 2 ++ examples/noise-profile.py | 2 ++ examples/sensorcommunity_combined.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/examples/noise-amps-at-freqs.py b/examples/noise-amps-at-freqs.py index 957511b4..75497df2 100755 --- a/examples/noise-amps-at-freqs.py +++ b/examples/noise-amps-at-freqs.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import st7735 from PIL import Image, ImageDraw diff --git a/examples/noise-profile.py b/examples/noise-profile.py index be6a1855..480815e6 100755 --- a/examples/noise-profile.py +++ b/examples/noise-profile.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import st7735 from PIL import Image, ImageDraw diff --git a/examples/sensorcommunity_combined.py b/examples/sensorcommunity_combined.py index a7aeb7b8..bb9869d6 100644 --- a/examples/sensorcommunity_combined.py +++ b/examples/sensorcommunity_combined.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import colorsys import logging import time From b6fd390e03843d16d20970a331635c382f1176e5 Mon Sep 17 00:00:00 2001 From: Alexandre Esse Date: Tue, 11 Jun 2024 03:15:48 +0200 Subject: [PATCH 07/11] mqtt-all: fix display box The previous display box function wasn't properly used. This fix the information displayed on the enviro+ display. Signed-off-by: Alexandre Esse --- examples/mqtt-all.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/mqtt-all.py b/examples/mqtt-all.py index ecab4a35..db4cf875 100755 --- a/examples/mqtt-all.py +++ b/examples/mqtt-all.py @@ -136,7 +136,7 @@ def display_status(disp, mqtt_broker): message = f"{device_serial_number}\nWi-Fi: {wifi_status}\nmqtt-broker: {mqtt_broker}" img = Image.new("RGB", (WIDTH, HEIGHT), color=(0, 0, 0)) draw = ImageDraw.Draw(img) - x1, y1, x2, y2 = font.getbbox(message) + x1, y1, x2, y2 = draw.textbbox((0,0), message, font=font) size_x = x2 - x1 size_y = y2 - y1 x = (WIDTH - size_x) / 2 From f32e560580d32356858fddae2a3e18ef2eabb0ae Mon Sep 17 00:00:00 2001 From: Alexandre Esse Date: Tue, 11 Jun 2024 03:22:26 +0200 Subject: [PATCH 08/11] mqtt-all: update display message Signed-off-by: Alexandre Esse --- examples/mqtt-all.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/mqtt-all.py b/examples/mqtt-all.py index db4cf875..b4fd19ef 100755 --- a/examples/mqtt-all.py +++ b/examples/mqtt-all.py @@ -133,7 +133,7 @@ def display_status(disp, mqtt_broker): text_colour = (255, 255, 255) back_colour = (0, 170, 170) if check_wifi() else (85, 15, 15) device_serial_number = get_serial_number() - message = f"{device_serial_number}\nWi-Fi: {wifi_status}\nmqtt-broker: {mqtt_broker}" + message = f"Serial: {device_serial_number}\nWi-Fi: {wifi_status}\nmqtt-broker: {mqtt_broker}" img = Image.new("RGB", (WIDTH, HEIGHT), color=(0, 0, 0)) draw = ImageDraw.Draw(img) x1, y1, x2, y2 = draw.textbbox((0,0), message, font=font) From f2b11de49d0499d3b3d430208d61aba4f2d59a7f Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 18 Mar 2025 16:31:53 +0000 Subject: [PATCH 09/11] packaging: sync with boilerplate, move example requirements. --- Makefile | 5 ++++- install.sh | 20 +++++++++++++++----- pyproject.toml | 8 +------- requirements-examples.txt | 7 +++++++ tox.ini | 11 ++--------- 5 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 requirements-examples.txt diff --git a/Makefile b/Makefile index 34f4a7dd..56cf0dfe 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,9 @@ endif @echo "deploy: build and upload to PyPi" @echo "tag: tag the repository with the current version\n" +version: + @hatch version + install: ./install.sh --unstable @@ -47,7 +50,7 @@ pytest: nopost: @bash check.sh --nopost -tag: +tag: version git tag -a "v${LIBRARY_VERSION}" -m "Version ${LIBRARY_VERSION}" build: check diff --git a/install.sh b/install.sh index 495919b4..61f1a4a6 100755 --- a/install.sh +++ b/install.sh @@ -58,11 +58,6 @@ find_config() { if [ ! -f "$CONFIG_DIR/$CONFIG_FILE" ]; then fatal "Could not find $CONFIG_FILE!" fi - else - if [ -f "/boot/$CONFIG_FILE" ] && [ ! -L "/boot/$CONFIG_FILE" ]; then - warning "Oops! It looks like /boot/$CONFIG_FILE is not a link to $CONFIG_DIR/$CONFIG_FILE" - warning "You might want to fix this!" - fi fi inform "Using $CONFIG_FILE in $CONFIG_DIR" } @@ -171,6 +166,12 @@ function pip_pkg_install { check_for_error } +function pip_requirements_install { + # A null Keyring prevents pip stalling in the background + PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring $PYTHON -m pip install -r "$@" + check_for_error +} + while [[ $# -gt 0 ]]; do K="$1" case $K in @@ -340,6 +341,15 @@ fi printf "\n" +if [ -f "requirements-examples.txt" ]; then + if confirm "Would you like to install example dependencies?"; then + inform "Installing dependencies from requirements-examples.txt..." + pip_requirements_install requirements-examples.txt + fi +fi + +printf "\n" + # Use pdoc to generate basic documentation from the installed module if confirm "Would you like to generate documentation?"; then diff --git a/pyproject.toml b/pyproject.toml index 7c565bb5..057079f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,13 +41,7 @@ dependencies = [ "pms5003 >= 1.0.1", "ltr559 >= 1.0.0", "st7735 >= 1.0.0", - "ads1015 >= 1.0.0", - "fonts", - "font-roboto", - "astral", - "pytz", - "sounddevice", - "paho-mqtt" + "ads1015 >= 1.0.0" ] [project.urls] diff --git a/requirements-examples.txt b/requirements-examples.txt new file mode 100644 index 00000000..b61fd7f5 --- /dev/null +++ b/requirements-examples.txt @@ -0,0 +1,7 @@ +fonts +font-roboto +astral +pytz +sounddevice +paho-mqtt + diff --git a/tox.ini b/tox.ini index 44c86546..2b6d87b8 100644 --- a/tox.ini +++ b/tox.ini @@ -20,15 +20,8 @@ commands = python -m build --no-isolation python -m twine check dist/* isort --check . - ruff . + ruff check . codespell . deps = - check-manifest - ruff - codespell - isort - twine - build - hatch - hatch-fancy-pypi-readme + -r{toxinidir}/requirements-dev.txt From 70947aa09406f5cfebce4b78b6630a0b48ec9919 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 18 Mar 2025 16:38:08 +0000 Subject: [PATCH 10/11] Add pillow to example requirements. --- requirements-examples.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-examples.txt b/requirements-examples.txt index b61fd7f5..96def717 100644 --- a/requirements-examples.txt +++ b/requirements-examples.txt @@ -4,4 +4,4 @@ astral pytz sounddevice paho-mqtt - +pillow From e85fab90893f2ed34b4c9deeabfaecb83f1475d9 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Fri, 11 Jul 2025 14:55:38 +0100 Subject: [PATCH 11/11] Prefer pip binary installs for #154. --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 61f1a4a6..d2d973a9 100755 --- a/install.sh +++ b/install.sh @@ -162,13 +162,13 @@ function apt_pkg_install { function pip_pkg_install { # A null Keyring prevents pip stalling in the background - PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring $PYTHON -m pip install --upgrade "$@" + PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring $PYTHON -m pip install --prefer-binary --upgrade "$@" check_for_error } function pip_requirements_install { # A null Keyring prevents pip stalling in the background - PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring $PYTHON -m pip install -r "$@" + PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring $PYTHON -m pip install --prefer-binary -r "$@" check_for_error }