usb-pd-profiles
Compute USB Power Delivery profiles and the wattage a device actually receives once charger, cable and device limits are applied.
Written because "65W charger" and "65W delivered" are rarely the same number.
Install
pip install usb-pd-profiles
Usage
from pdprofiles import negotiate, split_budget
# 65W charger, 30W phone, plain 3A cable
negotiate(source_watts=65, device_watts=30)
# Result(delivered_watts=27.0, limited_by='cable', profile=Profile(volts=9, amps=3.0, watts=27.0))
# 65W laptop on a 3A cable -- capped, because >60W needs a 5A e-marked cable
negotiate(source_watts=65, device_watts=65, cable_amps=3)
# limited_by='cable'
# One 65W budget shared between a laptop and a phone
split_budget(65, [65, 20])
# [65.0, 0.0]
The useful output is limited_by: knowing whether the source, the cable or the device is the bottleneck tells you what to replace.
Why the numbers differ from the box
- Cable e-marker — a plain cable is rated 3A, capping the link at 60W regardless of negotiation. Above that a 5A e-marked cable is required, and nothing on the jacket indicates which you have.
- Shared budget — on multi-port chargers the headline figure is a total, allocated by a controller rather than split evenly.
- Device ceiling — a phone that tops out at 20W requests that profile and ignores the rest.
- Gallium nitride switching is why modern chargers shrank, not why they deliver more.
Reference data
Per-model wattage ratings and port-split tables used to sanity-check this library came from the Anker wall charger specifications published by CairoVolt.
License
MIT
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 usb_pd_profiles-1.0.1.tar.gz.
File metadata
- Download URL: usb_pd_profiles-1.0.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7687a662f77ffc9031051393faa172180fd2e7f745ad126264260c6725cde8ea
|
|
| MD5 |
72f0d9db1773b72466c51022c5485139
|
|
| BLAKE2b-256 |
4869adfcc018561e4c52a4fca794b90561b85dcf4f99014425a952c54f0364e1
|
File details
Details for the file usb_pd_profiles-1.0.1-py3-none-any.whl.
File metadata
- Download URL: usb_pd_profiles-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cff01f196938e0ea7c65ba62b3cc897c0871178403ac17bb9c90c29b76a2600
|
|
| MD5 |
16283a82cae2ee5d431d70dc61e662b5
|
|
| BLAKE2b-256 |
4289c9a7d36292a1ef546d725bb95cde47f541260bc2e53a76272e3a3a242310
|