Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ venv/
.envrc
.superpowers/
.last_config
configs/rates/rates_cache.yaml

# Roadmap and planning docs (not published yet)
span_panel_simulator/docs/roadmap/
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "span-panel-simulator"
version = "1.0.7"
version = "1.0.8"
description = "Standalone eBus simulator for SPAN panels"
requires-python = ">=3.12"
dependencies = [
Expand Down
7 changes: 5 additions & 2 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ BROKER_PASSWORD="${BROKER_PASSWORD:-sim-password}"
ADVERTISE_ADDRESS="${ADVERTISE_ADDRESS:-}"

echo "==> Generating TLS certificates..."
export CERT_DIR
export ADVERTISE_ADDRESS
python -c "
import os
from span_panel_simulator.certs import generate_certificates
from pathlib import Path
addr = '${ADVERTISE_ADDRESS}' or None
generate_certificates(Path('${CERT_DIR}'), advertise_address=addr)
addr = os.environ.get('ADVERTISE_ADDRESS') or None
generate_certificates(Path(os.environ['CERT_DIR']), advertise_address=addr)
"

# Mosquitto runs as the 'mosquitto' user — ensure it can read certs
Expand Down
6 changes: 4 additions & 2 deletions scripts/run-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ ensure_venv() {
generate_certs() {
echo "==> Checking TLS certificates..."
mkdir -p "${CERT_DIR}"
python3 -c "
ADVERTISE_ADDRESS="${ADVERTISE_ADDR}" CERT_DIR="${CERT_DIR}" python3 -c "
import os
from span_panel_simulator.certs import generate_certificates
from pathlib import Path
generate_certificates(Path('${CERT_DIR}'), advertise_address='${ADVERTISE_ADDR}')
addr = os.environ.get('ADVERTISE_ADDRESS') or None
generate_certificates(Path(os.environ['CERT_DIR']), advertise_address=addr)
"
}

Expand Down
2 changes: 1 addition & 1 deletion span_panel_simulator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ EXPOSE 18883 8081 18080
LABEL io.hass.name="SPAN Panel Simulator" \
io.hass.description="Simulates a SPAN electrical panel for testing and upgrade modeling" \
io.hass.type="addon" \
io.hass.version="1.0.7" \
io.hass.version="1.0.8" \
io.hass.arch="aarch64|amd64"

CMD ["/run.sh"]
2 changes: 1 addition & 1 deletion span_panel_simulator/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "SPAN Panel Simulator"
description: "Simulates a SPAN electrical panel for testing and upgrade modeling"
version: "1.0.7"
version: "1.0.8"
slug: "span_panel_simulator"
url: "https://github.com/SpanPanel/simulator"
image: "ghcr.io/spanpanel/simulator/{arch}"
Expand Down
9 changes: 6 additions & 3 deletions span_panel_simulator/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ BASE_HTTP_PORT=$(jq -r '.base_http_port // 8081' "${OPTIONS_FILE}")

# Auto-detect host IP for TLS cert SAN.
# Inside a bridge-networked container the default gateway is the host.
ADVERTISE_ADDRESS=$(ip route | awk '/default/ { print $3 }' || true)
# Strip control characters — some container ip implementations emit trailing
# non-printables that would break Python string literals or cert generation.
ADVERTISE_ADDRESS=$(ip route | awk '/default/ { print $3 }' | tr -d '[:cntrl:]' || true)
export ADVERTISE_ADDRESS
export CERT_DIR="/data/certs"
export BROKER_USERNAME="span"
Expand All @@ -43,10 +45,11 @@ mkdir -p "${CERT_DIR}"

# Generate TLS certs
python3 -c "
import os
from span_panel_simulator.certs import generate_certificates
from pathlib import Path
addr = '${ADVERTISE_ADDRESS}' or None
generate_certificates(Path('${CERT_DIR}'), advertise_address=addr)
addr = os.environ.get('ADVERTISE_ADDRESS') or None
generate_certificates(Path(os.environ['CERT_DIR']), advertise_address=addr)
"

chmod 644 "${CERT_DIR}"/*.crt "${CERT_DIR}"/*.key
Expand Down
2 changes: 1 addition & 1 deletion src/span_panel_simulator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Standalone eBus simulator for SPAN panels."""

__version__ = "1.0.7"
__version__ = "1.0.8"
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading