Add SmartThings water consumption sensor (#142765)

* Add SmartThings water consumption sensor

* Update water consumption sensor

* Partly revert changes UnitOfVolume

* Fix

* Fix

---------

Co-authored-by: Joostlek <joostlek@outlook.com>
This commit is contained in:
Wilbert 2025-04-30 19:58:39 +02:00 committed by GitHub
parent 9732b8c0dd
commit 24803b1e75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 67 additions and 0 deletions

View File

@ -990,6 +990,18 @@ CAPABILITY_TO_SENSORS: dict[
)
],
},
Capability.SAMSUNG_CE_WATER_CONSUMPTION_REPORT: {
Attribute.WATER_CONSUMPTION: [
SmartThingsSensorEntityDescription(
key=Attribute.WATER_CONSUMPTION,
translation_key="water_consumption",
state_class=SensorStateClass.TOTAL_INCREASING,
device_class=SensorDeviceClass.WATER,
native_unit_of_measurement=UnitOfVolume.LITERS,
value_fn=lambda value: value["cumulativeAmount"] / 1000,
)
]
},
}

View File

@ -487,6 +487,9 @@
"wrinkle_prevent": "[%key:component::smartthings::entity::sensor::dishwasher_job_state::state::wrinkle_prevent%]",
"freeze_protection": "Freeze protection"
}
},
"water_consumption": {
"name": "Water consumption"
}
},
"switch": {

View File

@ -8494,6 +8494,58 @@
'state': '0.0',
})
# ---
# name: test_all_entities[da_wm_wm_01011][sensor.machine_a_laver_water_consumption-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'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.machine_a_laver_water_consumption',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.WATER: 'water'>,
'original_icon': None,
'original_name': 'Water consumption',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'water_consumption',
'unique_id': 'b854ca5f-dc54-140d-6349-758b4d973c41_main_samsungce.waterConsumptionReport_waterConsumption_waterConsumption',
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>,
})
# ---
# name: test_all_entities[da_wm_wm_01011][sensor.machine_a_laver_water_consumption-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'water',
'friendly_name': 'Machine à Laver Water consumption',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>,
}),
'context': <ANY>,
'entity_id': 'sensor.machine_a_laver_water_consumption',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '1642.2',
})
# ---
# name: test_all_entities[ecobee_sensor][sensor.child_bedroom_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': set({