Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pythermacell

A modern, fully-typed async Python client for Thermacell IoT devices (LIV Hub) built on the ESP RainMaker API.

PyPI Version Python Versions License CI GitHub Sponsors Ko-fi Built with Omnigent

What It Does

pythermacell is an asynchronous Python library for controlling and monitoring Thermacell LIV mosquito-repellent devices through their cloud platform (Espressif ESP RainMaker). It handles authentication, device discovery, power and LED control, and status monitoring behind a clean, fully-typed API. It is the engine behind the Thermacell LIV Home Assistant integration, and is equally suitable for standalone scripts and other applications.

Features

  • Fully asynchronous (aiohttp) with comprehensive type hints (strict mypy).
  • Three-layer architecture: low-level API, coordinating client, stateful devices.
  • Power control, RGB LED control (HSV), and refill/runtime/status monitoring.
  • Optimistic updates with automatic rollback for instant UI responsiveness.
  • State caching, optional background auto-refresh, and change listeners.
  • Built-in resilience: circuit breaker, exponential backoff, and rate limiting.
  • Session injection for sharing an aiohttp session (e.g. with Home Assistant).
  • Custom exception hierarchy and high unit + integration test coverage.

Installation

See INSTALL.md for the complete guide.

pip install pythermacell
# or
uv add pythermacell

Requires Python 3.13+.

Quick Start

import asyncio

from pythermacell import ThermacellClient


async def main() -> None:
    async with ThermacellClient(
        username="your@email.com",
        password="your_password",
    ) as client:
        for device in await client.get_devices():
            print(f"{device.name} ({device.model}) online={device.is_online}")

            await device.turn_on()
            await device.set_led_color(hue=120, brightness=80)

            print(f"Refill life: {device.refill_life}%")


asyncio.run(main())

Usage

The most common workflow is: construct a ThermacellClient, enter its async context, fetch devices, then control or monitor them through ThermacellDevice objects. Device control methods apply optimistically (local state updates immediately, then the API call runs in the background and rolls back on failure).

device = (await client.get_devices())[0]

await device.turn_on()                              # power on (optimistic)
await device.set_led_color(hue=240, brightness=80)  # blue
await device.refresh()                              # pull latest state from API

print(device.is_powered_on, device.refill_life, device.system_status)

For depth — authentication, LED rules, monitoring, optimistic updates, auto-refresh and change listeners, session injection, resilience patterns, and full error handling — see the Usage Guide. Runnable scripts live in examples/.

API Reference

Full reference lives in docs/. Key entry points:

Symbol Description
ThermacellClient High-level client: authentication, device discovery, caching
ThermacellDevice Stateful device: power, LED, monitoring, listeners
ThermacellAPI Low-level ESP RainMaker HTTP layer
AuthenticationHandler JWT authentication and token refresh
pythermacell.resilience Circuit breaker, backoff, rate limiter
Exceptions ThermacellError hierarchy

Endpoint-level details are documented under docs/api/.

Development

See docs/DEVELOPMENT.md. In short:

git clone https://github.com/joyfulhouse/pythermacell.git
cd pythermacell
uv sync
uv run pytest
uv run ruff check
uv run mypy

Support

Support Development

If this library is useful to you, please consider supporting its development:

License

This project is licensed under the MIT License — see LICENSE for details.

This is an unofficial library and is not affiliated with, endorsed by, or sponsored by Thermacell Repellents, Inc. All product names, logos, and brands are the property of their respective owners.

  • Thermacell LIV — the Home Assistant integration built on this library.

Built with Omnigent
Built with Omnigent — the open-source AI agent framework and meta-harness.

Native Services and LAN Control

Version 0.3.0b1 adds capability-driven timers, schedules, reboot, timezone, cloud OTA, and encrypted RainMaker local transport. See verified contracts and examples. This beta is validated against HTTP/protocol simulators; live hub validation remains outstanding.

Metadata

Release files for pythermacell 0.3.0b5

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

Source distribution (sdist)

Source distribution for pythermacell 0.3.0b5
File Size Uploaded Provenance
pythermacell-0.3.0b5.tar.gz 301.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pythermacell 0.3.0b5
File Interpreter ABI Platform
pythermacell-0.3.0b5-py3-none-any.whl Python 3 none any Details

Total release size: 370.5 kB

Release files / pythermacell-0.3.0b5.tar.gz

Download URL pythermacell-0.3.0b5.tar.gz
Size 301.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c11eb10893397b1f30c5c859842ed3ec9d7ae758ff69e7696c8069aff9668c56
BLAKE2b-256 checksum
How to use checksums
3d75f5aebf31e4fce39e21afba7a8701134bb25ad8346a8f81a81cdc3d8d91e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 20, 2026.

Transparency log

Release files / pythermacell-0.3.0b5-py3-none-any.whl

Download URL pythermacell-0.3.0b5-py3-none-any.whl
Size 68.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1525048f1679904dc3e8ab52be8edff389580ead63e7c67fa260dbb48febbff
BLAKE2b-256 checksum
How to use checksums
5afbe1f56931b649287b1409849ada2dedbb1f3a2e8ffa8a143b4c7844698b4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 20, 2026.

Transparency log

Security for pythermacell 0.3.0b5

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 pythermacell-0.3.0b5.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 Oct 20, 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.

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