aiokef.aiokef module¶
A module for asynchronously interacting with KEF wireless speakers.
- class aiokef.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[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()
.- Type:
- async get_volume() Optional[float] [source]¶
Volume level of the media player (0..1). None if muted.
- async 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.aiokef.Mode(desk_mode, wall_mode, phase_correction, high_pass, sub_polarity, bass_extension)¶
Bases:
tuple
- property bass_extension¶
Alias for field number 5
- property desk_mode¶
Alias for field number 0
- property high_pass¶
Alias for field number 3
- property phase_correction¶
Alias for field number 2
- property sub_polarity¶
Alias for field number 4
- property wall_mode¶
Alias for field number 1
- class aiokef.aiokef.State(source, is_on, standby_time, orientation)¶
Bases:
tuple
- property is_on¶
Alias for field number 1
- property orientation¶
Alias for field number 3
- property source¶
Alias for field number 0
- property standby_time¶
Alias for field number 2
- class aiokef.aiokef.SyncKefSpeaker(async_speaker: 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.