From 99835b68c8488a10b5295b822aa345dcd4d16f31 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Tue, 2 May 2023 22:27:11 +0100 Subject: [PATCH 01/20] Drop old python <3.7, add 3.11 to CI tests --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf86d52..484473f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} From df1fead5b309912765b7e752fd51a06204f59df6 Mon Sep 17 00:00:00 2001 From: Dave T Date: Tue, 2 May 2023 21:12:46 +0000 Subject: [PATCH 02/20] Add experimental support for TEMPer2_V3.7 --- temperusb/device_library.py | 5 +++++ temperusb/temper.py | 1 + 2 files changed, 6 insertions(+) diff --git a/temperusb/device_library.py b/temperusb/device_library.py index f6969f8..2d2bc4c 100644 --- a/temperusb/device_library.py +++ b/temperusb/device_library.py @@ -84,6 +84,11 @@ def __init__( hum_sens_offsets=None, type=TemperType.FM75, ), + "TEMPer2_V3.7": TemperConfig( + temp_sens_offsets=[2, 10], + hum_sens_offsets=None, + type=TemperType.FM75, + ), "TEMPer2V1.4": TemperConfig( temp_sens_offsets=[2], hum_sens_offsets=None, diff --git a/temperusb/temper.py b/temperusb/temper.py index f94cec4..dcfc965 100644 --- a/temperusb/temper.py +++ b/temperusb/temper.py @@ -19,6 +19,7 @@ VIDPIDS = [ (0x0c45, 0x7401), (0x0c45, 0x7402), + (0x1a86, 0xe025), ] REQ_INT_LEN = 8 ENDPOINT = 0x82 From d4a75051a2adeedd24d19f444ebd1d2c6ad01136 Mon Sep 17 00:00:00 2001 From: Dave T Date: Mon, 8 May 2023 09:57:29 +0000 Subject: [PATCH 03/20] Update permissions rule for new sensor id --- etc/99-tempsensor.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/99-tempsensor.rules b/etc/99-tempsensor.rules index 037a343..6a8986d 100644 --- a/etc/99-tempsensor.rules +++ b/etc/99-tempsensor.rules @@ -1,2 +1,3 @@ SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7401", MODE="666" SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7402", MODE="666" +SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="e025", MODE="666" From 19dd9f88ebde56da626df0cabe0536e6ec8d87e7 Mon Sep 17 00:00:00 2001 From: Philipp Born Date: Sun, 18 Jun 2023 15:44:05 +0200 Subject: [PATCH 04/20] feat(TemperDevice): add get_product function Signed-off-by: Philipp Born --- temperusb/temper.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/temperusb/temper.py b/temperusb/temper.py index dcfc965..d8c77a6 100644 --- a/temperusb/temper.py +++ b/temperusb/temper.py @@ -194,6 +194,12 @@ def set_sensor_count(self, count): self._sensor_count = int(count) + def get_product(self): + """ + Get device product name. + """ + return self._device.product + def get_ports(self): """ Get device USB ports. From 7043ba9ce0713c7cba34d4df0568d2c464e6ed03 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:16:02 +0000 Subject: [PATCH 05/20] Add python 3.12 to tests --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf86d52..f32f342 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.12"] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} From 403bb0e82f674523aea7e563f5782790a49d3b8b Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:17:44 +0000 Subject: [PATCH 06/20] Add python 3.11 to tests --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f32f342..26d35e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.12"] + python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} From 63e48f9ef628215b1172a3bc2fac39820c2f0753 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:37:47 +0000 Subject: [PATCH 07/20] Update compatible python versions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 43f547f..b9901ca 100644 --- a/README.md +++ b/README.md @@ -347,7 +347,7 @@ as seen on [Google+](https://plus.google.com/105569853186899442987/posts/N9T7xAj # Compatibility with Python versions -This should work on Python 3.5 and above. It was tested with Python 3.5, 3.6, 3.7, 3.8, 3.9, 3.10. +This should work on Python 3.7 and above. It was tested with Python 3.7, 3.8, 3.9, 3.10, 3.11, 3.12. # Authors From 8a86428fe46ad3bbae993f38584aa6bcef9121f1 Mon Sep 17 00:00:00 2001 From: Dave T Date: Tue, 2 May 2023 21:44:57 +0000 Subject: [PATCH 08/20] Add support for devcontainer development --- .devcontainer/Dockerfile | 22 +++++++++++++++++ .devcontainer/devcontainer.json | 43 +++++++++++++++++++++++++++++++++ .vscode/settings.json | 10 ++++++++ etc/99-tempsensor.rules | 1 - 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .vscode/settings.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..5e3b9e7 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,22 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.145.1/containers/python-3/.devcontainer/base.Dockerfile + +# [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6 +ARG VARIANT="3" +FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} + +# [Option] Install Node.js +ARG INSTALL_NODE="true" +ARG NODE_VERSION="lts/*" +RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image. +# COPY requirements.txt /tmp/pip-tmp/ +# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ +# && rm -rf /tmp/pip-tmp + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# [Optional] Uncomment this line to install global node packages. +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..581e30a --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,43 @@ +{ + "name": "Python 3", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + "args": { + // Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9 + "VARIANT": "3", + // Options + "INSTALL_NODE": "false", + "NODE_VERSION": "lts/*" + } + }, + "containerEnv": { + "PYTHONPATH": "." + }, + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "python.pythonPath": "/usr/local/bin/python", + "python.linting.enabled": true, + "python.linting.pylintEnabled": true, + "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", + "python.formatting.blackPath": "/usr/local/py-utils/bin/black", + "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", + "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", + "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", + "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", + "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", + "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", + "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint" + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python" + ] + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "pip3 install --user -r requirements.txt", + // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. + // "remoteUser": "vscode" +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..77694e9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "python.envFile": "${workspaceFolder}/.env", + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.nosetestsEnabled": false, + "python.testing.pytestEnabled": true, + "python.pythonPath": "/usr/local/bin/python", +} \ No newline at end of file diff --git a/etc/99-tempsensor.rules b/etc/99-tempsensor.rules index 6a8986d..037a343 100644 --- a/etc/99-tempsensor.rules +++ b/etc/99-tempsensor.rules @@ -1,3 +1,2 @@ SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7401", MODE="666" SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7402", MODE="666" -SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="e025", MODE="666" From e2a2c4e61a19bab5ddeb2eb54f7ac5b9e08b294e Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Tue, 19 Dec 2023 16:48:29 +0000 Subject: [PATCH 09/20] Update devcontainer spec using newer template --- .devcontainer/devcontainer.json | 55 ++++++++++----------------------- requirements.txt | 1 + requirements_test.txt | 4 +-- tests/__init__.py | 0 4 files changed, 20 insertions(+), 40 deletions(-) create mode 100644 requirements.txt create mode 100644 tests/__init__.py diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 581e30a..2babca0 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,43 +1,22 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python { "name": "Python 3", - "build": { - "dockerfile": "Dockerfile", - "context": "..", - "args": { - // Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9 - "VARIANT": "3", - // Options - "INSTALL_NODE": "false", - "NODE_VERSION": "lts/*" - } - }, - "containerEnv": { - "PYTHONPATH": "." - }, - // Set *default* container specific settings.json values on container create. - "settings": { - "terminal.integrated.shell.linux": "/bin/bash", - "python.pythonPath": "/usr/local/bin/python", - "python.linting.enabled": true, - "python.linting.pylintEnabled": true, - "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", - "python.formatting.blackPath": "/usr/local/py-utils/bin/black", - "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", - "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", - "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", - "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", - "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", - "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", - "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint" - }, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "ms-python.python" - ] + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye", + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "pip3 install --user -r requirements.txt", - // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. - // "remoteUser": "vscode" -} \ No newline at end of file + "postCreateCommand": "pip3 install --user -r requirements.txt -r requirements_test.txt", + + // Configure tool-specific properties. + "customizations": {} + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4f21f91 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pyusb==1.2.1 \ No newline at end of file diff --git a/requirements_test.txt b/requirements_test.txt index 3d2b9eb..448d54c 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,3 +1,3 @@ # Dependencies for running tests. -pytest -pyusb +pytest>=7.4.3 + diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 From eb048f87eae9ede97167ffe055ffd6f773d30a2b Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Tue, 19 Dec 2023 16:49:48 +0000 Subject: [PATCH 10/20] Remove unnecessary dockerfile --- .devcontainer/Dockerfile | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 5e3b9e7..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.145.1/containers/python-3/.devcontainer/base.Dockerfile - -# [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6 -ARG VARIANT="3" -FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} - -# [Option] Install Node.js -ARG INSTALL_NODE="true" -ARG NODE_VERSION="lts/*" -RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi - -# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image. -# COPY requirements.txt /tmp/pip-tmp/ -# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ -# && rm -rf /tmp/pip-tmp - -# [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends - -# [Optional] Uncomment this line to install global node packages. -# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 \ No newline at end of file From 87d89a083c77a45b26c561c1c9112dba47c4ed98 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Tue, 19 Dec 2023 16:51:28 +0000 Subject: [PATCH 11/20] Update 99-tempsensor.rules --- etc/99-tempsensor.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/99-tempsensor.rules b/etc/99-tempsensor.rules index 037a343..6a8986d 100644 --- a/etc/99-tempsensor.rules +++ b/etc/99-tempsensor.rules @@ -1,2 +1,3 @@ SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7401", MODE="666" SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7402", MODE="666" +SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="e025", MODE="666" From 84ed9dfe1e14c701506d8074c0176e02b4169633 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Tue, 19 Dec 2023 16:54:55 +0000 Subject: [PATCH 12/20] Add pyusb to test requirements. --- requirements.txt | 2 +- requirements_test.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4f21f91..7e2effa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -pyusb==1.2.1 \ No newline at end of file +pyusb==1.2.1 diff --git a/requirements_test.txt b/requirements_test.txt index 448d54c..8900955 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,3 +1,4 @@ # Dependencies for running tests. -pytest>=7.4.3 +pyusb==1.2.1 +pytest==7.4.3 From 441ab3104cf0829b74ee2754eb59c9d547f36a56 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Tue, 19 Dec 2023 20:53:35 +0000 Subject: [PATCH 13/20] Modify devcontainer to give access to usb devices --- .devcontainer/Dockerfile | 5 +++++ .devcontainer/devcontainer.json | 16 +++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..41fcd25 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,5 @@ +FROM mcr.microsoft.com/devcontainers/base:alpine-3.18 + +RUN apk add --no-cache \ + libusb=1.0.26-r2 \ + py3-pip=23.1.2-r0 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2babca0..3c46125 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,9 +1,12 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/python +// README at: https://github.com/devcontainers/templates/tree/main/src/alpine { - "name": "Python 3", + "name": "Python Alpine", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, @@ -14,9 +17,12 @@ // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "pip3 install --user -r requirements.txt -r requirements_test.txt", + // Priviledged mode is necessary to get access to usb + "runArgs": ["--privileged"] + // Configure tool-specific properties. - "customizations": {} + // "customizations": {}, // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" + //"remoteUser": "root" } From e3e10e8148176679f81c562e7bbefb3ebed42843 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:44:41 +0000 Subject: [PATCH 14/20] Update CHANGELOG.md --- CHANGELOG.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ee86c2..07a6bc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,16 @@ All notable changes to this project will be documented in this file. No changes yet. -## [1.6.0] +## [1.6.1] - 2023-12-19 +### Added +- Support for for TEMPer2V1.3 +- Support for TEMPerHumiV1.1 +- Support for TEMPerHumiV1.0 +- Experimental support for TEMPer2_V3.7 +- get_product() function to get product name +- Updates to documentation + +## [1.6.0] - 2021-11-03 ### Added - A new architecture for supporting different device types. - Tests using pytest From 08cafca21b7b209157dce08bdd1c95b0c8a00188 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Tue, 19 Dec 2023 21:05:22 +0000 Subject: [PATCH 15/20] Update version info --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 4360b85..b1cb6c9 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ author='Philipp Adelt', author_email='autosort-github@philipp.adelt.net ', url='https://github.com/padelt/temper-python', - version='1.6.0', + version='1.6.1', description='Reads temperature from TEMPerV1 devices (USB 0c45:7401)', long_description=open('README.md', encoding='utf-8').read(), long_description_content_type='text/markdown', @@ -24,7 +24,6 @@ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', - 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', ], ) From d30bf8b4c072bfc6d66e56a360f11853ccaf6b3d Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Thu, 21 Dec 2023 22:14:35 +0000 Subject: [PATCH 16/20] Add publish script --- .devcontainer/devcontainer.json | 7 ++++++- scripts/publish_to_pypi.sh | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100755 scripts/publish_to_pypi.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3c46125..b8c8fea 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,11 +18,16 @@ "postCreateCommand": "pip3 install --user -r requirements.txt -r requirements_test.txt", // Priviledged mode is necessary to get access to usb - "runArgs": ["--privileged"] + "runArgs": ["--privileged"], // Configure tool-specific properties. // "customizations": {}, // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. //"remoteUser": "root" + + // Access local .pypi api keys + "mounts": [ + "source=${localEnv:HOME}${localEnv:USERPROFILE}/.pypirc,target=/home/vscode/.pypirc,type=bind,consistency=cached" + ] } diff --git a/scripts/publish_to_pypi.sh b/scripts/publish_to_pypi.sh new file mode 100755 index 0000000..3d1b860 --- /dev/null +++ b/scripts/publish_to_pypi.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Script to automate publishing to pypi +# Dave T 2023-12-21 +pypi_config_file=~/.pypirc + +pip install twine + +if [ ! -f dist/*.tar.gz ]; then + echo "No releases found. Please run python3 -m setup.py sdist" + exit +fi +twine check dist/* + +echo "Ready to publish." +echo "Default is publishing to testpypi." +read -r -p "If you are fully ready, please publish to pypi by typing 'thisisnotatest': " response +echo "response=$response" +if [ "$response" = "thisisnotatest" ]; then + repository=pypi +else + repository=testpypi +fi + +if [ -f $pypi_config_file ]; then + echo "Using $pypi_config_file for API keys" +else + echo "$pypi_config_file not found, please paste pypi API token below:" + read twine_api_key + export TWINE_USERNAME=__token__ + export TWINE_PASSWORD=$twine_api_key +fi +echo "Publishing to $repository..." +twine upload --repository $repository dist/* +echo "Publishing complete!" +echo +echo "Don't forget to tag this release!" \ No newline at end of file From 75d356ed4ea348ff1d61365d43dffa6aa6078725 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Thu, 21 Dec 2023 22:20:30 +0000 Subject: [PATCH 17/20] Correct typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07a6bc0..155de48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ No changes yet. ## [1.6.1] - 2023-12-19 ### Added -- Support for for TEMPer2V1.3 +- Support for TEMPer2V1.3 - Support for TEMPerHumiV1.1 - Support for TEMPerHumiV1.0 - Experimental support for TEMPer2_V3.7 From 7a26fd21806a434bbe81495173b1d1cfccbe6fd2 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Sun, 18 Aug 2024 21:30:46 +0100 Subject: [PATCH 18/20] Add new sensor TEMPer2_M12_V1.3 --- temperusb/device_library.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/temperusb/device_library.py b/temperusb/device_library.py index 2d2bc4c..d1f0b26 100644 --- a/temperusb/device_library.py +++ b/temperusb/device_library.py @@ -84,6 +84,11 @@ def __init__( hum_sens_offsets=None, type=TemperType.FM75, ), + "TEMPer2_M12_V1.3": TemperConfig( + temp_sens_offsets=[2, 4], + hum_sens_offsets=None, + type=TemperType.FM75, + ), "TEMPer2_V3.7": TemperConfig( temp_sens_offsets=[2, 10], hum_sens_offsets=None, From 7638c7e7bec83f841957bc4875b7567a3002a289 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Thu, 9 Jan 2025 22:58:06 +0000 Subject: [PATCH 19/20] Support python 3.13, drop 3.7 --- .github/workflows/ci.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f32ca9..355f7c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} diff --git a/README.md b/README.md index b9901ca..ea57c0d 100644 --- a/README.md +++ b/README.md @@ -347,7 +347,7 @@ as seen on [Google+](https://plus.google.com/105569853186899442987/posts/N9T7xAj # Compatibility with Python versions -This should work on Python 3.7 and above. It was tested with Python 3.7, 3.8, 3.9, 3.10, 3.11, 3.12. +This should work on Python 3.8 and above. It was tested with Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13. # Authors From 6a47e0a09337727c452ef4681e6bd7b295f66695 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Thu, 9 Jan 2025 22:52:13 +0000 Subject: [PATCH 20/20] Add TEMPer2_M12_V1.3 --- temperusb/device_library.py | 5 +++++ tests/test_temper.py | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/temperusb/device_library.py b/temperusb/device_library.py index d1f0b26..90cdebb 100644 --- a/temperusb/device_library.py +++ b/temperusb/device_library.py @@ -99,6 +99,11 @@ def __init__( hum_sens_offsets=None, type=TemperType.FM75, ), + "TEMPer2_M12_V1.3": TemperConfig( + temp_sens_offsets=[2, 4], + hum_sens_offsets=None, + type=TemperType.FM75, + ), # The config used if the sensor type is not recognised. # If your sensor is working but showing as unrecognised, please # add a new entry above based on "generic_fm75" below, and submit diff --git a/tests/test_temper.py b/tests/test_temper.py index 408269a..e0c8a59 100644 --- a/tests/test_temper.py +++ b/tests/test_temper.py @@ -66,6 +66,16 @@ [32.1], None, ], + [ + "TEMPer2_M12_V1.3", + 0x0C45, + 0x7401, + 2, + b"\x01\x80\x33\x01\x00\x00\x00\x00", + b"\x00\x00\x20\x1A\x2B\x33", # 0x201A,0x2B33 converts to 32.1C, 43.2C (fm75) + [32.1, 43.2], + None, + ], [ "TEMPer1F_V1.3", # Has 1 sensor at offset 4 0x0C45,