wattaged is a utility that logs the consummed electricity and allows you to quickly compute the consummed kWh
Project description
wattaged
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.shscript to/opt/wattaged - It adds a root cron task to run
wattage_apcupsd.shevery 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a247df1eece821ca130434bd7ef4e1cbddf0ae8d5b6a4549a5da64370b150f15
|
|
| MD5 |
04378dcb96d6758bf877e4b80b94b16f
|
|
| BLAKE2b-256 |
0b79386c7e15a51ebcdadab027446f0007b07e53e36164f1f3ddc778931e0fb3
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a536b5b5aa778bea97f18683236a974c5b2b419281ea2e23d6497eeaa65309f
|
|
| MD5 |
42af8621cccb05c92071f0f4d3531721
|
|
| BLAKE2b-256 |
d506068652b8fb582b52d7b39eb6979f083dabcd60ca3bd29a475b2c1301b473
|