diff --git a/homeassistant/components/lg_thinq/number.py b/homeassistant/components/lg_thinq/number.py index 0f2cf1f67b9f..5c40301be228 100644 --- a/homeassistant/components/lg_thinq/number.py +++ b/homeassistant/components/lg_thinq/number.py @@ -101,6 +101,9 @@ DEVICE_TYPE_NUMBER_MAP: dict[DeviceType, tuple[NumberEntityDescription, ...]] = TIMER_NUMBER_DESC[ThinQProperty.RELATIVE_HOUR_TO_STOP], TIMER_NUMBER_DESC[ThinQProperty.SLEEP_TIMER_RELATIVE_HOUR_TO_STOP], ), + DeviceType.AIR_PURIFIER: ( + TIMER_NUMBER_DESC[ThinQProperty.SLEEP_TIMER_RELATIVE_HOUR_TO_STOP], + ), DeviceType.AIR_PURIFIER_FAN: ( NUMBER_DESC[ThinQProperty.WIND_TEMPERATURE], TIMER_NUMBER_DESC[ThinQProperty.SLEEP_TIMER_RELATIVE_HOUR_TO_STOP], diff --git a/tests/components/lg_thinq/conftest.py b/tests/components/lg_thinq/conftest.py index c373c5dac5da..96c916a64a98 100644 --- a/tests/components/lg_thinq/conftest.py +++ b/tests/components/lg_thinq/conftest.py @@ -117,9 +117,10 @@ def mock_thinq_mqtt_client() -> Generator[None]: "air_conditioner", "air_conditioner1", "air_conditioner2", - "washer", + "air_purifier", "dehumidifier", "kimchi_refrigerator", + "washer", ] ) def device_fixture(request: pytest.FixtureRequest) -> Generator[str]: diff --git a/tests/components/lg_thinq/fixtures/air_purifier/device.json b/tests/components/lg_thinq/fixtures/air_purifier/device.json new file mode 100644 index 000000000000..770c02c19a5a --- /dev/null +++ b/tests/components/lg_thinq/fixtures/air_purifier/device.json @@ -0,0 +1,9 @@ +{ + "deviceId": "MW2-5E747ABC-6542-4DEF-AA89-4EC4353B2E90", + "deviceInfo": { + "deviceType": "DEVICE_AIR_PURIFIER", + "modelName": "AIR_910604_WW", + "alias": "Test air purifier", + "reportable": true + } +} diff --git a/tests/components/lg_thinq/fixtures/air_purifier/energy_profile.json b/tests/components/lg_thinq/fixtures/air_purifier/energy_profile.json new file mode 100644 index 000000000000..05dd9622432b --- /dev/null +++ b/tests/components/lg_thinq/fixtures/air_purifier/energy_profile.json @@ -0,0 +1,4 @@ +{ + "resultCode": "0000", + "result": {} +} diff --git a/tests/components/lg_thinq/fixtures/air_purifier/profile.json b/tests/components/lg_thinq/fixtures/air_purifier/profile.json new file mode 100644 index 000000000000..e64a65add071 --- /dev/null +++ b/tests/components/lg_thinq/fixtures/air_purifier/profile.json @@ -0,0 +1,20 @@ +{ + "property": { + "operation": { + "airPurifierOperationMode": { + "mode": ["r", "w"], + "type": "enum", + "value": { + "r": ["POWER_ON", "POWER_OFF"], + "w": ["POWER_ON", "POWER_OFF"] + } + } + }, + "sleepTimer": { + "relativeHourToStop": { + "mode": ["r", "w"], + "type": "number" + } + } + } +} diff --git a/tests/components/lg_thinq/fixtures/air_purifier/status.json b/tests/components/lg_thinq/fixtures/air_purifier/status.json new file mode 100644 index 000000000000..a440ffe4b526 --- /dev/null +++ b/tests/components/lg_thinq/fixtures/air_purifier/status.json @@ -0,0 +1,8 @@ +{ + "operation": { + "airPurifierOperationMode": "POWER_ON" + }, + "sleepTimer": { + "relativeHourToStop": 4 + } +} diff --git a/tests/components/lg_thinq/snapshots/test_number.ambr b/tests/components/lg_thinq/snapshots/test_number.ambr index 3263b8818b2e..32aac596932f 100644 --- a/tests/components/lg_thinq/snapshots/test_number.ambr +++ b/tests/components/lg_thinq/snapshots/test_number.ambr @@ -179,3 +179,63 @@ 'state': '0', }) # --- +# name: test_number_entities[air_purifier][number.test_air_purifier_sleep_timer-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : 100.0, + : 0.0, + : , + : 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.test_air_purifier_sleep_timer', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Sleep timer', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Sleep timer', + 'platform': 'lg_thinq', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': , + 'unique_id': 'MW2-5E747ABC-6542-4DEF-AA89-4EC4353B2E90_sleep_timer_relative_hour_to_stop', + 'unit_of_measurement': , + }) +# --- +# name: test_number_entities[air_purifier][number.test_air_purifier_sleep_timer-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Test air purifier Sleep timer', + : 100.0, + : 0.0, + : , + : 1.0, + : , + }), + 'context': , + 'entity_id': 'number.test_air_purifier_sleep_timer', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '4', + }) +# --- diff --git a/tests/components/lg_thinq/test_number.py b/tests/components/lg_thinq/test_number.py index a740cb500c5c..0ba49b117284 100644 --- a/tests/components/lg_thinq/test_number.py +++ b/tests/components/lg_thinq/test_number.py @@ -15,7 +15,9 @@ from tests.common import MockConfigEntry, snapshot_platform @pytest.mark.usefixtures("entity_registry_enabled_by_default") -@pytest.mark.parametrize("device_fixture", ["air_conditioner", "washer"]) +@pytest.mark.parametrize( + "device_fixture", ["air_conditioner", "air_purifier", "washer"] +) async def test_number_entities( hass: HomeAssistant, snapshot: SnapshotAssertion,