aiokef package¶
A module for asynchronously interacting with KEF wireless speakers.
-
class
aiokef.
AsyncKefSpeaker
(host: str, port: int = 50001, volume_step: float = 0.05, maximum_volume: float = 1.0, standby_time: Optional[int] = None, inverse_speaker_mode: bool = False, *, loop: Optional[asyncio.events.AbstractEventLoop] = None)[source]¶ Bases:
object
Asynchronous KEF speaker class.
- Parameters
host (str) – The IP of the speaker.
port (int, optional) – The port used for the communication, the default is 50001.
volume_step (float, optional) – The volume change when calling
increase_volume
ordecrease_volume
, by default 0.05.maximum_volume (float, optional) – The maximum allow volume, between 0 and 1. Use this to avoid accidentally setting very high volumes, by default 1.0.
loop (
asyncio.BaseEventLoop
, optional) – The eventloop to use.standby_time (int, optional) – Put the speaker in standby when inactive for
standby_time
minutes. The only options are None (default), 20, and 60.inverse_speaker_mode (bool, optional) – Reverse L/R to R/L.
-
sync
¶ Run any method that the
AsyncKefSpeaker
has in a synchronous way. For examplekef_speaker.sync.mute()
.
-
get_mode
() → Union[aiokef.aiokef.Mode, str][source]¶
-
get_state
() → aiokef.aiokef.State[source]¶
-
async
get_volume
() → Optional[float][source]¶ Volume level of the media player (0..1). None if muted.
-
get_volume_and_is_muted
(scale=True) → Tuple[Union[float, int], bool][source]¶ Return volume level (0..1) and is_muted (in a single call).
-
async
set_mode
(desk_mode=None, wall_mode=None, phase_correction=None, high_pass=None, sub_polarity=None, bass_extension=None) → None[source]¶ Set the mode of the speaker.
Leave option None to keep the setting the same.
-
class
aiokef.
SyncKefSpeaker
(async_speaker: aiokef.aiokef.AsyncKefSpeaker)[source]¶ Bases:
object
A synchronous KEF speaker class.
This has the same methods as
aiokef.AsyncKefSpeaker
, however, it wraps all async methods and call them in a blocking way.