Python library for communicating with Power Pet Door devices
Reason this release was yanked:
Not working quite right.
Project description
Power Pet Door Python Library
A Python library for communicating with Power Pet Door WiFi-enabled pet doors made by High Tech Pet.
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
Usage
import asyncio
from powerpetdoor import PowerPetDoorClient, COMMAND, CMD_OPEN, CMD_CLOSE
# Create a client
client = PowerPetDoorClient(
host="192.168.1.100",
port=3000,
keepalive=30.0,
timeout=10.0,
reconnect=5.0
)
# Add a listener for door status updates
client.add_listener(
name="my_app",
door_status_update=lambda status: print(f"Door status: {status}")
)
# Start the client (blocks if running own event loop)
# For integration with existing event loop, pass it to the constructor
client.start()
# Send commands
client.send_message(COMMAND, CMD_OPEN)
client.send_message(COMMAND, CMD_CLOSE)
# Stop when done
client.stop()
Async Usage
For use with an existing asyncio event loop:
import asyncio
from powerpetdoor import PowerPetDoorClient, COMMAND, CMD_GET_SETTINGS, CONFIG
async def main():
loop = asyncio.get_event_loop()
client = PowerPetDoorClient(
host="192.168.1.100",
port=3000,
keepalive=30.0,
timeout=10.0,
reconnect=5.0,
loop=loop
)
# Connect
await client.connect()
# Send a command and wait for response
settings = await client.send_message(CONFIG, CMD_GET_SETTINGS, notify=True)
print(f"Settings: {settings}")
# Disconnect
client.stop()
asyncio.run(main())
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)
Door Simulator
The library includes a full-featured door simulator for testing clients without real hardware. The simulator speaks the same protocol as the real device and supports all commands.
Quick Start
# Run the interactive simulator
python -m powerpetdoor.simulator
# Run with a test script
python -m powerpetdoor.simulator --script basic_cycle
# Run script and exit (for CI/CD)
python -m powerpetdoor.simulator --script full_test_suite --exit-after-script
Programmatic Usage
import asyncio
from powerpetdoor.simulator import DoorSimulator
async def main():
simulator = DoorSimulator(host="0.0.0.0", port=3000)
await simulator.start()
# Trigger events programmatically
simulator.trigger_sensor("inside")
await asyncio.sleep(5)
await simulator.close_door()
await simulator.stop()
asyncio.run(main())
For complete documentation including scripting syntax and all available commands, see docs/SIMULATOR.md.
Library Structure
powerpetdoor/
├── client.py # PowerPetDoorClient - main client class
├── 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
Related Projects
- ha-powerpetdoor - Home Assistant integration for Power Pet Door
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pypowerpetdoor-0.2.0.tar.gz.
File metadata
- Download URL: pypowerpetdoor-0.2.0.tar.gz
- Upload date:
- Size: 48.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
235ee03ce58cd951e02021d3db3b7050e48ff3f08b6df8c2e5836d193f1088ec
|
|
| MD5 |
f8b996fbd697144aa7f5c67c9dfb9bd3
|
|
| BLAKE2b-256 |
218dc5f5cc4530628fe1926a6c0ee0b1d3b9ce362eb1aadd2a3b155bfeab65ef
|
Provenance
The following attestation bundles were made for pypowerpetdoor-0.2.0.tar.gz:
Publisher:
ci.yml on corporategoth/py-powerpetdoor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pypowerpetdoor-0.2.0.tar.gz -
Subject digest:
235ee03ce58cd951e02021d3db3b7050e48ff3f08b6df8c2e5836d193f1088ec - Sigstore transparency entry: 780248514
- Sigstore integration time:
-
Permalink:
corporategoth/py-powerpetdoor@0a5eff153990c319f8e775df887413ff6e8953c6 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/corporategoth
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@0a5eff153990c319f8e775df887413ff6e8953c6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pypowerpetdoor-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pypowerpetdoor-0.2.0-py3-none-any.whl
- Upload date:
- Size: 46.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9231d46c6d1952d9307d647b61243712be87b02c8aba394a8278d708fe0ba150
|
|
| MD5 |
01eee0e5c3ad10d67d2f5e7b3be22a48
|
|
| BLAKE2b-256 |
d580590570f788ed2afa3e5afa14f874c28152bc4d83303ce3f2d1c2a1b14c5f
|
Provenance
The following attestation bundles were made for pypowerpetdoor-0.2.0-py3-none-any.whl:
Publisher:
ci.yml on corporategoth/py-powerpetdoor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pypowerpetdoor-0.2.0-py3-none-any.whl -
Subject digest:
9231d46c6d1952d9307d647b61243712be87b02c8aba394a8278d708fe0ba150 - Sigstore transparency entry: 780248517
- Sigstore integration time:
-
Permalink:
corporategoth/py-powerpetdoor@0a5eff153990c319f8e775df887413ff6e8953c6 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/corporategoth
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@0a5eff153990c319f8e775df887413ff6e8953c6 -
Trigger Event:
release
-
Statement type: