diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e1b509b..158787f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: packages: write name: Builds the source distribution package @@ -25,10 +25,13 @@ jobs: - name: Setup python environment uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.13' - name: Install packages run: sudo apt install -y libsystemd-dev + + - name: Install setuptools + run: pip3 install setuptools --upgrade - name: Clean run: python setup.py clean --all @@ -50,7 +53,7 @@ jobs: if-no-files-found: error docker: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 name: Builds the docker image(s) steps: - name: Checkout diff --git a/CHANGELOG.md b/CHANGELOG.md index 14bc9001..51eb3aab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## Server Version 4.7.1 (06.01.25): + +### Maintenance: +- Update required packages to latest versions. +- Add optional resolution parameter to cli.py for chromium setup + +### Fixes: +- Fix startup behavior with respect to mosquitto and influxdb. +- Fix to install libsystemd-dev under github docker workflow (use ubuntu-22.04 instead of ubuntu-latest) +- Adapt onewire setup -> change /boot/firmware/config.txt instead of /boot/config.txt + + ## Server Version 4.7.0 (23.11.25): ### Codename: Winter Bock diff --git a/cbpi/__init__.py b/cbpi/__init__.py index 1e212f2b..9df7ac54 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1,2 +1,2 @@ -__version__ = "4.7.0" +__version__ = "4.7.1" __codename__ = "Winter Bock" diff --git a/cbpi/cli.py b/cbpi/cli.py index cad32ee6..9511455e 100644 --- a/cbpi/cli.py +++ b/cbpi/cli.py @@ -51,22 +51,23 @@ def start(self): def setup_one_wire(self): print("Setting up 1Wire") - with open("/boot/config.txt", "r") as f: + with open("/boot/firmware/config.txt", "r") as f: lines = f.readlines() - lines.append("dtoverlay=w1-gpio,gpiopin=4,pullup=on") + if "dtoverlay=w1-gpio,gpiopin=4,pullup=on\n" not in lines: + lines.append("dtoverlay=w1-gpio,gpiopin=4,pullup=on\n") configtempfile = os.path.join(self.config.get_file_path(""), "config.txt") with open(configtempfile, "w") as f: for line in lines: f.write(line) - destfile = "/boot/config.txt" + destfile = "/boot/firmware/config.txt" # copy and remove afterwards as mv will work, but raise an error message due to different file owners shutil.os.system('sudo cp "{}" "{}"'.format(configtempfile, destfile)) shutil.os.system('rm -rf "{}"'.format(configtempfile)) - print("/boot/config.txt created") + print("/boot/firmware/config.txt created") def list_one_wire(self): print("List 1Wire") @@ -291,7 +292,7 @@ def autostart(self, name): return return - def chromium(self, name): + def chromium(self, name, width=None, height=None): try: version = int(distro.version()) except: @@ -389,11 +390,15 @@ def chromium(self, name): pass elif name == "on": print("Add chromium to labwc autostart") + if width is not None and height is not None: + command='chromium = /usr/bin/chromium --start-maximized --start-fullscreen --window-size={},{} --password-store=basic --app=http://localhost:8000'.format(width, height) + else: + command='chromium = /usr/bin/chromium --start-maximized --start-fullscreen --password-store=basic --app=http://localhost:8000' try: if os.path.exists(file) is False: pathlib.Path(file).mkdir(parents=True, exist_ok=True) with open(file, "a") as f: - f.write('chromium = /usr/bin/chromium --start-fullscreen --start-maximized --password-store=basic --app=http://localhost:8000') + f.write(command) print("Added chromium to labwc autostart") print( "CraftBeerPi Chromium Autostart is {}ON{}".format( @@ -418,7 +423,7 @@ def chromium(self, name): return else: with open(file, "a") as f: - f.write('chromium = /usr/bin/chromium --start-fullscreen --start-maximized --password-store=basic --app=http://localhost:8000') + f.write(command) print("Added chromium to labwc autostart") print( "CraftBeerPi Chromium Autostart is {}ON{}".format( @@ -604,10 +609,17 @@ def autostart(context, name): @main.command() @click.pass_context @click.argument("name") -def chromium(context, name): +@click.option("--resolution", nargs=2, type=int, help="Optional for on:Set the chromium resolution for fullscreen mode (width height)") +def chromium(context, name, resolution): """(on|off|status) Enable or disable Kiosk mode""" operationsystem = sys.platform if not operationsystem.startswith("win"): - context.obj.chromium(name) + if resolution is not None and name == "on": + width = resolution[0] + height = resolution[1] + print("Set screen resolution to {}x{}".format(width, height)) + context.obj.chromium(name, width, height) + else: + context.obj.chromium(name) else: print("Chromium option NOT available under Windows") diff --git a/cbpi/config/craftbeerpi.template b/cbpi/config/craftbeerpi.template index 462b6171..22ef2e17 100644 --- a/cbpi/config/craftbeerpi.template +++ b/cbpi/config/craftbeerpi.template @@ -1,8 +1,10 @@ [Unit] Description=Craftbeer Pi +After=mosquitto.service influxdb.service [Service] WorkingDirectory=/home/{{ user }} +ExecStartPre=/bin/sleep 5 ExecStart={{ path }} start KillSignal=SIGKILL TimeoutStopSec=15 diff --git a/cbpi/controller/satellite_controller.py b/cbpi/controller/satellite_controller.py index 27c45058..c99298ce 100644 --- a/cbpi/controller/satellite_controller.py +++ b/cbpi/controller/satellite_controller.py @@ -43,7 +43,7 @@ def remove_key(self, d, key): return r async def init(self): - + self.client = aiomqtt.Client( self.host, port=self.port, diff --git a/requirements.txt b/requirements.txt index dcb2931d..018bf9ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ typing-extensions>=4 -aiohttp==3.13.2 +aiohttp==3.13.3 aiohttp-auth==0.1.1 aiohttp-route-decorator==0.1.4 aiohttp-security==0.5.0 @@ -7,7 +7,7 @@ aiohttp-session==2.12.1 aiohttp-swagger==1.0.16 #async-timeout==4.0.3 aiojobs==1.4.0 -aiosqlite==0.21.0 +aiosqlite==0.22.1 cryptography==46.0.3 pyopenssl==25.3.0 requests==2.32.5 @@ -20,7 +20,7 @@ numpy==2.3.5 cbpi4gui click==8.3.1 importlib_metadata -aiomqtt==2.4.0 +aiomqtt==2.5.0 psutil==7.1.3 zipp>=0.5 distro>=1.8.0 diff --git a/setup.py b/setup.py index c5cbadb1..137902f3 100644 --- a/setup.py +++ b/setup.py @@ -58,14 +58,14 @@ long_description_content_type='text/markdown', install_requires=[ "typing-extensions>=4", - "aiohttp==3.13.2", + "aiohttp==3.13.3", "aiohttp-auth==0.1.1", "aiohttp-route-decorator==0.1.4", "aiohttp-security==0.5.0", "aiohttp-session==2.12.1", "aiohttp-swagger==1.0.16", "aiojobs==1.4.0 ", - "aiosqlite==0.21.0", + "aiosqlite==0.22.1", "cryptography==46.0.3", "pyopenssl==25.3.0", "requests==2.32.5", @@ -74,7 +74,7 @@ 'click==8.3.1', 'shortuuid==1.0.13', 'tabulate==0.9.0', - 'aiomqtt==2.4.0', + 'aiomqtt==2.5.0', 'inquirer==3.4.1', 'colorama==0.4.6', 'psutil==7.1.3',