aioafero.v1.controllers package¶
Submodules¶
aioafero.v1.controllers.base module¶
Base class for Controllers.
- class aioafero.v1.controllers.base.NumbersName(unit: str, display_name: str | None = None)[source]¶
Bases:
NamedTupleData used for displaying a Number.
- class aioafero.v1.controllers.base.BaseResourcesController(bridge: AferoBridgeV1)[source]¶
Bases:
GenericBase controller for device types registered on
AferoBridgeV1.Subclasses expose typed models and action methods. Use
get_deviceto read state andsubscribefor update callbacks.- Parameters:
bridge (AferoBridgeV1)
- ITEM_TYPE_ID: ResourceTypes | None = None¶
- ITEM_TYPES: list[ResourceTypes] | None = None¶
- ITEM_CLS = None¶
- __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
- 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.
- get_filtered_devices(initial_data: list[dict]) list[AferoDevice][source]¶
Determine devices that align to the controller.
- Parameters:
- Return type:
- 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:
func_def (dict)
state (AferoState)
- 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:
state (AferoState)
- 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:
- 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:
- Returns:
function to unsubscribe.
- Return type:
- async update_afero_api(device_id: str, states: list[dict]) ClientResponse | bool[source]¶
Update Afero IoT API with the new states.
- 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.
- generate_update_dev(device_id: str, states: list[AferoState]) AferoDevice[source]¶
Generate update data for the event controller.
- Parameters:
device_id (str)
states (list[AferoState])
- Return type:
- 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_idis not tracked by this controller.- Return type:
AferoResource
- aioafero.v1.controllers.base.dataclass_to_afero(elem: AferoResource, cls: dataclass, mapping: dict, send_duplicate_states: bool) list[dict][source]¶
Convert the current state to be consumed by Afero IoT.
- aioafero.v1.controllers.base.get_afero_states_from_mapped(element: AferoResource, field_name: str, update_vals: dict, send_duplicate_states: bool) list[dict][source]¶
Convert an update element to dict to be consumed by Afero API.
- aioafero.v1.controllers.base.get_afero_instance_for_state(elem: AferoResource, feature, mapped_afero_key: str | None) str | None[source]¶
Determine the function instance based on the field data or device.
aioafero.v1.controllers.climate module¶
Base controller for climate devices.
- aioafero.v1.controllers.climate.generate_target_temp(func_def: dict, state: AferoState) TargetTemperatureFeature[source]¶
Determine the target temp based on the function definition.
- Parameters:
func_def (dict)
state (AferoState)
- Return type:
- aioafero.v1.controllers.climate.generate_target_temp_capability(capability: AferoCapability, state: AferoState) TargetTemperatureFeature[source]¶
Determine the target temp based on the function definition.
- Parameters:
capability (AferoCapability)
state (AferoState)
- Return type:
- class aioafero.v1.controllers.climate.ClimateController(bridge: AferoBridgeV1)[source]¶
Bases:
BaseResourcesController[AferoResourceT]Base controller for climate devices.
- Parameters:
bridge (AferoBridgeV1)
- async initialize_climate_elem(afero_device: AferoDevice) dict[source]¶
Initialize the climate elements of a device.
- Parameters:
afero_device (AferoDevice)
- Return type:
- async update_climate_elem(afero_device: AferoDevice) set[source]¶
Update the climate elements of a device.
- Parameters:
afero_device (AferoDevice)
- Return type:
aioafero.v1.controllers.device module¶
Controller that holds top-level devices.
- class aioafero.v1.controllers.device.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 = []¶
- 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:
- 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:
- 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:
aioafero.v1.controllers.event module¶
Handle connecting to Afero IoT and distribute events.
- exception aioafero.v1.controllers.event.BackoffException[source]¶
Bases:
ExceptionException raised when a backoff is required.
- class aioafero.v1.controllers.event.CallbackResponse(split_devices: list[AferoDevice] = [], remove_original: bool = False)[source]¶
Bases:
NamedTupleCallback response for DEVICE_SPLIT_CALLBACKS.
- Parameters:
split_devices (list[AferoDevice]) – New devices that should be added to the overall list
remove_original (bool) – Remove the original device from the list of devices
- split_devices: list[AferoDevice]¶
Alias for field number 0
- class aioafero.v1.controllers.event.EventStreamStatus(*values)[source]¶
Bases:
EnumStatus options of EventStream.
- CONNECTING = 0¶
- CONNECTED = 1¶
- DISCONNECTED = 2¶
- class aioafero.v1.controllers.event.AferoEvent[source]¶
Bases:
TypedDictAfero IoT Event message as emitted by the EventStream.
- device_id: NotRequired[str]¶
- device: NotRequired[AferoDevice]¶
- polled_data: NotRequired[Any]¶
- polled_devices: NotRequired[Any]¶
- force_forward: NotRequired[bool]¶
- class aioafero.v1.controllers.event.EventStream(bridge: AferoBridgeV1, polling_interval: int, poll_version: bool, discovery_interval: int = 3600)[source]¶
Bases:
objectData gatherer and eventer.
Polls Afero IoT API, converts the response into devices, and notifies subscribers of the event.
- Parameters:
bridge (AferoBridgeV1)
polling_interval (int)
poll_version (bool)
discovery_interval (int)
- __init__(bridge: AferoBridgeV1, polling_interval: int, poll_version: bool, discovery_interval: int = 3600) None[source]¶
Initialize instance.
- Parameters:
bridge (AferoBridgeV1)
polling_interval (int)
poll_version (bool)
discovery_interval (int)
- Return type:
None
- property status: EventStreamStatus¶
Return connection status.
- property registered_multiple_devices: dict[str, Callable]¶
Get all registered callbacks for splitting devices.
- async wait_for_first_poll() None[source]¶
Wait until the first poll has completed.
- Return type:
None
- async initialize_discovery() None[source]¶
Initialize gathering data from Afero API.
- Return type:
None
- async initialize_device_polling() None[source]¶
Initialize gathering device state data from Afero API.
- Return type:
None
- register_multi_device(name: str, generate_devices: callable)[source]¶
Register a callable to find multi-devices within the payload.
The callable must return a list of tracked AferoDevices
- Parameters:
name (str)
generate_devices (callable)
- subscribe(callback: Callable[[EventType, dict | None], None], event_filter: EventType | tuple[EventType] | None = None, resource_filter: tuple[str] | None = None) Callable[source]¶
Subscribe to events emitted.
- Parameters:
- Returns:
function to unsubscribe.
- Return type:
- add_job(event: AferoEvent) None[source]¶
Manually add a job to be processed.
- Parameters:
event (AferoEvent)
- Return type:
None
- emit(event_type: EventType, data: AferoEvent = None) None[source]¶
Emit event to all listeners.
- Parameters:
event_type (EventType)
data (AferoEvent)
- Return type:
None
- async process_backoff(attempt: int) None[source]¶
Handle backoff timer for Afero IoT API.
- Parameters:
attempt (int) – Number of attempts
reason – Reason why the backoff is occurring
- Return type:
None
- async generate_devices_from_data(data: list[dict[Any, str]]) list[AferoDevice][source]¶
Generate all devices from a given payload.
Generating devices will attempt to split devices where required and remove devices that are no longer needed, as identified by the callback.
- async split_devices(devices: list[AferoDevice]) list[AferoDevice][source]¶
Split Afero devices into multiple devices where required.
- Parameters:
devices (list[AferoDevice])
- Return type:
- async generate_events_from_update(dev: AferoDevice) None[source]¶
Generate updates for a single device update.
- Parameters:
dev (AferoDevice)
- Return type:
None
- async generate_events_from_data(data: list[dict[Any, str]]) None[source]¶
Process the raw Afero IoT data for emitting.
aioafero.v1.controllers.exhaust_fan module¶
Controller holding and managing Afero IoT resources of type exhaust-fan.
- aioafero.v1.controllers.exhaust_fan.generate_split_name(afero_device: AferoDevice, instance: str) str[source]¶
Generate the name for an instanced element.
- Parameters:
afero_device (AferoDevice)
instance (str)
- Return type:
- aioafero.v1.controllers.exhaust_fan.get_split_instances(afero_dev: AferoDevice) list[str][source]¶
Determine available instances from the states.
- Parameters:
afero_dev (AferoDevice)
- Return type:
- aioafero.v1.controllers.exhaust_fan.get_valid_states(afero_dev: AferoDevice, instance: str) list[source]¶
Find states associated with the specific instance.
- Parameters:
afero_dev (AferoDevice)
instance (str)
- Return type:
- aioafero.v1.controllers.exhaust_fan.exhaust_fan_callback(afero_device: AferoDevice) CallbackResponse[source]¶
Convert an AferoDevice into multiple devices.
- Parameters:
afero_device (AferoDevice)
- Return type:
- class aioafero.v1.controllers.exhaust_fan.ExhaustFanController(bridge: AferoBridgeV1)[source]¶
Bases:
BaseResourcesController[ExhaustFan]Exhaust fans on
bridge.exhaust_fans.Tracks sensors, numbers, and selects. Toggles, fan speed, and light on the same unit are on
bridge.switches,bridge.fans, andbridge.lights.- Parameters:
bridge (AferoBridgeV1)
- ITEM_TYPE_ID: ResourceTypes | None = 'metadevice.device'¶
- ITEM_TYPES: list[ResourceTypes] | None = [ResourceTypes.EXHAUST_FAN]¶
- ITEM_CLS¶
alias of
ExhaustFan
- ITEM_BINARY_SENSORS: dict[str, str] = {'humidity-threshold-met': 'above-threshold', 'motion-detection': 'motion-detected'}¶
- ITEM_NUMBERS: dict[tuple[str, str | None], NumbersName] = {('auto-off-timer', 'auto-off'): ('seconds', None)}¶
- ITEM_SELECTS: dict[tuple[str, str | None], str] = {('motion-action', 'exhaust-fan'): 'Motion Action', ('sensitivity', 'humidity-sensitivity'): 'Humidity Sensitivity'}¶
- async initialize_elem(afero_device: AferoDevice) ExhaustFan[source]¶
Initialize the element.
- Parameters:
afero_device (AferoDevice) – Afero Device that contains the updated states
- Returns:
Newly initialized resource
- Return type:
- async update_elem(afero_device: AferoDevice) set[source]¶
Update the Exhaust 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:
aioafero.v1.controllers.fan module¶
Controller holding and managing Afero IoT resources of type fan.
- class aioafero.v1.controllers.fan.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]¶
- 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_preset(device_id: str, preset: bool) None[source]¶
Enable or disable the comfort-breeze preset.
- 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:
- 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:
aioafero.v1.controllers.light module¶
Controller holding and managing Hubspace resources of type light.
- aioafero.v1.controllers.light.process_names(values: list[dict]) set[str][source]¶
Extract unique names from the elements.
- aioafero.v1.controllers.light.generate_split_name(afero_device: AferoDevice, instance: str) str[source]¶
Generate the name for an instanced element.
- Parameters:
afero_device (AferoDevice)
instance (str)
- Return type:
- aioafero.v1.controllers.light.is_dual_channel_rgb_fixture(afero_dev: AferoDevice) bool[source]¶
Return True for one fixture with separate RGB and warm-white LED drivers.
- Parameters:
afero_dev (AferoDevice)
- Return type:
- aioafero.v1.controllers.light.preferred_brightness_instance(afero_dev: AferoDevice) str | None[source]¶
Return the functionInstance used for overall brightness on dual-channel lights.
- Parameters:
afero_dev (AferoDevice)
- Return type:
str | None
- aioafero.v1.controllers.light.should_use_brightness_state(afero_dev: AferoDevice, state: AferoState) bool[source]¶
Return whether a brightness state should populate the single light model.
- Parameters:
afero_dev (AferoDevice)
state (AferoState)
- Return type:
- aioafero.v1.controllers.light.is_dual_channel_light(cur_item: Light) bool[source]¶
Return True when a light exposes separate color and white brightness controls.
- aioafero.v1.controllers.light.resolve_brightness_instance(cur_item: Light, *, color_mode: str | None = None, color: tuple[int, int, int] | None = None, temperature: int | None = None, effect: str | None = None) str | None[source]¶
Return the brightness functionInstance to PUT for dual-channel fixtures.
- aioafero.v1.controllers.light.get_split_instances(afero_dev: AferoDevice) list[tuple[str, ResourceTypes]][source]¶
Determine available instances from the states.
- Parameters:
afero_dev (AferoDevice)
- Return type:
- aioafero.v1.controllers.light.state_belongs_to_light_instance(afero_dev: AferoDevice, state: AferoState, instance: str) bool[source]¶
Return whether a state belongs to a light zone instance.
- Parameters:
afero_dev (AferoDevice)
state (AferoState)
instance (str)
- Return type:
- aioafero.v1.controllers.light.state_matches_instance(afero_device: AferoDevice, state: AferoState) bool[source]¶
Return whether a state belongs to a split light instance.
- Parameters:
afero_device (AferoDevice)
state (AferoState)
- Return type:
- aioafero.v1.controllers.light.resolve_function_instance(afero_device: AferoDevice) str | None[source]¶
Return the functionInstance key for this light resource (split zone or single).
- Parameters:
afero_device (AferoDevice)
- Return type:
str | None
- aioafero.v1.controllers.light.get_color_modes_for_device(afero_device: AferoDevice) list[str][source]¶
Return supported color-mode names for this zone’s color-mode function.
- Parameters:
afero_device (AferoDevice)
- Return type:
- aioafero.v1.controllers.light.get_valid_states(afero_dev: AferoDevice, instance: str) list[source]¶
Find states associated with the specific instance.
- Parameters:
afero_dev (AferoDevice)
instance (str)
- Return type:
- aioafero.v1.controllers.light.apply_brightness_state_update(afero_device: AferoDevice, cur_item: Light, state: AferoState, updated_keys: set[str]) None[source]¶
Apply inbound brightness state to a light model.
- Parameters:
afero_device (AferoDevice)
cur_item (Light)
state (AferoState)
- Return type:
None
- aioafero.v1.controllers.light.light_callback(afero_device: AferoDevice) CallbackResponse[source]¶
Convert an AferoDevice into multiple devices.
- Parameters:
afero_device (AferoDevice)
- Return type:
- class aioafero.v1.controllers.light.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_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)}¶
- 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.
- async set_white(device_id: str, *, on: bool | None = True, brightness: int | None = None) None[source]¶
Set white mode without a color-temperature function.
- async set_brightness(device_id: str, brightness: int) None[source]¶
Set brightness, turning the light on if needed.
- async set_rgb(device_id: str, red: int, green: int, blue: int) None[source]¶
Set RGB color, turning the light on if needed.
- async set_effect(device_id: str, effect: str) None[source]¶
Set a color sequence effect, turning the light on if needed.
- 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:
- 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:
- async update_elem_color(cur_item: Light, color_seq_states: dict) set[source]¶
Perform the update for effects.
- 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
aioafero.v1.controllers.lock module¶
Controller holding and managing Afero IoT resources of type lock.
- class aioafero.v1.controllers.lock.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]¶
- 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:
- 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:
- 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
aioafero.v1.controllers.portable_ac module¶
Controller holding and managing Afero IoT resources of type portable-air-conditioner.
- aioafero.v1.controllers.portable_ac.generate_split_name(afero_device: AferoDevice, instance: str) str[source]¶
Generate the name for an instanced element.
- Parameters:
afero_device (AferoDevice)
instance (str)
- Return type:
- aioafero.v1.controllers.portable_ac.get_valid_states(afero_dev: AferoDevice) list[source]¶
Find states associated with the element.
- Parameters:
afero_dev (AferoDevice)
- Return type:
- aioafero.v1.controllers.portable_ac.portable_ac_callback(afero_device: AferoDevice) CallbackResponse[source]¶
Convert an AferoDevice into multiple devices.
- Parameters:
afero_device (AferoDevice)
- Return type:
- class aioafero.v1.controllers.portable_ac.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_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:
- 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:
- 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
aioafero.v1.controllers.security_system module¶
Controller holding and managing Afero IoT resources of type security-system.
- aioafero.v1.controllers.security_system.get_sensor_ids(device) set[int][source]¶
Determine available sensors from the states.
- aioafero.v1.controllers.security_system.generate_sensor_name(afero_device, sensor_id: int) str[source]¶
Generate the name for an instanced element.
- aioafero.v1.controllers.security_system.get_valid_states(afero_states: list, sensor_id: int) list[source]¶
Find states associated with the specific sensor.
- aioafero.v1.controllers.security_system.get_model_type(states: list[AferoState], sensor_id: int) str[source]¶
Get the model type from the state list.
- Parameters:
states (list[AferoState])
sensor_id (int)
- Return type:
- aioafero.v1.controllers.security_system.get_valid_functions(afero_functions: list, sensor_id: int) list[source]¶
Find functions associated with the specific sensor.
- aioafero.v1.controllers.security_system.get_sensor_name(afero_capabilities: list[AferoCapability], sensor_id: int) str[source]¶
Get the Afero name for a specific sensor.
- Parameters:
afero_capabilities (list[AferoCapability])
sensor_id (int)
- Return type:
- aioafero.v1.controllers.security_system.security_system_callback(afero_device: AferoDevice) CallbackResponse[source]¶
Convert an AferoDevice into multiple devices.
- Parameters:
afero_device (AferoDevice)
- Return type:
- class aioafero.v1.controllers.security_system.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_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 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:
- 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:
- 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 (
2away,4home,5alarm 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
aioafero.v1.controllers.security_system_keypad module¶
Controller holding and managing Afero IoT resources of type security-system-keypad.
- class aioafero.v1.controllers.security_system_keypad.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
- 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:
- 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:
aioafero.v1.controllers.security_system_sensor module¶
Controller holding and managing Afero IoT resources of type security-system.
- class aioafero.v1.controllers.security_system_sensor.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
- SENSOR_TYPES = {1: 'Motion Sensor', 2: 'Door/Window Sensor'}¶
- 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:
aioafero.v1.controllers.switch module¶
Controller holding and managing Afero IoT resources of type switch.
- class aioafero.v1.controllers.switch.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]¶
- 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:
- 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:
aioafero.v1.controllers.thermostat module¶
Controller holding and managing Afero IoT resources of type thermostat.
- class aioafero.v1.controllers.thermostat.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_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:
- 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:
- async set_target_temperature(device_id: str, target_temperature: float) None[source]¶
Set target temperature for the active heat/cool mode.
- async set_temperature_range(device_id: str, temp_low: float, temp_high: float) None[source]¶
Set auto-mode heating/cooling setpoints.
- 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
aioafero.v1.controllers.valve module¶
Controller holding and managing Afero IoT resources of type valve.
- class aioafero.v1.controllers.valve.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]¶
- 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:
- 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:
Module contents¶
Sub-package that holds controllers for creating and updating devices from Afero API.