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

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.4.3

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.4.3
File Size Uploaded
pypowerpetdoor-0.4.3.tar.gz 630.1 kB Details

Built distribution (wheel)

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

Total release size: 851.4 kB

Release files / pypowerpetdoor-0.4.3.tar.gz

Download URL pypowerpetdoor-0.4.3.tar.gz
Size 630.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c00b9150442d2906aa5a725f9d42b98e57824f25f8cc081380e86db16d12aa43
BLAKE2b-256 checksum
How to use checksums
96fc12f253697bb30c372b9943a5f5a4c0ae077cfdd8fbd16eef902979879165
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 Aug 25, 2026.

Transparency log

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

Download URL pypowerpetdoor-0.4.3-py3-none-any.whl
Size 221.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ace7d0d6074143f6142c111013e408dfa463e61a74dff3f2bd68ac70deb6fda1
BLAKE2b-256 checksum
How to use checksums
d50c9231fe56d353b2cc656af1ac515b401820cee24106cc5ae92c000bbadf6a
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 Aug 25, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.1

2 release files

0.5.0

2 release files

This release

0.4.3 This release

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