Skip to main content

wattaged is a utility that logs the consummed electricity and allows you to quickly compute the consummed kWh

Project description

wattaged

PyPI version

Wattage Daemon is a utility that logs the consummed electricity and allows you to quickly compute the consummed kWh

Getting started

To install the CLI, run the following:

pip3 install -U wattaged
wattage --help

# Install the daemon to /opt/wattaged
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/sam1902/wattaged/HEAD/install.sh)"

The install script (separate from pip3 install) does a lot of things:

  • It moves the wattage_apcupsd.sh script to /opt/wattaged
  • It adds a root cron task to run wattage_apcupsd.sh every 5 minutes and log the results to /var/wattaged/watts.log
  • It adds a logrotate config to rotate the wattaged logs before it gets out of hands
  • Finally, it installs the CLI to the global Python interpreter with pip install

The CLI will try reading logs from /var/log/wattaged. Since the daemon logs every 5 minutes, wait at least 5 minutes to see the first log appear.

The CLI also displays the price in EUR based on the price per kWh in France in 2021-07-27.

If you want to use the output of wattage for something, you can get the Wh value alone by doing:

wattage 2>/dev/null | cut -f 1

as the price in EUR is outputted to stderr, and the Wh value is tab separated from the unit and timespan.

Development

To install the latest version from Github, run:

git clone git@github.com:sam1902/wattaged.git wattaged
cd wattaged
chmod +x install.sh
./install.sh
pip3 install -U .

Usage

usage: wattage [-h] [--start START] [--end END] [--logdir LOGDIR]

Computes how much watt-hours were consummed in the time span requested

optional arguments:
  -h, --help       show this help message and exit
  --start START    The start date to compute the consumption, any format recognised by dateutil.parser.parse will work. By default, starts at
                   the last boot time.
  --end END        The end date to compute the consumption. By default computes till the latest record.
  --logdir LOGDIR  The path where .log and .log.gz-ddMMYY are stored

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

wattaged-0.1.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wattaged-0.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file wattaged-0.1.1.tar.gz.

File metadata

  • Download URL: wattaged-0.1.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.7

File hashes

Hashes for wattaged-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a247df1eece821ca130434bd7ef4e1cbddf0ae8d5b6a4549a5da64370b150f15
MD5 04378dcb96d6758bf877e4b80b94b16f
BLAKE2b-256 0b79386c7e15a51ebcdadab027446f0007b07e53e36164f1f3ddc778931e0fb3

See more details on using hashes here.

File details

Details for the file wattaged-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: wattaged-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.7

File hashes

Hashes for wattaged-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a536b5b5aa778bea97f18683236a974c5b2b419281ea2e23d6497eeaa65309f
MD5 42af8621cccb05c92071f0f4d3531721
BLAKE2b-256 d506068652b8fb582b52d7b39eb6979f083dabcd60ca3bd29a475b2c1301b473

See more details on using hashes here.

Supported by

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