{"id":37082978,"url":"https://github.com/numat/tripplite","last_synced_at":"2026-01-14T10:02:25.165Z","repository":{"id":38106517,"uuid":"118970009","full_name":"numat/tripplite","owner":"numat","description":"Python USB HID interface to Tripplite UPS battery backups.","archived":false,"fork":false,"pushed_at":"2023-09-06T19:06:42.000Z","size":46,"stargazers_count":31,"open_issues_count":3,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-11-27T16:20:37.195Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numat.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}},"created_at":"2018-01-25T21:30:40.000Z","updated_at":"2025-08-25T16:40:54.000Z","dependencies_parsed_at":"2022-09-03T23:03:12.772Z","dependency_job_id":null,"html_url":"https://github.com/numat/tripplite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/numat/tripplite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numat%2Ftripplite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numat%2Ftripplite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numat%2Ftripplite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numat%2Ftripplite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numat","download_url":"https://codeload.github.com/numat/tripplite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numat%2Ftripplite/sbom","scorecard":{"id":698529,"data":{"date":"2025-08-11","repo":{"name":"github.com/numat/tripplite","commit":"5678aefa7fac12845b90f3368d4c612704264f08"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/26 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/python-package.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/numat/tripplite/python-package.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:31","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:32","Info:   1 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T04:28:27.974Z","repository_id":38106517,"created_at":"2025-08-22T04:28:27.974Z","updated_at":"2025-08-22T04:28:27.974Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416502,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"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":[],"created_at":"2026-01-14T10:02:24.267Z","updated_at":"2026-01-14T10:02:25.146Z","avatar_url":"https://github.com/numat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tripplite\n\nPython USB interface and command-line tool for TrippLite UPS battery backups.\n\n![](https://www.markertek.com/productImage/450X450/SMART1500LCD.JPG)\n\n## Background\n\nTrippLite offers [UI software](https://www.tripplite.com/products/power-alert)\nfor monitoring its batteries. However, most of its batteries don't have\nnetwork access, and the existing TrippLite software requires a local install.\n\nI wanted to monitor the UPS from a remote headless Linux server, so I wrote\nthis tool.\n\n## Supported Hardware\n\nThis has been exclusively tested on the TrippLite SMART1500LCD UPS. It will\nlikely work on similar firmware but there is a known communication issue with\nsome other TrippLite models (see [numat/tripplite#3](https://github.com/numat/tripplite/issues/3)).\n\nUse `lsusb` to check. `09ae:2012` should work, while `09ae:3016` may not.\n\n## Installation\n\n```console\napt install gcc libusb-1.0-0-dev libudev-dev\npip install tripplite\n```\n\nConnect a USB cable from the UPS to your headless server, and you should be\nready to run. If you don't want to run as root, see *Note on Permissions*\nbelow.\n\n# Command Line\n\n```\n$ tripplite\n{\n    \"config\": {\n        \"frequency\": 60,  # Hz\n        \"power\": 1500,  # VA\n        \"voltage\": 120  # V\n    },\n    \"health\": 100,  # %\n    \"input\": {\n        \"frequency\": 59.7,  # Hz\n        \"voltage\": 117.2  # V\n    },\n    \"output\": {\n        \"power\": 324,  # W\n        \"voltage\": 117.2  # V\n    },\n    \"status\": {\n        \"ac present\": true,\n        \"below remaining capacity\": true,\n        \"charging\": false,\n        \"discharging\": false,\n        \"fully charged\": true,\n        \"fully discharged\": false,\n        \"needs replacement\": false,\n        \"shutdown imminent\": false\n    },\n    \"time to empty\": 1004  # s\n}\n```\n\nTo use in shell scripts, parse the json output with something like\n[jq](https://stedolan.github.io/jq/). For example,\n`tripplite | jq '.status.\"ac present\"'` will return whether or not the unit\ndetects AC power.\n\n## Python\n\nIf you'd like to link this to more complex behavior (e.g. data logging,\ntext alerts), consider using a Python script.\n\n```python\nfrom tripplite import Battery\nwith Battery() as battery:\n    print(battery.get())\n```\n\nThe `state` variable will contain an object with the same format as above. Use\n`state['status']['ac present']` and `state['status']['shutdown imminent']` for\nalerts, and consider logging voltage, frequency, and power.\n\nIf you are logging multiple batteries, you will need to handle each connection\nseparately.\n\n```python\nfrom tripplite import Battery, battery_paths\nfor path in battery_paths:\n    with Battery(path) as battery:\n        print(battery.get())\n```\n\nThese paths are unfortunately non-deterministic and will change on each\niteration.\n\nFor long polling, you can improve stability by keeping connections open as long\nas possible and reconnecting on error. For example:\n\n```python\nstate = None\n\ndef read_batteries(check_period=5):\n    \"\"\"Read battery and reopen in error. Use for long polling.\"\"\"\n    battery = Battery()\n    battery.open()\n    while True:\n        time.sleep(check_period)\n        try:\n            state = battery.get()\n        except OSError:\n            logging.exception(f\"Could not read battery {battery}.\")\n            battery.close()\n            battery.open()\n```\n\nAn example for multiple batteries can be found in [numat/tripplite#6](https://github.com/numat/tripplite/pull/6#issuecomment-700152340).\n\n## Note on Permissions\n\nTo read the TrippLite, you need access to the USB port. You have options:\n\n* Run everything as root\n* Add your user to the `dialout` group to access *all* serial ports\n* Create a group restricted to accessing TrippLite USB devices through `udev`\n\nFor the last option, the rule looks like:\n\n```console\necho 'SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"09ae\", GROUP=\"tripplite\"' \u003e /etc/udev/rules.d/tripplite.rules\nudevadm control --reload-rules\n```\n\n## Prometheus Exporter\n\nThis package offers an extra install to include a [Prometheus Exporter](https://prometheus.io/docs/instrumenting/exporters/)\nwhich allows for data collection into a prometheus time series database. Essentially it's a small `HTTP` server that allows\nPrometheus to *scrape* grabbing metrics at a configurable period.\n\n### Install\n\n```console\npip install tripplite[exporter]\n```\n\n* This adds the [prometheus_client](https://pypi.org/project/prometheus-client/) dependency.\n\nYou can then manually run the `triplite-exporter` cli or use the\n[tripplite_exporter.service](https://github.com/numat/tripplite/blob/master/tripplite_exporter.service)\nsystemd unit file to have systemd run and supervise the process.\n\n### Failure Mode\n\nThe script will try to close and reopen the USB serial connection to the device on an `OSError`. If an open fails,\nthe script will exit with the return code of 2.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumat%2Ftripplite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumat%2Ftripplite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumat%2Ftripplite/lists"}