Python SDK for Yarbo robot devices
Project description
Yarbo Data SDK
Python SDK for Yarbo robot devices. Enables integration with smart home platforms and custom applications.
Features
- Authentication — Login with email/password (RSA-encrypted), token refresh, session restore
- Device Management — Query device list via REST API
- MQTT Real-time Data — Subscribe to device messages and heart beats with automatic zlib decompression (firmware >= 3.9.0)
- Device Control — Publish commands via MQTT with automatic compression and debug logging
- Request with Feedback — Send commands and wait for device response via data_feedback topic
- Device Registry — JSON-driven device capability definitions with structured field and control metadata
- Custom Extractors — Extensible field extraction logic (network priority, volume scaling, RTK signal, planning/recharging status)
Installation
pip install yarbo-data-sdk
Requirements: Python >= 3.10
Quick Start
from yarbo_robot_sdk import YarboClient
client = YarboClient(api_base_url="https://api.yarbo.com")
client.login("user@email.com", "password")
devices = client.get_devices()
for device in devices:
print(f"{device.name} ({device.sn}) - Online: {device.online}")
MQTT Real-time Updates
client.mqtt_connect()
# Subscribe to device status messages
def on_device_message(topic, data):
print(f"Status update: {data}")
client.subscribe_device_message("SN123", "yarbo_Y", on_device_message)
# Subscribe to heart beat
def on_heart_beat(topic, data):
print(f"Heart beat: {data}")
client.subscribe_heart_beat("SN123", "yarbo_Y", on_heart_beat)
Device Control
# Set working state
client.mqtt_publish_command("SN123", "yarbo_Y", "set_working_state", {"state": 1, "source": "smart_home"})
# Sound control
client.mqtt_publish_command("SN123", "yarbo_Y", "set_sound_param", {"enable": True, "vol": 0.5, "mode": 0})
# Headlight control (all 7 light fields required)
client.mqtt_publish_command("SN123", "yarbo_Y", "light_ctrl", {
"body_left_r": 255, "body_right_r": 255, "led_head": 255,
"led_left_w": 255, "led_right_w": 255, "tail_left_r": 255, "tail_right_r": 255
})
# Start auto plan
client.mqtt_publish_command("SN123", "yarbo_Y", "start_plan", {"id": 123, "percent": 0})
# Pause / Resume / Stop plan
client.mqtt_publish_command("SN123", "yarbo_Y", "pause", {})
client.mqtt_publish_command("SN123", "yarbo_Y", "resume", {})
client.mqtt_publish_command("SN123", "yarbo_Y", "stop", {})
# Return to charge (disable wireless charging first)
client.mqtt_publish_command("SN123", "yarbo_Y", "wireless_charging_cmd", {"cmd": 0})
client.mqtt_publish_command("SN123", "yarbo_Y", "cmd_recharge", {"cmd": 2})
Request with Feedback
Some commands return data via the data_feedback MQTT topic:
# Fetch full device status snapshot
device_msg = client.get_device_msg("SN123", "yarbo_Y", timeout=10.0)
# Fetch all auto plans
plans = client.read_all_plan("SN123", "yarbo_Y", timeout=10.0)
# Fetch GPS reference origin
gps_ref = client.read_gps_ref("SN123", "yarbo_Y", timeout=10.0)
Device Registry
Access device field definitions programmatically:
from yarbo_robot_sdk import get_field_definitions, get_control_field_definitions
# Sensor/binary_sensor field definitions
fields = get_field_definitions("yarbo_Y")
for f in fields:
print(f"{f.path} -> {f.name} ({f.entity_type})")
# Control field definitions (select/switch/number)
controls = get_control_field_definitions("yarbo_Y")
for c in controls:
print(f"{c.path} -> {c.name} ({c.entity_type})")
Supported Control Topics
| Topic | Description | Payload Example |
|---|---|---|
| set_working_state | Set working state | {"state": 1, "source": "smart_home"} |
| set_sound_param | Sound control | {"enable": true, "vol": 0.5, "mode": 0} |
| light_ctrl | Headlight control | {"body_left_r": 255, ...} (7 fields) |
| start_plan | Start auto plan | {"id": 123, "percent": 0} |
| pause | Pause plan | {} |
| resume | Resume plan | {} |
| stop | Stop plan | {} |
| cmd_recharge | Return to charge | {"cmd": 2} |
| wireless_charging_cmd | Wireless charging | {"cmd": 0} |
| read_all_plan | Request plans | {} (response via data_feedback) |
| get_device_msg | Request full status | {} (response via data_feedback) |
| read_gps_ref | Request GPS ref | {} (response via data_feedback) |
| get_map | Request map data | {} (response via data_feedback) |
Network Helper
from yarbo_robot_sdk import extract_active_network
# Determine active network from route_priority data
# Returns the interface with the lowest non-negative priority value
result = extract_active_network({"hg0": 10, "wlan0": 600, "wwan0": -1})
# result = "Halow" (hg0 has lowest priority value)
Session Persistence
# Save tokens
saved_token = client.token
saved_refresh_token = client.refresh_token
# Restore in a new client (no re-login needed)
client2 = YarboClient(api_base_url="https://api.yarbo.com")
client2.restore_session(
username="user@email.com",
token=saved_token,
refresh_token=saved_refresh_token,
)
Documentation
- API Reference — All methods, parameters, and return types
- MQTT Topics — Topic formats, payload structures, compression
- Device Fields — Complete field definitions for all device types
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 yarbo_data_sdk-0.1.0.tar.gz.
File metadata
- Download URL: yarbo_data_sdk-0.1.0.tar.gz
- Upload date:
- Size: 41.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a86626a0cb4ed84d5183a658b4d6803fc787e837f1fb0af52ed66f9146945f1d
|
|
| MD5 |
3cf1e0c7aa65a255b3819e252b3cfc1e
|
|
| BLAKE2b-256 |
64b9f8c427d33b84b44c4aedc6b14302504fb07b097648a05508cb7f86c0a783
|
Provenance
The following attestation bundles were made for yarbo_data_sdk-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on YarboInc/YarboDataSDK
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yarbo_data_sdk-0.1.0.tar.gz -
Subject digest:
a86626a0cb4ed84d5183a658b4d6803fc787e837f1fb0af52ed66f9146945f1d - Sigstore transparency entry: 1270644496
- Sigstore integration time:
-
Permalink:
YarboInc/YarboDataSDK@f003e7ee84b76fe924d67e777eef603406de4519 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/YarboInc
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@f003e7ee84b76fe924d67e777eef603406de4519 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yarbo_data_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: yarbo_data_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d201d89f392853683d86e822da165c4875db84f15c69364f2355eda25a071617
|
|
| MD5 |
d28b80c1652b167e4e2ef6992d2f0dbb
|
|
| BLAKE2b-256 |
62d832a97ebf62d08e46c61af29d5c69a60493ec19b2cc08caf6150654bfd966
|
Provenance
The following attestation bundles were made for yarbo_data_sdk-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on YarboInc/YarboDataSDK
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yarbo_data_sdk-0.1.0-py3-none-any.whl -
Subject digest:
d201d89f392853683d86e822da165c4875db84f15c69364f2355eda25a071617 - Sigstore transparency entry: 1270644498
- Sigstore integration time:
-
Permalink:
YarboInc/YarboDataSDK@f003e7ee84b76fe924d67e777eef603406de4519 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/YarboInc
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@f003e7ee84b76fe924d67e777eef603406de4519 -
Trigger Event:
push
-
Statement type: