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.1

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.1
File Size Uploaded
aiomodernforms-0.3.1.tar.gz 34.1 kB Details

Built distribution (wheel)

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

Total release size: 55.7 kB

Release files / aiomodernforms-0.3.1.tar.gz

Download URL aiomodernforms-0.3.1.tar.gz
Size 34.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a6fb198c573ec4eb3da0dd4b45b9209cad0294bcf92e0c9cd77bc9a93613fc68
BLAKE2b-256 checksum
How to use checksums
c87e332fc1c2c06dfc2ab73d0ec27085ab4da1012a7e2f094e38e71c10e668bd
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.1-py3-none-any.whl

Download URL aiomodernforms-0.3.1-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
895bc52d4c07547cd22056c5b9ef2787eb78b40bd0bee461362672f8764ef991
BLAKE2b-256 checksum
How to use checksums
eff957d5b2e42932bc15a3d5c9751767b3112ff9c16b8bdfcbe93838a97c897f
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

This release

0.3.1 This release

2 release files

0.3.0

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