Files
SmartThings-Local/.env.example
T
Jack Nagy 709fdf444d Refactor to polling-first architecture with OBSERVE as accelerator
State freshness now comes from a tiered PollScheduler over the persistent
DTLS session; OBSERVE registrations are kept as an opportunistic
acceleration layer. Behaviour is identical online vs air-gapped except
for worst-case freshness latency.

Adds three modules:
- StateCache: single source of truth, source-tagged change events
- PollScheduler: hot/warm/cold + sweep tiers, write-defer past the
  fetchback-revert window, per-window RTT/slow-poll tracking
- KeepaliveTask: CoAP empty-CON ping with consecutive-fail detection
  driving MQTT availability

Bridge publishes per-appliance diagnostic entities (Push Active, Last
Update Source, Poll Max RTT, Slow Polls, Poll Errors, Stalest Resource
Age, Last OBSERVE Age) under HA's Diagnostic section. Tier cadences
are descriptor-declared, calibrated against measured per-firmware
ceilings (dryer ~14 req/s, oven ~8 req/s via probe_poll_rate_combined.py).

Drops HEARTBEAT_INTERVAL_S in favour of the descriptor-declared sweep
tier; PING_INTERVAL_S now consumed by KeepaliveTask inside the bridge
rather than driven from main.py.

README explains the push/poll split and what happens when the appliance
is blocked from internet.
2026-06-03 18:38:04 +01:00

64 lines
2.1 KiB
Bash

# SmartThings-Local Bridge config.
# Copy to `.env` and fill in. Never commit `.env`.
# =============================================================
# Appliances — one process supervises N appliances over DTLS.
# =============================================================
# APPLIANCE_COUNT defines how many entries to read. Per-appliance
# keys are 1-indexed (APPLIANCE_1_*, APPLIANCE_2_*, …).
APPLIANCE_COUNT=1
# Appliance 1 — Samsung dryer
APPLIANCE_1_CLASS=dryer
APPLIANCE_1_IP=192.168.1.100
# Leave OCF_PORT blank to inherit the descriptor's default
# (dryer=49155, oven=49154).
APPLIANCE_1_OCF_PORT=
APPLIANCE_1_TOPIC=samsung_dryer
APPLIANCE_1_NAME=Samsung Dryer
# Future:
# APPLIANCE_2_CLASS=oven
# APPLIANCE_2_IP=192.168.1.101
# APPLIANCE_2_OCF_PORT=
# APPLIANCE_2_TOPIC=samsung_oven
# APPLIANCE_2_NAME=Samsung Oven
# (Don't forget to bump APPLIANCE_COUNT=2.)
# --- Cert paths ---
# Defaults work for Docker (mount as /config) and bare-metal (drop
# into ./certs). The ab0b0ac4 admin-override cert + key are built by
# local-tools/setup_samsung_cloud_cert.py.
# CERT_PATH=./certs/ab0b0ac4_fullchain.pem
# KEY_PATH=./certs/ab0b0ac4.key
# --- MQTT broker (HA Mosquitto add-on or any broker) ---
MQTT_BROKER=192.168.1.5
MQTT_PORT=1883
MQTT_USER=samsung_bridge
MQTT_PASS=
# HA discovery prefix — must match the MQTT integration's setting in HA
# (default `homeassistant`).
HA_DISCOVERY_PREFIX=homeassistant
# Bridge timers (seconds).
# HEALTH_INTERVAL_S — how often <prefix>/bridge/health republishes.
# PING_INTERVAL_S — CoAP empty-CON ping cadence (DTLS-layer
# liveness). Three consecutive failures publish
# availability=offline.
# State freshness itself comes from the in-bridge PollScheduler whose
# tier cadences are declared in the appliance descriptor — there is
# no top-level heartbeat env var to tune.
HEALTH_INTERVAL_S=60
PING_INTERVAL_S=25
# Container TZ.
TZ=Europe/London
# --- Deploy (deploy.sh — tar + ssh docker compose) ---
SSH_HOST=user@your-server
REMOTE_DIR=/mnt/user/compose/smartthings-local
APPDATA_DIR=/mnt/user/appdata/smartthings-local