Skip to main content

DFRobotUPS module

Project description

DFROBOTUPS MODULE

It supports the DFRobotUPS HAT for the Raspberry Pi Zero (the more sophisticated version for other Pis has not be checked nor tested) and can retrieve information about the HAT itself, as well as dynamic data for the current SoC (State of Charge) and cell voltage.

In addition, it can be run in a mode to poll the SoC and trigger a shutdown command when it falls below a specified level.

This module contains can be used as a standalone utility or imported for use in other scripts.

The module was developed and used under Python 3.9 on Raspberry PiOS 11.9.

The information to write the module was taken from the DFRobotUPS wiki at: https://wiki.dfrobot.com/UPS%20HAT%20for%20Raspberry%20Pi%20%20Zero%20%20SKU%3A%20DFR0528

Command line options

The command line options listed with --help are shown below:

usage: DFRobotUPS [-h] [-s] [-p PERCENT] [-i INTERVAL] [-c CMD [ARG ...]]
                  [-a ADDR] [-b BUS] [-r RETRY] [-d] [-v]

optional arguments:
  -h, --help            show this help message and exit
  -s, --shutdown        poll the battery SoC and initiate system shutdown when
                        level drops below the defined level; the default is
                        not to do this but display information about the UPS
                        HAT instead
  -p PERCENT, --percent PERCENT
                        State of Charge (SoC) percentage at which to trigger
                        shutdown shutdown (min: 5, max: 95, default: 7)
  -i INTERVAL, --interval INTERVAL
                        number of seconds between polls of the battery SoC
                        (min: 1, max: 600, default: 60)
  -c CMD [ARG ...], --cmd CMD [ARG ...]
                        command to run to trigger shutdown
  -a ADDR, --addr ADDR  I2C address for UPS HAT; can be specified in hex as
                        0xNN (default: 0x10)
  -b BUS, --bus BUS     I2C SMBus number for UPS HAT (default: 1)
  -r RETRY, --retry RETRY
                        number of times to try connecting to the UPS HAT
                        (default: 10)
  -d, --debug           increase debugging level (max: 2, default: 0)
  -v, --version         show program's version number and exit

Author

Robert Franklin rcf@mince.net, UK

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

DFRobotUPS-0.4.7.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

DFRobotUPS-0.4.7-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file DFRobotUPS-0.4.7.tar.gz.

File metadata

  • Download URL: DFRobotUPS-0.4.7.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for DFRobotUPS-0.4.7.tar.gz
Algorithm Hash digest
SHA256 15bc69ab643ae0efab253d2536d8063d72757eaf4ffc26ca67725063f6739f4c
MD5 3555e73d3c0431e215049efbbdf5ab6a
BLAKE2b-256 2aa7e68576e7b55c70f40dc5fd6604e40d2ba95ed190a0670720c9910c5dbcc2

See more details on using hashes here.

File details

Details for the file DFRobotUPS-0.4.7-py3-none-any.whl.

File metadata

  • Download URL: DFRobotUPS-0.4.7-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for DFRobotUPS-0.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 29e8cc539ec3f454091220178ea0349ec794f1809ee3942be52020d04c1a57bc
MD5 7b2275142e2bfa89db6025aa8c6102dc
BLAKE2b-256 35f62faeb61a4f6ab0f67e51fa2f689659cacce89da888c2e7ea94a790e3fbc7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page