Skip to main content

Python: Async IO Modern Forms API Client

GitHub Workflow Status Codecov License: MIT PyPI

Asynchronous Python client for Modern Forms Fans.

About

This package allows you to control and monitor Modern Forms fans programmatically. It is mainly created to allow third-party programs to automate the behavior of the Modern Forms fans

Installation

pip install aiomodernforms

Usage

"""Asynchronous Python client for Async IO Modern Forms fan."""

import asyncio
from datetime import datetime, timedelta

import aiomodernforms
from aiomodernforms.const import LIGHT_POWER_ON


async def main():
    """Turn on the fan light."""
    async with aiomodernforms.ModernFormsDevice("192.168.3.197") as fan:
        await fan.update()
        print(fan.status)
        await fan.light(
            on=LIGHT_POWER_ON,
            brightness=50,
            sleep=datetime.now() + timedelta(minutes=2),
        )
        print(fan.status)


if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

Reporting compatibility issues

WAC and Modern Forms fans span several hardware generations, and not every generation behaves identically. If this library doesn't work correctly against your fan, run diagnose.py against it and paste the output into a GitHub issue:

python diagnose.py <fan-ip-address>
# or, from a checkout with a dev environment set up:
make diagnose HOST=<fan-ip-address>

This prints a Markdown report — parsed capability flags, the raw API responses, and any response fields this library doesn't recognize yet — that helps pinpoint model/generation differences. It redacts your account email, AWS identity, MAC address, device name, and certificate ID, and never includes the fan's IP address, so the output is safe to paste as-is. Still, give it a quick read before posting.

Mock fan for development

To develop or test a client (such as a Home Assistant integration) against this API without real hardware, run a mock fan that speaks the same wire protocol:

python -m mock_fan --generation gen3 --breeze --port 8080
# or
make mock-fan GENERATION=gen1_2 PORT=8081

--generation is gen1_2 or gen3 and is required; --breeze optionally enables breeze/wind mode support; --no-light simulates a fan-only unit with no light kit (light is on by default). Point your client at the printed host/port exactly as you would a real fan.

For Gen4, use --generation gen4 --lights N (--breeze/--no-light don't apply — Gen4 always exposes breeze fields on the fan fixture, and light count is controlled by --lights, default 1; --lights 0 simulates a fan with no light kit).

Metadata

Release files for aiomodernforms 0.3.0

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

Source distribution (sdist)

Source distribution for aiomodernforms 0.3.0
File Size Uploaded
aiomodernforms-0.3.0.tar.gz 33.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiomodernforms 0.3.0
File Interpreter ABI Platform
aiomodernforms-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 55.1 kB

Release files / aiomodernforms-0.3.0.tar.gz

Download URL aiomodernforms-0.3.0.tar.gz
Size 33.6 kB
Tags Source
SHA-256 checksum
How to use checksums
02032eb15fc7d66ee505856936b73312a57bc91a971d3d7e7b3683eb98d81da5
BLAKE2b-256 checksum
How to use checksums
cac15d71c18ab2908f1d5dd482bf4f252a0bd2ee9aef217bb145c3735512281a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / aiomodernforms-0.3.0-py3-none-any.whl

Download URL aiomodernforms-0.3.0-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec86ea2be70d4af20bee6126b0a72c021429cafe687bd1ee679fa449718cd9a7
BLAKE2b-256 checksum
How to use checksums
29191a33967dca648b7b0d942a063c8a9daafcfed3ce05dfad892adf4ca59fcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

0.3.1

2 release files

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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