Skip to content

esphome external component to support meters with OBIS D0 interface

License

Notifications You must be signed in to change notification settings

freakyjoe8/esphome_obis_d0

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESPHome Smart Meter OBIS D0 Component

This repository adds support for smart meters with OBIS D0 interface to ESPHome.

Configuration

This component can be easily added as an external component to ESPHome.

Communication with the smart meter is done using UART, so you need to configure the UART bus.

external_components:
  - source: github://mampfes/esphome_obis_d0

uart:
  id: my_uart
  rx_pin: GPIO16
  baud_rate: 9600
  data_bits: 7
  parity: EVEN
  stop_bits: 1

obis_d0:
  id: my_sm
  uart_id: my_uart

sensor:
  - platform: obis_d0
    name: "Consumed Energy"
    obis_d0_id: my_sm
    obis_code: "1-0:1.8.0*255"
    unit_of_measurement: kWh
    accuracy_decimals: 4
    state_class: total_increasing
    device_class: energy
    value_regex: "\\d{6}\\.\\d{8}\\*kWh"

text_sensor:
  - platform: obis_d0
    name: "Device Identification"
    obis_d0_id: my_sm
    obis_code: "1-0:96.1.0*255"
    entity_category: diagnostic
    value_regex: "\\w{14}"

Configuration Variables

OBIS D0 platform

  • id (Optional, ID): Manually specify the ID used for code generation.
  • uart_id (Optional, ID): ID of the UART Component if you want to use multiple UART buses.

Sensor

  • obis_code (Required, string): Specify the OBIS code you want to retrieve data for from the device.
  • obis_d0_id (Optional, ID): ID of the OBIS D0 Component if you want to manage multiple smart meters.
  • value_regex (Optional, string): Regular expression to check the validity of the OBIS value. If received value does't match the regular expression, it will be discarded.
  • format (Optional, string): Format of the OBIS value. Possible choices: float, hex. Defaults to float.
  • timeout (Optional, Time): Timeout after which value will be invalidated. Defaults to 5s.
  • All other options form Sensor.

Text Sensor

  • obis_code (Required, string): Specify the OBIS code you want to retrieve data for from the device.
  • All other options from Text Sensor.

Hardware

A infrared reader is required to attach to the smart meter.

I am using the "IR-Lese-Schreibkopf" from Hicham Belmadani:

Infrared Reader

This device is sold on ebay.

NOTE: I'm not responsible or anyhow associated with this offering!


Supported Smart Meters

This section lists supported smart meters:

Device Status
eBZ DD3 Drehstromzähler Supported
Logarex LK11 / LK13 Supported

Important Notes

Error Detection

The OBIS D0 data format is a textual format based on ASCII characters without error detection and correction mechanisms except the parity bit. Parity errors are detected by the underlying UART layer, but in case of an error the characters are simply omitted - without further notifications to the application. This leads to corrupt readings being read which completly messes the statistics in Home Assistant. Therefore you can specify the expected format for each using regular expressions. If the received data doesn't match the regular expression (e.g. in case of parity error), the data will be discarded.

If anyone knows how to get a notification from the UART layer in case of an error - please let me know!

ESP-01

Due to the size of the code, this component doesn't fit into an ESP-01 / ESP-01s.

About

esphome external component to support meters with OBIS D0 interface

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 77.9%
  • Python 22.1%