Skip to main content

Rabbit Air Python library

This library can be used to control Rabbit Air air purifiers over a local network.

Usage

#! /usr/bin/env python3

import asyncio

from rabbitair import Mode, Speed, UdpClient


async def main():
    with UdpClient("ip", "token") as client:

        # Getting the current state of the air purifier

        state = await client.get_state()
        print(state)

        # Controlling the air purifier

        print("Power Off")
        await client.set_state(power=False)

        await asyncio.sleep(3)

        print("Power On")
        await client.set_state(power=True)

        await asyncio.sleep(3)

        print("Set Speed to High")
        await client.set_state(speed=Speed.High)

        await asyncio.sleep(3)

        print("Set Mode to Auto")
        await client.set_state(mode=Mode.Auto)


asyncio.run(main())

Retrieving the Access Token

To establish a connection, you need to know the address and access token of the device.

  1. Open the Rabbit Air mobile app. You will see a list of devices connected to your account.
  2. Tap the list item and the device control page will open.
  3. On the device page tap the Edit button. You will see a page with the device location and name settings.
  4. On this page, quickly tap on "Serial Number" several times until you see two more lines that were previously hidden. The first is the device ID, and the second is the access token.

Note that the device ID is used as an mDNS name of the device. So you can specify it as the host value by adding the suffix ".local" at the end.

For example, you got:

Screenshot: Access token on the "Edit device" screen

Then you can use abcdef1234_123456789012345678.local as the host and 0123456789ABCDEF0123456789ABCDEF as the token.

In some cases the access token may not be available right away, then you will see a "Tap for setup user key" message instead. To generate the access token, tap on this message and follow the instructions. If the app says "your device is not supported", it probably means that you are trying to connect to a first-generation MinusA2 model (an older hardware revision). It is not yet supported.

Release files for python-rabbitair 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-rabbitair 0.0.8
File Size Uploaded
python-rabbitair-0.0.8.tar.gz 12.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-rabbitair 0.0.8
File Interpreter ABI Platform
python_rabbitair-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 27.3 kB

Release files / python-rabbitair-0.0.8.tar.gz

Download URL python-rabbitair-0.0.8.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d5cab3a4cc26396fff831f036ab296e45377766da833e6e07902a7a711f7c6e7
BLAKE2b-256 checksum
How to use checksums
dde7cd2a8015258e86ec7295ce790b17fb8a042670a29db76865a920c8b5b609
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Release files / python_rabbitair-0.0.8-py3-none-any.whl

Download URL python_rabbitair-0.0.8-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed56d4ca5df93103f3703d2a3cadec007a6ff389ba06be2ce5cd2cc474363f1f
BLAKE2b-256 checksum
How to use checksums
53bcd882e078eb344f52cfab216905f26b78dee789bd7f4f12ebedd2d6bd0a93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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