Skip to main content

Interact with and control Vantage InFusion home automation controllers.

Project description

aiovantage

Documentation PyPI - Version Discord

Python library for interacting with and controlling Vantage InFusion home automation controllers.

This open-source, non-commercial library is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Vantage, and is provided for interoperability purposes only.

Example

from aiovantage import Vantage

async with Vantage("192.168.1.2", "username", "password") as vantage:
    async for load in vantage.loads:
        print(f"{load.name} is at {load.level}%")

See the examples folder for more examples.

Features

  • Fetch object configuration from your Vantage system.
  • Fetch object state and subscribe to state changes (e.g. load levels, sensor readings).
  • Control devices (turn on lights, set thermostats, etc).
  • Uses asyncio for non-blocking I/O.
  • Uses SSL connections by default, with automatic reconnection.
  • Supports both lazy and eager object fetching.

Installation

Add aiovantage as a dependency to your project, or install it directly:

pip install aiovantage

Supported objects

The following interfaces/controllers are currently supported.

Type Description Controller
AnemoSensor Wind speed sensors vantage.anemo_sensors
Area Rooms, etc vantage.areas
BackBox Backboxes vantage.back_boxes
Blind Shades, blinds vantage.blinds
BlindGroups Groups of blinds vantage.blind_groups
Buttons Keypad buttons vantage.buttons
DryContacts Motion sensors, etc vantage.dry_contacts
GMem Vantage variables vantage.gmem
LightSensor Light sensors vantage.light_sensors
Load Lights, relays, etc vantage.loads
LoadGroup Groups of loads vantage.load_groups
Master Vantage controllers vantage.masters
Module Dimmer modules vantage.modules
OmniSensor Power, current, etc vantage.omni_sensors
PortDevice Port devices (hubs) vantage.port_devices
PowerProfile Load power profiles vantage.power_profiles
RGBLoad RGB lights vantage.rgb_loads
Stations Keypads, etc vantage.stations
Tasks Vantage tasks vantage.tasks
Temperature Temperature sensors vantage.temperatures
Thermostat Thermostats vantage.thermostats

If you have an object that you expect to show up in one of these controllers but is missing, please create an issue or submit a pull request.

Usage

Creating a client

Begin by importing the Vantage class:

from aiovantage import Vantage

The most convenient way to create a client is by using the async context manager:

async with Vantage("hostname", "username", "password") as vantage:
    # ...use the vantage client

Alternatively, you can manage the lifecycle of the client yourself:

from aiovantage import Vantage

vantage = Vantage("hostname", "username", "password")
# ...use the vantage client
vantage.close()

Querying objects

The Vantage class exposes a number of controllers, which can be used to query objects. Controllers can either be populated lazily (by using async for), or eagerly (by using controller.initialize()).

For example, to get a list of all loads:

async with Vantage("hostname", "username", "password") as vantage:
    async for load in vantage.loads:
        print(f"{load.name} is at {load.level}%")

Alternatively, you can use controller.initialize() to eagerly fetch all objects:

async with Vantage("hostname", "username", "password") as vantage:
    await vantage.loads.initialize()
    for load in vantage.loads:
        print(f"{load.name} is at {load.level}%")

If you aren't interested in the state of the objects, you can call controller.initialize(fetch_state=False) to slightly speed up the initialization:

async with Vantage("hostname", "username", "password") as vantage:
    await vantage.loads.initialize(fetch_state=False)
    for load in vantage.loads:
        print(f"{load.name}")

All controllers implement a django-like query interface, which can be used to filter objects. You can either query by matching attributes:

async with Vantage("hostname", "username", "password") as vantage:
    async for load in vantage.loads.filter(name="Kitchen"):
        print(f"{load.name} is at {load.level}%")

Or by using a filter predicate:

async with Vantage("hostname", "username", "password") as vantage:
    async for load in vantage.loads.filter(lambda load: load.level > 50):
        print(f"{load.name} is at {load.level}%")

Fetching a single object

You can fetch a single object by id, by calling controller.aget() or controller.get():

async with Vantage("hostname", "username", "password") as vantage:
    load = await vantage.loads.aget(118)
    print(f"{load.name} is at {load.level}%")

These functions also implement the same query interface as controller.filter() for querying by attributes or filter predicate:

async with Vantage("hostname", "username", "password") as vantage:
    load = await vantage.loads.aget(name="Kitchen")
    print(f"{load.name} is at {load.level}%")

Controlling objects

Objects also expose various methods for controlling state. For example, to turn on a load:

async with Vantage("hostname", "username", "password") as vantage:
    load = vantage.loads.aget(name="Study Lights")
    await load.turn_on()

Subscribing to state changes

You can subscribe to state changes by using the controller.subscribe() method:

def on_load_state_change(event, load, data):
    print(f"{load.name} is at {load.level}%")

async with Vantage("hostname", "username", "password") as vantage:
    vantage.loads.subscribe(on_load_state_change)
    await vantage.loads.initialize()

Note that a subscription will only receive state changes for objects that have populated into the controller.

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

aiovantage-0.22.7.tar.gz (71.7 kB view details)

Uploaded Source

Built Distribution

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

aiovantage-0.22.7-py3-none-any.whl (102.9 kB view details)

Uploaded Python 3

File details

Details for the file aiovantage-0.22.7.tar.gz.

File metadata

  • Download URL: aiovantage-0.22.7.tar.gz
  • Upload date:
  • Size: 71.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aiovantage-0.22.7.tar.gz
Algorithm Hash digest
SHA256 cc9bd88f0e21127d9b1829de7afefef10414f32bd5fecf0d253e105804b953b5
MD5 cd99eddc6169d2c77880f2bbedc351a1
BLAKE2b-256 87359b37e57eb9e18dda9ba7070221b6bb5158f188d6d4c949ba82d9e642e6a7

See more details on using hashes here.

File details

Details for the file aiovantage-0.22.7-py3-none-any.whl.

File metadata

  • Download URL: aiovantage-0.22.7-py3-none-any.whl
  • Upload date:
  • Size: 102.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aiovantage-0.22.7-py3-none-any.whl
Algorithm Hash digest
SHA256 98b23eec589a489314a12c2dd5e20fa42f89cba52380c99bd3d2ac5d75f5f2ff
MD5 b06feb0cefc18780fc827b52d2d61fb9
BLAKE2b-256 ac973e446416024bf7d747319d44ad3c4c41eb5d430c82ff524141d284718ce2

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