This repository provides optimized, feature-rich ESPHome templates for popular P1 smart meter readers, including the WeiGu SmartyReader and Slimmelezer. These configurations are designed for seamless, stable integration with Home Assistant.
This project modernizes and ports the incredible features from the original Arduino-based SmartyReader project by Guy Weiler (weigu.lu) to the ESPHome ecosystem.
- Hardware-Specific: Separate, pre-configured templates for different hardware to avoid confusion.
- Advanced Analytics: 15-minute statistics (mean/min/max), daily/monthly totals, and power class monitoring (3kW, 7kW, 12kW).
- Cost Calculation: Automatically calculates the cost of exceeding power thresholds.
- Gas & Water Metering: Full support for M-Bus gas and water meters, with automatic detection of the secondary meter type.
- Robust & Stable: Includes modern ESPHome features like Safe Mode, Fallback AP, and memory optimizations for high reliability.
- MQTT Version Available: A powerful ESP32-based template with deep MQTT integration, including LWT (Birth/Will messages) for professional monitoring.
Choose the one file that matches your hardware and desired communication method.
| Filename | Hardware | Communication | Description |
|---|---|---|---|
slimmelezer-esp8266-api.yaml |
Slimmelezer | Home Assistant API | Recommended for Slimmelezer users. A complete, standalone config for the ESP8266-based Slimmelezer. |
weigu-smartyreader-esp8266-api.yaml |
WeiGu SmartyReader | Home Assistant API | Recommended for WeiGu users. A complete, standalone config for the ESP8266-based SmartyReader. |
smartyreader-esp32-mqtt.yaml |
ESP32 (Universal) | MQTT | For advanced users or non-HA systems. A powerful template for any ESP32 board using MQTT. |
Follow these steps to get your reader up and running in minutes.
- In your ESPHome dashboard, find or create the
secrets.yamlfile. - Copy the entire content from the
secrets_template.yamlfile in this repository. - Paste it into your
secrets.yamland fill in your values. At a minimum, you must provide:wifi_ssidandwifi_passworddsmr_key(Your 32-character key from your utility provider)ota_password(Create a password for wireless updates)fallback_ap_password(Create a password for the recovery hotspot)api_key(If using an API version. You can generate one with an online tool).
- In the ESPHome Dashboard, click "+ NEW DEVICE".
- Give it a name (e.g.,
slimmelezer) and click through the wizard. - Select the correct board for your hardware:
- For Slimmelezer: Choose WEMOS D1 mini.
- For WeiGu SmartyReader: Choose WEMOS D1 mini Pro.
- For the MQTT Version: Choose Generic ESP32.
- Click "SKIP" when asked to create a basic configuration. A blank device file will be created.
- Click "EDIT" on your newly created device.
- Open the correct YAML template file from this repository for your hardware (e.g.,
slimmelezer-esp8266-api.yaml). - Copy the entire content of the template.
- Paste it into the ESPHome editor, replacing anything that was there.
- Optional: Change the
device_nameandfriendly_nameunder thesubstitutions:block at the top of the file.
- Click "SAVE" and then "INSTALL".
- Choose your preferred installation method (e.g., "Plug into this computer").
- Follow the on-screen instructions.
Once flashed, your device will connect to your Wi-Fi and should automatically be discovered by Home Assistant!
The templates are designed to work out-of-the-box, but you can customize them further.
The DSMR standard assigns gas to M-Bus channel 1 and water to channel 2. This is the default. If you have a non-standard setup (e.g., only a water meter on channel 1), you can change it in the dsmr: section.
Example for a water-only setup on channel 1:
dsmr:
gas_mbus_id: 0 # Disable gas monitoring
water_mbus_id: 1 # Assign water meter to channel 1
### Cost Calculations
To change the cost per kWh for exceeding power classes, edit the lambda value in the cost sensors.
```yaml
# Update cost per kWh for your region
- platform: template
name: "Cost Exceed 3kW Today"
# ...
lambda: 'return id(exceed_class_3kw_day_kwh) * 0.1139;' # Change 0.1139 to your rateThis project is built upon the outstanding work of Guy WEILER (www.weigu.lu), who created the original Arduino-based SmartyReader project. His comprehensive implementation provided:
- ✨ Complete DSMR P1 port reading with Luxembourg smartmeter decryption
- ✨ Advanced power analytics including ring buffer statistical calculations
- ✨ Power class monitoring with exceed energy tracking and cost calculations
- ✨ Comprehensive MQTT integration with individual topics and JSON payloads
- ✨ Extensive debugging tools and test programs
- ✨ Detailed documentation and hardware specifications
Guy's Arduino implementation serves as the foundation for all the advanced features in these ESPHome configurations. His meticulous attention to detail and comprehensive feature set made this ESPHome port possible.
A special thank you also goes to:
- The ESPHome team and contributors for creating the robust
dsmrcomponent that makes this integration possible. - Marcel Zuidwijk for the Slimmelezer, for providing an excellent open-hardware solution for the community.
- Author: Guy WEILER
- Website: www.weigu.lu
- Project: SmartyReader - Arduino-based Luxembourg smartmeter interface
- Hardware: Complete P1 port interface boards and documentation
To improve these configurations:
- Test thoroughly with your hardware setup
- Document changes clearly in commit messages
- Maintain compatibility with existing features and Guy's original design
- Follow ESPHome best practices for configuration structure
- Original SmartyReader Project
- ESPHome Documentation
- Home Assistant Energy Dashboard
- Luxembourg P1 Specification
This enhanced ESPHome configuration brings the full power of the Arduino SmartyReader to the ESPHome ecosystem while adding modern Home Assistant integration and improved diagnostics.
This project is released under the GNU General Public License v3.0. Please see the LICENSE file for full details.
The separate MQTT script included in this repository remains untested and may not work as expected with this template. The primary, recommended method for integration is via the native ESPHome API.