Python API and CLI for controlling Jackery portable power stations
Project description
socketry
Python API and CLI for controlling Jackery portable power stations.
Reverse-engineered from the Jackery Android APK (v1.0.7) and iOS app (v1.2.0). Communicates via Jackery's cloud MQTT broker and HTTP API — no modifications to the device or its firmware.
Quick start
uvx 'socketry[cli]' login --email you@example.com --password 'yourpass'
uvx 'socketry[cli]' get
Or install it once and use socketry directly:
uv tool install 'socketry[cli]'
socketry login --email you@example.com --password 'yourpass'
socketry get
Supported devices
All 10 models in the current Jackery app share the same protocol:
| Model | Code |
|---|---|
| Explorer 3000 Pro | 1 |
| Explorer 2000 Plus | 2 |
| Explorer 300 Plus | 4 |
| Explorer 1000 Plus | 5 |
| Explorer 700 Plus | 6 |
| Explorer 280 Plus | 7 |
| Explorer 1000 Pro2 | 8 |
| Explorer 600 Plus | 9 |
| Explorer 240 | 10 |
| Explorer 2000 | 12 |
Properties and MQTT action IDs are exhaustive for this APK version. Unknown properties returned by newer firmware are displayed as raw key/value pairs.
Install
# Install as a CLI tool
uv tool install 'socketry[cli]'
# Or run directly without installing
uvx 'socketry[cli]' --help
# Or install as a library only (no CLI dependencies)
pip install socketry
# Or install with CLI included
pip install 'socketry[cli]'
CLI usage
Login
# Authenticates and discovers all devices (owned + shared with you)
socketry login --email you@example.com --password 'yourpass'
# List devices and select the active one
socketry devices
socketry select 0
Credentials are saved to ~/.config/socketry/credentials.json (mode 0600).
Reading properties (get)
# All properties (colored + grouped on a TTY)
socketry get
# Single property — by CLI name or raw protocol key
socketry get battery # Battery: 85%
socketry get rb # Battery: 85% (same thing)
socketry get ac # AC output: ON
# JSON output (indented on TTY, compact when piped)
socketry get --json
socketry get ac --json # {"oac": 1}
socketry get --json | jq .rb # pipe-friendly
Available properties:
| Group | Names |
|---|---|
| Battery & Power | battery, battery-temp, battery-state, input-power, output-power, input-time, output-time |
| I/O State | ac, dc, usb, car, ac-in, dc-in, light, wireless |
| Settings | charge-speed, auto-shutdown, energy-saving, battery-protection, sfc, ups, screen-timeout |
| AC / Power Detail | ac-input-power, car-input-power, ac-voltage, ac-freq, ac-power, ac-power-2, ac-socket-power |
| Other / Alarms | error-code, temp-alarm, power-alarm, power-mode-battery, total-temp, system-status, power-capacity |
Raw protocol keys (rb, oac, bt, ...) are also accepted.
Changing settings (set)
# I/O toggles
socketry set ac on
socketry set dc off
socketry set usb on
socketry set car off
# Light
socketry set light high # off | low | high | sos
# Device settings
socketry set charge-speed mute # fast | mute
socketry set battery-protection eco # full | eco
socketry set ups on
socketry set sfc on
# Integer settings
socketry set screen-timeout 30
socketry set auto-shutdown 60
socketry set energy-saving 30
# Wait for device confirmation
socketry set ac on --wait
# Show available settings
socketry set
socketry set light # "expects a value: off | low | high | sos"
Writable settings:
| Setting | Values | Description |
|---|---|---|
ac |
on / off | AC output |
dc |
on / off | DC output |
usb |
on / off | USB output |
car |
on / off | Car (12V) output |
ac-in |
on / off | AC input |
dc-in |
on / off | DC input |
light |
off / low / high / sos | Light mode |
screen-timeout |
integer | Screen timeout |
auto-shutdown |
integer | Auto shutdown timer |
charge-speed |
fast / mute | Charge speed mode |
battery-protection |
full / eco | Battery protection level |
energy-saving |
integer | Energy saving timeout |
sfc |
on / off | Super fast charge |
ups |
on / off | UPS mode |
Sharing devices (share-qr)
# Generate a sharing QR code (expires in 5 minutes)
socketry share-qr
# JSON output
socketry share-qr --json
Another Jackery user can scan the QR code in their Jackery app to gain access to your shared devices.
Watching live updates (watch)
# Stream all property changes in real time
socketry watch
# Filter to a single property
socketry watch battery
# Example output:
# [14:32:01] 855124121010657 Output power (output-power): 182W
# [14:32:05] 855124121010657 Battery (battery): 85%
# [14:32:10] Disconnected, reconnecting...
# [14:32:15] 855124121010657 Battery (battery): 84%
Press Ctrl+C to stop. The connection automatically reconnects if the broker
disconnects (e.g. when a set command runs from another terminal).
Note: The Jackery broker only allows one MQTT connection per account. Running
socketry setwhilewatchis active will briefly disconnect the watcher. It reconnects automatically, but updates during the reconnection window are lost.
Library usage
import asyncio
from socketry import Client
async def main():
# Authenticate (or load saved credentials)
client = await Client.login("email@example.com", "password")
client.save_credentials()
# Or load previously saved credentials
client = Client.from_saved()
# List and select devices
devices = await client.fetch_devices()
client.select_device(0)
# Read properties
props = await client.get_all_properties()
setting, value = await client.get_property("battery")
print(f"{setting.name}: {setting.format_value(value)}")
# Control
await client.set_property("ac", "on")
result = await client.set_property("light", "high", wait=True)
# Generate a sharing QR code
qr = await client.generate_share_qrcode()
print(f"QR Code ID: {qr['qrCodeId']}")
# Subscribe to real-time updates
async def on_update(device_sn: str, properties: dict) -> None:
print(f"{device_sn}: {properties}")
async def on_disconnect() -> None:
print("Reconnecting...")
subscription = await client.subscribe(on_update, on_disconnect=on_disconnect)
# ... later
await subscription.stop()
asyncio.run(main())
How it works
socketry ──HTTP──> iot.jackeryapp.com (login, device list, properties)
socketry ──MQTT──> emqx.jackeryapp.com (device control via encrypted TLS)
Login uses AES-192/ECB + RSA-1024 encrypted HTTP POST. Device control commands are published over MQTT (TLS 1.2 with a self-signed CA). Status polling uses the HTTP property endpoint. See docs/protocol.md for the full protocol specification.
Roadmap
- MQTT real-time monitor (
socketry watch+client.subscribe()) - Token auto-refresh (JWT expires ~30 days)
License
MIT
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
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 socketry-0.2.4.tar.gz.
File metadata
- Download URL: socketry-0.2.4.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cf2398c69ce5e8b2062530f5952bcc342eb2e237d9f67b19e5304d379429cd1
|
|
| MD5 |
9d5697fe6a717a0470993bb4d34ff7fc
|
|
| BLAKE2b-256 |
c805235bc0a5833056f1f81d96735eeca7e4edfdf4178833e9b4695129589522
|
Provenance
The following attestation bundles were made for socketry-0.2.4.tar.gz:
Publisher:
release.yml on jlopez/socketry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
socketry-0.2.4.tar.gz -
Subject digest:
8cf2398c69ce5e8b2062530f5952bcc342eb2e237d9f67b19e5304d379429cd1 - Sigstore transparency entry: 1203861704
- Sigstore integration time:
-
Permalink:
jlopez/socketry@66e39ed91ece0de3f2196f4632c978c766719aa4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jlopez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@66e39ed91ece0de3f2196f4632c978c766719aa4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file socketry-0.2.4-py3-none-any.whl.
File metadata
- Download URL: socketry-0.2.4-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fef279029fe95e7ee6c7912e7b74df241720c6088fb136427e362d323182ec7b
|
|
| MD5 |
10db0c25c500cde5688c21bc5f7003a1
|
|
| BLAKE2b-256 |
c01bb0ecfb12f6b7482199cecefcced9037e6e83e6a49800131e6115760acd33
|
Provenance
The following attestation bundles were made for socketry-0.2.4-py3-none-any.whl:
Publisher:
release.yml on jlopez/socketry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
socketry-0.2.4-py3-none-any.whl -
Subject digest:
fef279029fe95e7ee6c7912e7b74df241720c6088fb136427e362d323182ec7b - Sigstore transparency entry: 1203861707
- Sigstore integration time:
-
Permalink:
jlopez/socketry@66e39ed91ece0de3f2196f4632c978c766719aa4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jlopez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@66e39ed91ece0de3f2196f4632c978c766719aa4 -
Trigger Event:
push
-
Statement type: