Exploring the Integration of Smart Meters with ESPHome

As a homeowner looking to optimize my energy consumption, I’ve been diving into the world of smart meters and ESPHome integration. My journey began with a Siemens TD-3511 smart meter provided by Netz OÖ GmbH in Upper Austria. This meter uses M-Bus over Infrared for communication and encrypts data with AES, which I found both intriguing and challenging.

I started by exploring existing projects like Volkszähler and AMIS Leser to understand how others have approached similar integrations. My goal was to create a custom component for ESPHome that could handle the meter’s data effectively. Along the way, I encountered a few hurdles that I’d love to discuss with the community.

One challenge I faced was handling the timestamp data reported by the meter. The timestamp is in local time, and converting it to a Unix timestamp in Home Assistant resulted in a loss of precision, specifically about 30 seconds. I’m curious if there’s a more efficient way to maintain this precision without creating a new sensor, which seems to complicate things further.

Another aspect I’m exploring is the data reporting interval. Since the meter acts as an M-Bus slave, data transmission is initiated every second. I want to make this interval configurable to suit different use cases. I’ve looked into the ESPHome documentation and some community solutions, but I’m still not entirely sure how to implement this feature cleanly.

For those interested, I’ve shared my code on GitHub. It’s a work in progress, and I’d appreciate any feedback or suggestions the community might have. Whether it’s about improving the timestamp handling, making the data interval configurable, or any other aspect of the integration, your insights would be invaluable.

This project has been a fantastic learning experience, and I’m excited to see how it evolves with the help of the ESPHome and Home Assistant communities. If anyone has tackled similar challenges or has tips to share, please don’t hesitate to reach out!