Activate sml2mqtt bridge (privileged USB access, stdout logging, replicas 1) #84

Merged
k.renner merged 1 commits from worktree-ha-meter-mqtt-bridge into master 2026-06-27 20:59:41 +00:00
Owner

Phase 2 — activate the meter bridge (edl21 now disabled, port free)

Follow-up to #83. EDL21 has been disabled in HA, freeing the meter's serial port, so the dormant bridge is activated. Three fixes found during bring-up:

  • logging.file: stdout (was ''). Empty string made sml2mqtt open the /sml2mqtt config directory as a logfile → IsADirectoryError crashloop. stdout sends logs to the container console.
  • securityContext.privileged: true (+ runAsUser: 0). The device is root:root 0600 and the device cgroup blocks a hostPath-mounted char device for non-privileged containers even as root. No device-plugin exists; the existing USB pods (zwave-js, home-assistant) already use this exact privileged pattern. User-approved.
  • replicas: 0 → 1 — port is free, no edl21 contention.

After merge

Bridge starts reading the meter and publishing to sml2mqtt/# on Mosquitto. I'll then observe the actual topics/device-id, add HA mqtt: sensors in the homeassistant repo reusing the old entity_ids (history-preserving), and finally evict HA from edge.

kubectl kustomize kubernetes/apps/home-assistant builds clean.

Generated with Claude Code

## Phase 2 — activate the meter bridge (edl21 now disabled, port free) Follow-up to #83. EDL21 has been disabled in HA, freeing the meter's serial port, so the dormant bridge is activated. Three fixes found during bring-up: - **`logging.file: stdout`** (was `''`). Empty string made sml2mqtt open the `/sml2mqtt` config *directory* as a logfile → `IsADirectoryError` crashloop. `stdout` sends logs to the container console. - **`securityContext.privileged: true`** (+ `runAsUser: 0`). The device is `root:root 0600` **and** the device cgroup blocks a hostPath-mounted char device for non-privileged containers even as root. No device-plugin exists; the existing USB pods (`zwave-js`, `home-assistant`) already use this exact privileged pattern. **User-approved.** - **`replicas: 0 → 1`** — port is free, no edl21 contention. ### After merge Bridge starts reading the meter and publishing to `sml2mqtt/#` on Mosquitto. I'll then observe the actual topics/device-id, add HA `mqtt:` sensors in the `homeassistant` repo reusing the old entity_ids (history-preserving), and finally evict HA from edge. `kubectl kustomize kubernetes/apps/home-assistant` builds clean. Generated with Claude Code
k.renner added 1 commit 2026-06-27 20:59:16 +00:00
edl21 has been disabled in HA, freeing the meter's serial port, so the
bridge is activated for the cutover.

Three fixes from bring-up testing:
- logging.file: stdout (was ''). Empty string made sml2mqtt try to open
  the /sml2mqtt config dir as a log file (IsADirectoryError crash loop).
  'stdout' routes logs to the container console for kubectl/Loki.
- securityContext.privileged: true (with runAsUser 0). The meter device
  is root:root 0600, AND the device cgroup blocks a hostPath-mounted char
  device for non-privileged containers even as root. There is no
  device-plugin in the cluster; the existing USB pods (zwave-js, HA) use
  the same privileged pattern. User-approved.
- replicas: 0 -> 1 (port is now free; no edl21 contention).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
k.renner merged commit 5d1764562e into master 2026-06-27 20:59:41 +00:00
Sign in to join this conversation.