Add Miele door binary sensor on coffee systems (#180731)

This commit is contained in:
Andrea Turri
2026-09-02 07:18:59 +02:00
committed by GitHub
parent 17be34523d
commit ff5b42fcdb
3 changed files with 319 additions and 0 deletions
@@ -44,6 +44,7 @@ class MieleBinarySensorDefinition:
BINARY_SENSOR_TYPES: Final[tuple[MieleBinarySensorDefinition, ...]] = (
MieleBinarySensorDefinition(
types=(
MieleAppliance.COFFEE_SYSTEM,
MieleAppliance.DISH_WARMER,
MieleAppliance.DISHWASHER,
MieleAppliance.FREEZER,
@@ -2927,3 +2927,306 @@
'state': 'off',
})
# ---
# name: test_coffee_system_binary_sensor_states[platforms0-coffee_system.json][binary_sensor.coffee_system_door-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.coffee_system_door',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Door',
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.DOOR: 'door'>,
'original_icon': None,
'original_name': 'Door',
'platform': 'miele',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'DummyAppliance_CoffeeSystem-state_signal_door',
'unit_of_measurement': None,
})
# ---
# name: test_coffee_system_binary_sensor_states[platforms0-coffee_system.json][binary_sensor.coffee_system_door-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'door',
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Coffee system Door',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.coffee_system_door',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_coffee_system_binary_sensor_states[platforms0-coffee_system.json][binary_sensor.coffee_system_mobile_start-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.coffee_system_mobile_start',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Mobile start',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Mobile start',
'platform': 'miele',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'mobile_start',
'unique_id': 'DummyAppliance_CoffeeSystem-state_mobile_start',
'unit_of_measurement': None,
})
# ---
# name: test_coffee_system_binary_sensor_states[platforms0-coffee_system.json][binary_sensor.coffee_system_mobile_start-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Coffee system Mobile start',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.coffee_system_mobile_start',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_coffee_system_binary_sensor_states[platforms0-coffee_system.json][binary_sensor.coffee_system_notification_active-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.coffee_system_notification_active',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Notification active',
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
'original_icon': None,
'original_name': 'Notification active',
'platform': 'miele',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'notification_active',
'unique_id': 'DummyAppliance_CoffeeSystem-state_signal_info',
'unit_of_measurement': None,
})
# ---
# name: test_coffee_system_binary_sensor_states[platforms0-coffee_system.json][binary_sensor.coffee_system_notification_active-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'problem',
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Coffee system Notification active',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.coffee_system_notification_active',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_coffee_system_binary_sensor_states[platforms0-coffee_system.json][binary_sensor.coffee_system_problem-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.coffee_system_problem',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Problem',
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
'original_icon': None,
'original_name': 'Problem',
'platform': 'miele',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'DummyAppliance_CoffeeSystem-state_signal_failure',
'unit_of_measurement': None,
})
# ---
# name: test_coffee_system_binary_sensor_states[platforms0-coffee_system.json][binary_sensor.coffee_system_problem-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'problem',
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Coffee system Problem',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.coffee_system_problem',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_coffee_system_binary_sensor_states[platforms0-coffee_system.json][binary_sensor.coffee_system_remote_control-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.coffee_system_remote_control',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Remote control',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Remote control',
'platform': 'miele',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'remote_control',
'unique_id': 'DummyAppliance_CoffeeSystem-state_full_remote_control',
'unit_of_measurement': None,
})
# ---
# name: test_coffee_system_binary_sensor_states[platforms0-coffee_system.json][binary_sensor.coffee_system_remote_control-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Coffee system Remote control',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.coffee_system_remote_control',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_coffee_system_binary_sensor_states[platforms0-coffee_system.json][binary_sensor.coffee_system_smart_grid-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.coffee_system_smart_grid',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Smart grid',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Smart grid',
'platform': 'miele',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'smart_grid',
'unique_id': 'DummyAppliance_CoffeeSystem-state_smart_grid',
'unit_of_measurement': None,
})
# ---
# name: test_coffee_system_binary_sensor_states[platforms0-coffee_system.json][binary_sensor.coffee_system_smart_grid-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Coffee system Smart grid',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.coffee_system_smart_grid',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
@@ -39,3 +39,18 @@ async def test_binary_sensor_states_api_push(
"""Test binary sensor state when the API pushes data via SSE."""
await snapshot_platform(hass, entity_registry, snapshot, setup_platform.entry_id)
@pytest.mark.parametrize("load_device_file", ["coffee_system.json"])
@pytest.mark.parametrize("platforms", [(BINARY_SENSOR_DOMAIN,)])
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_coffee_system_binary_sensor_states(
hass: HomeAssistant,
mock_miele_client: MagicMock,
snapshot: SnapshotAssertion,
entity_registry: er.EntityRegistry,
setup_platform: MockConfigEntry,
) -> None:
"""Test coffee system binary sensor state."""
await snapshot_platform(hass, entity_registry, snapshot, setup_platform.entry_id)