Skip to main content

Power Pet Door Python Library

Buy Me Coffee

Tests Github Release Github Activity License

PyPI Python Versions

A Python library for communicating with Power Pet Door WiFi-enabled pet doors made by High Tech Pet.

Power Pet Door

Disclaimer

This library is NOT authorized, endorsed, or supported by High Tech Pet Products, Inc.

This is an independent, community-developed project. No contributions, financial or otherwise, have been received from High Tech Pet. If you need official support for your Power Pet Door, please contact High Tech Pet directly.

Installation

pip install pypowerpetdoor

Requires Python 3.11-3.14. Supported platforms: Linux and macOS. The library itself has no platform-specific code, but the simulator's plain-stdin prompt fallback uses loop.add_reader() on stdin, which Windows' ProactorEventLoop does not implement, and CI runs on Linux only - so Windows is not a claimed platform.

Quick Start

The library provides two interfaces:

PowerPetDoor (Recommended)

A high-level, Pythonic interface with cached state and simple methods:

import asyncio
from powerpetdoor import PowerPetDoor


async def main():
    door = PowerPetDoor("192.168.1.100")
    await door.connect()

    # Read state via properties
    print(f"Door status: {door.status.name}")
    print(f"Battery: {door.battery_percent}%")

    # Control via async methods
    if door.is_closed:
        await door.open()

    await door.set_hold_time(15)
    await door.set_inside_sensor(True)

    # Register callbacks
    door.on_status_change(lambda s: print(f"Status: {s.name}"))

    await door.disconnect()


asyncio.run(main())

See docs/door.md for complete documentation.

PowerPetDoorClient (Low-Level)

For advanced use cases requiring direct protocol access:

import asyncio
from powerpetdoor import PowerPetDoorClient, CONFIG, CMD_GET_SETTINGS


async def main():
    loop = asyncio.get_running_loop()

    client = PowerPetDoorClient(
        host="192.168.1.100", port=3000, keepalive=30.0, timeout=10.0, reconnect=5.0, loop=loop
    )

    await client.connect()

    settings = await client.send_message(CONFIG, CMD_GET_SETTINGS, notify=True)
    print(f"Settings: {settings}")

    client.stop()


asyncio.run(main())

See docs/client.md for complete documentation.

Documentation

Document Description
docs/door.md PowerPetDoor high-level interface
docs/client.md PowerPetDoorClient low-level interface
docs/simulator.md Door simulator for testing
docs/scripting.md The simulator's YAML scripting language
docs/development.md How the codebase is put together, and where to add things
schemas/ Generated specs: JSON Schema for the script DSL and state documents, AsyncAPI 3.0 for the wire protocol

Door Simulator

The library includes a full-featured door simulator for testing without hardware:

# Run interactive simulator (also available as the ppd-simulator entry point)
python -m powerpetdoor.simulator

# Run with a test script (built-in name or file path)
python -m powerpetdoor.simulator --script basic_cycle

# Run in CI/CD (exit on completion; exit code reflects pass/fail)
python -m powerpetdoor.simulator --script full_test_suite --oneshot

See docs/simulator.md for complete documentation.

Library Structure

powerpetdoor/
├── __init__.py        # Public API surface (see __all__)
├── door.py            # PowerPetDoor high-level interface
├── client.py          # PowerPetDoorClient low-level client
├── const.py           # Protocol constants and commands
├── framing.py         # Shared JSON frame scanner for the wire protocol
├── i18n.py            # t() translation lookup for user-facing text
├── locales/           # Translation catalogue and per-language files
│   └── messages.json      # Generated key -> English catalogue
├── sanitize.py        # Terminal-safety helper for untrusted text (shared)
├── schedule.py        # Schedule utilities
├── tz_utils.py        # Timezone utilities
├── py.typed           # PEP 561 marker; downstream mypy sees real types
└── simulator/         # Door simulator submodule
    ├── state.py           # Simulator state dataclasses
    ├── protocol.py        # Protocol handler (asyncio Protocol + command registry)
    ├── engine.py          # DoorMotionEngine (shared door-motion state machine)
    ├── server.py          # DoorSimulator server
    ├── cli.py             # ppd-simulator CLI (interactive/script/daemon modes)
    ├── ctl.py             # ppd-simulator-ctl remote-control client
    ├── prompt_common.py   # Shared prompt_toolkit machinery (highlighting, completion)
    ├── commands/          # Interactive command implementations
    ├── scripting.py       # YAML script runner
    └── scripts/           # Built-in test scripts

Schedule Utilities

The library includes utilities for working with Power Pet Door schedules:

from powerpetdoor import (
    compress_schedule,
    validate_schedule_entry,
    compute_schedule_diff,
    schedule_template,
)

# Validate a schedule entry
entry = {...}
if validate_schedule_entry(entry):
    print("Entry is valid")

# Compress multiple schedule entries
compressed = compress_schedule(schedule_list)

# Compute differences between schedules
to_delete, to_add = compute_schedule_diff(current, new)

Related Projects

License

MIT License - see LICENSE file for details.


Release files for pypowerpetdoor 0.5.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 pypowerpetdoor 0.5.0
File Size Uploaded
pypowerpetdoor-0.5.0.tar.gz 911.1 kB Details

Built distribution (wheel)

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

Total release size: 1.2 MB

Release files / pypowerpetdoor-0.5.0.tar.gz

Download URL pypowerpetdoor-0.5.0.tar.gz
Size 911.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c13a7180602037ce144ffa24bab8a73812eb7c8206920f10f04bc9b8f1a4df18
BLAKE2b-256 checksum
How to use checksums
45b9e0b9b36b435e98f905c37ec927bc4b9f8e49608a2b77799bd5bf3505a5f7
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 Sep 1, 2026.

Transparency log

Release files / pypowerpetdoor-0.5.0-py3-none-any.whl

Download URL pypowerpetdoor-0.5.0-py3-none-any.whl
Size 279.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c802871272586f191316b7304e29806b34a90a651d46af697726132d3292b74c
BLAKE2b-256 checksum
How to use checksums
aa321174a2b3a2dde7ba5c13d760a9f41cd3fc7d72e37ea7219cb3978517db8e
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 Sep 1, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.1

2 release files

This release

0.5.0 This release

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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