Add water filter replacement and usage sensors to SmartThings (#147279)

* Add "Filter status" binary sensor for Samsung refrigerators

* Add "Water filter usage" sensor for Samsung refrigerators
This commit is contained in:
msw 2025-06-22 14:57:02 -07:00 committed by GitHub
parent 75946065f2
commit fcba1183f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 324 additions and 0 deletions

View File

@ -80,6 +80,14 @@ CAPABILITY_TO_SENSORS: dict[
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
) )
}, },
Capability.CUSTOM_WATER_FILTER: {
Attribute.WATER_FILTER_STATUS: SmartThingsBinarySensorEntityDescription(
key=Attribute.WATER_FILTER_STATUS,
translation_key="filter_status",
device_class=BinarySensorDeviceClass.PROBLEM,
is_on_key="replace",
)
},
Capability.SAMSUNG_CE_STEAM_CLOSET_KEEP_FRESH_MODE: { Capability.SAMSUNG_CE_STEAM_CLOSET_KEEP_FRESH_MODE: {
Attribute.OPERATING_STATE: SmartThingsBinarySensorEntityDescription( Attribute.OPERATING_STATE: SmartThingsBinarySensorEntityDescription(
key=Attribute.OPERATING_STATE, key=Attribute.OPERATING_STATE,

View File

@ -325,6 +325,16 @@ CAPABILITY_TO_SENSORS: dict[
) )
] ]
}, },
Capability.CUSTOM_WATER_FILTER: {
Attribute.WATER_FILTER_USAGE: [
SmartThingsSensorEntityDescription(
key=Attribute.WATER_FILTER_USAGE,
translation_key="water_filter_usage",
native_unit_of_measurement=PERCENTAGE,
state_class=SensorStateClass.MEASUREMENT,
)
]
},
Capability.DISHWASHER_OPERATING_STATE: { Capability.DISHWASHER_OPERATING_STATE: {
Attribute.MACHINE_STATE: [ Attribute.MACHINE_STATE: [
SmartThingsSensorEntityDescription( SmartThingsSensorEntityDescription(

View File

@ -595,6 +595,9 @@
}, },
"water_consumption": { "water_consumption": {
"name": "Water consumption" "name": "Water consumption"
},
"water_filter_usage": {
"name": "Water filter usage"
} }
}, },
"switch": { "switch": {

View File

@ -679,6 +679,55 @@
'state': 'on', 'state': 'on',
}) })
# --- # ---
# name: test_all_entities[da_ref_normal_000001][binary_sensor.refrigerator_filter_status-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.refrigerator_filter_status',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
'original_icon': None,
'original_name': 'Filter status',
'platform': 'smartthings',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'filter_status',
'unique_id': '7db87911-7dce-1cf2-7119-b953432a2f09_main_custom.waterFilter_waterFilterStatus_waterFilterStatus',
'unit_of_measurement': None,
})
# ---
# name: test_all_entities[da_ref_normal_000001][binary_sensor.refrigerator_filter_status-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'problem',
'friendly_name': 'Refrigerator Filter status',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.refrigerator_filter_status',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_all_entities[da_ref_normal_000001][binary_sensor.refrigerator_freezer_door-entry] # name: test_all_entities[da_ref_normal_000001][binary_sensor.refrigerator_freezer_door-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({
@ -826,6 +875,55 @@
'state': 'off', 'state': 'off',
}) })
# --- # ---
# name: test_all_entities[da_ref_normal_01001][binary_sensor.refrigerator_filter_status-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.refrigerator_filter_status',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
'original_icon': None,
'original_name': 'Filter status',
'platform': 'smartthings',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'filter_status',
'unique_id': '7d3feb98-8a36-4351-c362-5e21ad3a78dd_main_custom.waterFilter_waterFilterStatus_waterFilterStatus',
'unit_of_measurement': None,
})
# ---
# name: test_all_entities[da_ref_normal_01001][binary_sensor.refrigerator_filter_status-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'problem',
'friendly_name': 'Refrigerator Filter status',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.refrigerator_filter_status',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_all_entities[da_ref_normal_01001][binary_sensor.refrigerator_freezer_door-entry] # name: test_all_entities[da_ref_normal_01001][binary_sensor.refrigerator_freezer_door-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({
@ -924,6 +1022,55 @@
'state': 'off', 'state': 'off',
}) })
# --- # ---
# name: test_all_entities[da_ref_normal_01011][binary_sensor.frigo_filter_status-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.frigo_filter_status',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
'original_icon': None,
'original_name': 'Filter status',
'platform': 'smartthings',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'filter_status',
'unique_id': '5758b2ec-563e-f39b-ec39-208e54aabf60_main_custom.waterFilter_waterFilterStatus_waterFilterStatus',
'unit_of_measurement': None,
})
# ---
# name: test_all_entities[da_ref_normal_01011][binary_sensor.frigo_filter_status-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'problem',
'friendly_name': 'Frigo Filter status',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.frigo_filter_status',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_all_entities[da_ref_normal_01011][binary_sensor.frigo_freezer_door-entry] # name: test_all_entities[da_ref_normal_01011][binary_sensor.frigo_freezer_door-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({

View File

@ -5122,6 +5122,58 @@
'state': '0.0135559777781698', 'state': '0.0135559777781698',
}) })
# --- # ---
# name: test_all_entities[da_ref_normal_000001][sensor.refrigerator_water_filter_usage-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.refrigerator_water_filter_usage',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Water filter usage',
'platform': 'smartthings',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'water_filter_usage',
'unique_id': '7db87911-7dce-1cf2-7119-b953432a2f09_main_custom.waterFilter_waterFilterUsage_waterFilterUsage',
'unit_of_measurement': '%',
})
# ---
# name: test_all_entities[da_ref_normal_000001][sensor.refrigerator_water_filter_usage-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Refrigerator Water filter usage',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': '%',
}),
'context': <ANY>,
'entity_id': 'sensor.refrigerator_water_filter_usage',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '100',
})
# ---
# name: test_all_entities[da_ref_normal_01001][sensor.refrigerator_energy-entry] # name: test_all_entities[da_ref_normal_01001][sensor.refrigerator_energy-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({
@ -5516,6 +5568,58 @@
'state': '0.0270189050030708', 'state': '0.0270189050030708',
}) })
# --- # ---
# name: test_all_entities[da_ref_normal_01001][sensor.refrigerator_water_filter_usage-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.refrigerator_water_filter_usage',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Water filter usage',
'platform': 'smartthings',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'water_filter_usage',
'unique_id': '7d3feb98-8a36-4351-c362-5e21ad3a78dd_main_custom.waterFilter_waterFilterUsage_waterFilterUsage',
'unit_of_measurement': '%',
})
# ---
# name: test_all_entities[da_ref_normal_01001][sensor.refrigerator_water_filter_usage-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Refrigerator Water filter usage',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': '%',
}),
'context': <ANY>,
'entity_id': 'sensor.refrigerator_water_filter_usage',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '52',
})
# ---
# name: test_all_entities[da_ref_normal_01011][sensor.frigo_energy-entry] # name: test_all_entities[da_ref_normal_01011][sensor.frigo_energy-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({
@ -5910,6 +6014,58 @@
'state': '0.0143511805540986', 'state': '0.0143511805540986',
}) })
# --- # ---
# name: test_all_entities[da_ref_normal_01011][sensor.frigo_water_filter_usage-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.frigo_water_filter_usage',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Water filter usage',
'platform': 'smartthings',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'water_filter_usage',
'unique_id': '5758b2ec-563e-f39b-ec39-208e54aabf60_main_custom.waterFilter_waterFilterUsage_waterFilterUsage',
'unit_of_measurement': '%',
})
# ---
# name: test_all_entities[da_ref_normal_01011][sensor.frigo_water_filter_usage-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Frigo Water filter usage',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': '%',
}),
'context': <ANY>,
'entity_id': 'sensor.frigo_water_filter_usage',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '97',
})
# ---
# name: test_all_entities[da_rvc_normal_000001][sensor.robot_vacuum_battery-entry] # name: test_all_entities[da_rvc_normal_000001][sensor.robot_vacuum_battery-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({