{"id":20278767,"url":"https://github.com/twrecked/hass-pwrstat","last_synced_at":"2025-08-25T12:26:42.083Z","repository":{"id":209244735,"uuid":"723566600","full_name":"twrecked/hass-pwrstat","owner":"twrecked","description":"Cyberpower/pwrstat-api UPS Support for Home Assistant","archived":false,"fork":false,"pushed_at":"2024-05-02T21:37:31.000Z","size":79,"stargazers_count":16,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T06:13:12.217Z","etag":null,"topics":["cyberpower","home-assistant","pwrstat-api"],"latest_commit_sha":null,"homepage":"","language":"Python","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/twrecked.png","metadata":{"files":{"readme":"README.md","changelog":"changelog","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":"2023-11-26T04:17:20.000Z","updated_at":"2025-04-09T10:27:43.000Z","dependencies_parsed_at":"2024-05-02T22:37:28.525Z","dependency_job_id":"b2778040-d8b2-48be-bf72-7b7f556d5ee6","html_url":"https://github.com/twrecked/hass-pwrstat","commit_stats":null,"previous_names":["twrecked/hass-pwrstat"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twrecked%2Fhass-pwrstat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twrecked%2Fhass-pwrstat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twrecked%2Fhass-pwrstat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twrecked%2Fhass-pwrstat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twrecked","download_url":"https://codeload.github.com/twrecked/hass-pwrstat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351394,"owners_count":21089270,"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","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":["cyberpower","home-assistant","pwrstat-api"],"created_at":"2024-11-14T13:26:11.785Z","updated_at":"2025-08-25T12:26:42.069Z","avatar_url":"https://github.com/twrecked.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A pwrstat Home Assistant Integration\n\nAn integration to poll a _Cyberpower_ UPS throught the [pwrstat-api](https://github.com/sbruggeman/pwrstat-api) wrapper.\n\n# Thanks\n\nMany thanks to:\n* @bruggeman for the `pwrstat-api` wrapper.\n\n# Introduction\n\nI wrote this to compliment the _pwrstat-api_ wrapper. I've been accessing the wrapper using the [RESTful API](https://www.home-assistant.io/integrations/rest/) integration and it was working great. But it was lacking full _Integration_ support and monitoring more than one UPS was a pain manage to config.\n\nI decided to add proper _Integration_ support.\n\nThe integration needs a working `pwrstat-api` server. The integration does not support any of the cloud feature of _Cyberpower_.\n\n# Requirements\n\nThe integration needs a working install of `pwrstat-api` to provide the _UPS_ data in a _JSON_ format. You can install one directly from the official web site or look at the [A Quick pwrstat Docker Image](#a-quick-pwrstat-docker-image) section to see how to set one up from this repository.\n\n# Installing the Integration\n\n## HACS\n[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg?style=for-the-badge)](https://github.com/hacs/integration)\n\nNot yet...\n\n## Manually\nCopy the `custom_components/pwrstat` directory into your `/config/custom_components` directory.\n\n## From Script\nRun the installation script. Run it once to make sure the operations look sane  \nand run it a second time with the `go` parameter to do the actual work. If you  \nupdate just rerun the script, it will overwrite all installed files.\n\n```shell  \ninstall /config# check output looks good  \ninstall go /config\n```  \n\nRestart your _Home Assistant_ installation.\n\n# Adding and Configuring the Integration\n\nFollow these steps:\n\n- Navigate to `Settings -\u003e Devices \u0026 Services`.\n- Click on `+ ADD INTEGRATION`.\n- Search for `cyberpower` and select it.\n- Enter the _UPS_ name, its exact URL including the scheme, and how often you   \n  want to poll the device.\n- Click `Submit`.\n\nIf it works you should see this:\n\n![Sensor List](images/pwrstat-sensors.png)\n\nYou can enter more than one _UPS_.\n\n# Extras\n\n## Energy Sensor\n\nYou can create an energy sensor to convert `W` into `kWh` with something similar to this:\n\n```yaml  \n- platform: integration  \n  source: sensor.pwrstat_office_ups_load\n  name: pwrstat_office_ups_energy\n  unit_prefix: k\n  round: 2\n  method: left  \n```  \n\n## A Quick pwrstat Docker Image\n\nThis is my snapshot of the `pwrstat-api` docker set up. I modified it to mount the local tools inside the docker so there was no need to include a `deb` file.\n\nYou can create a docker instance with these commands:\n\n```bash  \ncd extras/pwstatcd\ndocker build -t ups-status:latest -f dockerfile .\nHOME_NAME=your-name-goes-here docker-compose up  \n  \n# This should work.  \nwget -q -O - http://127.0.0.1:5002/pwrstat\n{\"Battery Capacity\": \"80 %\", \"Firmware Number\": \"BF01902B1D1z\", \"Last Power Event\": \"Blackout at 2023/11/25 22:04:46 for 15 sec\", \"Line Interaction\": \"None\", \"Load\": \"86 Watt(23 %)\", \"Model Name\": \"ST Series\", \"Output Voltage\": \"116 V\", \"Power Supply by\": \"Utility Power\", \"Rating Power\": \"375 Watt\", \"Rating Voltage\": \"120 V\", \"Remaining Runtime\": \"19 min\", \"State\": \"Normal\", \"Test Result\": \"Passed at 2022/08/24 10:20:31\", \"Utility Voltage\": \"116 V\"}\n```\n\n## Nut\nYou can also use [Network UPS Tools](https://www.home-assistant.io/integrations/nut/).\n\nAnd I did for the longest time and it great. I just found it a little too powerful for my needs. I have 2 PCs each with a Cyberpower UPS on them and it ended up being simpler to monitor them in _Home Assistant_ so a lot of the extra functionality was moot. Look at it if you're trying to hook different UPS devices together across a variety of systems.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwrecked%2Fhass-pwrstat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwrecked%2Fhass-pwrstat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwrecked%2Fhass-pwrstat/lists"}