Skip to main content

Python library for communicating with Power Pet Door devices

Project description

Power Pet Door Python Library

A Python library for communicating with Power Pet Door devices over the network.

Installation

pip install powerpetdoor

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)

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.1.0.tar.gz (25.4 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.1.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pypowerpetdoor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4c5d15864d279ccb0c64f75052e734b43bb94e0f3e0dddaf1dc0c2f33eec15d3
MD5 27b9619a6a364e5179054b272786fa37
BLAKE2b-256 7d9eb049ae7689183afd779e5d6b939240414685391771b9e1ed94eeb005335e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypowerpetdoor-0.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: pypowerpetdoor-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3a6e8ccd4470e16ca002f6ce7c378394d8014cb701d7ea2ff87fb0615b3172ac
MD5 5442913d9fd36394a797e151c0194060
BLAKE2b-256 65757e31abcfbe18c93804f614bbf5f22774f765cbd5c830dc0897384cf7e4f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypowerpetdoor-0.1.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