diff --git a/homeassistant/components/withings/sensor.py b/homeassistant/components/withings/sensor.py index 96cb433deba..28a0fbd1492 100644 --- a/homeassistant/components/withings/sensor.py +++ b/homeassistant/components/withings/sensor.py @@ -425,6 +425,9 @@ SLEEP_SENSORS = [ key="sleep_snoring", value_fn=lambda sleep_summary: sleep_summary.snoring, translation_key="snoring", + native_unit_of_measurement=UnitOfTime.SECONDS, + suggested_unit_of_measurement=UnitOfTime.MINUTES, + device_class=SensorDeviceClass.DURATION, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), diff --git a/tests/components/withings/snapshots/test_sensor.ambr b/tests/components/withings/snapshots/test_sensor.ambr index 543cba05e21..ec9fc1ed3fc 100644 --- a/tests/components/withings/snapshots/test_sensor.ambr +++ b/tests/components/withings/snapshots/test_sensor.ambr @@ -3198,8 +3198,11 @@ }), 'name': None, 'options': dict({ + 'sensor.private': dict({ + 'suggested_unit_of_measurement': , + }), }), - 'original_device_class': None, + 'original_device_class': , 'original_icon': None, 'original_name': 'Snoring', 'platform': 'withings', @@ -3207,21 +3210,23 @@ 'supported_features': 0, 'translation_key': 'snoring', 'unique_id': 'withings_12345_sleep_snoring', - 'unit_of_measurement': None, + 'unit_of_measurement': , }) # --- # name: test_all_entities[sensor.henk_snoring-state] StateSnapshot({ 'attributes': ReadOnlyDict({ + 'device_class': 'duration', 'friendly_name': 'henk Snoring', 'state_class': , + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.henk_snoring', 'last_changed': , 'last_reported': , 'last_updated': , - 'state': '1080', + 'state': '18.0', }) # --- # name: test_all_entities[sensor.henk_snoring_episode_count-entry]