The continuous development in the field of home automation opens up ever new possibilities to control the energy consumption in our homes efficiently. A crucial step in this direction is the reading of data from smart electricity meters using the Smart Message Language to gain detailed insights into energy consumption. That’s exactly why I created “SML-Reader” to read out the Smart Message Language data and then send it to smart home systems, such as Home Assistant, via MQTT.

Why this project?

The idea for this project arose from the existing materials. With an already available W5500-EVB-Pico and the need for a reliable Ethernet connection in the basement, where the WLAN is weak, the motivation for implementing the Smart Message Language-Reader was born. The W5500-EVB-Pico, an inexpensive and easy-to-use microcontroller board with Ethernet port, provides the perfect basis for this project. In addition, it has two hardware serials, which allow both the connection to the computer and to the infrared reading head.

The difficulties in finding suitable software with Ethernet support for the RP2040 chip (used in the EVB-Pico) reinforced the desire to develop a tailor-made solution. For example, Tasmota or Tasmota is not yet available for the RP2040 chip with the W5500.

Another obstacle was determining the OBIS codes, which vary depending on the smart meter and configuration. However, this can be easily found out by using the program.

This Project was allowed by the Smart Message Language, which is a standard for the transmission of energy consumption data. The SML is used in Germany for the communication between smart meters and the smart meter gateway. The SML is also used in other countries, such as Austria, Switzerland and the Netherlands.

Project details

Supported smart meters

The SML-Reader is compatible with all smart meters that support the SML protocol. I successfully tested the system with the Apator PICUS. The displayed data depends on the functions supported and configured in the smart meter. Under certain circumstances, certain settings may need to be made on the meter, such as disabling the PIN or enabling extended operating modes (InF). Some data also requires manual activation by the LMN interface by the network operator.

Further OBIS codes can be added by editing the OBIS handler list.

Hardware and software

Configuration of the SML-Reader

Edit the config.h file in the SML-Reader project to enter the connection information for your MQTT server. Here you enter the MQTT login data. Further settings, such as a static IP address or other OBIS codes, can be made in main.cpp.

After saving the configuration file, you can re-flash the SML-Reader to apply the changes. The configuration file is saved during flashing. A dynamic configuration via the web interface is in progress.

The reading head must also be connected correctly. The connections are standard on the W5500-EVB-Pico board as follows:

  • TX: GPIO04
  • RX: GPIO05
  • GND: GND
  • VCC: 3V3

The setup should look like this:

Diagram of the setup of the SML-Reader, showing the connection between the W5500-EVB-Pico and the IR reading head. The pins are the ones mentioned above.
Diagram of the setup of the SML-Reader

These connections come from the second hardware serial of the RP2040 chip. The first hardware serial is used for the connection to the computer. The second hardware serial is used for the connection to the reading head (UART0/UART1 and UART2)

Flashing the SML-Reader with PlatformIO in VSCode

  1. Install PlatformIO in VSCode
  2. Clone the SML-Reader project
  3. Open the project in VSCode. There PlatformIO should see the option to build the project directly (upload)
  4. After compiling and uploading the project, the SML-Reader should be ready to use.

If there are problems with flashing, you can also manually copy the UF2 files to the device (hold Bootsel pressed while doing so).

After successful flashing, the SML-Reader should receive the data from the electricity meter and then send it to the MQTT server.

Reading the MQTT data in Home Assistant

The device should now automatically send the data to the MQTT server. Using MQTT Discovery, the sensors are automatically created in Home Assistant. The sensors can then be used in Home Assistant. If this does not happen, you can always manually insert the measured values in Home Assistant via the config.yaml.

The data is sent to homeassistant/sensor/w5500-evb-pico/<name-of-the-value>/state, if you want to integrate it into other systems.

Web interface

The project has a web interface that allows you to display the data read from the electricity meter. The interface is accessible via the IP address or the mDNS name of the SML-Reader. The displayed data depends on the functions supported and configured in the smart meter.

Conclusion

The project is an inexpensive and simple solution to read out the SML data from a smart meter and then send it to smart home systems, such as Home Assistant, via MQTT. The use of the W5500-EVB-Pico allows a reliable Ethernet connection, which is advantageous for local home automation. The web interface offers an easy way to display the data of the electricity meter. The use of PlatformIO allows an easy installation and configuration of the project.

Further information

Many thanks to the SML Parser library, which forms the basis for this project.

More information is available on the German version of this page.