Skip to main content

Python library for communicating with Power Pet Door devices

Project description

Power Pet Door Python Library

Buy Me Coffee

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

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
python -m powerpetdoor.simulator

# Run with test script
python -m powerpetdoor.simulator --script basic_cycle

# Run in CI/CD (exit on completion)
python -m powerpetdoor.simulator --script full_test_suite --exit-after-script

See docs/simulator.md for complete documentation.

Library Structure

powerpetdoor/
├── door.py            # PowerPetDoor high-level interface
├── client.py          # PowerPetDoorClient low-level client
├── const.py           # Protocol constants and commands
├── schedule.py        # Schedule utilities
├── tz_utils.py        # Timezone utilities
└── simulator/         # Door simulator submodule
    ├── state.py       # Simulator state dataclasses
    ├── protocol.py    # Command handler registry
    ├── server.py      # DoorSimulator server
    ├── cli.py         # Interactive CLI
    ├── 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.


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

pypowerpetdoor-0.3.0.tar.gz (60.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypowerpetdoor-0.3.0-py3-none-any.whl (53.2 kB view details)

Uploaded Python 3

File details

Details for the file pypowerpetdoor-0.3.0.tar.gz.

File metadata

  • Download URL: pypowerpetdoor-0.3.0.tar.gz
  • Upload date:
  • Size: 60.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pypowerpetdoor-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6e807f8ddac3cef161c3dc53e8e6dbc7041688bca1b0307be444b29b914607e9
MD5 1e7014e9cb066da17f4b36cd1a7bee70
BLAKE2b-256 6d0dbecdb706ebf6cb269def5facb9a718b317a961fb850fed4f55c4e1d864ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypowerpetdoor-0.3.0.tar.gz:

Publisher: ci.yml on corporategoth/py-powerpetdoor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypowerpetdoor-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pypowerpetdoor-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 53.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pypowerpetdoor-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08e1db27947f314ef31b158cacea0775175889b64e6b4fb6e776cd29a121a40b
MD5 f201160e93e5e80d0256f5b2d27be008
BLAKE2b-256 881c2481b5f20072d02a01189087a8f02f3f987eff455122693cf8a30c4e93c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypowerpetdoor-0.3.0-py3-none-any.whl:

Publisher: ci.yml on corporategoth/py-powerpetdoor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page