mirror of
https://github.com/home-assistant/core.git
synced 2026-09-24 23:41:48 -05:00
Add binary sensor for full dust bag in SmartThings (#164457)
This commit is contained in:
@@ -36,6 +36,7 @@ class SmartThingsBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||
| None
|
||||
) = None
|
||||
component_translation_key: dict[str, str] | None = None
|
||||
supported_states_attributes: Attribute | None = None
|
||||
|
||||
|
||||
CAPABILITY_TO_SENSORS: dict[
|
||||
@@ -188,6 +189,17 @@ CAPABILITY_TO_SENSORS: dict[
|
||||
},
|
||||
)
|
||||
},
|
||||
Capability.SAMSUNG_CE_ROBOT_CLEANER_DUST_BAG: {
|
||||
Attribute.STATUS: SmartThingsBinarySensorEntityDescription(
|
||||
key=Attribute.STATUS,
|
||||
is_on_key="full",
|
||||
component_translation_key={
|
||||
"station": "robot_cleaner_dust_bag",
|
||||
},
|
||||
exists_fn=lambda component, _: component == "station",
|
||||
supported_states_attributes=Attribute.SUPPORTED_STATUS,
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -237,6 +249,18 @@ async def async_setup_entry(
|
||||
not description.category
|
||||
or get_main_component_category(device) in description.category
|
||||
)
|
||||
and (
|
||||
not description.supported_states_attributes
|
||||
or (
|
||||
isinstance(
|
||||
options := device.status[component][capability][
|
||||
description.supported_states_attributes
|
||||
].value,
|
||||
list,
|
||||
)
|
||||
and len(options) == 2
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
"state": {
|
||||
"on": "mdi:remote"
|
||||
}
|
||||
},
|
||||
"robot_cleaner_dust_bag": {
|
||||
"default": "mdi:delete"
|
||||
}
|
||||
},
|
||||
"button": {
|
||||
|
||||
@@ -76,6 +76,9 @@
|
||||
"remote_control": {
|
||||
"name": "Remote control"
|
||||
},
|
||||
"robot_cleaner_dust_bag": {
|
||||
"name": "Dust bag full"
|
||||
},
|
||||
"sub_remote_control": {
|
||||
"name": "Upper washer remote control"
|
||||
},
|
||||
|
||||
@@ -1836,6 +1836,55 @@
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[da_rvc_map_01011][binary_sensor.robot_vacuum_dust_bag_full-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'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.robot_vacuum_dust_bag_full',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Dust bag full',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Dust bag full',
|
||||
'platform': 'smartthings',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'robot_cleaner_dust_bag',
|
||||
'unique_id': '01b28624-5907-c8bc-0325-8ad23f03a637_station_samsungce.robotCleanerDustBag_status_status',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[da_rvc_map_01011][binary_sensor.robot_vacuum_dust_bag_full-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Robot Vacuum Dust bag full',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.robot_vacuum_dust_bag_full',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[da_wm_dw_000001][binary_sensor.dishwasher_child_lock-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
|
||||
Reference in New Issue
Block a user