Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.sonos.number Namespace Reference

Classes

class  SonosLevelEntity
 

Functions

tuple[int, int] _balance_from_number (float value)
 
float _balance_to_number (tuple[int, int] state)
 
None async_setup_entry (HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
dictionary LEVEL_FROM_NUMBER = {"balance": _balance_from_number}
 
dictionary LEVEL_TO_NUMBER = {"balance": _balance_to_number}
 
dictionary LEVEL_TYPES
 
 SocoFeatures
 

Detailed Description

Entity representing a Sonos number control.

Function Documentation

◆ _balance_from_number()

tuple[int, int] homeassistant.components.sonos.number._balance_from_number ( float  value)
private
Convert a balance value from -100 to 100 into SoCo format.

0 becomes (100, 100), fully enabling both sides. Note that
the master volume control is separate, so this does not
turn up the speakers to maximum volume. Negative values
reduce the volume of the right side, and positive values
reduce the volume of the left side. -100 becomes (100, 0),
fully muting the right side, and +100 becomes (0, 100),
muting the left side.

Definition at line 50 of file number.py.

◆ _balance_to_number()

float homeassistant.components.sonos.number._balance_to_number ( tuple[int, int]  state)
private
Represent a balance measure returned by SoCo as a number.

SoCo returns a pair of volumes, one for the left side and one
for the right side. When the two are equal, sound is centered;
HA will show that as 0. When the left side is louder, HA will
show a negative value, and a positive value means the right
side is louder. Maximum absolute value is 100, which means only
one side produces sound at all.

Definition at line 36 of file number.py.

◆ async_setup_entry()

None homeassistant.components.sonos.number.async_setup_entry ( HomeAssistant  hass,
ConfigEntry  config_entry,
AddEntitiesCallback  async_add_entities 
)
Set up the Sonos number platform from a config entry.

Definition at line 70 of file number.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.sonos.number._LOGGER = logging.getLogger(__name__)
private

Definition at line 33 of file number.py.

◆ LEVEL_FROM_NUMBER

dictionary homeassistant.components.sonos.number.LEVEL_FROM_NUMBER = {"balance": _balance_from_number}

Definition at line 67 of file number.py.

◆ LEVEL_TO_NUMBER

dictionary homeassistant.components.sonos.number.LEVEL_TO_NUMBER = {"balance": _balance_to_number}

Definition at line 66 of file number.py.

◆ LEVEL_TYPES

dictionary homeassistant.components.sonos.number.LEVEL_TYPES
Initial value:
1 = {
2  "audio_delay": (0, 5),
3  "bass": (-10, 10),
4  "balance": (-100, 100),
5  "treble": (-10, 10),
6  "sub_crossover": (50, 110),
7  "sub_gain": (-15, 15),
8  "surround_level": (-15, 15),
9  "music_surround_level": (-15, 15),
10 }

Definition at line 20 of file number.py.

◆ SocoFeatures

homeassistant.components.sonos.number.SocoFeatures

Definition at line 31 of file number.py.