Skip to content

Commit

Permalink
Added support for Whirlpool W7I HT58 T.
Browse files Browse the repository at this point in the history
Added new data model entry for oven

Signed-off-by: Adrian Lasota <[email protected]>
  • Loading branch information
adrianlasota committed May 24, 2024
1 parent 703aaed commit 7e8d89d
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 6 deletions.
97 changes: 97 additions & 0 deletions tests/test_appliancesmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,100 @@ async def test_fetch_appliances_returns_true_if_either_method_returns_true(

assert result == bool(owned_response or shared_response)
await http_client_mock.close_session()


@pytest.mark.parametrize(
"data_model_key",
[
"DDM_COOKING_BIO_SELF_CLEAN_TOURMALINE_V2",
"COOKING_MINERVA",
"COOKING_VSI",
"COOKING_U2",
],
)
async def test_add_appliance(data_model_key, http_client_mock: AiohttpClientMocker):
appliance = {
"DATA_MODEL_KEY": f"{data_model_key}",
"CATEGORY_NAME": "Cooking",
"MODEL_NO": "000000000000",
"REPLENISHMENT_DEVICE_MODEL": None,
"IMAGE_PATH": None,
"APPLIANCE_ID": 95842,
"APPLIANCE_MASTER_ID": 491,
"MODEL_SKU_ID": None,
"CREATED_AT": 1715804778000,
"UPDATED_AT": 1715804778000,
"APPLIANCE_NAME": "Oven",
"SAID": "0000000000000",
"NEST_AWAY": 0,
"CYCLE_HANDOFF": 0,
"NEST_THERMOSTAT_ID": 0,
"THERMOSTAT_INFLUENCE_THRESHOLD": None,
"THERMOSTAT_DESIRED_OFFSET": None,
"THERMOSTAT_OFFSET_NEEDED": None,
"DELETE_FLAG": 0,
"DISPLAY_POSITION": None,
"SERIAL": "000000000000",
"LOCATION_ID": 260998,
"MACHINE_ID": None,
"MACHINE_POSITION": 0,
"ISVOICEDEFAULT": 1,
"DEVICE_ID": "aaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa",
"IS_ENROLLED": None,
"STATUS": "CLAIMED",
"APPLIANCE_TYPE_ID": None,
"MACHINE_STATUS": None,
"APPLIANCE_MODE": 2,
}
appliance_data = {
"CATEGORY": "Cooking",
"DATA_MODEL": f"{data_model_key}",
"MODEL_NUMBER": "000000000000",
"NAME": "Oven",
"SAID": "0000000000000",
"SERIAL_NUMBER": "000000000000",
}
auth = Auth(BACKEND_SELECTOR_MOCK, "email", "secretpass", http_client_mock.session)
am = AppliancesManager(BACKEND_SELECTOR_MOCK, auth, http_client_mock.session)
am._add_appliance(appliance)
assert appliance_data in am._ovens


async def test_add_appliance_not_supported(http_client_mock: AiohttpClientMocker):
appliance = {
"DATA_MODEL_KEY": "cooking",
"CATEGORY_NAME": "Cooking",
"MODEL_NO": "000000000000",
"REPLENISHMENT_DEVICE_MODEL": None,
"IMAGE_PATH": None,
"APPLIANCE_ID": 95842,
"APPLIANCE_MASTER_ID": 491,
"MODEL_SKU_ID": None,
"CREATED_AT": 1715804778000,
"UPDATED_AT": 1715804778000,
"APPLIANCE_NAME": "Oven",
"SAID": "0000000000000",
"NEST_AWAY": 0,
"CYCLE_HANDOFF": 0,
"NEST_THERMOSTAT_ID": 0,
"THERMOSTAT_INFLUENCE_THRESHOLD": None,
"THERMOSTAT_DESIRED_OFFSET": None,
"THERMOSTAT_OFFSET_NEEDED": None,
"DELETE_FLAG": 0,
"DISPLAY_POSITION": None,
"SERIAL": "000000000000",
"LOCATION_ID": 260998,
"MACHINE_ID": None,
"MACHINE_POSITION": 0,
"ISVOICEDEFAULT": 1,
"DEVICE_ID": "aaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa",
"IS_ENROLLED": None,
"STATUS": "CLAIMED",
"APPLIANCE_TYPE_ID": None,
"MACHINE_STATUS": None,
"APPLIANCE_MODE": 2,
}
auth = Auth(BACKEND_SELECTOR_MOCK, "email", "secretpass", http_client_mock.session)
am = AppliancesManager(BACKEND_SELECTOR_MOCK, auth, http_client_mock.session)
am._add_appliance(appliance)
assert len(am._ovens) is 0
13 changes: 7 additions & 6 deletions whirlpool/appliancesmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ def _add_appliance(self, appliance: dict[str, Any]) -> None:
if "dryer" in data_model or "washer" in data_model:
self._washer_dryers.append(appliance_data)
return

if (
"cooking_minerva" in data_model
or "cooking_vsi" in data_model
or "cooking_u2" in data_model
):
oven_models = [
"cooking_minerva",
"cooking_vsi",
"cooking_u2",
"ddm_cooking_bio_self_clean_tourmaline_v2",
]
if any(model in data_model for model in oven_models):
self._ovens.append(appliance_data)
return

Expand Down

0 comments on commit 7e8d89d

Please sign in to comment.