Skip to content

[pull] dev from home-assistant:dev #646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 1, 2025
2 changes: 1 addition & 1 deletion homeassistant/components/lamarzocco/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: LaMarzoccoConfigEntry) -
raise ConfigEntryAuthFailed(
translation_domain=DOMAIN, translation_key="authentication_failed"
) from ex
except RequestNotSuccessful as ex:
except (RequestNotSuccessful, TimeoutError) as ex:
_LOGGER.debug(ex, exc_info=True)
raise ConfigEntryNotReady(
translation_domain=DOMAIN, translation_key="api_error"
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/media_player/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
"description": "The term to search for."
},
"media_filter_classes": {
"name": "Media filter classes",
"name": "Media class filter",
"description": "List of media classes to filter the search results by."
}
}
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/miele/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ def available(self) -> bool:

return (
super().available
and self.entity_description.press_data
in self.coordinator.data.actions[self._device_id].process_actions
and self.entity_description.press_data in self.action.process_actions
)

async def async_press(self) -> None:
Expand Down
8 changes: 2 additions & 6 deletions homeassistant/components/miele/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,15 @@ def max_temp(self) -> float:
"""Return the maximum target temperature."""
return cast(
float,
self.coordinator.data.actions[self._device_id]
.target_temperature[self.entity_description.zone - 1]
.max,
self.action.target_temperature[self.entity_description.zone - 1].max,
)

@property
def min_temp(self) -> float:
"""Return the minimum target temperature."""
return cast(
float,
self.coordinator.data.actions[self._device_id]
.target_temperature[self.entity_description.zone - 1]
.min,
self.action.target_temperature[self.entity_description.zone - 1].min,
)

async def async_set_temperature(self, **kwargs: Any) -> None:
Expand Down
28 changes: 24 additions & 4 deletions homeassistant/components/miele/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ class MieleActions(IntEnum):
}
STATE_PROGRAM_PHASE_WARMING_DRAWER = {
0: "not_running",
3073: "heating_up",
3075: "door_open",
3094: "keeping_warm",
3088: "cooling_down",
Expand Down Expand Up @@ -404,14 +405,21 @@ class MieleActions(IntEnum):
TUMBLE_DRYER_PROGRAM_ID: dict[int, str] = {
-1: "no_program", # Extrapolated from other device types.
0: "no_program", # Extrapolated from other device types
2: "cottons",
3: "minimum_iron",
4: "woollens_handcare",
5: "delicates",
6: "warm_air",
8: "express",
10: "automatic_plus",
20: "cottons",
23: "cottons_hygiene",
30: "minimum_iron",
31: "gentle_minimum_iron",
31: "bed_linen",
40: "woollens_handcare",
50: "delicates",
60: "warm_air",
66: "eco",
70: "cool_air",
80: "express",
90: "cottons",
Expand Down Expand Up @@ -449,17 +457,29 @@ class MieleActions(IntEnum):
31: "bottom_heat",
35: "moisture_plus_auto_roast",
40: "moisture_plus_fan_plus",
48: "moisture_plus_auto_roast",
49: "moisture_plus_fan_plus",
50: "moisture_plus_intensive_bake",
51: "moisture_plus_conventional_heat",
74: "moisture_plus_intensive_bake",
76: "moisture_plus_conventional_heat",
49: "moisture_plus_fan_plus",
323: "pyrolytic",
326: "descale",
335: "shabbat_program",
336: "yom_tov",
356: "defrost",
357: "drying",
358: "heat_crockery",
360: "low_temperature_cooking",
361: "steam_cooking",
362: "keeping_warm",
512: "1_tray",
513: "2_trays",
529: "baking_tray",
554: "baiser_one_large",
555: "baiser_several_small",
556: "lemon_meringue_pie",
557: "viennese_apple_strudel",
621: "prove_15_min",
622: "prove_30_min",
623: "prove_45_min",
Expand Down Expand Up @@ -673,7 +693,7 @@ class MieleActions(IntEnum):
2019: "defrosting_with_steam",
2020: "blanching",
2021: "bottling",
2022: "heat_crockery",
2022: "sterilize_crockery",
2023: "prove_dough",
2027: "soak",
2029: "reheating_with_microwave",
Expand Down Expand Up @@ -745,7 +765,7 @@ class MieleActions(IntEnum):
2129: "potatoes_floury_diced",
2130: "german_turnip_sliced",
2131: "german_turnip_cut_into_batons",
2132: "german_turnip_sliced",
2132: "german_turnip_diced",
2133: "pumpkin_diced",
2134: "corn_on_the_cob",
2135: "mangel_cut",
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/miele/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def device(self) -> MieleDevice:
return self.coordinator.data.devices[self._device_id]

@property
def actions(self) -> MieleAction:
def action(self) -> MieleAction:
"""Return the actions object."""
return self.coordinator.data.actions[self._device_id]

Expand Down
15 changes: 10 additions & 5 deletions homeassistant/components/miele/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@
},
"entity": {
"binary_sensor": {
"door": {
"name": "Door"
},
"failure": {
"name": "Failure"
},
Expand Down Expand Up @@ -316,6 +313,8 @@
"automatic_plus": "Automatic plus",
"baking_tray": "Baking tray",
"barista_assistant": "BaristaAssistant",
"baser_one_large": "Baiser one large",
"baser_severall_small": "Baiser several small",
"basket_program": "Basket program",
"basmati_rice_rapid_steam_cooking": "Basmati rice (rapid steam cooking)",
"basmati_rice_steam_cooking": "Basmati rice (steam cooking)",
Expand Down Expand Up @@ -471,7 +470,7 @@
"gentle_minimum_iron": "Gentle minimum iron",
"gentle_smoothing": "Gentle smoothing",
"german_turnip_cut_into_batons": "German turnip (cut into batons)",
"german_turnip_sliced": "German turnip (sliced)",
"german_turnip_diced": "German turnip (diced)",
"gilt_head_bream_fillet": "Gilt-head bream (fillet)",
"gilt_head_bream_whole": "Gilt-head bream (whole)",
"glasses_warm": "Glasses warm",
Expand All @@ -492,7 +491,6 @@
"greenage_plums": "Greenage plums",
"halibut_fillet_2_cm": "Halibut (fillet, 2 cm)",
"halibut_fillet_3_cm": "Halibut (fillet, 3 cm)",
"heat_crockery": "Heat crockery",
"heating_damp_flannels": "Heating damp flannels",
"hens_eggs_size_l_hard": "Hen’s eggs (size „L“, hard)",
"hens_eggs_size_l_medium": "Hen’s eggs (size „L“, medium)",
Expand Down Expand Up @@ -532,9 +530,11 @@
"latte_macchiato": "Latte macchiato",
"leek_pieces": "Leek (pieces)",
"leek_rings": "Leek (rings)",
"lemon_meringue_pie": "Lemon meringue pie",
"long_coffee": "Long coffee",
"long_grain_rice_general_rapid_steam_cooking": "Long grain rice (general, rapid steam cooking)",
"long_grain_rice_general_steam_cooking": "Long grain rice (general, steam cooking)",
"low_temperature_cooking": "Low temperature cooking",
"maintenance": "Maintenance program",
"make_yoghurt": "Make yoghurt",
"mangel_cut": "Mangel (cut)",
Expand Down Expand Up @@ -673,6 +673,7 @@
"prove_dough": "Prove dough",
"pumpkin_diced": "Pumpkin (diced)",
"pumpkin_soup": "Pumpkin soup",
"pyrolytic": "Pyrolytic",
"quick_mw": "Quick MW",
"quick_power_wash": "QuickPowerWash",
"quinces_diced": "Quinces (diced)",
Expand Down Expand Up @@ -725,6 +726,7 @@
"sea_devil_fillet_3_cm": "Sea devil (fillet, 3 cm)",
"sea_devil_fillet_4_cm": "Sea devil (fillet, 4 cm)",
"separate_rinse_starch": "Separate rinse/starch",
"shabbat_program": "Shabbat program",
"sheyang_rapid_steam_cooking": "Sheyang (rapid steam cooking)",
"sheyang_steam_cooking": "Sheyang (steam cooking)",
"shirts": "Shirts",
Expand Down Expand Up @@ -755,6 +757,7 @@
"steam_care": "Steam care",
"steam_cooking": "Steam cooking",
"steam_smoothing": "Steam smoothing",
"sterilize_crockery": "Sterilize crockery",
"stuffed_cabbage": "Stuffed cabbage",
"sweat_onions": "Sweat onions",
"swede_cut_into_batons": "Swede (cut into batons)",
Expand Down Expand Up @@ -793,6 +796,7 @@
"veal_sausages": "Veal sausages",
"venus_clams": "Venus clams",
"very_hot_water": "Very hot water",
"viennese_apple_strudel": "Viennese apple strudel",
"viennese_silverside": "Viennese silverside",
"warm_air": "Warm air",
"wheat_cracked": "Wheat (cracked)",
Expand All @@ -817,6 +821,7 @@
"yellow_beans_cut": "Yellow beans (cut)",
"yellow_beans_whole": "Yellow beans (whole)",
"yellow_split_peas": "Yellow split peas",
"yom_tov": "Yom tov",
"zander_fillet": "Zander (fillet)"
}
},
Expand Down
13 changes: 4 additions & 9 deletions homeassistant/components/miele/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,14 @@ class MielePowerSwitch(MieleSwitch):
@property
def is_on(self) -> bool | None:
"""Return the state of the switch."""
return self.coordinator.data.actions[self._device_id].power_off_enabled
return self.action.power_off_enabled

@property
def available(self) -> bool:
"""Return the availability of the entity."""

return (
self.coordinator.data.actions[self._device_id].power_off_enabled
or self.coordinator.data.actions[self._device_id].power_on_enabled
self.action.power_off_enabled or self.action.power_on_enabled
) and super().available

async def async_turn_switch(self, mode: dict[str, str | int | bool]) -> None:
Expand All @@ -192,12 +191,8 @@ async def async_turn_switch(self, mode: dict[str, str | int | bool]) -> None:
"entity": self.entity_id,
},
) from err
self.coordinator.data.actions[self._device_id].power_on_enabled = cast(
bool, mode
)
self.coordinator.data.actions[self._device_id].power_off_enabled = not cast(
bool, mode
)
self.action.power_on_enabled = cast(bool, mode)
self.action.power_off_enabled = not cast(bool, mode)
self.async_write_ha_state()


Expand Down
30 changes: 15 additions & 15 deletions tests/components/home_connect/test_binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ def platforms() -> list[str]:

@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
async def test_paired_depaired_devices_flow(
appliance: HomeAppliance,
hass: HomeAssistant,
config_entry: MockConfigEntry,
integration_setup: Callable[[MagicMock], Awaitable[bool]],
client: MagicMock,
device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry,
client: MagicMock,
config_entry: MockConfigEntry,
integration_setup: Callable[[MagicMock], Awaitable[bool]],
appliance: HomeAppliance,
) -> None:
"""Test that removed devices are correctly removed from and added to hass on API events."""
assert config_entry.state == ConfigEntryState.NOT_LOADED
Expand Down Expand Up @@ -104,14 +104,14 @@ async def test_paired_depaired_devices_flow(
indirect=["appliance"],
)
async def test_connected_devices(
appliance: HomeAppliance,
keys_to_check: tuple,
hass: HomeAssistant,
config_entry: MockConfigEntry,
integration_setup: Callable[[MagicMock], Awaitable[bool]],
client: MagicMock,
device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry,
client: MagicMock,
config_entry: MockConfigEntry,
integration_setup: Callable[[MagicMock], Awaitable[bool]],
appliance: HomeAppliance,
keys_to_check: tuple,
) -> None:
"""Test that devices reconnected.

Expand Down Expand Up @@ -170,9 +170,9 @@ def get_status_side_effect(ha_id: str):
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
async def test_binary_sensors_entity_availability(
hass: HomeAssistant,
client: MagicMock,
config_entry: MockConfigEntry,
integration_setup: Callable[[MagicMock], Awaitable[bool]],
client: MagicMock,
appliance: HomeAppliance,
) -> None:
"""Test if binary sensor entities availability are based on the appliance connection state."""
Expand Down Expand Up @@ -268,15 +268,15 @@ async def test_binary_sensors_entity_availability(
indirect=["appliance"],
)
async def test_binary_sensors_functionality(
hass: HomeAssistant,
client: MagicMock,
config_entry: MockConfigEntry,
integration_setup: Callable[[MagicMock], Awaitable[bool]],
entity_id: str,
event_key: EventKey,
event_value_update: str,
appliance: HomeAppliance,
expected: str,
hass: HomeAssistant,
config_entry: MockConfigEntry,
integration_setup: Callable[[MagicMock], Awaitable[bool]],
client: MagicMock,
) -> None:
"""Tests for Home Connect Fridge appliance door states."""
assert config_entry.state == ConfigEntryState.NOT_LOADED
Expand Down Expand Up @@ -309,9 +309,9 @@ async def test_binary_sensors_functionality(
@pytest.mark.parametrize("appliance", ["Washer"], indirect=True)
async def test_connected_sensor_functionality(
hass: HomeAssistant,
client: MagicMock,
config_entry: MockConfigEntry,
integration_setup: Callable[[MagicMock], Awaitable[bool]],
client: MagicMock,
appliance: HomeAppliance,
) -> None:
"""Test if the connected binary sensor reports the right values."""
Expand Down
Loading