Smart Message Language Reader for Home Automation
The "SML-Reader" uses a W5500-EVB-Pico to read smart meter data via SML and sends it to Home Assistant using MQTT.
As home automation technology advances, new opportunities arise to manage energy consumption more effectively. One pivotal innovation in this realm is reading data from smart electricity meters via Smart Message Language (SML). This article explores the "SML-Reader" project, designed to read SML data and send it to smart home systems like Home Assistant using MQTT.
Overview
Modern home automation systems are becoming essential, providing unparalleled control over various home functions, particularly energy management. The SML-Reader project showcases this integration by utilizing a W5500-EVB-Pico microcontroller to read electricity meter data and relay it to smart home systems, ensuring a stable Ethernet connection even in areas with poor Wi-Fi.
Project Inspiration
The need for accurate and efficient energy consumption monitoring inspired the SML-Reader project. The W5500-EVB-Pico, with its Ethernet port and dual hardware serials, was chosen for its cost-effectiveness and user-friendliness. A significant challenge was finding software compatible with Ethernet for the RP2040 chip in the W5500-EVB-Pico, as existing options like Tasmota lacked support.
Addressing Challenges
Several challenges were encountered, including identifying OBIS codes that vary by meter and configuration. These codes are crucial for decoding the data from electricity meters. Despite these difficulties, a functional SML-Reader was developed, capable of reliably reading and transmitting data.
Detailed Project Description
Compatibility with Smart Meters
The SML-Reader works with any smart meter supporting the SML protocol. Tests were successfully conducted with the Apator PICUS meter. The displayed data depends on the smart meter's functionalities and settings. Some meters might require specific adjustments, like disabling PINs or enabling extended operation modes.
Necessary Hardware and Software
- W5500-EVB-Pico Microcontroller: The project's foundation, offering robust Ethernet connectivity and dual serial communication.
- SML-Compatible Electricity Meter: A meter that communicates using the SML protocol.
- Ethernet Cable and Connection: For stable data transmission.
- Power Supply: To power the setup.
- MQTT Server: Receives data from the SML-Reader and relays it to smart home systems.
- PlatformIO IDE: For programming and flashing the microcontroller.
- SML-Reader Project Code: The software required for the microcontroller.
Setup and Configuration
Users must edit the `config.h` file in the project to include MQTT server details for configuring the SML-Reader. Additional settings, such as assigning a static IP address or modifying OBIS codes, can be adjusted in `main.cpp`. After configuration, the project is flashed onto the W5500-EVB-Pico.
Hardware Connectivity
Connect the IR reading head to the W5500-EVB-Pico as follows:
- TX: GPIO04
- RX: GPIO05
- GND: GND
- VCC: 3V3
These connections utilize the second hardware serial of the RP2040 chip, while the first serial is reserved for computer communication.
Flashing the SML-Reader
To flash the SML-Reader using PlatformIO in Visual Studio Code:
1. Install PlatformIO.
2. Clone the SML-Reader project repository.
3. Open the project in VSCode, where PlatformIO should allow you to build and upload the project.
4. After successful compilation and upload, the SML-Reader will be ready for use.
If flashing issues arise, manually copy the UF2 files to the device while holding the Bootsel button.
Integrating with Home Assistant
Once operational, the SML-Reader sends data to the MQTT server, which Home Assistant can automatically discover and integrate as sensors. If automatic discovery fails, manual configuration via `config.yaml` is possible. Data is sent to `homeassistant/sensor/w5500-evb-pico/<name-of-the-value>/state`, facilitating integration with various systems.
Web Interface Access
The SML-Reader project includes a web interface accessible via the device's IP address or mDNS name. This interface displays data read from the electricity meter, providing a user-friendly method to monitor energy consumption.
Conclusion
The SML-Reader project offers an economical and straightforward solution for reading SML data from smart meters and integrating it with smart home systems via MQTT. Utilizing the W5500-EVB-Pico ensures a reliable Ethernet connection, essential for local home automation. The web interface simplifies data visualization, while PlatformIO supports easy installation and configuration.