aiokem package¶
- class aiokem.AioKem(session: ClientSession, home_timezone: tzinfo = datetime.timezone.utc)[source]¶
Bases:
objectAioKem class for interacting with Kohler Energy Management System (KEM) API.
- async authenticate(email: str, password: str, refresh_token: str | None = None) None[source]¶
Login to the server.
- async authenticate_with_refresh_token(refresh_token: str) None[source]¶
Login to the server using a refresh token.
- async check_and_refresh_token() None[source]¶
Check if the token is expired and refresh it if necessary.
- async get_alerts(generator_id: int) list[dict[str, Any]][source]¶
Get list of alerts for a generator.
- async get_events(generator_id: int) list[dict[str, Any]][source]¶
Get list of events for a generator.
- async get_generator_data(generator_id: int) dict[str, Any][source]¶
Get generator data for a specific generator.
- async get_maintenance_notes(generator_id: int) list[dict[str, Any]][source]¶
Get list of maintenance_notes for a generator.
- get_token_subject() str | None[source]¶
Returns the subject of the JWT token, used as unique id for the user.
- async on_refresh_token_update(refresh_token: str | None) None[source]¶
Execute the registered callback.
- set_refresh_token_callback(callback: Callable[[str | None], Awaitable[None]]) None[source]¶
Set the callback for refresh token updates.
- Args:
callback (callable): Callback function to be called when the refresh token updates. The function should accept a single argument, which is the new refresh token.
- exception aiokem.AuthenticationCredentialsError(message: str = 'Authentication failed')[source]¶
Bases:
AuthenticationErrorException raised for authentication-related errors.
- exception aiokem.AuthenticationError(message: str = 'Authentication failed')[source]¶
Bases:
AioKemErrorException raised for authentication-related errors.
- exception aiokem.CommunicationError(message: str = 'Communication error')[source]¶
Bases:
AioKemErrorException raised for communication-related errors.
- exception aiokem.ServerError(message: str = 'Server error')[source]¶
Bases:
AioKemErrorException raised for server-related errors.
Submodules¶
aiokem.exceptions module¶
Exceptions for the aiokem package.
- exception aiokem.exceptions.AioKemError[source]¶
Bases:
ExceptionBase exception for the aiokem package.
- exception aiokem.exceptions.AuthenticationCredentialsError(message: str = 'Authentication failed')[source]¶
Bases:
AuthenticationErrorException raised for authentication-related errors.
- exception aiokem.exceptions.AuthenticationError(message: str = 'Authentication failed')[source]¶
Bases:
AioKemErrorException raised for authentication-related errors.
- exception aiokem.exceptions.CommunicationError(message: str = 'Communication error')[source]¶
Bases:
AioKemErrorException raised for communication-related errors.
- exception aiokem.exceptions.ServerError(message: str = 'Server error')[source]¶
Bases:
AioKemErrorException raised for server-related errors.
aiokem.helpers module¶
Helper functions for the aiokem package.
- aiokem.helpers.convert_number_abs(response: dict[str, Any], key: str) None[source]¶
Convert a number to its absolute value.
aiokem.main module¶
AioKem class for interacting with Kohler Energy Management System (KEM) API.
- class aiokem.main.AioKem(session: ClientSession, home_timezone: tzinfo = datetime.timezone.utc)[source]¶
Bases:
objectAioKem class for interacting with Kohler Energy Management System (KEM) API.
- async authenticate(email: str, password: str, refresh_token: str | None = None) None[source]¶
Login to the server.
- async authenticate_with_refresh_token(refresh_token: str) None[source]¶
Login to the server using a refresh token.
- async check_and_refresh_token() None[source]¶
Check if the token is expired and refresh it if necessary.
- async get_alerts(generator_id: int) list[dict[str, Any]][source]¶
Get list of alerts for a generator.
- async get_events(generator_id: int) list[dict[str, Any]][source]¶
Get list of events for a generator.
- async get_generator_data(generator_id: int) dict[str, Any][source]¶
Get generator data for a specific generator.
- async get_maintenance_notes(generator_id: int) list[dict[str, Any]][source]¶
Get list of maintenance_notes for a generator.
- get_token_subject() str | None[source]¶
Returns the subject of the JWT token, used as unique id for the user.
- async on_refresh_token_update(refresh_token: str | None) None[source]¶
Execute the registered callback.
- set_refresh_token_callback(callback: Callable[[str | None], Awaitable[None]]) None[source]¶
Set the callback for refresh token updates.
- Args:
callback (callable): Callback function to be called when the refresh token updates. The function should accept a single argument, which is the new refresh token.
aiokem.message_logger module¶
Module to log messages to files.