{"id":15508285,"url":"https://github.com/heubeck/samler","last_synced_at":"2026-04-12T12:10:34.901Z","repository":{"id":65703947,"uuid":"573850641","full_name":"heubeck/samler","owner":"heubeck","description":"SaMLer - Smart Meter data collector at the edge","archived":false,"fork":false,"pushed_at":"2025-11-17T15:49:29.000Z","size":1722,"stargazers_count":5,"open_issues_count":6,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-17T17:31:53.337Z","etag":null,"topics":["influxdb","iot","sml"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heubeck.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":"2022-12-03T16:25:11.000Z","updated_at":"2025-11-17T15:49:32.000Z","dependencies_parsed_at":"2023-11-07T13:24:27.503Z","dependency_job_id":"195d43a3-683f-4f49-a6d6-09a252c6160a","html_url":"https://github.com/heubeck/samler","commit_stats":{"total_commits":38,"total_committers":5,"mean_commits":7.6,"dds":0.2894736842105263,"last_synced_commit":"46a562eae3c6e474cde105ffaaac08431ecbf9f0"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/heubeck/samler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heubeck%2Fsamler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heubeck%2Fsamler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heubeck%2Fsamler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heubeck%2Fsamler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heubeck","download_url":"https://codeload.github.com/heubeck/samler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heubeck%2Fsamler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31714137,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-12T06:22:27.080Z","status":"ssl_error","status_checked_at":"2026-04-12T06:21:52.710Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["influxdb","iot","sml"],"created_at":"2024-10-02T09:36:55.948Z","updated_at":"2026-04-12T12:10:34.896Z","avatar_url":"https://github.com/heubeck.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SaMLer\n\nThe SaMLer is reading SML messages produced by a smart meter from a serial device and publishes it to a backend like InfluxDB or MySQL.\n\n## Dependencies\n\nIt uses [libsml](https://github.com/volkszaehler/libsml) for the low level device and protocol handling, and has filesystem caching using [diskqueue](https://github.com/nsqio/go-diskqueue) to overcome (temporary) network issues.\nCredits to these projects!\n\n## Use\n\nThe dependency `libuuid` has to be installed on the target system, on Debian based systems availabe from package `uuid-runtime`.\n```shell\nsudo apt-get install uuid-runtime\n```\n\nThere are pre-build binaries available with every [release](https://github.com/heubeck/samler/releases).\n\nSaMLer is configured using environment variables, just run it, to let it print its options:\n\n```shell\n\u003e ./samler.amd64\nSaMLer v0.5.0  Copyright (C) 2025  Florian Heubeck\nThis program comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it under certain conditions.\n\n# Configuration options, set them as ENV:\nSAMLER_INFLUX_TOKEN (default: -)\nSAMLER_DEVICE (default: /dev/ttyUSB0)\nSAMLER_DEVICE_MODE (default: 8-N-1)\nSAMLER_INFLUX_URL (default: -)\nSAMLER_INFLUX_ORG (default: -)\nSAMLER_MYSQL_TABLE (default: home_power)\nSAMLER_DEVICE_BAUD_RATE (default: 9600)\nSAMLER_CACHE_PATH (default: /home/heubeck/.samler)\nSAMLER_IDENT_FILTER (default: ) # Comma separated idents to forward, e.g. \"1.8.0,16.7.0\"\nSAMLER_DEBUG (default: false)\nSAMLER_MYSQL_DSN (default: -)\nSAMLER_INFLUX_MEASUREMENT (default: power)\nSAMLER_BACKEND (options: influx, mysql)\nSAMLER_INFLUX_BUCKET (default: home)\n\nPlease set all values without default depending on the chosen backend\n```\n\nA minimalistic run script using [Influx Cloud](https://cloud2.influxdata.com/) may look like:\n\n```shell\n#!/bin/bash\nSAMLER_BACKEND=influx \\\nSAMLER_INFLUX_URL=https://region.provider.cloud2.influxdata.com \\\nSAMLER_INFLUX_TOKEN=thisIsVerySecret== \\\nSAMLER_INFLUX_ORG=your.influx.registered@mail.address \\\n/opt/samler.arm-v7\n```\n\nWith MySQL the script can look like, the target table is created automatically if it doesn't exist:\n\n```shell\n#!/bin/bash\nSAMLER_BACKEND=mysql \\\nSAMLER_MYSQL_DSN=\"user:password@tcp(your-database-host:3306)/samler\" \\\n/opt/samler.arm-v7\n```\n\nUsing systemd a service description may look like:\n\n```shell\necho \"[Unit]\nDescription=SaMLer SmartMeter Data collector\nStartLimitIntervalSec=0\n[Service]\nType=simple\nRestart=always\nRestartSec=10\nUser=root\nExecStart=/opt/run_samler.sh\n\n[Install]\nWantedBy=multi-user.target\"  \u003e /etc/systemd/system/samler.service\n```\n```shell\nsystemctl enable samler.service\n```\n```shell\nsystemctl start samler.service\n```\n\n## Grafana Dashboard Flux Query Examples\n\nIn case you are interested in leveraging data stored in Influx by Samler, you can use the following queries for some basic dashboards:\n\nTotal energy consumption (1.8.0) and production (2.8.0) dashboard data in kWh:\n\n```\nfrom(bucket: \"home\")\n    |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n\t|\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"power\")\n    |\u003e filter(fn: (r) =\u003e r[\"ident\"] == \"1.8.0\" or r[\"ident\"] == \"2.8.0\")\n    |\u003e map(fn: (r) =\u003e ({r with _value: r._value / 1000.0}))\n    |\u003e map(fn: (r) =\u003e ({r with unit: \"kWh\"}))\n```\n\nDifferences in consumption (1.8.0) and poduction (2.8.0) dashboard data in Wh:\n\n```\nfrom(bucket: \"home\")\n    |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n\t\t|\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"power\")\n    |\u003e filter(fn: (r) =\u003e r[\"ident\"] == \"1.8.0\" or r[\"ident\"] == \"2.8.0\")\n    |\u003e difference()\n```\n\nExample data:\n\n![](static/SaMLer_Grafana_Simple_Dashboard.png)\n\n## Known restrictions \u0026 TODO\n\n* By now, there's only a single serial mode supported what's reflected in the configuration defaults:\n  _Baud rate `9600` and mode `8-N-1` (8 data bits, 1 stop bit, none parity)_\n  That needs to be generalized.\n* Smart Meter data may be properitary to electric power meter, as that's the only one I have tested SaMLer with right now.\n  Please file [issues](https://github.com/heubeck/samler/issues) with devices you'd like to read.\n* Timing values are hard coded and should made configurable on demand.\n* My C and Go skills are only rudimentary, don't hesitate to point out improvements.\n* The only supported backends are InfluxDB and MySQL by now, but it's prepared to support more, just file an [issues](https://github.com/heubeck/samler/issues).\n\n## Contribution\n\nYes, please. Looking forward to your ideas.\n\n## Sample installation\n\nAt my place, I'm using the SaMLer on a Banana Pi 2 Zero connected to an USB IR sensor attached to the electric smart meter, sending to a free Influx2 Cloud account.\nThe visualization is done using a free Grafana Cloud account using the InfluxDB datasource.\nAt night, my WLAN is disabled, SaMLer caches the measurements on its \"disk\" during this network outage and sends it once the connection is recovered in the morning\n\n![](static/SaMLer_IR.jpg)\n\n![](static/SaMLer_Pi.jpg)\n\n![](static/SaMLer_Wifi.jpg)\n\n![](static/SaMLer_Grafana.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheubeck%2Fsamler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheubeck%2Fsamler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheubeck%2Fsamler/lists"}