Add support for Sonos subwoofer gain controls (#68334)

This commit is contained in:
jjlawren 2022-03-18 12:12:10 -05:00 committed by GitHub
parent 7174e7897c
commit dbb79e2937
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 3 deletions

View file

@ -6,8 +6,8 @@ from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.helpers import entity_registry as ent_reg
async def test_audio_input_sensor(hass, async_autosetup_sonos, soco):
"""Test audio input sensor."""
async def test_number_entities(hass, async_autosetup_sonos, soco):
"""Test number entities."""
entity_registry = ent_reg.async_get(hass)
bass_number = entity_registry.entities["number.zone_a_bass"]
@ -30,3 +30,16 @@ async def test_audio_input_sensor(hass, async_autosetup_sonos, soco):
blocking=True,
)
assert mock_audio_delay.called_with(3)
sub_gain_number = entity_registry.entities["number.zone_a_sub_gain"]
sub_gain_state = hass.states.get(sub_gain_number.entity_id)
assert sub_gain_state.state == "5"
with patch("soco.SoCo.sub_gain") as mock_sub_gain:
await hass.services.async_call(
NUMBER_DOMAIN,
SERVICE_SET_VALUE,
{ATTR_ENTITY_ID: sub_gain_number.entity_id, "value": -8},
blocking=True,
)
assert mock_sub_gain.called_with(-8)