Module contents

aiosimon_io package for managing Simon iO smart home devices.

class aiosimon_io.AbstractAuth(websession, host)[source]

Bases: ABC

Abstract base class for making authenticated requests.

This class provides a framework for handling authentication and making HTTP requests with an access token.

Canonical:

aiosimon_io.auth.AbstractAuth

abstract async async_get_access_token()[source]

Retrieve a valid access token.

Returns:

A valid access token.

Return type:

str

async async_request(method, endpoint, **kwargs)[source]

Make an authenticated HTTP request.

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

  • endpoint (str) – The API endpoint to call.

  • **kwargs – Additional arguments to pass to the request.

Returns:

The JSON response from the API.

Return type:

dict

Raises:
  • aiohttp.ClientConnectionError – If a connection error occurs.

  • aiohttp.ClientResponseError – If the response contains an error.

  • aiohttp.ClientError – For other client-related errors.

  • Exception – For unexpected errors.

async async_request_hub(method, url, failover_endpoint, auth, **kwargs)[source]

Make a request to the hub, with failover support.

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

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

  • failover_endpoint (str) – The failover endpoint to use if the primary request fails.

  • auth – Authentication information for the request.

  • **kwargs – Additional arguments to pass to the request.

Returns:

The JSON response from the API.

Return type:

dict

Raises:

Exception – If both the primary and failover requests fail.

class aiosimon_io.Device(**data)[source]

Bases: BaseModel

Represents a device in the Simon iO system.

Canonical:

aiosimon_io.devices.Device

async async_refresh()[source]

Update the device asynchronously.

Returns:

The updated device instance, or None if not available.

Return type:

Optional[Device]

async async_set_level(level)[source]

Set the level of the device (e.g., dimmer level) asynchronously.

Parameters:

level (int) – The desired level of the device.

Raises:
  • ValueError – If the device type or subtype is not defined.

  • Exception – If an error occurs while setting the level.

Return type:

None

async async_set_state(state)[source]

Set the state of the device (on/off) asynchronously.

Parameters:

state (bool) – The desired state of the device.

Raises:
  • ValueError – If the device type or subtype is not defined.

  • Exception – If an error occurs while setting the state.

Return type:

None

deviceConfigs: Optional[dict]
deviceInfo: dict
favoriteExperience: Optional[int]
get_capabilities()[source]

Get the capabilities of the device.

Returns:

A list of capabilities supported by the device.

Return type:

List[str]

get_device_type()[source]

Get the device type based on its type and subtype.

Returns:

The device type, or None if not available.

Return type:

Optional[str]

get_firmware_version()[source]

Get the firmware version of the device.

Returns:

The firmware version, or None if not available.

Return type:

Optional[str]

get_level()[source]

Get the level of the device (e.g., dimmer level).

Returns:

The level of the device, or None if not available.

Return type:

Optional[int]

Raises:

ValueError – If the device type property is not found.

get_manufacturer()[source]

Get the manufacturer of the device.

Returns:

The manufacturer ID, or None if not available.

Return type:

Optional[str]

get_reference()[source]

Get the reference of the device.

Returns:

The reference, or None if not available.

Return type:

Optional[str]

get_serie()[source]

Get the series ID of the device.

Returns:

The series ID, or None if not available.

Return type:

Optional[str]

get_serie_name()[source]

Get the series name of the device.

Returns:

The series name, or None if not available.

Return type:

Optional[str]

get_state()[source]

Get the current state of the device (on/off).

Returns:

The state of the device, or None if not available.

Return type:

Optional[bool]

Raises:

ValueError – If the device type property is not found.

get_subtype()[source]

Get the subtype of the device.

Returns:

The subtype of the device, or None if not available.

Return type:

Optional[str]

get_type()[source]

Get the type of the device.

Returns:

The type of the device, or None if not available.

Return type:

Optional[str]

icon: Optional[str]
id: str
installation: Installation
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

multilevel: Optional[dict]
name: str
room: Optional[str]
roomId: Optional[str]
schedulers: Optional[List[dict]]
socket: Optional[dict]
switch: Optional[dict]
class aiosimon_io.Installation(**data)[source]

Bases: BaseModel

Represents an installation in the Simon iO system.

Canonical:

aiosimon_io.installations.Installation

apiVersion: Optional[str]
async async_get_device(id)[source]

Retrieve a specific device by its ID asynchronously.

Parameters:

id (str) – The ID of the device.

Returns:

The device object if found, otherwise None.

Return type:

Optional[aiosimon_io.devices.Device]

async async_get_devices()[source]

Retrieve all devices for the installation asynchronously.

Returns:

A dictionary of devices associated with the installation.

Return type:

Dict[str, aiosimon_io.devices.Device]

async classmethod async_get_installation(api_client, id, ttl=5)[source]

Retrieve a specific installation by its ID asynchronously.

Parameters:
  • api_client (aiosimon_io.auth.AbstractAuth) – The API client for authentication.

  • id (str) – The ID of the installation.

  • ttl (int) – The time-to-live for the cache in seconds.

Returns:

The installation object.

Return type:

Installation

async classmethod async_get_installations(api_client, ttl=5)[source]

Retrieve all installations for the current user asynchronously.

Parameters:
Returns:

A list of installations.

Return type:

List[Installation]

backups: Optional[List[dict]]
cleanMac: Optional[str]
countryCode: Optional[str]
currentNetwork: Optional[str]
elements: Elements
hardwareSubType: Optional[str]
hardwareToken: Optional[str]
hardwareType: Optional[str]
hardwareVersion: Optional[str]
icon: str
id: str
lanIp: Optional[str]
location: Optional[dict]
mac: Optional[str]
mdns: Optional[str]
mode: Literal[('managed', 'virtual')]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

mqttHost: Optional[str]
mqttPort: Optional[int]
mqttTls: Optional[bool]
name: str
notificationSettings: Optional[dict]
password: Optional[str]
port: Optional[int]
role: Optional[str]
savedDateTime: Optional[str]
softwareVersion: Optional[str]
status: Literal[('up', 'down')]
username: Optional[str]
wifiIp: Optional[str]
class aiosimon_io.SimonAuth(client_id, client_secret, username, password, session)[source]

Bases: AbstractAuth

Handle authentication with the Simon Cloud API.

This class manages access and refresh tokens for interacting with the Simon Cloud API.

Canonical:

aiosimon_io.auth.SimonAuth

async async_get_access_token()[source]

Retrieve the current access token, refreshing it if necessary.

Returns:

The current access token.

Return type:

str

Raises:

ValueError – If no access token is available.

async async_refresh_access_token()[source]

Refresh the access token using the refresh token.

Raises:
  • ValueError – If no refresh token is available.

  • aiohttp.ClientResponseError – If the token refresh request fails.

Return type:

None

class aiosimon_io.User(**data)[source]

Bases: BaseModel

Represents a user in the Simon iO system.

Canonical:

aiosimon_io.users.User

api_client: ClassVar[AbstractAuth]
async classmethod async_get_current_user(api_client)[source]

Retrieve the current authenticated user asynchronously.

Return type:

User

country: Optional[str]
email: str
endpoint: ClassVar[str] = 'api/v1/users'
gdprRegion: Optional[str]
id: str
isBlocked: bool
lastName: Optional[str]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: Optional[str]
aiosimon_io.setup_logging(level=10)[source]

Set up logging configuration.

Parameters:

level (Union[int, str]) – Logging level, can be an integer or string.

Canonical:

aiosimon_io.logging_config.setup_logging()

Return type:

None

aiosimon_io package

Submodules

aiosimon_io.auth module

Module for handling authentication and making authenticated requests.

This module provides an abstract base class and a concrete implementation for managing authentication with the Simon Cloud API.

class aiosimon_io.auth.AbstractAuth(websession, host)[source]

Bases: ABC

Abstract base class for making authenticated requests.

This class provides a framework for handling authentication and making HTTP requests with an access token.

Canonical:

aiosimon_io.auth.AbstractAuth

abstract async async_get_access_token()[source]

Retrieve a valid access token.

Returns:

A valid access token.

Return type:

str

async async_request(method, endpoint, **kwargs)[source]

Make an authenticated HTTP request.

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

  • endpoint (str) – The API endpoint to call.

  • **kwargs – Additional arguments to pass to the request.

Returns:

The JSON response from the API.

Return type:

dict

Raises:
  • aiohttp.ClientConnectionError – If a connection error occurs.

  • aiohttp.ClientResponseError – If the response contains an error.

  • aiohttp.ClientError – For other client-related errors.

  • Exception – For unexpected errors.

async async_request_hub(method, url, failover_endpoint, auth, **kwargs)[source]

Make a request to the hub, with failover support.

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

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

  • failover_endpoint (str) – The failover endpoint to use if the primary request fails.

  • auth – Authentication information for the request.

  • **kwargs – Additional arguments to pass to the request.

Returns:

The JSON response from the API.

Return type:

dict

Raises:

Exception – If both the primary and failover requests fail.

class aiosimon_io.auth.SimonAuth(client_id, client_secret, username, password, session)[source]

Bases: AbstractAuth

Handle authentication with the Simon Cloud API.

This class manages access and refresh tokens for interacting with the Simon Cloud API.

Canonical:

aiosimon_io.auth.SimonAuth

async async_get_access_token()[source]

Retrieve the current access token, refreshing it if necessary.

Returns:

The current access token.

Return type:

str

Raises:

ValueError – If no access token is available.

async async_refresh_access_token()[source]

Refresh the access token using the refresh token.

Raises:
  • ValueError – If no refresh token is available.

  • aiohttp.ClientResponseError – If the token refresh request fails.

Return type:

None

aiosimon_io.const module

Constants for the Simon iO system.

This module defines base URLs and API endpoints used throughout the Simon iO system.

aiosimon_io.const.AUTH_BASE_URL: str = 'https://auth.simon-cloud.com'

Base URL for the Simon Cloud authentication service.

aiosimon_io.const.HUB_DEVICES_ENDPOINT: str = 'api/v1/devices'

Hub endpoint to retrieve the list of connected devices.

aiosimon_io.const.HUB_ELEMENTS_ENDPOINT: str = 'api/v1/elements'

Hub endpoint to retrieve elements directly from the hub.

aiosimon_io.const.HUB_HARDWARE_TOKEN_ENDPOINT: str = 'api/v1/installation/hardware-token'

Endpoint to obtain the Hub hardware token for an installation.

aiosimon_io.const.INSTALLATIONS_ENDPOINT: str = 'api/v1/users/installations'

API endpoint to retrieve the list of installations linked to a user.

aiosimon_io.const.SNS_BASE_URL: str = 'https://sns.simon-cloud.com'

Base URL for the Simon Cloud S&S (Switch & Socket) API.

aiosimon_io.const.SNS_DEVICES_ENDPOINT: str = 'api/v1/installations/{installation_id}/devices'

S&S API endpoint to retrieve devices associated with a specific installation.

aiosimon_io.const.SNS_ELEMENTS_ENDPOINT: str = 'api/v1/installations/{installation_id}/elements'

S&S API endpoint to retrieve elements within a specific installation.

aiosimon_io.const.USER_ENDPOINT: str = 'api/v1/users'

API endpoint for accessing user data.

aiosimon_io.devices module

Module for managing devices in the Simon iO system.

This module provides the Device class, which represents a device in the Simon iO system, and includes methods for retrieving and updating device information, as well as controlling device states and levels.

class aiosimon_io.devices.Device(**data)[source]

Bases: BaseModel

Represents a device in the Simon iO system.

Canonical:

aiosimon_io.devices.Device

async async_refresh()[source]

Update the device asynchronously.

Returns:

The updated device instance, or None if not available.

Return type:

Optional[Device]

async async_set_level(level)[source]

Set the level of the device (e.g., dimmer level) asynchronously.

Parameters:

level (int) – The desired level of the device.

Raises:
  • ValueError – If the device type or subtype is not defined.

  • Exception – If an error occurs while setting the level.

Return type:

None

async async_set_state(state)[source]

Set the state of the device (on/off) asynchronously.

Parameters:

state (bool) – The desired state of the device.

Raises:
  • ValueError – If the device type or subtype is not defined.

  • Exception – If an error occurs while setting the state.

Return type:

None

deviceConfigs: Optional[dict]
deviceInfo: dict
favoriteExperience: Optional[int]
get_capabilities()[source]

Get the capabilities of the device.

Returns:

A list of capabilities supported by the device.

Return type:

List[str]

get_device_type()[source]

Get the device type based on its type and subtype.

Returns:

The device type, or None if not available.

Return type:

Optional[str]

get_firmware_version()[source]

Get the firmware version of the device.

Returns:

The firmware version, or None if not available.

Return type:

Optional[str]

get_level()[source]

Get the level of the device (e.g., dimmer level).

Returns:

The level of the device, or None if not available.

Return type:

Optional[int]

Raises:

ValueError – If the device type property is not found.

get_manufacturer()[source]

Get the manufacturer of the device.

Returns:

The manufacturer ID, or None if not available.

Return type:

Optional[str]

get_reference()[source]

Get the reference of the device.

Returns:

The reference, or None if not available.

Return type:

Optional[str]

get_serie()[source]

Get the series ID of the device.

Returns:

The series ID, or None if not available.

Return type:

Optional[str]

get_serie_name()[source]

Get the series name of the device.

Returns:

The series name, or None if not available.

Return type:

Optional[str]

get_state()[source]

Get the current state of the device (on/off).

Returns:

The state of the device, or None if not available.

Return type:

Optional[bool]

Raises:

ValueError – If the device type property is not found.

get_subtype()[source]

Get the subtype of the device.

Returns:

The subtype of the device, or None if not available.

Return type:

Optional[str]

get_type()[source]

Get the type of the device.

Returns:

The type of the device, or None if not available.

Return type:

Optional[str]

icon: Optional[str]
id: str
installation: Installation
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

multilevel: Optional[dict]
name: str
room: Optional[str]
roomId: Optional[str]
schedulers: Optional[List[dict]]
socket: Optional[dict]
switch: Optional[dict]

aiosimon_io.installations module

Module for managing installations in the Simon iO system.

This module provides classes and methods to interact with installations, retrieve their details, and manage associated devices.

class aiosimon_io.installations.Elements(**data)[source]

Bases: BaseModel

Represents the elements associated with an installation.

devices: Dict[str, 'Device']
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class aiosimon_io.installations.Installation(**data)[source]

Bases: BaseModel

Represents an installation in the Simon iO system.

Canonical:

aiosimon_io.installations.Installation

apiVersion: Optional[str]
async async_get_device(id)[source]

Retrieve a specific device by its ID asynchronously.

Parameters:

id (str) – The ID of the device.

Returns:

The device object if found, otherwise None.

Return type:

Optional[aiosimon_io.devices.Device]

async async_get_devices()[source]

Retrieve all devices for the installation asynchronously.

Returns:

A dictionary of devices associated with the installation.

Return type:

Dict[str, aiosimon_io.devices.Device]

async classmethod async_get_installation(api_client, id, ttl=5)[source]

Retrieve a specific installation by its ID asynchronously.

Parameters:
  • api_client (aiosimon_io.auth.AbstractAuth) – The API client for authentication.

  • id (str) – The ID of the installation.

  • ttl (int) – The time-to-live for the cache in seconds.

Returns:

The installation object.

Return type:

Installation

async classmethod async_get_installations(api_client, ttl=5)[source]

Retrieve all installations for the current user asynchronously.

Parameters:
Returns:

A list of installations.

Return type:

List[Installation]

backups: Optional[List[dict]]
cleanMac: Optional[str]
countryCode: Optional[str]
currentNetwork: Optional[str]
elements: Elements
hardwareSubType: Optional[str]
hardwareToken: Optional[str]
hardwareType: Optional[str]
hardwareVersion: Optional[str]
icon: str
id: str
lanIp: Optional[str]
location: Optional[dict]
mac: Optional[str]
mdns: Optional[str]
mode: Literal[('managed', 'virtual')]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

mqttHost: Optional[str]
mqttPort: Optional[int]
mqttTls: Optional[bool]
name: str
notificationSettings: Optional[dict]
password: Optional[str]
port: Optional[int]
role: Optional[str]
savedDateTime: Optional[str]
softwareVersion: Optional[str]
status: Literal[('up', 'down')]
username: Optional[str]
wifiIp: Optional[str]
class aiosimon_io.installations.Reachable(**data)[source]

Bases: BaseModel

Represents the reachability status of an installation.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

next_check: Optional[datetime]
type: Literal[('WAN', 'LAN')]

aiosimon_io.logging_config module

Logging configuration for the aiosimon_io package.

This module provides a function to set up logging with a specified level and format.

aiosimon_io.logging_config.setup_logging(level=10)[source]

Set up logging configuration.

Parameters:

level (Union[int, str]) – Logging level, can be an integer or string.

Canonical:

aiosimon_io.logging_config.setup_logging()

Return type:

None

aiosimon_io.users module

Module for managing users in the Simon iO system.

This module provides the User class, which represents a user in the Simon iO system, and includes methods for retrieving user information.

class aiosimon_io.users.User(**data)[source]

Bases: BaseModel

Represents a user in the Simon iO system.

Canonical:

aiosimon_io.users.User

api_client: ClassVar[AbstractAuth]
async classmethod async_get_current_user(api_client)[source]

Retrieve the current authenticated user asynchronously.

Return type:

User

country: Optional[str]
email: str
endpoint: ClassVar[str] = 'api/v1/users'
gdprRegion: Optional[str]
id: str
isBlocked: bool
lastName: Optional[str]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: Optional[str]