Skip to main content

Python API wrapper for the Actron Neo API.

Project description

ActronNeoAPI

The ActronNeoAPI library provides an interface to communicate with Actron Air Neo systems, enabling integration with Home Assistant or other platforms. This Python library offers methods for authentication, token management, and interacting with AC systems, zones, and settings.


Features

  • Authentication:
    • Pairing token and bearer token support.
    • Automatic token refresh handling.
  • System Information:
    • Retrieve system details, statuses, and events.
  • Control Features:
    • Set system modes (e.g., COOL, HEAT, AUTO, FAN).
    • Enable/disable zones.
    • Adjust fan modes and temperatures.

Installation

pip install actron-neo-api

Usage

1. Initialization

You must provide either an access token or username/password combination for authentication.

from actron_neo_api import ActronNeoAPI

# Initialize with username and password
api = ActronNeoAPI(username="your_username", password="your_password")

# Or initialize with an existing access token
api = ActronNeoAPI(access_token="your_access_token")

2. Authentication

Request Pairing Token

Pairing tokens are used to generate bearer tokens.

await api.request_pairing_token(device_name="MyDevice", device_unique_id="123456789")

Request Bearer Token

Use the pairing token to request a bearer token.

await api.request_bearer_token()

Refresh Token

Automatically refresh tokens when they expire.

await api.refresh_token()

3. Retrieve System Information

Get AC Systems

systems = await api.get_ac_systems()

Get System Status

status = await api.get_ac_status(serial_number="AC_SERIAL")

Get Events

events = await api.get_ac_events(serial_number="AC_SERIAL", event_type="latest")

4. Control the System

Set System Mode

await api.set_system_mode(serial_number="AC_SERIAL", is_on=True, mode="COOL")

Set Fan Mode

await api.set_fan_mode(serial_number="AC_SERIAL", fan_mode="HIGH", continuous=False)

Adjust Temperature

await api.set_temperature(serial_number="AC_SERIAL", mode="COOL", temperature=24.0)

Manage Zones

Enable or disable specific zones:

await api.set_zone(serial_number="AC_SERIAL", zone_number=0, is_enabled=True)

Enable or disable multiple zones:

zone_settings = {
    0: True,  # Enable zone 0
    1: False, # Disable zone 1
}
await api.set_multiple_zones(serial_number="AC_SERIAL", zone_settings=zone_settings)

Logging

This library uses Python's built-in logging module for debug and error messages. Configure logging in your application to capture these logs:

import logging

logging.basicConfig(level=logging.DEBUG)

Error Handling

The library defines custom exceptions for better error management:

  • ActronNeoAuthError: Raised for authentication-related issues.
  • ActronNeoAPIError: Raised for general API errors.

Example:

try:
    systems = await api.get_ac_systems()
except ActronNeoAuthError as e:
    print(f"Authentication failed: {e}")
except ActronNeoAPIError as e:
    print(f"API error: {e}")

Advanced Features

Handle Token Expiration

The library automatically refreshes expired tokens using _handle_request.

Proactive Token Refresh

Tokens are refreshed before they expire if expires_in is provided by the API.


Contributing

Contributions are welcome! Please submit issues and pull requests on GitHub.

  1. Fork the repository.
  2. Create a feature branch.
  3. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Disclaimer

This library is not affiliated with or endorsed by Actron Air. Use it at your own risk.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

actron_neo_api-0.1.26.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

actron_neo_api-0.1.26-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file actron_neo_api-0.1.26.tar.gz.

File metadata

  • Download URL: actron_neo_api-0.1.26.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for actron_neo_api-0.1.26.tar.gz
Algorithm Hash digest
SHA256 01f05e029f8b6b2f2ed5ebbb18a52e2f8168348fcd9eb6a2b8dcf0b4ba254280
MD5 cb4c751edc1e5191c17bb189f50d0612
BLAKE2b-256 722389ef27fb2a772c78e4e4317ac2960394d27d2b756c5406c568d2a5cf7a24

See more details on using hashes here.

Provenance

The following attestation bundles were made for actron_neo_api-0.1.26.tar.gz:

Publisher: publish.yml on kclif9/actronneoapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file actron_neo_api-0.1.26-py3-none-any.whl.

File metadata

File hashes

Hashes for actron_neo_api-0.1.26-py3-none-any.whl
Algorithm Hash digest
SHA256 0fa979cc620c5bb385716e6093445a049fee9f094609b094f43f1e413aa5c802
MD5 40f665a5ddca1d6b58fbd235b9b5435c
BLAKE2b-256 cd3c6525c9b4900a808c03f22df2ea178d4be73afefde7a99ad55876207663a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for actron_neo_api-0.1.26-py3-none-any.whl:

Publisher: publish.yml on kclif9/actronneoapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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