diff --git a/homeassistant/components/sleepiq/manifest.json b/homeassistant/components/sleepiq/manifest.json index 16881506cb8..cadfe126ecf 100644 --- a/homeassistant/components/sleepiq/manifest.json +++ b/homeassistant/components/sleepiq/manifest.json @@ -3,7 +3,7 @@ "name": "SleepIQ", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/sleepiq", - "requirements": ["asyncsleepiq==1.2.1"], + "requirements": ["asyncsleepiq==1.2.3"], "codeowners": ["@mfugate1", "@kbickar"], "dhcp": [ { diff --git a/homeassistant/components/sleepiq/select.py b/homeassistant/components/sleepiq/select.py index 711f228d7f2..0cbf1671e2b 100644 --- a/homeassistant/components/sleepiq/select.py +++ b/homeassistant/components/sleepiq/select.py @@ -1,7 +1,7 @@ """Support for SleepIQ foundation preset selection.""" from __future__ import annotations -from asyncsleepiq import BED_PRESETS, SleepIQBed, SleepIQPreset +from asyncsleepiq import BED_PRESETS, Side, SleepIQBed, SleepIQPreset from homeassistant.components.select import SelectEntity from homeassistant.config_entries import ConfigEntry @@ -39,14 +39,11 @@ class SleepIQSelectEntity(SleepIQBedEntity, SelectEntity): """Initialize the select entity.""" self.preset = preset - if preset.side: - self._attr_name = ( - f"SleepNumber {bed.name} Foundation Preset {preset.side_full}" - ) - self._attr_unique_id = f"{bed.id}_preset_{preset.side}" - else: - self._attr_name = f"SleepNumber {bed.name} Foundation Preset" - self._attr_unique_id = f"{bed.id}_preset" + self._attr_name = f"SleepNumber {bed.name} Foundation Preset" + self._attr_unique_id = f"{bed.id}_preset" + if preset.side != Side.NONE: + self._attr_name += f" {preset.side_full}" + self._attr_unique_id += f"_{preset.side}" super().__init__(coordinator, bed) self._async_update_attrs() diff --git a/requirements_all.txt b/requirements_all.txt index 79115c6988e..abcd7325601 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -336,7 +336,7 @@ async-upnp-client==0.27.0 asyncpysupla==0.0.5 # homeassistant.components.sleepiq -asyncsleepiq==1.2.1 +asyncsleepiq==1.2.3 # homeassistant.components.aten_pe atenpdu==0.3.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index e10973325d0..6e7bc79fd0e 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -266,7 +266,7 @@ arcam-fmj==0.12.0 async-upnp-client==0.27.0 # homeassistant.components.sleepiq -asyncsleepiq==1.2.1 +asyncsleepiq==1.2.3 # homeassistant.components.aurora auroranoaa==0.0.2 diff --git a/tests/components/sleepiq/conftest.py b/tests/components/sleepiq/conftest.py index 4408f41035b..23c42ee7f66 100644 --- a/tests/components/sleepiq/conftest.py +++ b/tests/components/sleepiq/conftest.py @@ -5,6 +5,7 @@ from collections.abc import Generator from unittest.mock import MagicMock, create_autospec, patch from asyncsleepiq import ( + Side, SleepIQActuator, SleepIQBed, SleepIQFoundation, @@ -52,14 +53,14 @@ def mock_bed() -> MagicMock: sleeper_r = create_autospec(SleepIQSleeper) bed.sleepers = [sleeper_l, sleeper_r] - sleeper_l.side = "L" + sleeper_l.side = Side.LEFT sleeper_l.name = SLEEPER_L_NAME sleeper_l.in_bed = True sleeper_l.sleep_number = 40 sleeper_l.pressure = 1000 sleeper_l.sleeper_id = SLEEPER_L_ID - sleeper_r.side = "R" + sleeper_r.side = Side.RIGHT sleeper_r.name = SLEEPER_R_NAME sleeper_r.in_bed = False sleeper_r.sleep_number = 80 @@ -91,13 +92,13 @@ def mock_asyncsleepiq_single_foundation( actuator_f = create_autospec(SleepIQActuator) mock_bed.foundation.actuators = [actuator_h, actuator_f] - actuator_h.side = "R" + actuator_h.side = Side.NONE actuator_h.side_full = "Right" actuator_h.actuator = "H" actuator_h.actuator_full = "Head" actuator_h.position = 60 - actuator_f.side = None + actuator_f.side = Side.NONE actuator_f.actuator = "F" actuator_f.actuator_full = "Foot" actuator_f.position = 10 @@ -106,8 +107,8 @@ def mock_asyncsleepiq_single_foundation( mock_bed.foundation.presets = [preset] preset.preset = PRESET_R_STATE - preset.side = None - preset.side_full = None + preset.side = Side.NONE + preset.side_full = "Right" yield client @@ -123,13 +124,13 @@ def mock_asyncsleepiq(mock_bed: MagicMock) -> Generator[MagicMock, None, None]: actuator_f = create_autospec(SleepIQActuator) mock_bed.foundation.actuators = [actuator_h_r, actuator_h_l, actuator_f] - actuator_h_r.side = "R" + actuator_h_r.side = Side.RIGHT actuator_h_r.side_full = "Right" actuator_h_r.actuator = "H" actuator_h_r.actuator_full = "Head" actuator_h_r.position = 60 - actuator_h_l.side = "L" + actuator_h_l.side = Side.LEFT actuator_h_l.side_full = "Left" actuator_h_l.actuator = "H" actuator_h_l.actuator_full = "Head" @@ -145,11 +146,11 @@ def mock_asyncsleepiq(mock_bed: MagicMock) -> Generator[MagicMock, None, None]: mock_bed.foundation.presets = [preset_l, preset_r] preset_l.preset = PRESET_L_STATE - preset_l.side = "L" + preset_l.side = Side.LEFT preset_l.side_full = "Left" preset_r.preset = PRESET_R_STATE - preset_r.side = "R" + preset_r.side = Side.RIGHT preset_r.side_full = "Right" yield client