{"id":17216198,"url":"https://github.com/jobe3774/smartmeter","last_synced_at":"2026-04-21T03:31:27.044Z","repository":{"id":237776679,"uuid":"239309937","full_name":"jobe3774/smartmeter","owner":"jobe3774","description":"A raspend based application for reading out current values of my two energy meters and serve them via HTTP as JSON.","archived":false,"fork":false,"pushed_at":"2025-02-27T09:08:05.000Z","size":488,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-10T17:34:36.091Z","etag":null,"topics":["d0-interface","d0-protocol","obis","python","python-3","python3","raspberry-pi","raspberry-pi-3","raspend","s0-interface","smartmeter"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/jobe3774.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-02-09T13:33:35.000Z","updated_at":"2025-02-27T09:08:09.000Z","dependencies_parsed_at":"2025-02-25T20:30:51.822Z","dependency_job_id":"e2d30cfa-7424-42ba-a29e-7584610e92c0","html_url":"https://github.com/jobe3774/smartmeter","commit_stats":null,"previous_names":["jobe3774/smartmeter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jobe3774/smartmeter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobe3774%2Fsmartmeter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobe3774%2Fsmartmeter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobe3774%2Fsmartmeter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobe3774%2Fsmartmeter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jobe3774","download_url":"https://codeload.github.com/jobe3774/smartmeter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobe3774%2Fsmartmeter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32075218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"last_error":"SSL_read: 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-interface","d0-protocol","obis","python","python-3","python3","raspberry-pi","raspberry-pi-3","raspend","s0-interface","smartmeter"],"created_at":"2024-10-15T03:27:09.346Z","updated_at":"2026-04-21T03:31:27.027Z","avatar_url":"https://github.com/jobe3774.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smartmeter\nThis application reads out the current values of the two energy meters installed in my house. It is based on the [raspend](https://github.com/jobe3774/raspend) python library and runs on my Raspberry Pi 3 Model B+.\n\n## Inputs\n### D0 Interface\n\nThe first smart meter is a eBZ DD3 installed by my local energy provider. The DD3 is a 2-directional meter that counts both the imported power and the exported power of my PV system. It comes with a D0 interface pushing data every second. This optical data interface is a unidirectional communication interface using infrared light. The data is read via an infrared read-write head which is attached to the so called *Info-DSS* of the smart meter. \nThe other end is plugged into one of my RPi's USB ports. \nMy DD3's data is ASCII and is specified by *DIN EN 625056-21* ([OBIS](https://de.wikipedia.org/wiki/OBIS-Kennzahlen), MODE-D (IEC 1107)).\n\n![ebz_ddr3_ir_head.png](./images/ebz_ddr3_ir_head.png)\n\n### S0 Interface\n\nThe second smart meter is used to measure the power consumption of my heatpump. It is a Finder Series 7E smart meter, which comes with a [S0 interface](https://de.wikipedia.org/wiki/S0-Schnittstelle) specified by *DIN 43864*. I connected **S0+** of the smart meter to one of the RPi's 5V+ GPIO pins and **S0-** is connected to another GPIO pin configured as an input pin. Since the minimum voltage for the S0 interface of this smart meter is 5V I had to use a voltage divider. I used one 2K and one 3K Ohm resistor to implement it, so the GPIO pin has a maximum voltage of 3V. The smart meter outputs 1000 pulses per kWh on the interface. These pulses are detected as rising edges on the GPIO pin and counted.\n\n![s0_if_to_rpi.png](./images/s0_if_to_rpi.png)\n\n## Installation\n\nDownload or clone this repository, go to its local folder and type:\n```\n$ pip3 install -r requirements.txt\n```\nThis will install all necessary dependencies.\n\n## Usage\n\nTo run it, type:\n```\n$ python3 smartmeter.py --port=\u003cport\u003e --serialPort=\u003cdevice\u003e --s0Pin=\u003cGPIO-pin\u003e\n```\nParameter | Description \n----------|--------\n--port | Port number the server should listen on\n--serialPort | Path to the serial port to use for reading the D0 interface\n--s0Pin | The GPIO input pin used for counting S0 interface pulses **(optional)**\n\nExample:\n```\n$ python3 smartmeter.py --port=8080 --serialPort=/dev/ttyUSB0 --s0Pin=21\n```\nTo quit the application, press *Ctrl+C*.\n\n## Output\n\nAfter starting the script, open your favourite browser and type:\n```\nhttp://\u003cIP-of-your-RPi\u003e:8080/data\n```\nYou'll get a JSON response like this:\n\n``` json\n{\n   \"smartmeter_d0\": {\n      \"CURRENT_POWER_L3\": {\n         \"OBIS_Code\": \"76.7.0\",\n         \"unit\": \"W\",\n         \"value\": 811.78\n      },\n      \"timestampUTC\": \"2020-02-06T21:37:51.607046+00:00\",\n      \"CURRENT_POWER_L2\": {\n         \"OBIS_Code\": \"56.7.0\",\n         \"unit\": \"W\",\n         \"value\": 960.38\n      },\n      \"POWER_IMPORT\": {\n         \"OBIS_Code\": \"1.8.0\",\n         \"unit\": \"kWh\",\n         \"value\": 4457.153\n      },\n      \"CURRENT_POWER_L1\": {\n         \"OBIS_Code\": \"36.7.0\",\n         \"unit\": \"W\",\n         \"value\": 619.06\n      },\n      \"POWER_EXPORT\": {\n         \"OBIS_Code\": \"2.8.0\",\n         \"unit\": \"kWh\",\n         \"value\": 4541.967\n      },\n      \"CURRENT_POWER_SUM\": {\n         \"OBIS_Code\": \"16.7.0\",\n         \"unit\": \"W\",\n         \"value\": 2391.22\n      }\n   },\n   \"smartmeter_s0\": {\n      \"count\": 13756.570000000247,\n      \"timestampUTC\": \"2020-02-06T21:37:53.330171+00:00\"\n  }\n}\n\n```\n## Hints\n\nIf you want to set the initial count of your S0 interface, you can use:\n\n```\nhttp://\u003cIP-of-your-RPi\u003e:8080/cmd?name=s0Interface.setValue\u0026value=\u003cinitial count\u003e\n```\n\n## License\n\nMIT. See LICENSE file.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjobe3774%2Fsmartmeter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjobe3774%2Fsmartmeter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjobe3774%2Fsmartmeter/lists"}