{"id":19451822,"url":"https://github.com/skoef/gop1","last_synced_at":"2025-08-19T11:05:10.337Z","repository":{"id":51827982,"uuid":"218785375","full_name":"skoef/gop1","owner":"skoef","description":"Golang P1 protocol reader","archived":false,"fork":false,"pushed_at":"2023-12-19T09:40:36.000Z","size":28,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-25T04:35:35.543Z","etag":null,"topics":["golang","p1","power","smartmeter"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skoef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-10-31T14:29:27.000Z","updated_at":"2023-03-02T08:22:34.000Z","dependencies_parsed_at":"2023-12-19T10:44:12.398Z","dependency_job_id":"b5f04459-0353-415b-9480-003ef842bb7f","html_url":"https://github.com/skoef/gop1","commit_stats":{"total_commits":18,"total_committers":3,"mean_commits":6.0,"dds":0.4444444444444444,"last_synced_commit":"4b78ea770875a5a7b849562ee0037f8823484918"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/skoef/gop1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skoef%2Fgop1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skoef%2Fgop1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skoef%2Fgop1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skoef%2Fgop1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skoef","download_url":"https://codeload.github.com/skoef/gop1/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skoef%2Fgop1/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271143332,"owners_count":24706343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["golang","p1","power","smartmeter"],"created_at":"2024-11-10T16:43:10.075Z","updated_at":"2025-08-19T11:05:10.290Z","avatar_url":"https://github.com/skoef.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/skoef/gop1)](https://goreportcard.com/report/github.com/skoef/gop1) [![Documentation](https://godocs.io/github.com/skoef/gop1?status.svg)](http://godocs.io/github.com/skoef/gop1)\n\n# Golang P1 protocol library\n\nThis is a golang library to read P1 data from a so called *smart* energy meter, used primarily in The Netherlands. P1 is the protocol Dutch power grid companies designed together and is described on [netbeheernederland.nl](https://www.netbeheernederland.nl/_upload/Files/Slimme_meter_15_a727fce1f1.pdf). The smart meters which are being deployed in Belgium implement the same protocol, but some additional data types were defined by the power grid companies. These types are defined in the [e-MUCS H](https://www.fluvius.be/sites/fluvius/files/2019-12/e-mucs_h_ed_1_3.pdf) specification.\n\nTo read P1 data, you'll need something like a P1-to-USB cable. The P1 port is essentially a serial port where data (a so called P1 telegram) is dumped every second.\n\n## Example usage:\n```golang\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/skoef/gop1\"\n)\n\nfunc main() {\n\t// open a new reader to given USB serial device\n\tp1, err := gop1.New(gop1.P1Config{\n\t\tUSBDevice: \"/dev/ttyUSB0\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// start reading data\n\t// this will send new telegrams to the channel p1.Incoming\n\tp1.Start()\n\n\tfor telegram := range p1.Incoming {\n\t\t// loop over the objects in the telegram to find types we're interested in\n\t\tfor _, obj := range telegram.Objects {\n\t\t\tswitch obj.Type {\n\t\t\tcase gop1.OBISTypeInstantaneousPowerDeliveredL1:\n\t\t\t\tfmt.Printf(\"actual power usage: %s %s\\n\", obj.Values[0].Value, obj.Values[0].Unit)\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\nIn the [example/](https://github.com/skoef/gop1/tree/master/example) folder is an example application that collects relevant metrics and offers them over a prometheus-compatible HTTP endpoint for scraping.\n\n## Acknowledgements\nThe [smartmeter](https://github.com/marceldegraaf/smartmeter) project from Marcel de Graaf inspired me to write something like this. I like his work, but was looking for a more pluggable library rather than an actual application. Also there is a whole lot python projects out there with P1 support that gave some insight.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskoef%2Fgop1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskoef%2Fgop1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskoef%2Fgop1/lists"}