{"id":15647719,"url":"https://github.com/mampfes/esphome_obis_d0","last_synced_at":"2026-03-27T02:42:24.181Z","repository":{"id":104297277,"uuid":"529934882","full_name":"mampfes/esphome_obis_d0","owner":"mampfes","description":"esphome external component to support meters with OBIS D0 interface","archived":false,"fork":false,"pushed_at":"2024-03-10T12:16:06.000Z","size":621,"stargazers_count":49,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-30T11:55:57.933Z","etag":null,"topics":["d0","d0-interface","d0-protocol","esphome","esphome-component","hacktoberfest","obis","smart-meter","smartmeter"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mampfes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-28T17:40:20.000Z","updated_at":"2025-04-04T09:22:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"84654f4f-098d-42e0-b65b-73c7d5dead26","html_url":"https://github.com/mampfes/esphome_obis_d0","commit_stats":{"total_commits":24,"total_committers":2,"mean_commits":12.0,"dds":"0.16666666666666663","last_synced_commit":"f66604849ba36d98ae51bbfcd0deb53d2f23c784"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mampfes/esphome_obis_d0","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mampfes%2Fesphome_obis_d0","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mampfes%2Fesphome_obis_d0/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mampfes%2Fesphome_obis_d0/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mampfes%2Fesphome_obis_d0/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mampfes","download_url":"https://codeload.github.com/mampfes/esphome_obis_d0/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mampfes%2Fesphome_obis_d0/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31011524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T02:33:22.146Z","status":"ssl_error","status_checked_at":"2026-03-27T02:33:21.763Z","response_time":164,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["d0","d0-interface","d0-protocol","esphome","esphome-component","hacktoberfest","obis","smart-meter","smartmeter"],"created_at":"2024-10-03T12:20:43.026Z","updated_at":"2026-03-27T02:42:24.162Z","avatar_url":"https://github.com/mampfes.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ESPHome Smart Meter OBIS D0 Component\n\nThis repository adds support for smart meters with OBIS D0 interface to [ESPHome](https://esphome.io).\n\n## Configuration\n\nThis component can be easily added as an [external component](https://esphome.io/components/external_components.html) to ESPHome.\n\nCommunication with the smart meter is done using UART, so you need to configure the [UART bus](https://esphome.io/components/uart.html#uart).\n\n```yaml\nexternal_components:\n  - source: github://mampfes/esphome_obis_d0\n\nuart:\n  id: my_uart\n  rx_pin: GPIO16\n  baud_rate: 9600\n  data_bits: 7\n  parity: EVEN\n  stop_bits: 1\n\nobis_d0:\n  id: my_sm\n  uart_id: my_uart\n  on_telegram:\n    then:\n      - logger.log: \"telegram received\"\n\nsensor:\n  - platform: obis_d0\n    name: \"Consumed Energy\"\n    obis_d0_id: my_sm\n    obis_code: \"1-0:1.8.0*255\"\n    unit_of_measurement: kWh\n    accuracy_decimals: 4\n    state_class: total_increasing\n    device_class: energy\n    value_regex: \"\\\\d{6}\\\\.\\\\d{8}\\\\*kWh\"\n\ntext_sensor:\n  - platform: obis_d0\n    name: \"Device Identification\"\n    obis_d0_id: my_sm\n    obis_code: \"1-0:96.1.0*255\"\n    entity_category: diagnostic\n    value_regex: \"\\\\w{14}\"\n\n  - platform: obis_d0\n    name: \"Manufacturer ID\"\n    obis_d0_id: my_sm\n    obis_code: \"id\"\n    entity_category: diagnostic\n    value_regex: \"\\\\w+\"\n```\n\n## Configuration Variables\n\n### OBIS D0 platform\n\n- **id** (Optional, [ID](https://esphome.io/guides/configuration-types.html#config-id)): Manually specify the ID used for code generation.\n- **uart_id** (Optional, [ID](https://esphome.io/guides/configuration-types.html#config-id)): ID of the [UART Component](https://esphome.io/components/uart.html#uart) if you want to use multiple UART buses.\n\n### Sensor\n\n- **obis_code** (Required, string): Specify the OBIS code you want to retrieve data for from the device.\n- **obis_d0_id** (Optional, [ID](https://esphome.io/guides/configuration-types.html#config-id)): ID of the *OBIS D0* Component if you want to manage multiple smart meters.\n- **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.\n- **format** (Optional, string): Format of the OBIS value. Possible choices: `float`, `hex`. Defaults to `float`.\n- **timeout** (Optional, [Time](https://esphome.io/guides/configuration-types.html#config-time)): Timeout after which value will be invalidated. Defaults to `5s`.\n- All other options form [Sensor](https://esphome.io/components/sensor/index.html#config-sensor).\n\n### Text Sensor\n\n- **obis_code** (Required, string): Specify the OBIS code you want to retrieve data for from the device.\n- All other options from [Text Sensor](https://esphome.io/components/text_sensor/index.html#config-text-sensor).\n\n**NOTE**: There is one special OBIS code for text sensors:  \n`id` returns the manufacturer identification at the beginning of an OBIS telegram (see example above).\n\n### Automations\n\n- **on_telegram** (Optional, [Automation](https://esphome.io/guides/automations.html#automation)): An automation to perform after a complete telegram (consisting of manufacturer identification and OBIS records) has been received.\n\n---\n\n## Hardware\n\nA infrared reader is required to attach to the smart meter.\n\nI am using the \"IR-Lese-Schreibkopf\" from Hicham Belmadani:\n\n![Infrared Reader](doc/ir_reader.jpg)\n\nThis device is sold on [ebay](https://www.ebay.de/itm/314015465828).\n\n**NOTE:** I'm not responsible or anyhow associated with this offering!\n\n---\n\n## Supported Smart Meters\n\nThis section lists supported smart meters:\n\n| Device | Status |\n|-|-|\n| [eBZ DD3 Drehstromzähler](doc/ebz_dd3.md) | Supported |\n| [ISKRA MT174](doc/iskra_mt174.md) | Supported |\n| [Logarex LK11 / LK13](doc/logarex.md) | Supported |\n| [EasyMeter Q3D](doc/easymeter_q3.md) | Supported |\n| [ACE 3000 Type 260](doc/ace_3000_type_260.md) | Supported |\n\n## Important Notes\n\n### Error Detection\n\nThe 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 completely 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.\n\nIf anyone knows how to get a notification from the UART layer in case of an error - please let me know!\n\n### ESP-01\n\nThe default implementation uses to much flash space (\u003e512k) to be used on an ESP-01. If you want to use an ESP-01, this is possible by using a limited implementation of the regex library. You may activate it by adding `optimize_size: true` to the `obis_d0` component.\n\n```yaml\n\nobis_d0:\n  id: my_sm\n  uart_id: my_uart\n  optimize_size: true\n\n```\n\nThis smaller implementation of regex comes with some caveats. They are described in the following section.\n\n#### RegEx compatibility\n\nThe [tiny-regex-c library](https://github.com/kokke/tiny-regex-c/tree/master) is used to reduce the size of the resulting executable. This comes with some caveats regarding the regex capabilities.\n\nThe library was somewhat extended and should include most required cases. Also error logs were added if the regex contains unsupported features.\n\n#### Unsupported RegEx Features\n- `()` any grouping mechanisms are not supported\n- `|` branching is not supported\n- Additionally the regex must match the entire value, partial matches are detected as an error. \\\n  as if they are surrounded with `^` and `$`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmampfes%2Fesphome_obis_d0","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmampfes%2Fesphome_obis_d0","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmampfes%2Fesphome_obis_d0/lists"}