Skip to main content

libnubiacare-py

An asynchronous Python client for the Nubia Care API used by ZTE Kids watches. The library handles request signing, password encryption, and the API's JSON responses. It leaves the aiohttp.ClientSession and authenticated session data under the caller's control, which makes it suitable for Home Assistant integrations.

Installation

python -m pip install libnubiacare-py

Usage

import asyncio

import aiohttp

from nubia_care import NubiaAPI, NubiaAuth


async def main() -> None:
    async with aiohttp.ClientSession() as http_session:
        auth = NubiaAuth(http_session)
        credentials = await auth.async_login("account@example.com", "password")

        api = NubiaAPI(auth)
        devices = await api.async_get_devices(credentials)
        for device in devices:
            details = await api.async_get_device(credentials, device.id)
            print(details.id, details.name)
            if details.location is not None:
                print(details.location.latitude, details.location.longitude)

            firmware = await api.async_get_device_firmware(credentials, device.id)
            print(firmware.device_firmware, firmware.firmware)

        # Store credentials.to_dict() in the application's own config entry
        # or credential store. The library does not retain login credentials.


asyncio.run(main())

NubiaAuth owns the built-in request signing and HTTP handling, while the caller provides the shared aiohttp.ClientSession and keeps the returned NubiaSession in their persistence layer. The API provides typed device and location views while retaining each response in raw_data. Use NubiaDevice.id as the identifier for device-details and firmware requests. JSON decimal numbers are decoded as Decimal, so numeric latitude and longitude values retain their reported precision; coordinate values returned as strings remain strings.

The API host, mobile client description, and protocol keys can be supplied to NubiaAuth for compatible service variants. See the class documentation and type signatures for the supported options.

NubiaDevice exposes device capabilities through device.features.supports() and device.features.available_features(). It also exposes parsed battery_level, device_type, permissions, model, and model_name properties; battery_level reads the percent value from the API's nested battery object and is None when that value is unavailable. The original API response remains available as device.raw_data.

CLI

The repository includes a simple verification script for checking access to the Nubia Care API from a source checkout:

PYTHONPATH=src .venv/bin/python scripts/nubia_care_cli.py

The script prompts for a Nubia Care login and password, then prints a JSON summary for each related device, including the latest device metadata and location information. It is intended for local validation and troubleshooting, and it is not part of the installed library API.

Development

Run the test suite with:

PYTHONPATH=src .venv/bin/python -m unittest discover -s tests

Releases are published to PyPI from GitHub Releases.

Metadata

Release files for libnubiacare-py 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libnubiacare-py 0.1.0
File Size Uploaded Provenance Actions
libnubiacare_py-0.1.0.tar.gz 13.1 kB With provenance Details for libnubiacare_py-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for libnubiacare-py 0.1.0
File Interpreter ABI Platform Actions
libnubiacare_py-0.1.0-py3-none-any.whl Python 3 none any Details for libnubiacare_py-0.1.0-py3-none-any.whl

Total release size: 23.7 kB

Release files / libnubiacare_py-0.1.0.tar.gz

Download URL libnubiacare_py-0.1.0.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d34e990b4099a2b827628386ea58b052d3aaf01bcc456dcffbb1c1d548222b65
BLAKE2b-256 checksum
How to use checksums
f544c5e862a698120f5f0bc77ddb549464024be5f65dad92f367acb83ebbf53b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / libnubiacare_py-0.1.0-py3-none-any.whl

Download URL libnubiacare_py-0.1.0-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df76f9f0d7e871faff8ebf1100e55f4a72e6a2e1b43b1a4108716846465bce2f
BLAKE2b-256 checksum
How to use checksums
68fb5c881b858be12af94c09c8c4ab6172b901754c5308be67921777bd45800c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for libnubiacare-py 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for libnubiacare_py-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page