Skip to main content

Python library for communicating with Briiv Air Purifier devices

Project description

PyBriiv

A Python library for communicating with Briiv Air Purifier devices.

Installation

pip install pybriiv

Usage

import asyncio
from pybriiv import BriivAPI

def select_device(devices):
    """Let the user select which device to connect to."""
    if not devices:
        print("No devices found.")
        return None
    
    if len(devices) == 1:
        print("Only one device found. Using it automatically.")
        return devices[0]
    
    print("Please select a device:")
    for i, device in enumerate(devices):
        pro_status = "Pro" if device.get('is_pro') else "Standard"
        print(f"{i+1}. {device['serial_number']} ({pro_status}) - IP: {device['host']}")
    
    while True:
        try:
            selection = int(input("Enter the number of the device to control: "))
            if 1 <= selection <= len(devices):
                return devices[selection-1]
            else:
                print(f"Please enter a number between 1 and {len(devices)}")
        except ValueError:
            print("Please enter a valid number")

async def main():
    # Discover devices
    devices = await BriivAPI.discover(timeout=15)
    print(f"Found {len(devices)} devices: {devices}")
    
    # Let user select which device to connect to
    selected_device = select_device(devices)
    if not selected_device:
        print("No device selected. Exiting.")
        return
    
    # Connect to the selected device
    api = BriivAPI(
        host=selected_device['host'], 
        port=3334,  # Using standard port
        serial_number=selected_device['serial_number']
    )
    
    # Start listening for updates
    await api.start_listening(asyncio.get_event_loop())
    
    # Control the device

    await api.set_fan_speed(50)

    await asyncio.sleep(5)

    await api.set_fan_speed(0)
    
    # Clean up
    await api.stop_listening()

if __name__ == "__main__":
    asyncio.run(main())

Features

  • Device discovery via UDP
  • Power control (on/off)
  • Fan speed adjustment
  • Boost mode control
  • Real-time device state updates

License

MIT

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

pybriiv-0.1.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

pybriiv-0.1.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file pybriiv-0.1.1.tar.gz.

File metadata

  • Download URL: pybriiv-0.1.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for pybriiv-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3dd840fa6414d7f8efb82fe74d5e3526f4cb1723bf95b812645891d0d6a27cec
MD5 8c442c1709231ebc893da9a232bb854b
BLAKE2b-256 29431ade74975cc2452d76390d4ba7a72ff15ad08ce4c8f5956a9cb9f70b617c

See more details on using hashes here.

File details

Details for the file pybriiv-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pybriiv-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for pybriiv-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ee17796315a6a2f3be7ae0a02d7c56fc58364fb5a9f28218fb3a25a04bd4610
MD5 dc7ffee7d99ce6d1769c6508e9c97e74
BLAKE2b-256 4bc770987e8590b9ebaf6c5bd953389d939f80aa343c6f8a6439b016645d05c4

See more details on using hashes here.

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