{"id":13725337,"url":"https://github.com/flyte/apcaccess","last_synced_at":"2025-03-19T17:32:24.282Z","repository":{"id":149757237,"uuid":"51380926","full_name":"flyte/apcaccess","owner":"flyte","description":null,"archived":false,"fork":false,"pushed_at":"2021-01-22T17:52:44.000Z","size":23,"stargazers_count":31,"open_issues_count":0,"forks_count":7,"subscribers_count":7,"default_branch":"develop","last_synced_at":"2025-02-28T20:15:38.574Z","etag":null,"topics":[],"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/flyte.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}},"created_at":"2016-02-09T16:45:08.000Z","updated_at":"2024-11-05T01:07:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"5e844016-322d-4b74-ba1d-20952233b667","html_url":"https://github.com/flyte/apcaccess","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyte%2Fapcaccess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyte%2Fapcaccess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyte%2Fapcaccess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyte%2Fapcaccess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flyte","download_url":"https://codeload.github.com/flyte/apcaccess/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244010927,"owners_count":20383333,"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":[],"created_at":"2024-08-03T01:02:19.879Z","updated_at":"2025-03-19T17:32:24.276Z","avatar_url":"https://github.com/flyte.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"![build status](https://travis-ci.org/flyte/apcaccess.svg?branch=develop)\n\napcaccess\n=========\n\nA pure Python version of [apcaccess](http://linux.die.net/man/8/apcaccess). This library may be used as part of a Python project to offer programmatic access to the status information provided by [apcupsd](http://www.apcupsd.org/) over its Network Information Server (NIS) which usually listens on TCP port 3551.\n\n\nInstallation\n------------\n\n```bash\npip install apcaccess\n```\n\nCommand Line Usage\n-----\n\nThe `apcaccess` command line script will output the same as the original [apcaccess](http://linux.die.net/man/8/apcaccess) and takes the following options:\n\n```bash\n$ apcaccess --help\nusage: apcaccess [-h] [--host HOST] [--port PORT] [--strip-units]\n\noptional arguments:\n  -h, --help     show this help message and exit\n  --host HOST\n  --port PORT\n  --strip-units\n```\n\nExample output:\n\n```bash\n$ apcaccess --host 10.0.0.15\nAPC      : 001,053,1270\nDATE     : 2017-01-04 10:52:18 +0000  \nHOSTNAME : hostname.yourdomain.co.uk\nVERSION  : 3.14.12 (29 March 2014) redhat\nUPSNAME  : netrack\nCABLE    : Custom Cable Smart\nDRIVER   : APC Smart UPS (any)\nUPSMODE  : Stand Alone\nSTARTTIME: 2016-09-07 12:05:18 +0100  \nMODEL    : SMART-UPS 1400\nSTATUS   : TRIM ONLINE \nLINEV    : 248.3 Volts\nLOADPCT  : 11.4 Percent\nBCHARGE  : 100.0 Percent\nTIMELEFT : 115.0 Minutes\nMBATTCHG : 5 Percent\nMINTIMEL : 3 Minutes\nMAXTIME  : 0 Seconds\nMAXLINEV : 252.2 Volts\nMINLINEV : 247.0 Volts\nOUTPUTV  : 219.7 Volts\nSENSE    : High\nDWAKE    : 0 Seconds\nDSHUTD   : 180 Seconds\nDLOWBATT : 2 Minutes\nLOTRANS  : 196.0 Volts\nHITRANS  : 253.0 Volts\nRETPCT   : 15.0 Percent\nITEMP    : 31.5 C\nALARMDEL : Low Battery\nBATTV    : 27.6 Volts\nLINEFREQ : 50.0 Hz\nLASTXFER : High line voltage\nNUMXFERS : 210\nXONBATT  : 2017-01-04 09:29:53 +0000  \nTONBATT  : 0 Seconds\nCUMONBATT: 518 Seconds\nXOFFBATT : 2017-01-04 09:29:55 +0000  \nLASTSTEST: 2016-10-27 23:23:36 +0100  \nSELFTEST : NO\nSTESTI   : 336\nSTATFLAG : 0x0500000A\nDIPSW    : 0x00\nREG1     : 0x00\nREG2     : 0x00\nREG3     : 0x00\nMANDATE  : 07/13/99\nSERIALNO : GS9939101425\nBATTDATE : 13/11/15\nNOMOUTV  : 230 Volts\nNOMBATTV : 24.0 Volts\nEXTBATTS : 0\nFIRMWARE : 70.11.I\nEND APC  : 2017-01-04 10:52:41 +000\n```\n\nProgrammatic Usage\n------------------\n\nThe advantage of this project over the original is that it can be used within another Python application to fetch and parse the output from an APC UPS into a more useful format:\n\n```python\nIn [1]: from apcaccess import status as apc\n\nIn [2]: apc.parse(apc.get(host=\"10.0.0.15\"), strip_units=True)\nOut[2]: \nOrderedDict([(u'APC', u'001,053,1270'),\n             (u'DATE', u'2017-01-04 11:07:36 +0000'),\n             (u'HOSTNAME', u'hostname.yourdomain.co.uk'),\n             (u'VERSION', u'3.14.12 (29 March 2014) redhat'),\n             (u'UPSNAME', u'netrack'),\n             (u'CABLE', u'Custom Cable Smart'),\n             (u'DRIVER', u'APC Smart UPS (any)'),\n             (u'UPSMODE', u'Stand Alone'),\n             (u'STARTTIME', u'2016-09-07 12:05:18 +0100'),\n             (u'MODEL', u'SMART-UPS 1400'),\n             (u'STATUS', u'TRIM ONLINE'),\n             (u'LINEV', u'247.0'),\n             (u'LOADPCT', u'11.4'),\n             (u'BCHARGE', u'100.0'),\n             (u'TIMELEFT', u'111.0'),\n             (u'MBATTCHG', u'5'),\n             (u'MINTIMEL', u'3'),\n             (u'MAXTIME', u'0'),\n             (u'MAXLINEV', u'250.9'),\n             (u'MINLINEV', u'247.0'),\n             (u'OUTPUTV', u'218.4'),\n             (u'SENSE', u'High'),\n             (u'DWAKE', u'0'),\n             (u'DSHUTD', u'180'),\n             (u'DLOWBATT', u'2'),\n             (u'LOTRANS', u'196.0'),\n             (u'HITRANS', u'253.0'),\n             (u'RETPCT', u'15.0'),\n             (u'ITEMP', u'31.5'),\n             (u'ALARMDEL', u'Low Battery'),\n             (u'BATTV', u'27.6'),\n             (u'LINEFREQ', u'50.0'),\n             (u'LASTXFER', u'High line voltage'),\n             (u'NUMXFERS', u'210'),\n             (u'XONBATT', u'2017-01-04 09:29:53 +0000'),\n             (u'TONBATT', u'0'),\n             (u'CUMONBATT', u'518'),\n             (u'XOFFBATT', u'2017-01-04 09:29:55 +0000'),\n             (u'LASTSTEST', u'2016-10-27 23:23:36 +0100'),\n             (u'SELFTEST', u'NO'),\n             (u'STESTI', u'336'),\n             (u'STATFLAG', u'0x0500000A'),\n             (u'DIPSW', u'0x00'),\n             (u'REG1', u'0x00'),\n             (u'REG2', u'0x00'),\n             (u'REG3', u'0x00'),\n             (u'MANDATE', u'07/13/99'),\n             (u'SERIALNO', u'GS9939101425'),\n             (u'BATTDATE', u'13/11/15'),\n             (u'NOMOUTV', u'230'),\n             (u'NOMBATTV', u'24.0'),\n             (u'EXTBATTS', u'0'),\n             (u'FIRMWARE', u'70.11.I'),\n             (u'END APC', u'2017-01-04 11:07:52 +000')])\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflyte%2Fapcaccess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflyte%2Fapcaccess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflyte%2Fapcaccess/lists"}