Successfully Integrating BitShake SmartMeterReader Air with ESPhome

Hello everyone! I wanted to share my recent experience integrating the BitShake SmartMeterReader Air with ESPhome. This was a bit of a challenge, but I managed to get it working smoothly, and I thought I’d document my process in case it helps anyone else.

For those who are unaware, the SmartMeterReader Air is a device designed to read smart meters using SML (Smart Message Language) over an IR interface. It comes with an ESP32-C3-MINI-1 module and is pre-installed with Tasmota, which is great for those not using Home Assistant. However, since I’m already deep into ESPhome and Home Assistant, I wanted to integrate it directly without adding the Tasmota layer.

The first step was to ensure the hardware was correctly set up. I connected the IR sensor to GPIO5 of the ESP32 module. I then moved on to configuring the SML component in ESPhome. I was initially concerned about the reliability of the SML library, but it turned out to be more than capable for my needs.

One hiccup I encountered was with my DZG WS7412 meter, which has a known firmware bug causing it to return negative values occasionally. To address this, I added a lambda filter in my ESPhome configuration to take the absolute value of the readings. This small tweak ensured that the data being sent to Home Assistant was always positive and accurate.

Another consideration was the communication rate between the meter and the SmartMeterReader. The meter sends updates multiple times per second, which could be overwhelming for the system. To mitigate this, I implemented a delta filter set to 5%, which only triggers updates when there’s a significant change in the readings. This has helped stabilize the system and reduce unnecessary updates.

I also configured the device to use ESPhome’s native API instead of MQTT, which simplifies the setup and reduces the number of add-ons needed in Home Assistant. This decision was purely based on the simplicity and efficiency it brings to the system.

For those interested, here’s a snippet of my ESPhome configuration:

BitShake SmartMeterReader Air – custom board with ESP32-C3-MINI-1

GPIO5 is connected to IR sensor

SML ESPhome doc:

https://github.com/esphome/esphome-docs/blob/current/components/sml.rst

esphome:
name: smartmeterreader
friendly_name: SmartMeterReader
esp32:
board: esp32-c3-devkitm-1
framework:
type: esp-idf
logger:
api:
encryption:
key: !secret home_assistant_encryption_key
ota:
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
captive_portal:
web_server:
uart:
id: uart_bus
rx_pin: GPIO5
baud_rate: 9600
data_bits: 8
parity: NONE
stop_bits: 1
sml:
id: mysml
uart_id: uart_bus
sensor:
- platform: sml
name: “Total energy”
icon: mdi:meter-electric
sml_id: mysml
obis_code: “1-0:1.8.0”
unit_of_measurement: kWh
accuracy_decimals: 4
device_class: energy
state_class: total_increasing
filters:
- multiply: 0.0001
- lambda: |-
return abs(x);

This setup has been running smoothly for a few weeks now, providing accurate and reliable energy monitoring. I’m thrilled with how well it integrates into my existing Home Assistant setup and the level of customization ESPhome offers.

If anyone has questions or needs help with their own setup, feel free to reach out! I’m happy to share my configuration and troubleshoot any issues you might encounter.

Happy tinkering! :rocket: