### Quick Start: ActronAirAPI Usage Example Source: https://github.com/kclif9/actronneoapi/blob/main/README.md A quick start example demonstrating asynchronous initialization of ActronAirAPI, fetching system status, and controlling AC system modes, temperatures, fan speeds, and zones using object-oriented methods. ```python import asyncio from actron_neo_api import ActronAirAPI async def main(): # Initialize with refresh token - token will be refreshed on first API call api = ActronAirAPI(refresh_token="your_refresh_token") # Get systems and update status systems = await api.get_ac_systems() api.systems = systems await api.update_status() # Get the status object serial = systems[0].get("serial") status = api.state_manager.get_status(serial) # Control your AC system using object-oriented methods # Through the AC system object await status.ac_system.set_system_mode(mode="COOL") # Through the settings object await status.user_aircon_settings.set_temperature(23.0) # Mode inferred automatically await status.user_aircon_settings.set_fan_mode("HIGH") # Control zones directly zone = status.remote_zone_info[0] await zone.enable(is_enabled=True) await zone.set_temperature(22.0) # Mode inferred from parent AC unit if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Configure Logging Source: https://github.com/kclif9/actronneoapi/blob/main/README.md Shows how to set up logging for the ActronNeoAPI. It includes basic logging configuration and an example of how to enable more detailed debug logging for the 'actron_neo_api' module. ```python import logging logging.basicConfig(level=logging.INFO) logging.getLogger("actron_neo_api").setLevel(logging.DEBUG) # For more detailed logging ``` -------------------------------- ### Install ActronAirAPI using pip Source: https://github.com/kclif9/actronneoapi/blob/main/README.md Installs the ActronAirAPI library using pip. This is the standard method for adding Python packages to your project. ```bash pip install actron-neo-api ``` -------------------------------- ### Use Actron Neo API as Context Manager (Python) Source: https://context7.com/kclif9/actronneoapi/llms.txt This Python example demonstrates using the Actron Neo API as an asynchronous context manager. This approach ensures that the API session is automatically closed upon exiting the `async with` block, simplifying resource management. It requires a refresh token and fetches system status to display aircon settings like mode and temperature. ```python import asyncio from actron_neo_api import ActronAirAPI async def use_context_manager(): async with ActronAirAPI(refresh_token="your_refresh_token") as api: systems = await api.get_ac_systems() api.systems = systems await api.update_status() serial = systems[0].serial status = api.state_manager.get_status(serial) if status and status.user_aircon_settings: print(f"Mode: {status.user_aircon_settings.mode}") print(f"Temperature: {status.user_aircon_settings.temperature_setpoint_cool_c}C") # Session automatically closed when exiting context asyncio.run(use_context_manager()) ``` -------------------------------- ### Control Actron Neo AC System via Object-Oriented API Source: https://github.com/kclif9/actronneoapi/blob/main/README.md Provides examples of controlling an Actron Neo AC system using the recommended object-oriented API. This includes changing the system name, setting the operational mode, retrieving firmware and model information, rebooting the system, and forcing a status update for a specific unit. ```python # Get the status object status = api.state_manager.get_status("AC_SERIAL") # Direct AC system control ac_system = status.ac_system # Change system name await ac_system.set_name("Living Room AC") # Turn the system on and set mode await ac_system.set_system_mode(mode="COOL") # Get system information firmware_version = await ac_system.get_firmware_version() outdoor_unit_model = await ac_system.get_outdoor_unit_model() # Reboot the system when needed await ac_system.reboot() # Force status update for this specific system updated_status = await ac_system.update_status() ``` -------------------------------- ### Perform OAuth2 Device Code Authentication Source: https://context7.com/kclif9/actronneoapi/llms.txt This Python script demonstrates the OAuth2 device code flow for authenticating with Actron Air systems. It guides the user through entering a code on a verification website and then polls for token data. The script requires the `asyncio` and `actron_neo_api` libraries. ```python import asyncio from actron_neo_api import ActronAirAPI async def authenticate(): async with ActronAirAPI() as api: # Step 1: Request device code device_code_response = await api.request_device_code() print(f"Go to: {device_code_response.verification_uri}") print(f"Enter code: {device_code_response.user_code}") print(f"Or use direct link: {device_code_response.verification_uri_complete}") # Step 2: Poll for authorization (automatic polling with retry logic) token_data = await api.poll_for_token( device_code_response.device_code, interval=device_code_response.interval, timeout=device_code_response.expires_in ) if token_data: print("Authentication successful!") # Save tokens for future use access_token = api.access_token refresh_token = api.refresh_token_value print(f"Refresh token (save this): {refresh_token}") # Get user info user_info = await api.get_user_info() print(f"Authenticated as: {user_info.name}") asyncio.run(authenticate()) ``` -------------------------------- ### Basic OAuth2 Authentication Flow with Actron Neo API Source: https://github.com/kclif9/actronneoapi/blob/main/README.md Demonstrates the complete OAuth2 device code flow for authenticating with the Actron Air API. It initializes the API, requests a device code, guides the user through the verification process, and automatically polls for an access token. Upon successful authentication, it retrieves user information and AC system data. ```python import asyncio from actron_neo_api import ActronAirAPI async def oauth2_flow(): # Initialize API async with ActronAirAPI() as api: # Request device code device_code_response = await api.request_device_code() device_code = device_code_response.device_code user_code = device_code_response.user_code verification_uri = device_code_response.verification_uri verification_uri_complete = device_code_response.verification_uri_complete expires_in = device_code_response.expires_in interval = device_code_response.interval # Display instructions to user print("1. Open: %s" % verification_uri) print("2. Enter code: %s" % user_code) print("3. Or use direct link: %s" % verification_uri_complete) # Poll for authorization (automatic polling) print("Waiting for authorization...") token_data = await api.poll_for_token( device_code, interval=interval, timeout=expires_in ) if token_data: print("Authorization successful!") # Get user info user_info = await api.get_user_info() print(f"Authenticated as: {user_info}") # Use API normally systems = await api.get_ac_systems() await api.update_status() # Save tokens for future use access_token = api.access_token refresh_token = api.refresh_token_value print(f"Save these tokens: {access_token}, {refresh_token}") asyncio.run(oauth2_flow()) ``` -------------------------------- ### Control AC Settings Source: https://github.com/kclif9/actronneoapi/blob/main/README.md Examples for controlling general AC settings such as temperature, fan mode, and special modes like quiet, turbo, and away. These operations directly interact with the system's settings module. ```python await settings.set_temperature(23.0) is_continuous = settings.continuous_fan_enabled base_mode = settings.base_fan_mode await settings.set_fan_mode("HIGH") await settings.set_continuous_mode(enabled=True) await settings.set_quiet_mode(enabled=True) await settings.set_turbo_mode(enabled=False) await settings.set_away_mode(enabled=False) ``` -------------------------------- ### Initialize ActronAirAPI with platform specification Source: https://github.com/kclif9/actronneoapi/blob/main/README.md Demonstrates how to initialize the ActronAirAPI, showing both automatic platform detection and explicit platform specification for Neo, Que (NX-Gen), and Actron Connect (ACM-2) systems. ```python # Auto-detect platform (recommended) api = ActronAirAPI(refresh_token="your_token") # Or explicitly specify platform api = ActronAirAPI(refresh_token="your_token", platform="neo") # Neo platform api = ActronAirAPI(refresh_token="your_token", platform="que") # NX-Gen platform ``` -------------------------------- ### Initialize ActronAirAPI with Saved Refresh Token Source: https://context7.com/kclif9/actronneoapi/llms.txt This Python script shows how to initialize the ActronAirAPI using a previously saved refresh token. It demonstrates fetching AC system information, updating status, and accessing specific settings like power, mode, and temperature setpoints. Error handling for authentication and API errors is included. Requires `asyncio`, `actron_neo_api`, `ActronAirAuthError`, and `ActronAirAPIError`. ```python import asyncio from actron_neo_api import ActronAirAPI, ActronAirAuthError, ActronAirAPIError async def main(): # Initialize with saved refresh token - auto-detects platform api = ActronAirAPI(refresh_token="your_saved_refresh_token") # Or explicitly specify platform # api = ActronAirAPI(refresh_token="your_token", platform="neo") # Neo platform # api = ActronAirAPI(refresh_token="your_token", platform="que") # NX-Gen platform try: # Get all AC systems in your account systems = await api.get_ac_systems() api.systems = systems for system in systems: print(f"System: {system.serial}, Type: {system.type}") # Update status to get latest data await api.update_status() # Access typed status for first system serial = systems[0].serial status = api.state_manager.get_status(serial) if status and status.user_aircon_settings: settings = status.user_aircon_settings print(f"Power: {'ON' if settings.is_on else 'OFF'}") print(f"Mode: {settings.mode}") print(f"Cool Setpoint: {settings.temperature_setpoint_cool_c}C") print(f"Heat Setpoint: {settings.temperature_setpoint_heat_c}C") print(f"Fan Mode: {settings.fan_mode}") except ActronAirAuthError as e: print(f"Authentication failed: {e}") except ActronAirAPIError as e: print(f"API error: {e}") finally: await api.close() asyncio.run(main()) ``` -------------------------------- ### Configure Logging for Actron Neo API (Python) Source: https://context7.com/kclif9/actronneoapi/llms.txt This Python snippet illustrates how to configure logging for the Actron Neo API, which is useful for debugging authentication and API-related issues. It sets up basic logging and specifically enables DEBUG level logging for the `actron_neo_api` module. This requires a refresh token to initiate API calls that will then be logged. ```python import asyncio import logging from actron_neo_api import ActronAirAPI # Configure logging logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s" ) # Enable debug logging for the library logging.getLogger("actron_neo_api").setLevel(logging.DEBUG) async def main(): api = ActronAirAPI(refresh_token="your_refresh_token") systems = await api.get_ac_systems() print(f"Found {len(systems)} systems") await api.close() asyncio.run(main()) ``` -------------------------------- ### Manage Actron Neo AC System Settings via Object-Oriented API Source: https://github.com/kclif9/actronneoapi/blob/main/README.md Illustrates how to manage individual AC system settings using the object-oriented API. This focuses on controlling the `user_aircon_settings` object to change the system's operational mode. It assumes the status object for the specific AC unit has already been retrieved. ```python # Get the status object status = api.state_manager.get_status("AC_SERIAL") # Settings control settings = status.user_aircon_settings # Turn the system on/off and set mode await settings.set_system_mode(mode="COOL") ``` -------------------------------- ### Retrieve and Display Actron Neo AC System Information Source: https://github.com/kclif9/actronneoapi/blob/main/README.md This snippet demonstrates how to fetch all connected AC systems associated with an authenticated account. It then iterates through the systems to display their names and serial numbers. Finally, it updates the status of all systems and shows how to access specific settings like power state and temperature setpoint. ```python # Get all AC systems systems = await api.get_ac_systems() for system in systems: print(f"System: {system.get('name')} (Serial: {system.get('serial')})") # Update status to get the latest data await api.update_status() # Access typed status for a system serial = systems[0].get("serial") status = api.state_manager.get_status(serial) # Access system properties if status and status.user_aircon_settings: print(f"Power: {'ON' if status.user_aircon_settings.is_on else 'OFF'}") print(f"Mode: {status.user_aircon_settings.mode}") print(f"Cool Setpoint: {status.user_aircon_settings.temperature_setpoint_cool_c}°C") ``` -------------------------------- ### Control Climate Zones with Actron Neo API (Python) Source: https://context7.com/kclif9/actronneoapi/llms.txt This Python script demonstrates how to control individual climate zones within an Actron Neo system. It shows how to enable/disable zones, set target temperatures, and retrieve detailed zone information including active status, HVAC mode, setpoints, live temperature, and sensor data. It requires the 'actron_neo_api' library and a valid refresh token. ```python import asyncio from actron_neo_api import ActronAirAPI async def control_zones(): api = ActronAirAPI(refresh_token="your_refresh_token") systems = await api.get_ac_systems() api.systems = systems await api.update_status() serial = systems[0].serial status = api.state_manager.get_status(serial) if status and status.remote_zone_info: print(f"Found {len(status.remote_zone_info)} zones") for i, zone in enumerate(status.remote_zone_info): print(f"\nZone {i}: {zone.title}") print(f" Active: {zone.is_active}") print(f" HVAC Mode: {zone.hvac_mode}") print(f" Cool Setpoint: {zone.temperature_setpoint_cool_c}C") print(f" Heat Setpoint: {zone.temperature_setpoint_heat_c}C") print(f" Live Temperature: {zone.live_temp_c}C") print(f" Temperature Range: {zone.min_temp}C - {zone.max_temp}C") print(f" Zone Position: {zone.zone_position}%") # Check for peripheral sensor data if zone.peripheral_temperature is not None: print(f" Sensor Temperature: {zone.peripheral_temperature}C") if zone.peripheral_humidity is not None: print(f" Sensor Humidity: {zone.peripheral_humidity}%") if zone.battery_level is not None: print(f" Sensor Battery: {zone.battery_level}%") # Control first zone first_zone = status.remote_zone_info[0] # Enable the zone await first_zone.enable(is_enabled=True) print(f"\nZone '{first_zone.title}' enabled") # Set zone temperature (mode inferred from parent AC unit) await first_zone.set_temperature(22.0) print(f"Zone temperature set to 22.0C") # Disable a zone await first_zone.enable(is_enabled=False) print(f"Zone '{first_zone.title}' disabled") await api.close() asyncio.run(control_zones()) ``` -------------------------------- ### Monitor System Status with Actron Neo API (Python) Source: https://context7.com/kclif9/actronneoapi/llms.txt This Python script shows how to retrieve real-time status information from an Actron Neo air conditioning system. It provides details on system online status, temperatures, compressor performance, alerts, and live aircon data. The script requires the 'actron_neo_api' library and a valid refresh token. ```python import asyncio from actron_neo_api import ActronAirAPI async def monitor_status(): api = ActronAirAPI(refresh_token="your_refresh_token") systems = await api.get_ac_systems() api.systems = systems await api.update_status() serial = systems[0].serial status = api.state_manager.get_status(serial) if status: # System online status print(f"System Online: {status.is_online}") print(f"System On: {status.system_on}") # Temperature readings print(f"Outdoor Temperature: {status.outdoor_temperature}C") print(f"Indoor Humidity: {status.humidity}%") # Compressor status print(f"Compressor Mode: {status.compressor_mode}") print(f"Compressor Speed: {status.compressor_speed}") print(f"Compressor Power: {status.compressor_power}W") print(f"Target Temperature: {status.compressor_chasing_temperature}C") print(f"Live Temperature: {status.compressor_live_temperature}C") # Alerts print(f"Clean Filter Alert: {status.clean_filter}") print(f"Defrost Mode: {status.defrost_mode}") # Temperature limits print(f"Min Temperature: {status.min_temp}C") print(f"Max Temperature: {status.max_temp}C") # Live aircon data if status.live_aircon: live = status.live_aircon print(f"\nLive Aircon Data:") print(f" Fan RPM: {live.fan_rpm}") print(f" Compressor Capacity: {live.compressor_capacity}%") print(f" Defrost Active: {live.defrost}") if live.outdoor_unit: ou = live.outdoor_unit print(f"\nOutdoor Unit:") print(f" Model: {ou.model_number}") print(f" Ambient Temp: {ou.amb_temp}C") print(f" Compressor Running: {ou.compressor_on}") # Access zones dictionary zones = status.zones print(f"\nZones: {list(zones.keys())}") await api.close() asyncio.run(monitor_status()) ``` -------------------------------- ### Adjust Temperature and Settings with Actron Neo API (Python) Source: https://context7.com/kclif9/actronneoapi/llms.txt Shows how to adjust temperature setpoints, fan modes, and special features like continuous fan, quiet mode, turbo mode, and away mode using the Actron Neo API. It requires a valid refresh token and assumes the system is initially set to cooling mode. ```python import asyncio from actron_neo_api import ActronAirAPI async def control_settings(): api = ActronAirAPI(refresh_token="your_refresh_token") systems = await api.get_ac_systems() api.systems = systems await api.update_status() serial = systems[0].serial status = api.state_manager.get_status(serial) if status and status.user_aircon_settings: settings = status.user_aircon_settings # Set system to cooling mode first await settings.set_system_mode(mode="COOL") # Set temperature (mode is automatically inferred from current system mode) await settings.set_temperature(23.0) print("Temperature set to 23.0C") # Fan control - set fan speed (preserves continuous mode setting) await settings.set_fan_mode("HIGH") # Options: AUTO, LOW, MEDIUM, HIGH print(f"Fan mode set to HIGH") # Check and toggle continuous fan mode print(f"Continuous fan enabled: {settings.continuous_fan_enabled}") print(f"Base fan mode: {settings.base_fan_mode}") await settings.set_continuous_mode(enabled=True) print("Continuous fan mode enabled") # Enable quiet mode (reduces noise) await settings.set_quiet_mode(enabled=True) print("Quiet mode enabled") # Enable turbo mode (maximum cooling/heating) if settings.turbo_supported: await settings.set_turbo_mode(enabled=True) print("Turbo mode enabled") # Enable away mode (energy saving when away) await settings.set_away_mode(enabled=True) print("Away mode enabled") await api.close() asyncio.run(control_settings()) ``` -------------------------------- ### Temperature and Settings Control API Source: https://context7.com/kclif9/actronneoapi/llms.txt This API allows you to adjust temperature setpoints, fan modes, and special features like quiet, turbo, and away modes. ```APIDOC ## Temperature and Settings Control ### Description Adjust temperature setpoints, fan modes, and special features through the `user_aircon_settings` object. ### Method POST (or equivalent method for setting state) ### Endpoint `/api/systems/{serial}/settings` ### Parameters #### Path Parameters - **serial** (string) - Required - The serial number of the AC system. #### Query Parameters None #### Request Body - **temperature** (float) - Optional - The desired temperature setpoint (e.g., 23.0). - **fan_mode** (string) - Optional - The desired fan mode. Options: `AUTO`, `LOW`, `MEDIUM`, `HIGH`. - **continuous_fan_enabled** (boolean) - Optional - Whether to enable continuous fan mode. - **quiet_mode_enabled** (boolean) - Optional - Whether to enable quiet mode. - **turbo_mode_enabled** (boolean) - Optional - Whether to enable turbo mode (if supported). - **away_mode_enabled** (boolean) - Optional - Whether to enable away mode. ### Request Example ```json { "temperature": 23.0, "fan_mode": "HIGH", "continuous_fan_enabled": true, "quiet_mode_enabled": true, "turbo_mode_enabled": true, "away_mode_enabled": true } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "success" } ``` ## Get Current Settings ### Description Retrieves the current settings of the air conditioning system, including fan mode and continuous fan status. ### Method GET ### Endpoint `/api/systems/{serial}/settings` ### Parameters #### Path Parameters - **serial** (string) - Required - The serial number of the AC system. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **continuous_fan_enabled** (boolean) - Whether continuous fan mode is enabled. - **base_fan_mode** (string) - The base fan mode (e.g., `AUTO`). - **turbo_supported** (boolean) - Whether turbo mode is supported by the system. #### Response Example ```json { "continuous_fan_enabled": false, "base_fan_mode": "AUTO", "turbo_supported": true } ``` ``` -------------------------------- ### Control AC System Mode with Actron Neo API (Python) Source: https://context7.com/kclif9/actronneoapi/llms.txt Demonstrates how to control the AC system's operational mode (COOL, HEAT, AUTO, FAN, OFF) using the Actron Neo API. It retrieves system status, prints system information, and then sets the mode to COOL and subsequently to OFF. Requires a valid refresh token. ```python import asyncio from actron_neo_api import ActronAirAPI async def control_ac_system(): api = ActronAirAPI(refresh_token="your_refresh_token") systems = await api.get_ac_systems() api.systems = systems await api.update_status() serial = systems[0].serial status = api.state_manager.get_status(serial) if status and status.ac_system: ac_system = status.ac_system # Get system information print(f"System Name: {ac_system.system_name}") print(f"Model: {ac_system.master_wc_model}") print(f"Firmware: {ac_system.master_wc_firmware_version}") print(f"Serial: {ac_system.master_serial}") # Set system mode await ac_system.set_system_mode(mode="COOL") # Options: COOL, HEAT, AUTO, FAN, OFF print("System mode set to COOL") # Turn system off await ac_system.set_system_mode(mode="OFF") print("System turned OFF") await api.close() asyncio.run(control_ac_system()) ``` -------------------------------- ### Manage AC Zones Source: https://github.com/kclif9/actronneoapi/blob/main/README.md Demonstrates how to interact with individual zones of an Actron Air system. This includes retrieving zone status, enabling/disabling zones, setting zone-specific temperatures, and checking temperature limits. ```python # Get the status object status = api.state_manager.get_status("AC_SERIAL") # Enable/disable a zone directly zone = status.remote_zone_info[0] # First zone await zone.enable(is_enabled=True) # Set zone temperature (mode is automatically inferred from the parent AC unit) await zone.set_temperature(22.0) # Check zone temperature limits print(f"Zone min temp: {zone.min_temp}°C") print(f"Zone max temp: {zone.max_temp}°C") # Enable/disable multiple zones zones = status.remote_zone_info for i, zone in enumerate(zones): if i == 0 or i == 2: # Enable zones 0 and 2 await zone.enable(is_enabled=True) else: # Disable other zones await zone.enable(is_enabled=False) ``` -------------------------------- ### Restore Actron Neo API Session with Saved Refresh Token Source: https://github.com/kclif9/actronneoapi/blob/main/README.md Shows how to re-initialize the Actron Air API using a previously saved refresh token. This allows for seamless session restoration without requiring the full OAuth2 flow again. The API automatically handles token refreshing on subsequent calls. ```python async def restore_session(): # Initialize with refresh token - token will be refreshed on first API call api = ActronAirAPI(refresh_token="your_saved_refresh_token") # API will automatically refresh tokens as needed systems = await api.get_ac_systems() ``` -------------------------------- ### Read Peripheral Sensors with Actron Neo API (Python) Source: https://context7.com/kclif9/actronneoapi/llms.txt This snippet demonstrates how to access peripheral sensor devices like temperature and humidity sensors assigned to specific zones using the Actron Neo API. It requires a refresh token for authentication and retrieves system status to access peripheral data. The output includes details about each peripheral and its assigned zones. ```python import asyncio from actron_neo_api import ActronAirAPI async def read_peripherals(): api = ActronAirAPI(refresh_token="your_refresh_token") systems = await api.get_ac_systems() api.systems = systems await api.update_status() serial = systems[0].serial status = api.state_manager.get_status(serial) if status and status.peripherals: print(f"Found {len(status.peripherals)} peripheral sensors") for peripheral in status.peripherals: print(f"\nPeripheral: {peripheral.serial_number}") print(f" Type: {peripheral.device_type}") print(f" Logical Address: {peripheral.logical_address}") print(f" Zone Assignments: {peripheral.zone_assignments}") if peripheral.temperature is not None: print(f" Temperature: {peripheral.temperature}C") if peripheral.humidity is not None: print(f" Humidity: {peripheral.humidity}%") if peripheral.battery_level is not None: print(f" Battery: {peripheral.battery_level}%") # Get assigned zone objects assigned_zones = peripheral.zones for zone in assigned_zones: print(f" Assigned to: {zone.title}") # Get peripheral for a specific zone zone_0_peripheral = status.get_peripheral_for_zone(0) if zone_0_peripheral: print(f"\nZone 0 has peripheral: {zone_0_peripheral.serial_number}") await api.close() asyncio.run(read_peripherals()) ``` -------------------------------- ### Handle Errors with Actron Neo API (Python) Source: https://context7.com/kclif9/actronneoapi/llms.txt This Python snippet shows how to implement error handling for the Actron Neo API. It specifically catches `ActronAirAuthError` for authentication issues and `ActronAirAPIError` for general API problems, providing informative messages for each. It also includes a general exception catch for unexpected errors. This requires a refresh token, which can be invalid to test the error handling. ```python import asyncio from actron_neo_api import ActronAirAPI, ActronAirAuthError, ActronAirAPIError async def handle_errors(): try: api = ActronAirAPI(refresh_token="invalid_or_expired_token") # This will fail if token is invalid systems = await api.get_ac_systems() except ActronAirAuthError as e: # Authentication failures: invalid tokens, expired tokens, denied authorization print(f"Authentication error: {e}") print("Please re-authenticate using the device code flow") except ActronAirAPIError as e: # API errors: network issues, invalid responses, server errors print(f"API error: {e}") except Exception as e: # Unexpected errors print(f"Unexpected error: {e}") asyncio.run(handle_errors()) ``` -------------------------------- ### AC System Control API Source: https://context7.com/kclif9/actronneoapi/llms.txt This API allows you to control the AC system mode, including COOL, HEAT, AUTO, FAN, and OFF states. ```APIDOC ## AC System Control ### Description Control the AC system mode (COOL, HEAT, AUTO, FAN, OFF) through the `ac_system` object. ### Method POST (or equivalent method for setting state) ### Endpoint `/api/systems/{serial}/ac_system/mode` ### Parameters #### Path Parameters - **serial** (string) - Required - The serial number of the AC system. #### Query Parameters None #### Request Body - **mode** (string) - Required - The desired system mode. Options: `COOL`, `HEAT`, `AUTO`, `FAN`, `OFF`. ### Request Example ```json { "mode": "COOL" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "success" } ``` ## Get AC System Information ### Description Retrieves detailed information about the AC system, including its name, model, firmware version, and serial number. ### Method GET ### Endpoint `/api/systems/{serial}` ### Parameters #### Path Parameters - **serial** (string) - Required - The serial number of the AC system. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **system_name** (string) - The name of the AC system. - **master_wc_model** (string) - The model of the AC unit. - **master_wc_firmware_version** (string) - The firmware version of the AC unit. - **master_serial** (string) - The serial number of the AC unit. #### Response Example ```json { "system_name": "Living Room AC", "master_wc_model": "WC-8000", "master_wc_firmware_version": "3.2.1", "master_serial": "ABC123DEF456" } ``` ``` -------------------------------- ### Handle API Errors Source: https://github.com/kclif9/actronneoapi/blob/main/README.md Provides a robust error handling structure for API interactions. It specifically catches authentication errors, general API errors, and any other unexpected exceptions, ensuring graceful failure. ```python from actron_neo_api import ActronAirAPI, ActronAirAuthError, ActronAirAPIError try: api = ActronAirAPI(refresh_token="your_refresh_token") # API operations... systems = await api.get_ac_systems() except ActronAirAuthError as e: print(f"Authentication error: {e}") except ActronAirAPIError as e: print(f"API error: {e}") except Exception as e: print(f"Unexpected error: {e}") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.