An ESPHome external component that connects an ESP32 directly to a Beszel Hub as a lightweight outbound WebSocket agent. It does not require an inbound port or a separate Beszel agent process.
- Beszel Hub 0.21.1 or newer
- ESPHome 2026.10.0 or newer
- ESP-IDF framework
- ESP32, ESP32-C3, or ESP32-S3
Arduino and other ESP32 variants are rejected during configuration. The component uses ESPHome's selected managed libsodium version, shared with API encryption (1.10021.12 in ESPHome 2026.10.0). Earlier ESPHome releases require an earlier component revision.
Add this repository as an external component:
external_components:
- source: github://danez/esphome-beszel
components: [beszel]Then configure the Hub connection:
beszel:
hub: https://beszel.example.com
token: !secret beszel_token
key: !secret beszel_hub_public_keyhub may be the Hub base URL or the complete /api/beszel/agent-connect
endpoint. HTTPS is converted to secure WebSocket transport automatically.
To register one device manually, open Add System in Beszel and copy its
token and Ed25519 public key. To let the device create its own system, enable a
universal token under Settings → Tokens & fingerprints and copy that token
and its public key instead. Keep tokens in ESPHome's secrets.yaml; neither
value needs to be committed.
The connection state can be exposed to Home Assistant:
text_sensor:
- platform: beszel
status:
name: Beszel StatusIt publishes only disconnected, connecting, authenticating, or
connected. State publication occurs from ESPHome's main loop, not from the
WebSocket callback task. Its entity category defaults to diagnostic and can be
overridden in the entity configuration.
The lowest observed WebSocket-task stack headroom during authentication can also be exposed as a diagnostic sensor:
sensor:
- platform: beszel
stack_headroom:
name: Beszel Stack HeadroomThe value is reported in bytes after authentication attempts. Lower values mean
the task came closer to exhausting its stack. Its entity category also defaults
to diagnostic and can be overridden.
The component reports:
- internal heap total and usage in exact bytes, plus usage percentage
- physical flash capacity and running firmware image size
- monotonic uptime
- built-in chip temperature as
SoC, when available - Wi-Fi signal strength in dBm and connected SSID
- ESPHome and ESP-IDF versions, chip model, core and CPU socket counts, and node name
CPU usage, network throughput, filesystem usage, containers, load, swap, battery, and other unavailable metrics are deliberately not fabricated. Memory uses Beszel 0.21.1's byte counters so sub-megabyte heaps retain their precision in charts and aggregated records. Deprecated GiB memory fields are not sent; older Hubs are no longer supported. Network monitoring is not supported; the component advertises the 0.19 agent capability level so the Hub does not expose or request that feature. This capability level is independent of the minimum supported Hub version.
Wi-Fi signal reporting is automatic and independent of network monitoring. It
uses the station interface name sta and includes the connected SSID when it is
non-empty and valid UTF-8, matching the official agent. Failed or disconnected
Wi-Fi readings are omitted; no extra ESPHome sensor is needed.
On an esp32dev build with ESPHome 2026.9.0 and ESP-IDF 5.5.5, adding the
component increases the firmware image by approximately 139 KiB when ESPHome API
encryption is enabled, or 150 KiB without API encryption. The smaller increase
with API encryption is because libsodium is already linked into the firmware.
These figures include the component's secure WebSocket, TLS, and cryptographic
dependencies.
Secure connections use ESP-IDF's built-in Common CA bundle and verify the Hub certificate. This works with publicly trusted certificates such as Let's Encrypt. Custom CA certificates are not supported in the first release, and certificate verification cannot be disabled.
HTTPS is required. Plain http:// URLs are rejected because they would expose
the token and WebSocket traffic without transport encryption.
The Hub authenticates by signing the configured token with Ed25519. The agent uses the factory Wi-Fi MAC to derive a stable fingerprint for per-system and universal-token registration.
Point ESPHome at the repository's component directory:
external_components:
- source:
type: local
path: ../componentsThe complete development configurations are in examples/. Create
examples/secrets.yaml with wifi_ssid, wifi_password, noise_key,
beszel_token, and beszel_hub_public_key, then compile with:
esphome compile examples/esp32.yaml
esphome compile examples/esp32-c3.yaml
esphome compile examples/esp32-s3.yamlThe ESP32-S3 example also demonstrates sharing ESPHome's internal_temperature
sensor. Without one, Beszel creates a hidden reader; it never exposes a second
Home Assistant temperature entity.
MIT