A Home Assistant integration that provides a web-based configuration interface for OpenEnergyMonitor emonPi/Tx devices connected via an ESP32 serial bridge running ESPHome.
- Device Configuration: Full configuration interface for CT calibration, voltage calibration, radio settings, and more
- Friendly Channel Names: Add custom names to CT, Voltage, OPA, and Temperature channels for easier identification
- Names are stored per-device in Home Assistant
- Export/Import names as JSON for backup or migration
- Multi-device Support: Switch between multiple emonPi/Tx devices from a dropdown selector
- Batch Configuration: Edit multiple settings and apply them all at once with the floating Apply/Discard bar
- Serial Terminal: Send commands and receive responses from your emonTx device
- Autoscroll toggle, copy to clipboard, download log, clear terminal
- Resizable terminal window
- Quick command buttons for common operations
- Live Data Display: View real-time power and energy readings from all channels
- Data grouped by type (Voltage, Power, Energy, Temperature, Pulse)
- Inactive channels shown with strikethrough indicator
- Accumulators Tab: View and reset individual energy and pulse counters
- Zero Energy: Reset energy counters with confirmation countdown (matching firmware behavior)
- Unsaved Changes Warning: Banner alerts you when device has unsaved changes
- YAML Generator: Generate ESPHome sensor configuration for active channels
- Uses friendly names when configured
- Supports OPA pulse channels and temperature sensors
- Multi-phase Support: Full support for emonPi3 with 3-phase voltage monitoring
- Firmware Update & OTA Flash: Checks for emon32-fw firmware updates from GitHub and flashes them wirelessly
- Configurable check frequency (Never, Daily, Weekly, Monthly)
- Settings stored on the HA side (shared across all browsers)
- Blinking badge when update is available
- One-click OTA flash via emonWifi (emonTx6 / emonPi3, requires UART SAM-BA bootloader)
- Bootloader auto-detection: contextual notice shows setup steps or a green "ready" indicator based on the active bootloader
- Switch back to USB/UF2 bootloader: when the UART bootloader is active, a dedicated Bootloader card lets you revert to the UF2 bootloader from the UI (with inline confirmation), without needing a USB cable
- No-response Detection: Shows a warning if the device doesn't respond within 10 seconds, with guidance for emonTx4/5 users (serial jumper must be removed)
- RF Power Warning: Safety warning when setting RF power to high levels (7 dBm+)
- Multi-language: Supports English, French, German, Italian, and Spanish
- Home Assistant 2023.1.0 or newer
- ESPHome Integration installed in Home Assistant (Settings > Devices & Services > Add Integration > ESPHome)
- An emonWifi (ESP32-C3 Mini) added to the ESPHome integration and showing as "Online"
- ESPHome firmware on the emonWifi with the built-in
emontxcomponent and theemontx_ha_bridgeexternal component configured - An emonTx/emonPi device connected to the emonWifi via UART
Note: If using a different ESP32 board, some settings (board type, GPIO pins) may need to be adjusted.
Important: This integration requires the
emontx_ha_bridgecomponent, which is not yet in mainline ESPHome. It must be loaded viaexternal_componentsfrom theemontx-ha-bridgebranch (see ESPHome Setup below).
-
Install the integration through HACS using the button below or by adding
https://github.com/FredM67/ha-emon-configto HACS as a custom repository. -
Restart Home Assistant
-
Go to Settings > Devices & Services > Add Integration > Search for "emonPi/Tx Configuration"
- Download this repository
- Copy the
custom_components/emontx_configfolder to your Home Assistantconfig/custom_components/directory - Restart Home Assistant
Your ESP32 needs to be configured with the built-in emontx component (now standard in ESPHome) plus the emontx_ha_bridge external component from the emontx-ha-bridge branch. The bridge component fires esphome.emontx_raw / esphome.emontx_json events and registers the send_command service in Home Assistant.
Note: The
emontx_ha_bridgecompanion component (which provides the HA-side bridge) is not yet in mainline ESPHome and must be loaded viaexternal_components.
If you haven't used ESPHome before, follow these steps:
-
Install the ESPHome Add-on (if using Home Assistant OS):
- Go to Settings > Add-ons > Add-on Store
- Search for "ESPHome" and install it
- Start the add-on and click "Open Web UI"
-
Create a New Device:
- In the ESPHome dashboard, click "+ New Device"
- Click "Continue" on the welcome screen
- Enter a name for your device (e.g.,
emonwifi) - Select "ESP32-C3" as the device type
- Click "Skip" when asked to install (we'll edit the config first)
-
Edit the Configuration:
- Click "Edit" on your newly created device
- Replace or modify the generated YAML with the configuration below
- Adjust the GPIO pins for your specific board
- Click "Save" then "Install"
-
Install the Firmware:
- For first-time installation, use "Plug into this computer" or "Manual download"
- For subsequent updates, use "Wirelessly" (OTA)
-
Add to Home Assistant:
- Go to Settings > Devices & Services
- ESPHome devices are usually auto-discovered
- If not, click "Add Integration" > "ESPHome" and enter the device IP
Here's a complete ESPHome configuration file for the emonWifi:
esphome:
name: emonwifi
friendly_name: emonWifi
esp32:
board: esp32-c3-devkitm-1
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API with encryption
api:
encryption:
key: "your-32-byte-base64-key-here" # See note below
# Required for the HA bridge component
homeassistant_services: true
custom_services: true
# Enable Over-The-Air updates
ota:
platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# External component for the HA bridge
# (emontx itself is now built into ESPHome)
external_components:
- source:
type: git
url: https://github.com/FredM67/esphome
ref: emontx-ha-bridge
components: [emontx, emontx_ha_bridge, emontx_updater]
refresh: 0s
emontx_ha_bridge:
# UART connection to emonTx/emonPi
uart:
id: emontx_uart
rx_pin: GPIO20 # Adjust for your board
tx_pin: GPIO21 # Adjust for your board
baud_rate: 115200
rx_buffer_size: 2048
# emonTx component — loaded from the fork branch (includes timing fixes)
emontx:
# HTTP client required by emontx_updater to download firmware binaries
http_request:
buffer_size_rx: 4096
# OTA firmware updater — registers the flash_emontx6 service in Home Assistant
emontx_updater:The api.encryption.key is required for secure communication between ESPHome and Home Assistant. You have two options:
-
Generate a new key: When you create a new ESPHome device through the Home Assistant ESPHome add-on, it automatically generates an encryption key for you. You can find it in your device's YAML configuration.
-
Use secrets: Store the key in your
secrets.yamlfile and reference it with!secret api_encryption_key:api: encryption: key: !secret api_encryption_key
To generate a new key manually, you can use: openssl rand -base64 32
If you already have an ESPHome device configured, you only need to add these sections:
external_components:
- source:
type: git
url: https://github.com/FredM67/esphome
ref: emontx-ha-bridge
components: [emontx, emontx_ha_bridge, emontx_updater]
refresh: 0s
# Add homeassistant_services and custom_services to your existing api: section
api:
# ... your existing config ...
homeassistant_services: true
custom_services: true
emontx_ha_bridge:
uart:
id: emontx_uart
rx_pin: GPIO20
tx_pin: GPIO21
baud_rate: 115200
rx_buffer_size: 2048
emontx:
http_request:
buffer_size_rx: 4096
emontx_updater:Note: Both
homeassistant_services: trueandcustom_services: trueare required in theapi:section. Theemontx_ha_bridgecomponent auto-registers thesend_commandservice and firesesphome.emontx_rawandesphome.emontx_jsonevents to Home Assistant. Commands sent via this service automatically have LF line endings appended as required by the emonTx firmware. Even thoughemontxis built into mainline ESPHome, the fork branch must be used as it adds a loop pause needed to keep the watchdog happy during the lengthy OTA firmware upload.emontx_updaterrequireshttp_requestwithbuffer_size_rx: 4096to download firmware binaries.
Prerequisites: Ensure the ESPHome integration is installed and your ESP32 device is added and showing as "Online" in Settings > Devices & Services > ESPHome.
- Go to Settings > Devices & Services
- Click "Add Integration"
- Search for "emonPi/Tx Configuration"
- Select your ESPHome device from the dropdown (only devices with the
emontx_ha_bridgecomponent will appear) - Click "Submit"
After installation, a new panel called "emonPi/Tx Config" will appear in the Home Assistant sidebar.
The main configuration interface with three sub-tabs:
- CT Channels: Configure calibration (CT Type), phase lead, and friendly name for each current channel
- Voltage Channels: Enable/disable, calibrate, and name voltage inputs (for 3-phase systems)
- Bulk Configuration: Apply the same CT type and settings to multiple channels at once
- OPA Channels: Configure OneWire or Pulse input modes with optional pull-up and debounce period
- Temperature Sensors: DS18B20 sensor management with 8-slot grid layout
- Scan for connected sensors on the OneWire bus
- Drag-and-drop sensors between slots to reassign
- Dropdown selector for slot reassignment
- Status indicators: matched (✓), pending (⏳), modified (✎), new (★), missing (⚠)
- Selectable/copyable sensor addresses
- Clear individual slots or all slots at once
- Restore saved sensor mappings from device memory
- Save mappings to device memory (with warning if pending changes exist)
- Slot changes use the "Apply/Discard" workflow
- Reliable list parsing using firmware
[end]markers
- Channel Names Backup: Export/Import friendly names as JSON for backup or migration
- Radio Settings: Configure RF module (node ID, group, band, power, format)
- Warning displayed when setting RF power to high levels (7 dBm+)
- Datalog Interval: Set the reporting interval
- JSON Output: Enable/disable JSON serial format
Buttons:
- Apply: Send pending configuration changes to the device
- Discard: Revert to the last applied configuration
- Save to Flash: Save configuration to EEPROM (sends
scommand) - Zero Energy: Reset all energy counters
- Reset Defaults: Restore factory settings
- Reload Config: Read current configuration from the device
- Generate YAML: Generate ESPHome sensor configuration using friendly names
Pending Changes Bar: When you modify settings, a floating bar appears at the bottom showing the number of pending changes. Click "Apply" to send them to the device or "Discard" to revert.
Other features:
- Device selector: Switch between multiple emonPi/Tx devices (dropdown in status bar)
- Unsaved changes warning: Banner appears when configuration changes haven't been saved to flash
A full serial terminal for direct communication:
- Terminal Output: Shows all received data from the emonPi/Tx (resizable window)
- Command Input: Type commands to send to the emonPi/Tx
- Quick Commands: Buttons for common commands (l, v, s, ?)
- Toolbar: Autoscroll toggle, copy to clipboard, download log, clear terminal
Manage emon32-fw firmware directly from the UI:
- Check frequency: Configure automatic update checks (Never / Daily / Weekly / Monthly)
- Check Now: Fetches the latest stable release from GitHub immediately
- A blinking badge appears in the tab bar when a newer version is available
- Bootloader detection (emonTx6 / emonPi3): the
lcommand response is parsed to identify the active bootloaderuart(SAM-BA): a green notice confirms the device is ready for OTA flashingusb(UF2) or unknown: a yellow notice explains the one-time USB setup needed to switch to the UART bootloader
- Flash Firmware: Sends the
.binto the device over the air via emonWifi (~2 min, do not power off)- A progress bar tracks the flash; the device reboots automatically on completion
Enable the Advanced Mode checkbox to access additional flashing options:
- Custom GitHub repository: override the default
openenergymonitor/emon32-fwsource to fetch releases from a fork or alternative repo; a Check Now button re-fetches the release list from the new repo - Version selector: pick any specific release (newest first) instead of always flashing the latest; the latest version is labelled for convenience
- Direct
.binURL: paste any URL to a firmware binary to bypass the release list entirely — useful for testing pre-release or custom builds; when set, it takes precedence over the version selector and an orange warning is shown
When the UART SAM-BA bootloader is active, a separate Bootloader section appears below the Firmware Update card:
- Switch back to USB bootloader: reverts the device to the UF2/USB bootloader without a USB cable
- An inline confirmation panel (red-tinted, no browser dialog) explains the consequences before proceeding
- After flashing, OTA firmware updates will no longer work until the UART bootloader is re-applied via USB
- The device reboots automatically and the green "ready" badge disappears
Real-time display of all sensor values received from the emonPi/Tx, grouped by type:
- Voltage (V1-V3, depending on single/three phase)
- Power (P1-P12, depending on device)
- Energy (E1-E12, depending on device)
- Other sensors: temperature, pulse, message counter (MSG)
Inactive channels are displayed with a strikethrough indicator.
View and manage energy and pulse accumulators stored on the device:
- Energy Accumulators: View current Wh values for each CT channel
- Pulse Accumulators: View pulse counts for OPA channels configured as pulse inputs
- Individual Reset: Zero individual accumulators with confirmation
- Zero All: Reset all accumulators at once
For detailed information about emonTx/emonPi devices, firmware configuration, and hardware specifications:
- emonPi/Tx Documentation - Complete hardware and firmware guide
- OpenEnergyMonitor Community - Community forum for support
| Command | Description |
|---|---|
l |
List all configuration parameters |
v |
Show firmware version |
s |
Save configuration to EEPROM |
? |
Show help with available commands |
d |
Reset to default values |
z |
Zero energy counters (requires y confirmation) |
k<n> <ical> <ilead> |
Set CT channel calibration |
ol |
List found OneWire temperature sensors on bus |
on |
List saved temperature sensor addresses in NVM |
oh |
Save (hold) current temperature sensor slot mapping to NVM |
Refer to the emonTx documentation for a complete list of commands.
- First, ensure the ESPHome integration is installed in Home Assistant
- Verify your ESP32 device is added to the ESPHome integration and shows as "Online"
- Check that the API encryption key matches between ESPHome firmware and Home Assistant
- Verify that the
emontx_ha_bridgecomponent is added to your ESPHome config viaexternal_components - Verify that
homeassistant_services: trueandcustom_services: trueare set in yourapi:section - The device dropdown only shows ESPHome devices that have the
_send_commandservice registered
- Check the UART connections between ESP32 and emonTx
- Verify the baud rate is correct (115200 by default)
- Important: Make sure the
emontx_ha_bridgecomponent is configured in your ESPHome firmware - If you recently renamed your ESPHome device, hard refresh the browser (Ctrl+Shift+R) to reload the frontend
- Check Developer Tools > Events and listen for
esphome.emontx_rawevents to verify data is being received - Look at the ESPHome logs for any errors
- Verify the TX pin is connected and configured in ESPHome
- Check that
homeassistant_services: trueandcustom_services: trueare set in yourapi:configuration - Monitor the serial output with an FTDI adapter to verify commands are being sent
- emonTx4/5 users: The serial jumper must be removed (unsoldered or broken) for the emonWifi to communicate with the board. Without this, the device will not respond to commands. A red warning will appear on the Config tab after 10 seconds if no response is received
The emontx_updater component is not loaded on your ESPHome device — the flash service is never registered in Home Assistant without it. To fix:
- Add
emontx_updater:andhttp_request: { buffer_size_rx: 4096 }to your ESPHome YAML (see ESPHome Setup) - Make sure
emontx_updateris listed in theexternal_componentsblock - Rebuild and flash the ESPHome firmware to the device via USB
- After it reconnects, the Flash Firmware button will be enabled
A yellow warning is shown in the Firmware Update tab when the service is not detected.
- The Flash Firmware button only appears after a firmware check finds a
.binasset in the latest GitHub release - OTA flashing requires the UART SAM-BA bootloader (not the default UF2 bootloader shipped on new devices)
- If the yellow "One-time USB setup required" notice is shown, you need to switch the bootloader once via USB:
- Connect the device via USB
- Copy
change-bootloader-uart.uf2from the emon32-fw release onto theEMONBOOTdrive - Eject the drive — the device reboots with the UART bootloader active
- Reload the Config tab; the notice should turn green
- After switching, the bootloader change is permanent — the USB step does not need to be repeated
If you want to revert to the UF2 bootloader (e.g. to use drag-and-drop USB firmware updates again):
- When the UART bootloader is active, use the Bootloader card in the Firmware Update tab — no USB cable needed
- After confirming, the device flashes
change-bootloader-usb.binand reboots automatically - Once reverted, OTA firmware updates will not work until you re-apply the UART bootloader via USB
- Make sure your ESPHome component is up to date (clean build and reinstall)
- Hard refresh the browser (Ctrl+Shift+R) to clear cached panel files
GPL-3.0 License - See LICENSE file for details.
- OpenEnergyMonitor for the emonTx hardware and firmware
- ESPHome for the amazing IoT framework