Zum Inhalt springen

Solution · Home Assistant

Your Energy dashboard needs per-circuit sensors — the whole-house meter is one line

rbAmp gives Home Assistant voltage, current, power and energy for each circuit as ordinary sensors — a few lines of YAML with the ESPHome component, or a Raspberry Pi over MQTT. Works with the HA Energy Dashboard.

What you get in Home Assistant

Ordinary HA sensors

Voltage · Current · Power · PF · Frequency · Energy appear as ordinary HA sensors — graphs, history, automations.

HA Energy Dashboard

Energy flows into the built-in Energy Dashboard: daily/tariff totals, long-term statistics, cost. (BASIC: consumption only. STD: import and export as separate energy sensors, for Grid consumption and Return to grid.)

Per-circuit / multi-module

Several modules on the bus → separate loads (water heater, kitchen, mains) as separate entities.

Automations & alerts

Thresholds, notifications, scenes — overload, "left the iron on", export to the grid (STD).

ESPHome (ESP32)SBC direct (Raspberry Pi)
HardwareESP32Raspberry Pi
EffortYAML, no codePython + MQTT
Best forEveryoneIntegrators · headless

Path A — ESPHome component

ESPHome on the ESP32 → a short YAML block → sensors in HA.

  1. Flash ESP32. ESPHome firmware on the ESP32; module on I²C (SDA/SCL; the DRDY line is optional), powered at 5 V.
  2. Add the component. external_components, an rbamp block (address, clamp model) and platform: rbamp sensors.
  3. Entities appear. U / I / P / PF / Hz / energy show up in HA automatically; drop them on a dashboard.
YAML
i2c:
  sda: GPIO21
  scl: GPIO22
  frequency: 50kHz
external_components:
  - source: github://rb-amp/rbamp-esphome@main
rbamp:
  id: meter1
  address: 0x50          # factory default
  ct_model: SCT_013_030  # your clamp model
sensor:
  - platform: rbamp
    rbamp_id: meter1
    voltage: { name: "Mains Voltage" }
    power: { name: "Mains Power" }
    energy: { name: "Mains Energy" }
  • No code — pure YAML
  • Multi-module on one bus
  • The energy total survives reboots — saved on the ESP32 and restored before the first update, so HA sees no reset
  • ESPHome's own API to HA (not MQTT)

ESPHome guide →

Path B — SBC direct (Raspberry Pi)

Module on the Pi's I²C → pip install rbamp smbus2 → MQTT autodiscovery → entities in HA.

  1. Wire to the Pi. Module on the Pi's I²C (SDA/SCL, 3.3 V logic), powered at 5 V; enable I²C in raspi-config.
  2. pip install rbamp smbus2. Read U / I / P / PF / Wh in Python.
  3. Bridge to HA. Publish to MQTT with autodiscovery → HA creates the entities itself.
Python
from smbus2 import SMBus
from rbamp import RbAmp

with SMBus(1) as bus, RbAmp(bus, 0x50) as dev:
    print(dev.voltage, dev.read_current(0), dev.read_power(0))  # V, A, W
  • For headless / Pi-centric / integrator setups
  • No ESP32 required
  • 3.3 V logic — no level shifter
  • Full MQTT discovery example in the docs

Raspberry Pi / Python guide → · Home Assistant over MQTT →

Get rbAmp into Home Assistant.

Follow the guide for your path: ESPHome on an ESP32, or Python on a Raspberry Pi.