Python UM-Meter interface
Project description
Python UM-Meter interface
Support RDTech UM24C, UM25C, UM34C.
Library usage
Open an UM-Meter interface and request data:
from pyummeter import UMmeter, UMmeterInterfaceTTY
with UMmeter(UMmeterInterfaceTTY("/path/to/serial/port")) as meter:
data = meter.get_data()
print(f"{data['voltage']} V / {data['power']} W")
It is also possible to export the data to a CSV file:
from datetime import datetime
from pyummeter import UMmeter, UMmeterInterfaceTTY
from pyummeter.export_csv import ExportCSV
csv = ExportCSV("/path/to/csv")
with UMmeter(UMmeterInterfaceTTY("/path/to/serial/port")) as meter:
csv.update(datetime.now(), meter.get_data())
List of data available:
model
: UM-Meter model name (exported to CSV)voltage
: Voltage (V) (exported to CSV)intensity
: Intensity (A) (exported to CSV)power
: Power (W) (exported to CSV)resistance
: Resistance (Ohm) (exported to CSV)usb_voltage_dp
: USB Voltage D+ (V) (exported to CSV)usb_voltage_dn
: USB Voltage D- (V) (exported to CSV)charging_mode
: Charging mode short name (exported to CSV)charging_mode_full
: Charging mode full nametemperature_celsius
: Temperature (°C) (exported to CSV)temperature_fahrenheit
: Temperature (°F)data_group_selected
: Selected data group (index)data_group
: Data for each data group (list) (exported to CSV, only the selected group)capacity
: Capacity (Ah)energy
: Energy (Wh)
record_capacity_threshold
: [Record mode] Capacity threshold (Ah) (exported to CSV)record_energy_threshold
: [Record mode] Energy threshold (Wh) (exported to CSV)record_intensity_threshold
: [Record mode] Intensity threshold (A) (exported to CSV)record_duration
: [Record mode] Duration (seconds) (exported to CSV)record_enabled
: [Record mode] Enable status (exported to CSV)screen_index
: Screen indexscreen_timeout
: Screen timeoutscreen_brightness
: Screen brightnesschecksum
: Checksum of all data
Meter control managed (not available on all model):
- Screen control:
- Change (next/previous)
- Rotate
- Set timeout (0 to 9 minutes)
- Set brightness (0 to 5)
- Data group control:
- Select (0 to 9, next)
- Clear
- Record threshold (0 to 300 mA)
Running example
Bluetooth initialisation
$ sudo killall rfcomm
$ rfkill block bluetooth
$ rfkill unblock bluetooth
$ sudo bluetoothctl
[bluetooth] power on
[bluetooth] agent on
[bluetooth] scan on
[bluetooth] pair <MAC>
$ sudo rfcomm connect /dev/rfcomm0 <MAC>
Demo application usage
poetry install
poetry run task demo -t /dev/rfcomm0
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
pyummeter-0.2.0.tar.gz
(7.2 kB
view details)
Built Distribution
File details
Details for the file pyummeter-0.2.0.tar.gz
.
File metadata
- Download URL: pyummeter-0.2.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.8.16 Linux/5.15.0-1021-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | def19bd72fb238f1ebb225caf5b7d7b254a79aa7b8bd4f0e6249a1c18eb98962 |
|
MD5 | 57aef4f4a0afec8e1ff9ac9983258d0a |
|
BLAKE2b-256 | ec47fccddc6f0e953d0e5634013be52bdd06cd6d612e7bce13f659cc89bbfc92 |
File details
Details for the file pyummeter-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: pyummeter-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.8.16 Linux/5.15.0-1021-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ab83c8d4ee25a0df714caa5b094ac8e601f0159fd8f69565137045b569a1688 |
|
MD5 | 80a7980d0ef71543052f216dc009e21e |
|
BLAKE2b-256 | e89372c5e2031529b690526e1be70a111f1a7e2011bb416ba98ccb7f6e26349c |