Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
61 changes: 30 additions & 31 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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/[email protected]
- name: Checkout repository
uses: actions/[email protected]

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
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@v3
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@v3
# 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@v3

# 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@v3
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: Add-on Lint

on:
push:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
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
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Tekmar Packet Server (tekmar-packetserv)

![Supports aarch64 Architecture][aarch64-shield]
![Supports amd64 Architecture][amd64-shield]
![Supports armhf Architecture][armhf-shield]
Expand Down Expand Up @@ -34,7 +35,7 @@ This Add-On is part of the Tekmar 482 Integration. Install this integration toge
## 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.

Expand Down
9 changes: 9 additions & 0 deletions tekmar_packetserv/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
# Changelog

## 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.
12 changes: 8 additions & 4 deletions tekmar_packetserv/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This Add-On requires additional hardware:

This Add-On is part of the Tekmar 482 Integration. Install this integration together with the add-on:

https://github.com/WillCodeForCats/tekmar-482
[https://github.com/WillCodeForCats/tekmar-482](https://github.com/WillCodeForCats/tekmar-482)

## Configuration

Expand All @@ -32,17 +32,21 @@ communicate with the Add-On across your LAN.
### Serial Port Configuration

Serial Port Mode: device

- For a locally connected USB to serial adapter

Serial Port Mode: socket

- For a IP to serial port server using a TCP socket connection.

Serial Port Mode: rfc2217

- For a IP to serial port server using a TCP connection using the RFC2217 protocol.

For "socket" and "rfc2217" types you will also need to configure the parameters for Serial Server IP and Serial Server Port.

On IP-to-Serial servers use "9600,8,N,1" for the serial port:

- Baud Rate 9600
- Eight Bits
- No Parity
Expand All @@ -51,13 +55,13 @@ On IP-to-Serial servers use "9600,8,N,1" for the serial port:
## Known Issues and Limitations

- If serial communications are lost the packet server won't show an error until the next
new incoming connection.
new incoming connection.
- Any errors will cause the packet server to stop, and it will need to be
restarted manually or by enabling the "watchdog" option.
restarted manually or by enabling the "watchdog" option.

## 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.
31 changes: 24 additions & 7 deletions tekmar_packetserv/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,31 @@ FROM $BUILD_FROM

ENV LANG C.UTF-8

ARG TEMPIO_VERSION BUILD_ARCH
ARG TEMPIO_VERSION
ARG BUILD_ARCH

# Install tempio and Python dependencies in a single layer
RUN \
# Install system packages
apk add --no-cache \
python3 \
py3-pip \
curl && \
# Download and install tempio with error handling
curl -sSLf -o /usr/bin/tempio \
"https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}"

# Install requirements for add-on
RUN apk add --no-cache python3
RUN apk add --no-cache py3-pip
RUN pip3 --no-cache-dir install pyserial
"https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}" || \
(echo "ERROR: Failed to download tempio from GitHub releases" && \
echo "URL: https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}" && \
echo "TEMPIO_VERSION: ${TEMPIO_VERSION}" && \
echo "BUILD_ARCH: ${BUILD_ARCH}" && \
exit 1) && \
# Verify the download was successful and file exists
test -f /usr/bin/tempio || \
(echo "ERROR: tempio binary was not downloaded successfully" && exit 1) && \
chmod +x /usr/bin/tempio && \
# Install Python packages
pip3 --no-cache-dir install pyserial==3.5 && \
# Clean up
rm -rf /var/cache/apk/*

COPY rootfs /
6 changes: 3 additions & 3 deletions tekmar_packetserv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ This is a Home Assistant Add-On used by the [Tekmar Gateway 482 Integration](htt

Install this integration together with the add-on:

https://github.com/WillCodeForCats/tekmar-482
[https://github.com/WillCodeForCats/tekmar-482](https://github.com/WillCodeForCats/tekmar-482)

### 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: [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.
27 changes: 13 additions & 14 deletions tekmar_packetserv/rootfs/usr/local/packetserv/fields.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 8 additions & 8 deletions tekmar_packetserv/rootfs/usr/local/packetserv/packet.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Packet server application. """
"""Packet server application."""

import datetime
import ipaddress
Expand Down
11 changes: 5 additions & 6 deletions tekmar_packetserv/rootfs/usr/local/packetserv/tpck.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading