diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 396f7d5..a339b1e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,10 +1,9 @@ --- name: Bug report about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - +title: "" +labels: "" +assignees: "" --- Before reporting a bug, make sure you are running the latest version of `tekmar-packetserv` add-on and the `tekmar-482` integration. @@ -22,9 +21,10 @@ If applicable, add screenshots of the problem and/or configuration. Copy any log messages/errors from the Home Assistant add-on logs. **Home Assistant (please complete the following information):** - - Home Assistant Core Version: - - Gateway 482 Firmware Version: - - Gateway 482 Protocol Version: + +- Home Assistant Core Version: +- Gateway 482 Firmware Version: +- Gateway 482 Protocol Version: **Additional context** Add any other context about the problem here. diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5b0c769..4552c12 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,12 +13,12 @@ name: "CodeQL" on: push: - branches: [ main ] + branches: [main] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [main] schedule: - - cron: '17 20 * * 6' + - cron: "17 20 * * 6" jobs: analyze: @@ -32,41 +32,40 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'python' ] + language: ["python"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout@v6.0.2 + - name: Checkout repository + uses: actions/checkout@v6.0.2 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v4 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v4 + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v4 - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..fbf6d9d --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,31 @@ +--- +name: Lint Code Base +on: + push: + pull_request: + branches: + - main +permissions: read-all +jobs: + build: + name: Lint Code Base + runs-on: ubuntu-latest + permissions: + contents: read + packages: read + statuses: write + steps: + - name: Checkout Code + uses: actions/checkout@v5 + with: + fetch-depth: 0 + - name: Lint Code Base + uses: github/super-linter@v7 + env: + VALIDATE_ALL_CODEBASE: true + VALIDATE_JSCPD: false + VALIDATE_PYTHON_MYPY: false + VALIDATE_PYTHON_PYLINT: false + VALIDATE_PYTHON_PYINK: false + DEFAULT_BRANCH: main + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.hadolint.yaml b/.hadolint.yaml new file mode 100644 index 0000000..99819b5 --- /dev/null +++ b/.hadolint.yaml @@ -0,0 +1,12 @@ +--- +ignored: + - DL3003 + - DL3006 + - DL3007 + - DL3008 + - DL3013 + - DL3018 + - DL3042 + - DL4006 + - SC2046 + - SC2086 diff --git a/README.md b/README.md index 7a7c68b..3dee7c2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Tekmar Packet Server (tekmar-packetserv) + ![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] @@ -31,9 +32,9 @@ This App is part of the Tekmar 482 Integration. Install this integration togethe ## Credits Implemented using "tN4 Gateway 482 - Custom Integration Tools" and "Tekmar Home Automation -(tHA) Protocol" from: https://www.watts.com/products/hvac-hot-water-solutions/controls/control-accessories/482/482 +(tHA) Protocol" from: [https://www.watts.com/products/hvac-hot-water-solutions/controls/control-accessories/482/482](https://www.watts.com/products/hvac-hot-water-solutions/controls/control-accessories/482/482) Tekmar, tekmarNet, tN4, tN2, and related logos and trademarks are copyright 2021 Watts. [aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg -[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg \ No newline at end of file +[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg diff --git a/tekmar_packetserv/CHANGELOG.md b/tekmar_packetserv/CHANGELOG.md index cfabcdb..52f8835 100644 --- a/tekmar_packetserv/CHANGELOG.md +++ b/tekmar_packetserv/CHANGELOG.md @@ -1,51 +1,64 @@ # Changelog ## 1.3.3 + - Update to base 3.23 - Addons are now Apps - Bind socket to docker container IP - Migrate from deprecated home-assistant/builder action ## 1.3.2 + - Detect IPv4 mapped IPv6 - Additional logging ## 1.3.1 + - Update to base 3.19 - Remove tempio - Use alpine pyserial package ## 1.3.0 + - Drop support for armhf, armv7, and i386 architectures. ## 1.2.2 + - Update documentation. ## 1.2.1 + - Update S6-Overlay structure - Fixes reloading on serial port errors ## 1.2.0 + - Add Socket and RFC2217 serial options. ## 1.1.0 + - Add custom apparmor file. - S6-Overlay 3.x ## 1.0.2 + - Add EN translation. ## 1.0.1 + - Add allowed IP address (CIDR format) setting for security. ## 1.0.0 + - First stable release. ## 0.9.1 through 0.9.9 + - Fine tuning on errors. - Internal cleanup for use as add-on. - Test with bad input sent to packet server - Test for USB serial unplugged while running ## 0.9.0 + - First test version. diff --git a/tekmar_packetserv/DOCS.md b/tekmar_packetserv/DOCS.md index 0c60429..7a6990c 100644 --- a/tekmar_packetserv/DOCS.md +++ b/tekmar_packetserv/DOCS.md @@ -20,7 +20,7 @@ Or an IP to Serial connection: This App is part of the Tekmar 482 Integration. Install this integration together with the App: -https://github.com/WillCodeForCats/tekmar-482 +[https://github.com/WillCodeForCats/tekmar-482](https://github.com/WillCodeForCats/tekmar-482) ## Configuration @@ -68,6 +68,6 @@ On IP-to-Serial servers use "9600,8,N,1" for the serial port: ## Credits Implemented using "tN4 Gateway 482 - Custom Integration Tools" and "Tekmar Home Automation -(tHA) Protocol" from: https://www.watts.com/products/hvac-hot-water-solutions/controls/control-accessories/482/482 +(tHA) Protocol" from: [https://www.watts.com/products/hvac-hot-water-solutions/controls/control-accessories/482/482](https://www.watts.com/products/hvac-hot-water-solutions/controls/control-accessories/482/482) Tekmar, tekmarNet, tN4, tN2, and related logos and trademarks are copyright 2021 Watts. diff --git a/tekmar_packetserv/README.md b/tekmar_packetserv/README.md index 00baa78..f525c11 100644 --- a/tekmar_packetserv/README.md +++ b/tekmar_packetserv/README.md @@ -4,13 +4,13 @@ This is a Home Assistant App used by the [Tekmar Gateway 482 Integration](https: Install this integration together with the App: -https://github.com/WillCodeForCats/tekmar-482 + Important: This App can only be used with the Gateway 482. The touchscreen Gateway 486 IS NOT compatible because it doesn't have a local API. -### Credits +## Credits Implemented using "tN4 Gateway 482 - Custom Integration Tools" and "Tekmar Home Automation -(tHA) Protocol" from: https://www.watts.com/products/hvac-hot-water-solutions/controls/control-accessories/482/482 +(tHA) Protocol" from: Tekmar, tekmarNet, tN4, tN2, and related logos and trademarks are copyright 2021 Watts. diff --git a/tekmar_packetserv/rootfs/usr/local/packetserv/fields.py b/tekmar_packetserv/rootfs/usr/local/packetserv/fields.py index 0673b58..9d1951e 100755 --- a/tekmar_packetserv/rootfs/usr/local/packetserv/fields.py +++ b/tekmar_packetserv/rootfs/usr/local/packetserv/fields.py @@ -1,22 +1,21 @@ -""" Field identifying and parsing. +"""Field identifying and parsing. - The contents of this module allow the specifcation of formats of arrays - of bytes (similar to the python's struct module), but with more - granularity. +The contents of this module allow the specifcation of formats of arrays +of bytes (similar to the python's struct module), but with more +granularity. - Each field basically has two properties: a name and a size (in bytes). +Each field basically has two properties: a name and a size (in bytes). - Each field has basically two methods: pack and unpack. +Each field has basically two methods: pack and unpack. - The unpack method takes a sequence of bytes and unpacks the data into - a list of values. The method returns the unpacked list and any trailing - (packed) data as a tuple. - - The pack method takes a sequence of values and packs them into a list of - bytes. The method returns the packed list and any extra values as a - tuple. - """ +The unpack method takes a sequence of bytes and unpacks the data into +a list of values. The method returns the unpacked list and any trailing +(packed) data as a tuple. +The pack method takes a sequence of values and packs them into a list of +bytes. The method returns the packed list and any extra values as a +tuple. +""" # ****************************************************************************** LITTLE_ENDIAN = False diff --git a/tekmar_packetserv/rootfs/usr/local/packetserv/packet.py b/tekmar_packetserv/rootfs/usr/local/packetserv/packet.py index 5649c17..5773f40 100755 --- a/tekmar_packetserv/rootfs/usr/local/packetserv/packet.py +++ b/tekmar_packetserv/rootfs/usr/local/packetserv/packet.py @@ -1,14 +1,14 @@ -""" Packet object. +"""Packet object. - Basically a packet has a type and some data and is represented in two - forms: its raw (object) form and in string form. +Basically a packet has a type and some data and is represented in two +forms: its raw (object) form and in string form. - In string form, it looks like a sequence of hex bytes, e.g. - 0102030F\n +In string form, it looks like a sequence of hex bytes, e.g. + 0102030F\n - The 01 is the packet type and 02, 03, and 0F is the packet data. A - packet is always delimited by a newline character (in string form). - """ +The 01 is the packet type and 02, 03, and 0F is the packet data. A +packet is always delimited by a newline character (in string form). +""" # ****************************************************************************** from fields import FieldList, Int8 diff --git a/tekmar_packetserv/rootfs/usr/local/packetserv/tpck.py b/tekmar_packetserv/rootfs/usr/local/packetserv/tpck.py index eef24fb..c779c31 100755 --- a/tekmar_packetserv/rootfs/usr/local/packetserv/tpck.py +++ b/tekmar_packetserv/rootfs/usr/local/packetserv/tpck.py @@ -1,10 +1,9 @@ -""" Allow reading and writing of packets using the tpck protocol. - - The tpck protocol provides data delimiting and validation for - communication links that can not support the simplicity of the - string-based packet transfer. - """ +"""Allow reading and writing of packets using the tpck protocol. +The tpck protocol provides data delimiting and validation for +communication links that can not support the simplicity of the +string-based packet transfer. +""" # ****************************************************************************** import packet