aioafero.v1 package

Subpackages

Submodules

aioafero.v1.auth module

Handle authentication to Afero API.

class aioafero.v1.auth.AferoAuth(session: ClientSession, username: str, refresh_token: str, *, token: str | None = None, token_expiration: float | None = None, hide_secrets: bool = True, afero_client: str = 'hubspace', client_name: str = 'aioafero')[source]

Bases: object

Authentication against the Afero IoT API.

This class follows the Afero IoT authentication workflow and utilizes refresh tokens.

Construct runtime instances with AferoAuth(session, username, refresh_token, ...) or use for_login() for credential-based login.

Parameters:
__init__(session: ClientSession, username: str, refresh_token: str, *, token: str | None = None, token_expiration: float | None = None, hide_secrets: bool = True, afero_client: str = 'hubspace', client_name: str = 'aioafero') None[source]

Initialize auth for refresh-token runtime flows; use for_login() for credentials.

Parameters:
  • session (ClientSession) – Shared aiohttp.ClientSession for OpenID and token requests.

  • username (str) – Afero-backed account username.

  • refresh_token (str) – OAuth refresh token from login or storage.

  • token (str | None) – Optional non-expired bearer token to skip the initial refresh.

  • token_expiration (float | None) – Unix timestamp when token expires; omit with token to refresh on first API use.

  • hide_secrets (bool) – Redact sensitive values from logs.

  • afero_client (str) – Afero client identifier (default hubspace).

  • client_name (str) – User-Agent token for auth requests.

Return type:

None

classmethod for_login(session: ClientSession, username: str, password: str, *, afero_client: str = 'hubspace', hide_secrets: bool = True, client_name: str = 'aioafero') AferoAuth[source]

Create an auth instance for credential-based login flows.

Parameters:
  • session (ClientSession) – Shared aiohttp.ClientSession for OpenID and token requests.

  • username (str) – Afero-backed account username.

  • password (str) – Account password (cleared after successful login).

  • afero_client (str)

  • hide_secrets (bool)

  • client_name (str)

Return type:

AferoAuth

property is_expired: bool

Determine if the token is expired.

property refresh_token: str | None

Get the current refresh token.

generate_auth_url(endpoint: str) str[source]

Generate an auth URL for the Afero API.

Parameters:

endpoint (str)

Return type:

str

set_token_data(data: TokenData) None[source]

Set the current token data.

When hide_secrets is True (default), updates the securelogging registry: removes old token values not reused in data, then registers new ones. When hide_secrets is False, only _token_data is replaced (no registry changes); DEBUG logs may expose secrets.

Parameters:

data (TokenData)

Return type:

None

async webapp_login(challenge: AuthChallenge) str[source]

Perform login to the webapp for a code.

Login to the webapp and generate a code used for generating tokens.

Parameters:

challenge (AuthChallenge) – Challenge data for connection and approving

Returns:

Code used for generating a refresh token

Return type:

str

async static generate_challenge_data() AuthChallenge[source]

Generate data to send to Afero API when logging into the system.

Return type:

AuthChallenge

async generate_code(data: AuthSessionData, challenge: AuthChallenge) str[source]

Finalize login to Afero IoT page.

Parameters:
  • session_code – Session code during form interaction

  • execution – Session code during form interaction

  • tab_id – Session code during form interaction

  • data (AuthSessionData)

  • challenge (AuthChallenge)

Returns:

code for generating tokens

Return type:

str

async static requires_otp(content: str) bool[source]

Determine if the user requires otp.

Parameters:

content (str)

Return type:

bool

async static parse_code(response: ClientResponse) str[source]

Parse the code for generating tokens.

Parameters:

response (ClientResponse)

Return type:

str

async generate_refresh_token(challenge: AuthChallenge | None = None, code: str | None = None) TokenData[source]

Generate a refresh token.

If a challenge is provided, it will send the correct data. If no challenge is required, it will use the existing refresh token.

Parameters:
  • challenge (AuthChallenge | None) – Challenge data for connection and approving.

  • code (str | None) – Code used for generating refresh token.

Returns:

Token data including refresh and bearer tokens.

Return type:

TokenData

async perform_initial_login() TokenData[source]

Login to generate a refresh token.

Returns:

Refresh token for the auth

Return type:

TokenData

async login() TokenData[source]

Perform credential-based login and return token data.

Return type:

TokenData

async perform_otp_login(otp_code: str) TokenData[source]

Perform otp login to generate a refresh token.

Returns:

Refresh token for the auth

Parameters:

otp_code (str)

Return type:

TokenData

async submit_otp(otp_code: str) TokenData[source]

Submit OTP code and complete login.

Parameters:

otp_code (str) – OTP code provided by the user

Returns:

Token data for the authenticated session

Return type:

TokenData

async token(retry: bool = True) str[source]

Generate the token required to make Afero API calls.

Parameters:

retry (bool)

Return type:

str

class aioafero.v1.auth.TokenData(token: str | None, access_token: str | None, refresh_token: str, expiration: float)[source]

Bases: NamedTuple

Data related to the current token.

Parameters:
  • token (str | None)

  • access_token (str | None)

  • refresh_token (str)

  • expiration (float)

token: str | None

Alias for field number 0

access_token: str | None

Alias for field number 1

refresh_token: str

Alias for field number 2

expiration: float

Alias for field number 3

aioafero.v1.auth.passthrough()[source]

Do nothing.

aioafero.v1.v1_const module

Constants for accessing Afero API.

Module contents

Controls Hubspace devices on v1 API.

class aioafero.v1.AferoAuth(session: ClientSession, username: str, refresh_token: str, *, token: str | None = None, token_expiration: float | None = None, hide_secrets: bool = True, afero_client: str = 'hubspace', client_name: str = 'aioafero')[source]

Bases: object

Authentication against the Afero IoT API.

This class follows the Afero IoT authentication workflow and utilizes refresh tokens.

Construct runtime instances with AferoAuth(session, username, refresh_token, ...) or use for_login() for credential-based login.

Parameters:
__init__(session: ClientSession, username: str, refresh_token: str, *, token: str | None = None, token_expiration: float | None = None, hide_secrets: bool = True, afero_client: str = 'hubspace', client_name: str = 'aioafero') None[source]

Initialize auth for refresh-token runtime flows; use for_login() for credentials.

Parameters:
  • session (ClientSession) – Shared aiohttp.ClientSession for OpenID and token requests.

  • username (str) – Afero-backed account username.

  • refresh_token (str) – OAuth refresh token from login or storage.

  • token (str | None) – Optional non-expired bearer token to skip the initial refresh.

  • token_expiration (float | None) – Unix timestamp when token expires; omit with token to refresh on first API use.

  • hide_secrets (bool) – Redact sensitive values from logs.

  • afero_client (str) – Afero client identifier (default hubspace).

  • client_name (str) – User-Agent token for auth requests.

Return type:

None

classmethod for_login(session: ClientSession, username: str, password: str, *, afero_client: str = 'hubspace', hide_secrets: bool = True, client_name: str = 'aioafero') AferoAuth[source]

Create an auth instance for credential-based login flows.

Parameters:
  • session (ClientSession) – Shared aiohttp.ClientSession for OpenID and token requests.

  • username (str) – Afero-backed account username.

  • password (str) – Account password (cleared after successful login).

  • afero_client (str)

  • hide_secrets (bool)

  • client_name (str)

Return type:

AferoAuth

property is_expired: bool

Determine if the token is expired.

property refresh_token: str | None

Get the current refresh token.

generate_auth_url(endpoint: str) str[source]

Generate an auth URL for the Afero API.

Parameters:

endpoint (str)

Return type:

str

set_token_data(data: TokenData) None[source]

Set the current token data.

When hide_secrets is True (default), updates the securelogging registry: removes old token values not reused in data, then registers new ones. When hide_secrets is False, only _token_data is replaced (no registry changes); DEBUG logs may expose secrets.

Parameters:

data (TokenData)

Return type:

None

async webapp_login(challenge: AuthChallenge) str[source]

Perform login to the webapp for a code.

Login to the webapp and generate a code used for generating tokens.

Parameters:

challenge (AuthChallenge) – Challenge data for connection and approving

Returns:

Code used for generating a refresh token

Return type:

str

async static generate_challenge_data() AuthChallenge[source]

Generate data to send to Afero API when logging into the system.

Return type:

AuthChallenge

async generate_code(data: AuthSessionData, challenge: AuthChallenge) str[source]

Finalize login to Afero IoT page.

Parameters:
  • session_code – Session code during form interaction

  • execution – Session code during form interaction

  • tab_id – Session code during form interaction

  • data (AuthSessionData)

  • challenge (AuthChallenge)

Returns:

code for generating tokens

Return type:

str

async static requires_otp(content: str) bool[source]

Determine if the user requires otp.

Parameters:

content (str)

Return type:

bool

async static parse_code(response: ClientResponse) str[source]

Parse the code for generating tokens.

Parameters:

response (ClientResponse)

Return type:

str

async generate_refresh_token(challenge: AuthChallenge | None = None, code: str | None = None) TokenData[source]

Generate a refresh token.

If a challenge is provided, it will send the correct data. If no challenge is required, it will use the existing refresh token.

Parameters:
  • challenge (AuthChallenge | None) – Challenge data for connection and approving.

  • code (str | None) – Code used for generating refresh token.

Returns:

Token data including refresh and bearer tokens.

Return type:

TokenData

async perform_initial_login() TokenData[source]

Login to generate a refresh token.

Returns:

Refresh token for the auth

Return type:

TokenData

async login() TokenData[source]

Perform credential-based login and return token data.

Return type:

TokenData

async perform_otp_login(otp_code: str) TokenData[source]

Perform otp login to generate a refresh token.

Returns:

Refresh token for the auth

Parameters:

otp_code (str)

Return type:

TokenData

async submit_otp(otp_code: str) TokenData[source]

Submit OTP code and complete login.

Parameters:

otp_code (str) – OTP code provided by the user

Returns:

Token data for the authenticated session

Return type:

TokenData

async token(retry: bool = True) str[source]

Generate the token required to make Afero API calls.

Parameters:

retry (bool)

Return type:

str

class aioafero.v1.AferoBridgeV1(username: str, refresh_token: str, session: ClientSession, *, token: str | None = None, token_expiration: float | None = None, polling_interval: int = 30, discovery_interval: int = 3600, afero_client: str | None = 'hubspace', hide_secrets: bool = True, poll_version: bool = True, client_name: str | None = 'aioafero', temperature_unit: TemperatureUnit = TemperatureUnit.CELSIUS)[source]

Bases: object

Controls Afero IoT devices on v1 API.

This class serves as the main entry point for interacting with the Afero API. It handles authentication, device discovery, state management, and event handling.

Parameters:
  • username (str) – The username for the Afero-backed account (e.g., Hubspace).

  • refresh_token (str) – The OAuth refresh token for the account.

  • token (str | None) – An optional non-expired bearer token to skip the initial refresh.

  • token_expiration (float | None) – Unix timestamp when token expires (omit to refresh immediately on first API use).

  • session (ClientSession) – aiohttp.ClientSession for API and auth traffic (required).

  • polling_interval (int) – The interval in seconds between polling the Afero API for device state updates. Defaults to 30 seconds.

  • discovery_interval (int) – The interval in seconds between polling the Afero API for new devices. Defaults to 3600 seconds (1 hour).

  • afero_client (str | None) – The Afero client identifier ("hubspace"). Defaults to “hubspace”.

  • hide_secrets (bool) – If True, sensitive information will be redacted from logs. Defaults to True.

  • poll_version (bool) – If True, device version information will be polled periodically. Defaults to True.

  • client_name (str | None) – A name for the client to be used in the User-Agent header. Defaults to “aioafero”.

  • temperature_unit (TemperatureUnit) – The desired temperature unit for API responses. Defaults to TemperatureUnit.CELSIUS.

__init__(username: str, refresh_token: str, session: ClientSession, *, token: str | None = None, token_expiration: float | None = None, polling_interval: int = 30, discovery_interval: int = 3600, afero_client: str | None = 'hubspace', hide_secrets: bool = True, poll_version: bool = True, client_name: str | None = 'aioafero', temperature_unit: TemperatureUnit = TemperatureUnit.CELSIUS)[source]

Initialize the AferoBridgeV1 instance.

session is required. _close_session defaults to False; only open() sets it to True when it creates the session internally.

Parameters:
  • username (str)

  • refresh_token (str)

  • session (ClientSession)

  • token (str | None)

  • token_expiration (float | None)

  • polling_interval (int)

  • discovery_interval (int)

  • afero_client (str | None)

  • hide_secrets (bool)

  • poll_version (bool)

  • client_name (str | None)

  • temperature_unit (TemperatureUnit)

property refresh_token: str | None

Get the current sessions refresh token.

property events: EventStream

Get the class that handles getting new data and notifying controllers.

property controllers: list

Get a list of initialized controllers.

property tracked_devices: set

Get all tracked devices.

add_device(device_id: str, controller: BaseResourcesController[AferoResource]) None[source]

Add a device to the list of known devices and map it to its controller.

Parameters:
  • device_id (str) – The unique identifier of the device.

  • controller (BaseResourcesController[AferoResource]) – The controller instance responsible for the device.

Return type:

None

get_device_controller(device_id: str) BaseResourcesController[source]

Get the controller for a given device.

Parameters:

device_id (str)

Return type:

BaseResourcesController

remove_device(device_id: str) None[source]

Remove a device from the list of known devices.

Parameters:

device_id (str) – The unique identifier of the device to remove.

Return type:

None

add_afero_dev(device: AferoDevice, device_id: str | None = None) None[source]

Add a raw AferoDevice object to the internal cache.

Parameters:
  • device (AferoDevice) – The AferoDevice object to cache.

  • device_id (str | None) – The ID to use for caching. If None, device.id is used.

Return type:

None

get_afero_device(device_id: str) AferoDevice | None[source]

Get the raw AferoDevice object for a given ID.

Parameters:

device_id (str) – The unique identifier of the device.

Returns:

The AferoDevice object if found, otherwise raises DeviceNotFound.

Raises:

DeviceNotFound – If the device with the given ID is not found.

Return type:

AferoDevice | None

resolve_metadevice_id(device_id: str) str[source]

Return the Afero API metadevice ID used for state queries and updates.

Parameters:

device_id (str)

Return type:

str

property account_id: str

Get the account ID for the Afero IoT account.

property afero_client: str

Get identifier for Afero system.

add_controller(name: str, controller_type: type) None[source]

Add and instantiate a controller.

The instantiated controller will be available as an attribute on the bridge instance with the provided name.

Parameters:
  • name (str) – The attribute name for the controller on the bridge instance.

  • controller_type (type) – The class of the controller to instantiate.

Return type:

None

set_token_data(data: TokenData) None[source]

Set TokenData used for querying the API.

Delegates to set_token_data() (including secret registry updates when hide_secrets is enabled on the bridge).

Parameters:

data (TokenData) – The TokenData object to set.

Return type:

None

set_polling_interval(polling_interval: int) None[source]

Set the time between polling Afero API.

Parameters:

polling_interval (int) – The polling interval in seconds.

Return type:

None

generate_api_url(endpoint: str) str[source]

Generate a URL for the Afero API.

Parameters:

endpoint (str) – The API endpoint path.

Returns:

The fully qualified API URL.

Return type:

str

async close() None[source]

Close connection and clean up resources.

Return type:

None

async __aenter__() Self[source]

Enter async context: await bridge.initialize().

Return type:

Self

async __aexit__(exc_type, exc_val, exc_tb) None[source]

Exit async context: await bridge.close().

Return type:

None

async classmethod open(username: str, refresh_token: str, session: ClientSession | None = None, *, token: str | None = None, token_expiration: float | None = None, polling_interval: int = 30, discovery_interval: int = 3600, afero_client: str | None = 'hubspace', hide_secrets: bool = True, poll_version: bool = True, client_name: str | None = 'aioafero', temperature_unit: TemperatureUnit = TemperatureUnit.CELSIUS) Self[source]

Create a bridge, initialize it, and wait for the first poll to finish.

Caller is responsible for await bridge.close() when not using async with.

If you use async with on a bridge returned from open, __aenter__ calls initialize() again but that is a no-op when polling tasks already exist; only __aexit__ (close()) matters for cleanup.

Parameters:
  • username (str) – Afero-backed account username.

  • refresh_token (str) – OAuth refresh token from login or storage.

  • session (ClientSession | None) – Optional shared aiohttp.ClientSession.

  • token (str | None) – Optional non-expired bearer token.

  • token_expiration (float | None) – Unix timestamp when token expires.

  • polling_interval (int) – Seconds between state polls.

  • discovery_interval (int) – Seconds between discovery polls.

  • afero_client (str | None) – Afero client identifier (default hubspace).

  • hide_secrets (bool) – Redact sensitive values from logs.

  • poll_version (bool) – Periodically fetch firmware version metadata.

  • client_name (str | None) – User-Agent token.

  • temperature_unit (TemperatureUnit) – Unit for temperature API responses.

Returns:

Initialized bridge with controllers populated from the first discovery poll.

Return type:

Self

subscribe(callback: Callable[[EventType, dict | None], None]) Callable[source]

Register a callback for resource changes on all initialized controllers.

The cloud API is polled on polling_interval; when state changes, controllers merge updates and invoke callback(event_type, item) in-process. item is the controller’s resource model (Fan, Light, etc.).

Parameters:

callback (Callable[[EventType, dict | None], None]) – Called as callback(event_type, item). May be sync or async.

Returns:

Callable that removes this subscription from every controller.

Return type:

Callable

async get_account_id() str[source]

Lookup the account ID associated with the login.

Returns:

The account ID.

Raises:

AferoError – If no account ID is found in the API response.

Return type:

str

async initialize() None[source]

Initialize the bridge for communication with Afero API.

To ensure the bridge is fully initialized, call async_block_until_done().

Return type:

None

async fetch_discovery_data(version_poll=False) list[dict[Any, str]][source]

Query the API for all device data.

Parameters:

version_poll – If True, also poll for device version information.

Returns:

A list of dictionaries, each representing a device.

Return type:

list[dict[Any, str]]

async fetch_device_states(device_id) list[dict[Any, str]][source]

Query the API for new device states.

Parameters:

device_id – The ID of the device to fetch states for.

Returns:

A list of AferoState objects representing the device’s states.

Return type:

list[dict[Any, str]]

async fetch_all_device_states() list[AferoDevice][source]

Query the API for all known device states.

Returns:

A list of AferoDevice objects with updated states.

Return type:

list[AferoDevice]

async get_device_version(device_id: str) dict[source]

Query the API for device version information.

Parameters:

device_id (str) – The ID of the device to get version info for.

Returns:

A dictionary containing version information.

Return type:

dict

create_request(method: str, url: str, include_token: bool, **kwargs) Generator[ClientResponse, None, None][source]

Create and manage an aiohttp request.

This is an async context manager that attaches authentication headers when requested and yields the response from the bridge’s session.

Parameters:
  • method (str) – The HTTP method (e.g., “GET”, “POST”).

  • url (str) – The URL for the request.

  • include_token (bool) – If True, an Authorization header with a bearer token will be included.

Return type:

Generator[ClientResponse, None, None]

async request(method: str, url: str, include_token: bool = True, **kwargs) ClientResponse[source]

Make a request to the API with automatic retries.

Parameters:
  • method (str) – The HTTP method.

  • url (str) – The request URL.

  • include_token (bool) – Whether to include the auth token. Defaults to True.

Returns:

The aiohttp.ClientResponse object.

Raises:

ExceededMaximumRetries – If the request fails after all retries.

Return type:

ClientResponse

async send_service_request(device_id: str, states: list[dict[str, Any]])[source]

Manually send state requests to Afero IoT.

Parameters:
  • device_id (str) – ID for the device

  • states (list[dict[str, Any]]) – List of states to send

Raises:

DeviceNotFound – If the device with the given ID is not found.

get_headers(**kwargs)[source]

Get default headers for an API call.

Parameters:

kwargs – Additional headers to include.

Returns:

A dictionary of headers.

add_job(task: Task) None[source]

Add a job to be processed.

Parameters:

task (Task)

Return type:

None

async async_block_until_done()[source]

Block until all ad-hoc and event queue tasks are completed.

async initialize_cleanup() None[source]

Start the background task that cleans up completed ad-hoc tasks.

Return type:

None

async adjust_temperature_unit(temperature_unit: TemperatureUnit) None[source]

Adjust the temperature unit for API responses.

Parameters:

temperature_unit (TemperatureUnit) – The desired temperature unit for API responses.

Return type:

None

type aioafero.v1.AferoController = DeviceController | FanController | LightController | LockController | AferoSensor | SwitchController | ThermostatController | ValveController | ExhaustFanController | PortableACController | SecuritySystemController | SecuritySystemKeypadController | SecuritySystemSensorController
type aioafero.v1.AferoModelResource = Device | Fan | Light | Lock | Switch | Valve | Thermostat | AferoBinarySensor | AferoSensor | ExhaustFan | PortableAC | SecuritySystem | SecuritySystemSensor
class aioafero.v1.BaseResourcesController(bridge: AferoBridgeV1)[source]

Bases: Generic

Base controller for device types registered on AferoBridgeV1.

Subclasses expose typed models and action methods. Use get_device to read state and subscribe for update callbacks.

Parameters:

bridge (AferoBridgeV1)

ITEM_TYPE_ID: ResourceTypes | None = None
ITEM_TYPES: list[ResourceTypes] | None = None
ITEM_CLS = None
ITEM_MAPPING: dict = {}
ITEM_SENSORS: dict[str, str] = {}
ITEM_BINARY_SENSORS: dict[str, str] = {}
ITEM_NUMBERS: dict[tuple[str, str | None], NumbersName] = {}
ITEM_SELECTS: dict[tuple[str, str | None], str] = {}
DEVICE_SPLIT_CALLBACKS: dict[str, callable] = {}
__init__(bridge: AferoBridgeV1) None[source]

Initialize instance.

Parameters:

bridge (AferoBridgeV1)

Return type:

None

__getitem__(device_id: str) AferoResource[source]

Get item by device_id.

Parameters:

device_id (str)

Return type:

AferoResource

__iter__() Iterator[source]

Iterate items.

Return type:

Iterator

__contains__(device_id: str) bool[source]

Return bool if device_id is in items.

Parameters:

device_id (str)

Return type:

bool

property items: list[AferoResource]

Return all items for this resource.

property initialized: bool

Determine if the controller has been initialized.

property subscribers: dict[str, list[tuple[Callable[[EventType, dict | None], None], tuple[EventType] | None]]]

Get all subscribers aligned to this controller.

async emit_to_subscribers(evt_type: EventType, item_id: str, item: AferoResource)[source]

Emit updates to subscribers.

Parameters:
  • evt_type (EventType) – Type of event

  • item_id (str) – ID of the item

  • item (AferoResource) – Item to emit to subscribers

get_filtered_devices(initial_data: list[dict]) list[AferoDevice][source]

Determine devices that align to the controller.

Parameters:

initial_data (list[dict])

Return type:

list[AferoDevice]

async initialize() None[source]

Initialize controller the controller.

Initialization process should only occur once. During this process, it will subscribe to all updates for the given resources and register any device split callbacks for the event controller.

Return type:

None

async initialize_number(func_def: dict, state: AferoState) tuple[tuple[str, str | None], NumbersFeature] | None[source]

Initialize a number from the provided data.

Parameters:
Return type:

tuple[tuple[str, str | None], NumbersFeature] | None

async initialize_select(functions: list[dict], state: AferoState) tuple[tuple[str, str | None], SelectFeature] | None[source]

Initialize a select from the provided data.

Parameters:
Return type:

tuple[tuple[str, str | None], SelectFeature] | None

async initialize_sensor(state: AferoState, child_id: str) AferoSensor | AferoBinarySensor | None[source]

Initialize the sensor.

Parameters:
  • state (AferoState) – State to update

  • child_id (str) – device_id of the parent device

Return type:

AferoSensor | AferoBinarySensor | None

async update_number(state: AferoState, cur_item: AferoResource) str | None[source]

Update the number if its tracked and a change has been detected.

Parameters:
  • state (AferoState) – State to update

  • cur_item (AferoResource) – Current item to update

Returns:

Identifier of the number that was updated or None

Return type:

str | None

async update_select(state: AferoState, cur_item: AferoResource) str | None[source]

Update the select if its tracked and a change has been detected.

Parameters:
  • state (AferoState) – State to update

  • cur_item (AferoResource) – Current item to update

Returns:

Identifier of the select that was updated or None

Return type:

str | None

async update_sensor(state: AferoState, cur_item: AferoResource) str | None[source]

Update the sensor if its tracked and a change has been detected.

Parameters:
  • state (AferoState) – State to update

  • cur_item (AferoResource) – Current item to update

Returns:

Identifier of the sensor that was updated or None

Return type:

str | None

async split_sensor_data(state: AferoState) tuple[Any, str | None][source]

Split the sensor value and return a tuple of the sensor value and key.

Parameters:

state (AferoState)

Return type:

tuple[Any, str | None]

async initialize_elem(element: AferoDevice) None[source]

Initialize the element.

Parameters:
  • afero_device – Afero Device that contains the updated states

  • element (AferoDevice)

Returns:

Newly initialized resource

Return type:

None

async update_elem(element: AferoDevice) None[source]

Update the Portable AC with the latest API data.

Parameters:
  • afero_device – Afero Device that contains the updated states

  • element (AferoDevice)

Returns:

States that have been modified

Return type:

None

subscribe(callback: Callable[[EventType, dict | None], None], id_filter: str | tuple[str] | None = None, event_filter: EventType | tuple[EventType] | None = None) Callable[source]

Subscribe to status changes for this resource type.

Parameters:
  • callback (Callable[[EventType, dict | None], None]) – callback function to call when an event emits.

  • id_filter (str | tuple[str] | None) – Optionally provide resource ID(s) to filter events for.

  • event_filter (EventType | tuple[EventType] | None) – Optionally provide EventType(s) as filter.

Returns:

function to unsubscribe.

Return type:

Callable

async update_afero_api(device_id: str, states: list[dict]) ClientResponse | bool[source]

Update Afero IoT API with the new states.

Parameters:
  • device_id (str) – Afero IoT Device ID

  • states (list[dict]) – States to manually set

Returns:

Response if successful, False otherwise.

Return type:

ClientResponse | bool

async update(device_id: str, obj_in: AferoResource | None = None, states: list[dict] | None = None, send_duplicate_states: bool = False) ClientResponse | None[source]

Update Afero IoT with the new data.

Parameters:
  • device_id (str) – Afero IoT Device ID

  • obj_in (AferoResource | None) – Afero IoT Resource elements to change

  • states (list[dict] | None) – States to manually set

  • send_duplicate_states (bool) – Send all states, regardless if there’s been a change

Return type:

ClientResponse | None

generate_update_dev(device_id: str, states: list[AferoState]) AferoDevice[source]

Generate update data for the event controller.

Parameters:
Return type:

AferoDevice

get_device(device_id: str) AferoResource[source]

Return the current model for a tracked device.

Parameters:

device_id (str) – Device ID on this controller (split or parent metadevice ID).

Returns:

Resource model with parsed feature state.

Raises:

DeviceNotFound – If device_id is not tracked by this controller.

Return type:

AferoResource

class aioafero.v1.DeviceController(*args, **kwargs)[source]

Bases: BaseResourcesController[Device]

Top-level / parent devices on bridge.devices (read-only).

ITEM_TYPE_ID: ResourceTypes | None = 'metadevice.device'
ITEM_TYPES: list[ResourceTypes] | None = []
ITEM_CLS

alias of Device

ITEM_SENSORS: dict[str, str] = {'battery-level': '%', 'wifi-rssi': 'dB'}
ITEM_BINARY_SENSORS: dict[str, str] = {'error': 'alerting'}
__init__(*args, **kwargs)[source]

Initialize instance.

async initialize_elem(afero_device: AferoDevice) Device[source]

Initialize the element.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

Newly initialized resource

Return type:

Device

async initialize() None[source]

Initialize controller by fetching all items for this resource type from bridge.

Return type:

None

get_filtered_devices(devices: list[AferoDevice]) list[AferoDevice][source]

Find parent devices.

Parameters:

devices (list[AferoDevice])

Return type:

list[AferoDevice]

async update_elem(afero_device: AferoDevice) set[source]

Update the Device with the latest API data.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

States that have been modified

Return type:

set

class aioafero.v1.FanController(bridge: AferoBridgeV1)[source]

Bases: BaseResourcesController[Fan]

Fan devices on bridge.fans.

Parameters:

bridge (AferoBridgeV1)

ITEM_TYPE_ID: ResourceTypes | None = 'metadevice.device'
ITEM_TYPES: list[ResourceTypes] | None = [ResourceTypes.FAN]
ITEM_CLS

alias of Fan

ITEM_MAPPING: dict = {'direction': 'fan-reverse', 'on': 'power', 'speed': 'fan-speed'}
async turn_on(device_id: str) None[source]

Turn on the fan.

Parameters:

device_id (str) – Device ID from this controller.

Return type:

None

async turn_off(device_id: str) None[source]

Turn off the fan.

Parameters:

device_id (str) – Device ID from this controller.

Return type:

None

async set_speed(device_id: str, speed: int) None[source]

Set fan speed as a percentage.

Parameters:
  • device_id (str) – Device ID from this controller.

  • speed (int) – Speed percentage (0 turns the fan off).

Return type:

None

async set_direction(device_id: str, forward: bool) None[source]

Set fan rotation direction.

Parameters:
  • device_id (str) – Device ID from this controller.

  • forward (bool) – True for forward, False for reverse. Ignored if the fan is off (Hubspace API quirk).

Return type:

None

async set_preset(device_id: str, preset: bool) None[source]

Enable or disable the comfort-breeze preset.

Parameters:
  • device_id (str) – Device ID from this controller.

  • preset (bool) – True to enable the preset, False to disable.

Return type:

None

async initialize_elem(afero_device: AferoDevice) Fan[source]

Initialize the element.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

Newly initialized resource

Return type:

Fan

async update_elem(afero_device: AferoDevice) set[source]

Update the Fan with the latest API data.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

States that have been modified

Return type:

set

async set_state(device_id: str, on: bool | None = None, speed: int | None = None, forward: bool | None = None, preset: bool | None = None) None[source]

Update fan state in the cloud.

Parameters:
  • device_id (str) – Device ID from this controller.

  • on (bool | None) – Power state.

  • speed (int | None) – Fan speed percentage (0 turns off).

  • forward (bool | None) – True for forward rotation, False for reverse.

  • preset (bool | None) – Comfort-breeze preset enabled state.

Return type:

None

class aioafero.v1.LightController(bridge: AferoBridgeV1)[source]

Bases: BaseResourcesController[Light]

Light devices on bridge.lights (including split zones).

Parameters:

bridge (AferoBridgeV1)

ITEM_TYPE_ID: ResourceTypes | None = 'metadevice.device'
ITEM_TYPES: list[ResourceTypes] | None = [ResourceTypes.LIGHT]
ITEM_CLS

alias of Light

ITEM_MAPPING: dict = {'color': 'color-rgb', 'color_mode': 'color-mode', 'color_temperature': 'color-temperature', 'dimming': 'brightness', 'effect': 'color-sequence'}
ITEM_NUMBERS: dict[tuple[str, str | None], NumbersName] = {('speed', 'color-sequence'): ('speed', None)}
DEVICE_SPLIT_CALLBACKS: dict[str, callable] = {'light': <function light_callback>}
async turn_on(device_id: str) None[source]

Turn on the light.

Parameters:

device_id (str) – Device ID from this controller.

Return type:

None

async turn_off(device_id: str) None[source]

Turn off the light.

Parameters:

device_id (str) – Device ID from this controller.

Return type:

None

async set_color_temperature(device_id: str, temperature: int) None[source]

Set color temperature or white mode when CCT is unavailable.

Parameters:
  • device_id (str) – Device ID from this controller.

  • temperature (int) – Color temperature in kelvin.

Return type:

None

async set_white(device_id: str, *, on: bool | None = True, brightness: int | None = None) None[source]

Set white mode without a color-temperature function.

Parameters:
  • device_id (str) – Device ID from this controller.

  • on (bool | None) – Power state (defaults to True).

  • brightness (int | None) – Brightness percentage when on is True.

Return type:

None

async set_brightness(device_id: str, brightness: int) None[source]

Set brightness, turning the light on if needed.

Parameters:
  • device_id (str) – Device ID from this controller.

  • brightness (int) – Brightness percentage.

Return type:

None

async set_rgb(device_id: str, red: int, green: int, blue: int) None[source]

Set RGB color, turning the light on if needed.

Parameters:
  • device_id (str) – Device ID from this controller.

  • red (int) – Red channel 0255.

  • green (int) – Green channel 0255.

  • blue (int) – Blue channel 0255.

Return type:

None

async set_effect(device_id: str, effect: str) None[source]

Set a color sequence effect, turning the light on if needed.

Parameters:
  • device_id (str) – Device ID from this controller.

  • effect (str) – Effect name from the model’s effect.effects list.

Return type:

None

async initialize_elem(afero_device: AferoDevice) Light[source]

Initialize the element.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

Newly initialized resource

Return type:

Light

async update_elem(afero_device: AferoDevice) set[source]

Update the Light with the latest API data.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

States that have been modified

Return type:

set

async update_elem_color(cur_item: Light, color_seq_states: dict) set[source]

Perform the update for effects.

Parameters:
Return type:

set

async set_state(device_id: str, on: bool | None = None, temperature: int | None = None, brightness: int | None = None, color_mode: str | None = None, color: tuple[int, int, int] | None = None, effect: str | None = None, force_white_mode: int | None = None, numbers: dict[tuple[str, str], float] | None = None) None[source]

Update light state in the cloud.

Parameters:
  • device_id (str) – Device ID from this controller.

  • on (bool | None) – Power state.

  • temperature (int | None) – Color temperature in kelvin.

  • brightness (int | None) – Brightness percentage.

  • color_mode (str | None) – API color mode (white, color, sequence, etc.).

  • color (tuple[int, int, int] | None) – RGB tuple (red, green, blue).

  • effect (str | None) – Named color sequence effect.

  • force_white_mode (int | None) – Brightness to apply after forcing white mode.

  • numbers (dict[tuple[str, str], float] | None) – Number features keyed by (functionClass, functionInstance).

Return type:

None

class aioafero.v1.LockController(bridge: AferoBridgeV1)[source]

Bases: BaseResourcesController[Lock]

Lock devices on bridge.locks.

Parameters:

bridge (AferoBridgeV1)

ITEM_TYPE_ID: ResourceTypes | None = 'metadevice.device'
ITEM_TYPES: list[ResourceTypes] | None = [ResourceTypes.LOCK]
ITEM_CLS

alias of Lock

ITEM_MAPPING: dict = {'position': 'lock-control'}
async lock(device_id: str) None[source]

Engage the lock.

Parameters:

device_id (str) – Device ID from this controller.

Return type:

None

async unlock(device_id: str) None[source]

Disengage the lock.

Parameters:

device_id (str) – Device ID from this controller.

Return type:

None

async initialize_elem(afero_device: AferoDevice) Lock[source]

Initialize the element.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

Newly initialized resource

Return type:

Lock

async update_elem(afero_device: AferoDevice) set[source]

Update the Lock with the latest API data.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

States that have been modified

Return type:

set

async set_state(device_id: str, lock_position: CurrentPositionEnum | None = None) None[source]

Update lock state in the cloud.

Parameters:
  • device_id (str) – Device ID from this controller.

  • lock_position (CurrentPositionEnum | None) – Target lock position (LOCKING / UNLOCKING).

Return type:

None

exception aioafero.v1.OTPRequired[source]

Bases: AferoError

One-time password is required for login.

class aioafero.v1.PortableACController(bridge: AferoBridgeV1)[source]

Bases: ClimateController[PortableAC]

Portable air conditioners on bridge.portable_acs.

The power toggle is split onto bridge.switches.

Parameters:

bridge (AferoBridgeV1)

ITEM_TYPE_ID: ResourceTypes | None = 'metadevice.device'
ITEM_TYPES: list[ResourceTypes] | None = [ResourceTypes.PORTABLE_AC]
ITEM_CLS

alias of PortableAC

ITEM_MAPPING: dict = {'hvac_mode': 'mode'}
ITEM_SELECTS: dict[tuple[str, str | None], str] = {('air-swing', None): 'Swing', ('fan-speed', 'ac-fan-speed'): 'Fan Speed', ('sleep', None): 'Sleep Mode'}
DEVICE_SPLIT_CALLBACKS: dict[str, callable] = {'portable-air-conditioner': <function portable_ac_callback>}
async initialize_elem(afero_device: AferoDevice) PortableAC[source]

Initialize the element.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

Newly initialized resource

Return type:

PortableAC

async update_elem(afero_device: AferoDevice) set[source]

Update the Portable AC with the latest API data.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

States that have been modified

Return type:

set

async set_state(device_id: str, **kwargs) None[source]

Update portable AC climate state in the cloud.

Parameters:
  • device_id (str) – Device ID from this controller.

  • hvac_mode – HVAC mode name from hvac_mode.supported_modes.

  • target_temperature – Cooling setpoint shorthand.

  • target_temperature_cooling – Cooling setpoint.

  • target_temperature_heating – Heating setpoint (when supported).

  • selects – Select features keyed by (functionClass, functionInstance).

  • **kwargs – Remaining climate fields forwarded to set_climate_state.

Return type:

None

class aioafero.v1.SecuritySystemController(bridge: AferoBridgeV1)[source]

Bases: BaseResourcesController[SecuritySystem]

Security systems on bridge.security_systems.

Parameters:

bridge (AferoBridgeV1)

ITEM_TYPE_ID: ResourceTypes | None = 'metadevice.device'
ITEM_TYPES: list[ResourceTypes] | None = [ResourceTypes.SECURITY_SYSTEM]
ITEM_CLS

alias of SecuritySystem

ITEM_MAPPING: dict = {'alarm_state': 'alarm-state'}
ITEM_SENSORS: dict[str, str] = {'alarm-state': None, 'disarmed-by': None, 'history-event': None}
ITEM_BINARY_SENSORS: dict[str, str] = {'battery-powered': 'battery-powered'}
ITEM_NUMBERS: dict[tuple[str, str | None], NumbersName] = {('arm-exit-delay', 'away'): ('seconds', 'Arm Exit Delay Away'), ('arm-exit-delay', 'stay'): ('seconds', 'Arm Exit Delay Home'), ('disarm-entry-delay', None): ('seconds', 'Disarm Entry Delay'), ('siren-alarm-timeout', None): ('seconds', 'Siren Timeout'), ('temporary-bypass-time', None): ('seconds', 'Bypass Time')}
ITEM_SELECTS: dict[tuple[str, str | None], str] = {('bypass-allowed', None): 'Enable Temporary Bypass', ('song-id', 'alarm'): 'Alarm Noise', ('song-id', 'chime'): 'Chime Noise', ('volume', 'chime'): 'Chime Volume', ('volume', 'entry-delay'): 'Entry Delay Volume', ('volume', 'exit-delay-away'): 'Exit Delay Volume Away', ('volume', 'exit-delay-stay'): 'Exit Delay Volume Home', ('volume', 'siren'): 'Alarm Volume'}
DEVICE_SPLIT_CALLBACKS: dict[str, callable] = {'security-system-sensor': <function security_system_callback>}
async disarm(device_id: str, disarm_pin: int) None[source]

Disarm the security system.

Parameters:
  • device_id (str) – Device ID from this controller.

  • disarm_pin (int) – Numeric PIN configured on the panel.

Return type:

None

async arm_home(device_id: str) None[source]

Arm the system in home mode.

Parameters:

device_id (str) – Device ID from this controller.

Return type:

None

async arm_away(device_id: str) None[source]

Arm the system in away mode.

Parameters:

device_id (str) – Device ID from this controller.

Return type:

None

async alarm_trigger(device_id: str) None[source]

Manually trigger the alarm siren.

Parameters:

device_id (str) – Device ID from this controller.

Return type:

None

async initialize_elem(afero_device: AferoDevice) SecuritySystem[source]

Initialize the element.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

Newly initialized resource

Return type:

SecuritySystem

async update_elem(afero_device: AferoDevice) set[source]

Update the Security System with the latest API data.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

States that have been modified

Return type:

set

async set_state(device_id: str, disarm_pin: int | None = None, command: int | None = None, numbers: dict[tuple[str, str | None], float] | None = None, selects: dict[tuple[str, str | None], str] | None = None) None[source]

Update security system state in the cloud.

Parameters:
  • device_id (str) – Device ID from this controller.

  • disarm_pin (int | None) – PIN for disarm commands.

  • command (int | None) – Panel command code (2 away, 4 home, 5 alarm trigger).

  • numbers (dict[tuple[str, str | None], float] | None) – Number features keyed by (functionClass, functionInstance).

  • selects (dict[tuple[str, str | None], str] | None) – Select features keyed by (functionClass, functionInstance).

Return type:

None

async refresh_alarm_state(device_id: str) None[source]

Refresh the alarm state after alarm state change command.

Parameters:

device_id (str)

Return type:

None

async validate_disarm_pin(device_id: str) None[source]

Ensure the system has switched to disarmed.

Parameters:

device_id (str)

Return type:

None

async validate_arm_state(device_id: str, arm_type: int) bool[source]

Ensure the system can arm.

Parameters:
  • device_id (str)

  • arm_type (int)

Return type:

bool

class aioafero.v1.SecuritySystemKeypadController(bridge: AferoBridgeV1)[source]

Bases: BaseResourcesController[SecuritySystemKeypad]

Security keypads on bridge.security_systems_keypads.

Parameters:

bridge (AferoBridgeV1)

ITEM_TYPE_ID: ResourceTypes | None = 'metadevice.device'
ITEM_TYPES: list[ResourceTypes] | None = [ResourceTypes.SECURITY_SYSTEM_KEYPAD]
ITEM_CLS

alias of SecuritySystemKeypad

ITEM_BINARY_SENSORS: dict[str, str] = {'tamper-detection': 'tampered'}
ITEM_SELECTS: dict[tuple[str, str | None], str] = {('volume', 'buzzer-volume'): 'Buzzer Volume'}
async initialize_elem(afero_device: AferoDevice) SecuritySystemKeypad[source]

Initialize the element.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

Newly initialized resource

Return type:

SecuritySystemKeypad

async update_elem(afero_device: AferoDevice) set[source]

Update the Security System with the latest API data.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

States that have been modified

Return type:

set

async set_state(device_id: str, selects: dict[tuple[str, str | None], str] | None = None) None[source]

Update security keypad selects in the cloud.

Parameters:
  • device_id (str) – Device ID from this controller.

  • selects (dict[tuple[str, str | None], str] | None) – Select features keyed by (functionClass, functionInstance).

Return type:

None

class aioafero.v1.SecuritySystemSensorController(bridge: AferoBridgeV1)[source]

Bases: BaseResourcesController[SecuritySystemSensor]

Security sensors split from a system on bridge.security_systems_sensors.

Parameters:

bridge (AferoBridgeV1)

ITEM_TYPE_ID: ResourceTypes | None = 'metadevice.device'
ITEM_TYPES: list[ResourceTypes] | None = [ResourceTypes.SECURITY_SYSTEM_SENSOR]
ITEM_CLS

alias of SecuritySystemSensor

ITEM_MAPPING: dict = {}
SENSOR_TYPES = {1: 'Motion Sensor', 2: 'Door/Window Sensor'}
ITEM_BINARY_SENSORS: dict[str, str] = {'tampered': 'On', 'triggered': 'On'}
ITEM_SELECTS: dict[tuple[str, str | None], str] = {('bypassType', None): 'Bypass', ('chirpMode', None): 'Chime', ('triggerType', None): 'Alarming State'}
async initialize_elem(device: AferoDevice)[source]

Initialize the element.

Parameters:
  • afero_device – Afero Device that contains the updated states

  • device (AferoDevice)

Returns:

Newly initialized resource

async update_elem(afero_device: AferoDevice) set[str][source]

Update the Security System Sensor with the latest API data.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

States that have been modified

Return type:

set[str]

async set_state(device_id: str, selects: dict[tuple[str, int | None], str] | None = None) None[source]

Update security sensor selects in the cloud.

Parameters:
  • device_id (str) – Device ID from this controller.

  • selects (dict[tuple[str, int | None], str] | None) – Select values keyed by (functionClass, functionInstance). Supported keys include chirpMode, triggerType, and bypassType.

Return type:

None

class aioafero.v1.SwitchController(bridge: AferoBridgeV1)[source]

Bases: BaseResourcesController[Switch]

Switch devices on bridge.switches.

A switch can have one or more toggleable elements controlled by instance.

Parameters:

bridge (AferoBridgeV1)

ITEM_TYPE_ID: ResourceTypes | None = 'metadevice.device'
ITEM_TYPES: list[ResourceTypes] | None = [ResourceTypes.SWITCH, ResourceTypes.POWER_OUTLET, ResourceTypes.LANDSCAPE_TRANSFORMER]
ITEM_CLS

alias of Switch

ITEM_MAPPING: dict = {}
ITEM_SENSORS: dict[str, str] = {'output-voltage-switch': 'V', 'watts': 'W'}
ITEM_BINARY_SENSORS: dict[str, str] = {}
async turn_on(device_id: str, instance: str | None = None) None[source]

Turn on the switch.

Parameters:
  • device_id (str) – Device ID from this controller.

  • instance (str | None) – functionInstance when the device has multiple toggles.

Return type:

None

async turn_off(device_id: str, instance: str | None = None) None[source]

Turn off the switch.

Parameters:
  • device_id (str) – Device ID from this controller.

  • instance (str | None) – functionInstance when the device has multiple toggles.

Return type:

None

async initialize_elem(afero_device: AferoDevice) Switch[source]

Initialize the element.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

Newly initialized resource

Return type:

Switch

async update_elem(afero_device: AferoDevice) set[source]

Update the Switch with the latest API data.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

States that have been modified

Return type:

set

async set_state(device_id: str, on: bool | None = None, instance: str | None = None) None[source]

Update switch state in the cloud.

Parameters:
  • device_id (str) – Device ID from this controller.

  • on (bool | None) – Power state for the selected instance.

  • instance (str | None) – functionInstance when the device has multiple toggles.

Return type:

None

class aioafero.v1.ThermostatController(bridge: AferoBridgeV1)[source]

Bases: ClimateController[Thermostat]

Thermostat devices on bridge.thermostats.

Parameters:

bridge (AferoBridgeV1)

ITEM_TYPE_ID: ResourceTypes | None = 'metadevice.device'
ITEM_TYPES: list[ResourceTypes] | None = [ResourceTypes.THERMOSTAT]
ITEM_CLS

alias of Thermostat

ITEM_MAPPING: dict = {'fan_mode': 'fan-mode', 'hvac_mode': 'mode'}
ITEM_BINARY_SENSORS: dict[str, str] = {'filter-replacement': 'replacement-needed', 'max-temp-exceeded': 'alerting', 'min-temp-exceeded': 'alerting'}
async initialize_elem(afero_device: AferoDevice) Thermostat[source]

Initialize the element.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

Newly initialized resource

Return type:

Thermostat

async update_elem(afero_device: AferoDevice) set[source]

Update the Thermostat with the latest API data.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

States that have been modified

Return type:

set

async set_fan_mode(device_id: str, fan_mode: str) None[source]

Set thermostat fan mode.

Parameters:
  • device_id (str) – Device ID from this controller.

  • fan_mode (str) – Fan mode name from the device model’s fan_mode.modes.

Return type:

None

async set_hvac_mode(device_id: str, hvac_mode: str) None[source]

Set HVAC mode.

Parameters:
  • device_id (str) – Device ID from this controller.

  • hvac_mode (str) – Mode name from hvac_mode.supported_modes on the model.

Return type:

None

async set_target_temperature(device_id: str, target_temperature: float) None[source]

Set target temperature for the active heat/cool mode.

Parameters:
  • device_id (str) – Device ID from this controller.

  • target_temperature (float) – Target temperature in the bridge’s configured unit.

Return type:

None

async set_temperature_range(device_id: str, temp_low: float, temp_high: float) None[source]

Set auto-mode heating/cooling setpoints.

Parameters:
  • device_id (str) – Device ID from this controller.

  • temp_low (float) – Auto-mode heating setpoint.

  • temp_high (float) – Auto-mode cooling setpoint.

Return type:

None

async set_state(device_id: str, fan_mode: str | None = None, hvac_mode: str | None = None, safety_max_temp: float | None = None, safety_min_temp: float | None = None, target_temperature_auto_heating: float | None = None, target_temperature_auto_cooling: float | None = None, target_temperature_heating: float | None = None, target_temperature_cooling: float | None = None, **kwargs) None[source]

Update thermostat state in the cloud.

Parameters:
  • device_id (str) – Device ID from this controller.

  • fan_mode (str | None) – Fan mode name.

  • hvac_mode (str | None) – HVAC mode name.

  • safety_max_temp (float | None) – Maximum safety cutoff temperature.

  • safety_min_temp (float | None) – Minimum safety cutoff temperature.

  • target_temperature_auto_heating (float | None) – Auto-mode heating setpoint.

  • target_temperature_auto_cooling (float | None) – Auto-mode cooling setpoint.

  • target_temperature_heating (float | None) – Heating setpoint.

  • target_temperature_cooling (float | None) – Cooling setpoint.

  • target_temperature – Shorthand applied to the active heat/cool setpoint.

  • **kwargs – Remaining climate fields forwarded to set_climate_state.

Return type:

None

class aioafero.v1.TokenData(token: str | None, access_token: str | None, refresh_token: str, expiration: float)[source]

Bases: NamedTuple

Data related to the current token.

Parameters:
  • token (str | None)

  • access_token (str | None)

  • refresh_token (str)

  • expiration (float)

token: str | None

Alias for field number 0

access_token: str | None

Alias for field number 1

refresh_token: str

Alias for field number 2

expiration: float

Alias for field number 3

class aioafero.v1.ValveController(bridge: AferoBridgeV1)[source]

Bases: BaseResourcesController[Valve]

Valve / water-timer devices on bridge.valves.

Valves can have multiple toggleable elements controlled by instance.

Parameters:

bridge (AferoBridgeV1)

ITEM_TYPE_ID: ResourceTypes | None = 'metadevice.device'
ITEM_TYPES: list[ResourceTypes] | None = [ResourceTypes.WATER_TIMER]
ITEM_CLS

alias of Valve

ITEM_MAPPING: dict = {}
async turn_on(device_id: str, instance: str | None = None) None[source]

Open the valve.

Parameters:
  • device_id (str) – Device ID from this controller.

  • instance (str | None) – functionInstance for multi-zone valves.

Return type:

None

async turn_off(device_id: str, instance: str | None = None) None[source]

Close the valve.

Parameters:
  • device_id (str) – Device ID from this controller.

  • instance (str | None) – functionInstance for multi-zone valves.

Return type:

None

async initialize_elem(afero_device: AferoDevice) Valve[source]

Initialize the element.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

Newly initialized resource

Return type:

Valve

async update_elem(afero_device: AferoDevice) set[source]

Update the Valve with the latest API data.

Parameters:

afero_device (AferoDevice) – Afero Device that contains the updated states

Returns:

States that have been modified

Return type:

set

async set_state(device_id: str, valve_open: bool | None = None, instance: str | None = None) None[source]

Update valve state in the cloud.

Parameters:
  • device_id (str) – Device ID from this controller.

  • valve_open (bool | None) – True to open, False to close.

  • instance (str | None) – functionInstance for multi-zone valves.

Return type:

None