Tiny Home Connect tweaks (#141403)

This commit is contained in:
J. Diego Rodríguez Royo 2025-03-25 22:06:38 +01:00 committed by GitHub
parent 56a8c74e87
commit f3bcb96b41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 91 additions and 91 deletions

View File

@ -155,7 +155,7 @@ class HomeConnectCoordinator(
f"home_connect-events_listener_task-{self.config_entry.entry_id}",
)
async def _event_listener(self) -> None: # noqa: C901
async def _event_listener(self) -> None:
"""Match event with listener for event type."""
retry_time = 10
while True:
@ -279,13 +279,6 @@ class HomeConnectCoordinator(
)
break
# Trigger to delete the possible depaired device entities
# from known_entities variable at common.py
for listener, context in self._special_listeners.values():
assert isinstance(context, tuple)
if EventKey.BSH_COMMON_APPLIANCE_DEPAIRED in context:
listener()
@callback
def _call_event_listener(self, event_message: EventMessage) -> None:
"""Call listener for event."""
@ -389,6 +382,13 @@ class HomeConnectCoordinator(
remove_config_entry_id=self.config_entry.entry_id,
)
# Trigger to delete the possible depaired device entities
# from known_entities variable at common.py
for listener, context in self._special_listeners.values():
assert isinstance(context, tuple)
if EventKey.BSH_COMMON_APPLIANCE_DEPAIRED in context:
listener()
async def _get_appliance_data(
self,
appliance: HomeAppliance,

View File

@ -1,4 +1,4 @@
"""Provides number enties for Home Connect."""
"""Provides number entities for Home Connect."""
import logging
from typing import cast

View File

@ -53,7 +53,7 @@ BSH_PROGRAM_SENSORS = (
device_class=SensorDeviceClass.TIMESTAMP,
translation_key="program_finish_time",
appliance_types=(
"CoffeMaker",
"CoffeeMaker",
"CookProcessor",
"Dishwasher",
"Dryer",
@ -194,30 +194,6 @@ SENSORS = (
)
EVENT_SENSORS = (
HomeConnectSensorEntityDescription(
key=EventKey.REFRIGERATION_FRIDGE_FREEZER_EVENT_DOOR_ALARM_FREEZER,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="freezer_door_alarm",
appliance_types=("FridgeFreezer", "Freezer"),
),
HomeConnectSensorEntityDescription(
key=EventKey.REFRIGERATION_FRIDGE_FREEZER_EVENT_DOOR_ALARM_REFRIGERATOR,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="refrigerator_door_alarm",
appliance_types=("FridgeFreezer", "Refrigerator"),
),
HomeConnectSensorEntityDescription(
key=EventKey.REFRIGERATION_FRIDGE_FREEZER_EVENT_TEMPERATURE_ALARM_FREEZER,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="freezer_temperature_alarm",
appliance_types=("FridgeFreezer", "Freezer"),
),
HomeConnectSensorEntityDescription(
key=EventKey.BSH_COMMON_EVENT_PROGRAM_ABORTED,
device_class=SensorDeviceClass.ENUM,
@ -274,6 +250,22 @@ EVENT_SENSORS = (
translation_key="drying_process_finished",
appliance_types=("Dryer",),
),
HomeConnectSensorEntityDescription(
key=EventKey.DISHCARE_DISHWASHER_EVENT_SALT_NEARLY_EMPTY,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="salt_nearly_empty",
appliance_types=("Dishwasher",),
),
HomeConnectSensorEntityDescription(
key=EventKey.DISHCARE_DISHWASHER_EVENT_RINSE_AID_NEARLY_EMPTY,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="rinse_aid_nearly_empty",
appliance_types=("Dishwasher",),
),
HomeConnectSensorEntityDescription(
key=EventKey.CONSUMER_PRODUCTS_COFFEE_MAKER_EVENT_BEAN_CONTAINER_EMPTY,
device_class=SensorDeviceClass.ENUM,
@ -434,6 +426,30 @@ EVENT_SENSORS = (
translation_key="device_calc_n_clean_blockage",
appliance_types=("CoffeeMaker",),
),
HomeConnectSensorEntityDescription(
key=EventKey.REFRIGERATION_FRIDGE_FREEZER_EVENT_DOOR_ALARM_FREEZER,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="freezer_door_alarm",
appliance_types=("FridgeFreezer", "Freezer"),
),
HomeConnectSensorEntityDescription(
key=EventKey.REFRIGERATION_FRIDGE_FREEZER_EVENT_DOOR_ALARM_REFRIGERATOR,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="refrigerator_door_alarm",
appliance_types=("FridgeFreezer", "Refrigerator"),
),
HomeConnectSensorEntityDescription(
key=EventKey.REFRIGERATION_FRIDGE_FREEZER_EVENT_TEMPERATURE_ALARM_FREEZER,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="freezer_temperature_alarm",
appliance_types=("FridgeFreezer", "Freezer"),
),
HomeConnectSensorEntityDescription(
key=EventKey.CONSUMER_PRODUCTS_CLEANING_ROBOT_EVENT_EMPTY_DUST_BOX_AND_CLEAN_FILTER,
device_class=SensorDeviceClass.ENUM,
@ -490,22 +506,6 @@ EVENT_SENSORS = (
translation_key="grease_filter_max_saturation_reached",
appliance_types=("Hood",),
),
HomeConnectSensorEntityDescription(
key=EventKey.DISHCARE_DISHWASHER_EVENT_SALT_NEARLY_EMPTY,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="salt_nearly_empty",
appliance_types=("Dishwasher",),
),
HomeConnectSensorEntityDescription(
key=EventKey.DISHCARE_DISHWASHER_EVENT_RINSE_AID_NEARLY_EMPTY,
device_class=SensorDeviceClass.ENUM,
options=EVENT_OPTIONS,
default_value="off",
translation_key="rinse_aid_nearly_empty",
appliance_types=("Dishwasher",),
),
)

View File

@ -1545,30 +1545,6 @@
"oven_current_cavity_temperature": {
"name": "Current oven cavity temperature"
},
"freezer_door_alarm": {
"name": "Freezer door alarm",
"state": {
"off": "[%key:common::state::off%]",
"confirmed": "[%key:component::home_connect::common::confirmed%]",
"present": "[%key:component::home_connect::common::present%]"
}
},
"refrigerator_door_alarm": {
"name": "Refrigerator door alarm",
"state": {
"off": "[%key:common::state::off%]",
"confirmed": "[%key:component::home_connect::common::confirmed%]",
"present": "[%key:component::home_connect::common::present%]"
}
},
"freezer_temperature_alarm": {
"name": "Freezer temperature alarm",
"state": {
"off": "[%key:common::state::off%]",
"confirmed": "[%key:component::home_connect::common::confirmed%]",
"present": "[%key:component::home_connect::common::present%]"
}
},
"program_aborted": {
"name": "Program aborted",
"state": {
@ -1617,6 +1593,22 @@
"present": "[%key:component::home_connect::common::present%]"
}
},
"salt_nearly_empty": {
"name": "Salt nearly empty",
"state": {
"off": "[%key:common::state::off%]",
"confirmed": "[%key:component::home_connect::common::confirmed%]",
"present": "[%key:component::home_connect::common::present%]"
}
},
"rinse_aid_nearly_empty": {
"name": "Rinse aid nearly empty",
"state": {
"off": "[%key:common::state::off%]",
"confirmed": "[%key:component::home_connect::common::confirmed%]",
"present": "[%key:component::home_connect::common::present%]"
}
},
"bean_container_empty": {
"name": "Bean container empty",
"state": {
@ -1777,6 +1769,30 @@
"present": "[%key:component::home_connect::common::present%]"
}
},
"freezer_door_alarm": {
"name": "Freezer door alarm",
"state": {
"off": "[%key:common::state::off%]",
"confirmed": "[%key:component::home_connect::common::confirmed%]",
"present": "[%key:component::home_connect::common::present%]"
}
},
"refrigerator_door_alarm": {
"name": "Refrigerator door alarm",
"state": {
"off": "[%key:common::state::off%]",
"confirmed": "[%key:component::home_connect::common::confirmed%]",
"present": "[%key:component::home_connect::common::present%]"
}
},
"freezer_temperature_alarm": {
"name": "Freezer temperature alarm",
"state": {
"off": "[%key:common::state::off%]",
"confirmed": "[%key:component::home_connect::common::confirmed%]",
"present": "[%key:component::home_connect::common::present%]"
}
},
"empty_dust_box_and_clean_filter": {
"name": "Empty dust box and clean filter",
"state": {
@ -1832,22 +1848,6 @@
"confirmed": "[%key:component::home_connect::common::confirmed%]",
"present": "[%key:component::home_connect::common::present%]"
}
},
"salt_nearly_empty": {
"name": "Salt nearly empty",
"state": {
"off": "[%key:common::state::off%]",
"confirmed": "[%key:component::home_connect::common::confirmed%]",
"present": "[%key:component::home_connect::common::present%]"
}
},
"rinse_aid_nearly_empty": {
"name": "Rinse aid nearly empty",
"state": {
"off": "[%key:common::state::off%]",
"confirmed": "[%key:component::home_connect::common::confirmed%]",
"present": "[%key:component::home_connect::common::present%]"
}
}
},
"switch": {

View File

@ -1,4 +1,4 @@
"""Provides time enties for Home Connect."""
"""Provides time entities for Home Connect."""
from datetime import time
from typing import cast