Catalog PyPI
Back to packageRELEASE DETAILS

1.0.0

PyPI

aioapcaccess

Async version of apcaccess library implemented in python.

Published2 Sept 2025
Direct dependencies3
Transitive dependenciesNot calculated

README

Version 1.0.0 documentation

aioapcaccess

build codecov PyPI GitHub

An async implementation of apcaccess. This library provides programmatic access to the status information provided by apcupsd over its Network Information Server (NIS) which usually listens on TCP port 3551.

This project is a re-implementation of the synchronous version flyte/apcaccess using asyncio, where a lot of the logic is borrowed and improved.

Install

Install with pip:

$ pip install aioapcaccess

Usage

The primary API for getting the status from APCUPS is aioapcaccess.request_status. It returns a collections.OrderedDict mapping from field names (e.g., "SERIALNO") to their values in string format. What fields are available will depend on the model of your APC UPS, see APCUPSD manual for details.

The following example shows a typical usage of aioapcaccess

import asyncio
import aioapcaccess

async def main():
    result = await aioapcaccess.request_status(host='localhost', port=3551)
    print(result)

if __name__ == '__main__':
    asyncio.run(main())

The example above will print the following (prettified and simplified):

OrderedDict([
  ('APC', '001,036,0879'),
  ...,
  ('BATTV', '13.7 Volts'),
  ('CUMONBATT', '0 Seconds')
))])

In addition to request_status, we offer the following functions for advanced uses:

  • aioapcaccess.request_raw_status for getting raw (unparsed) status in bytes.
  • aioapcaccess.parse_raw_status for parsing the bytes to the dict shown above.
  • aioapcaccess.split_unit for splitting the supported unit suffix from the value strings, returning a tuple (value, unit). You can check aioapcaccess.UNITS for the set of supported units. Note that units are also in the forms of strings (e.g., "Seconds", "Volts"). If no valid units are found in the value strings, unit will be None.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 3

Native requirements
3 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pytest>=6.0; extra == "dev"runtime
pytest-cov
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pytest-cov; extra == "dev"runtime
pytest-asyncio
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pytest-asyncio>=0.17; extra == "dev"runtime

Distribution files

1 collected
aioapcaccess-1.0.0-py3-none-any.whl

bdist_wheel · 4.93 KB · Python py3

Source file

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:36 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:50fc5500fb8f7363b9e5500a4ecbcdae5a790aee129ea11f6214795cbade1e1f

Other collected versions

View all collected versions →