diff --git a/homeassistant/components/withings/sensor.py b/homeassistant/components/withings/sensor.py index b5b77144281..e5096701b48 100644 --- a/homeassistant/components/withings/sensor.py +++ b/homeassistant/components/withings/sensor.py @@ -193,6 +193,38 @@ MEASUREMENT_SENSORS: dict[ device_class=SensorDeviceClass.SPEED, state_class=SensorStateClass.MEASUREMENT, ), + MeasurementType.VO2: WithingsMeasurementSensorEntityDescription( + key="vo2_max", + measurement_type=MeasurementType.VO2, + translation_key="vo2_max", + native_unit_of_measurement="ml/min/kg", + state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, + ), + MeasurementType.EXTRACELLULAR_WATER: WithingsMeasurementSensorEntityDescription( + key="extracellular_water", + measurement_type=MeasurementType.EXTRACELLULAR_WATER, + translation_key="extracellular_water", + native_unit_of_measurement=UnitOfMass.KILOGRAMS, + device_class=SensorDeviceClass.WEIGHT, + state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, + ), + MeasurementType.INTRACELLULAR_WATER: WithingsMeasurementSensorEntityDescription( + key="intracellular_water", + measurement_type=MeasurementType.INTRACELLULAR_WATER, + translation_key="intracellular_water", + native_unit_of_measurement=UnitOfMass.KILOGRAMS, + device_class=SensorDeviceClass.WEIGHT, + state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, + ), + MeasurementType.VASCULAR_AGE: WithingsMeasurementSensorEntityDescription( + key="vascular_age", + measurement_type=MeasurementType.VASCULAR_AGE, + translation_key="vascular_age", + entity_registry_enabled_default=False, + ), } diff --git a/homeassistant/components/withings/strings.json b/homeassistant/components/withings/strings.json index a9ba69ad045..020509064b3 100644 --- a/homeassistant/components/withings/strings.json +++ b/homeassistant/components/withings/strings.json @@ -72,6 +72,18 @@ "pulse_wave_velocity": { "name": "Pulse wave velocity" }, + "vo2_max": { + "name": "VO2 max" + }, + "extracellular_water": { + "name": "Extracellular water" + }, + "intracellular_water": { + "name": "Intracellular water" + }, + "vascular_age": { + "name": "Vascular age" + }, "breathing_disturbances_intensity": { "name": "Breathing disturbances intensity" }, diff --git a/tests/components/withings/fixtures/get_meas.json b/tests/components/withings/fixtures/get_meas.json index 1776ba8ff8a..d473b61c274 100644 --- a/tests/components/withings/fixtures/get_meas.json +++ b/tests/components/withings/fixtures/get_meas.json @@ -93,6 +93,26 @@ "type": 91, "unit": 0, "value": 100 + }, + { + "type": 123, + "unit": 0, + "value": 100 + }, + { + "type": 155, + "unit": 0, + "value": 100 + }, + { + "type": 168, + "unit": 0, + "value": 100 + }, + { + "type": 169, + "unit": 0, + "value": 100 } ], "modelid": 45, diff --git a/tests/components/withings/snapshots/test_diagnostics.ambr b/tests/components/withings/snapshots/test_diagnostics.ambr index c65c321a5ef..3b6a5390bd6 100644 --- a/tests/components/withings/snapshots/test_diagnostics.ambr +++ b/tests/components/withings/snapshots/test_diagnostics.ambr @@ -20,6 +20,10 @@ 54, 77, 91, + 123, + 155, + 168, + 169, ]), 'received_sleep_data': True, 'webhooks_connected': True, @@ -46,6 +50,10 @@ 54, 77, 91, + 123, + 155, + 168, + 169, ]), 'received_sleep_data': True, 'webhooks_connected': False, @@ -72,6 +80,10 @@ 54, 77, 91, + 123, + 155, + 168, + 169, ]), 'received_sleep_data': True, 'webhooks_connected': True, diff --git a/tests/components/withings/snapshots/test_sensor.ambr b/tests/components/withings/snapshots/test_sensor.ambr index c44ef6965f4..6a0bee0fbc8 100644 --- a/tests/components/withings/snapshots/test_sensor.ambr +++ b/tests/components/withings/snapshots/test_sensor.ambr @@ -120,62 +120,57 @@ # name: test_all_entities.16 StateSnapshot({ 'attributes': ReadOnlyDict({ - 'friendly_name': 'henk Breathing disturbances intensity', + 'friendly_name': 'henk VO2 max', 'state_class': , + 'unit_of_measurement': 'ml/min/kg', }), 'context': , - 'entity_id': 'sensor.henk_breathing_disturbances_intensity', + 'entity_id': 'sensor.henk_vo2_max', 'last_changed': , 'last_updated': , - 'state': '10', + 'state': '100', }) # --- # name: test_all_entities.17 StateSnapshot({ 'attributes': ReadOnlyDict({ - 'device_class': 'duration', - 'friendly_name': 'henk Deep sleep', - 'icon': 'mdi:sleep', - 'state_class': , - 'unit_of_measurement': , + 'friendly_name': 'henk Vascular age', }), 'context': , - 'entity_id': 'sensor.henk_deep_sleep', + 'entity_id': 'sensor.henk_vascular_age', 'last_changed': , 'last_updated': , - 'state': '26220', + 'state': '100', }) # --- # name: test_all_entities.18 StateSnapshot({ 'attributes': ReadOnlyDict({ - 'device_class': 'duration', - 'friendly_name': 'henk Time to sleep', - 'icon': 'mdi:sleep', + 'device_class': 'weight', + 'friendly_name': 'henk Extracellular water', 'state_class': , - 'unit_of_measurement': , + 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.henk_time_to_sleep', + 'entity_id': 'sensor.henk_extracellular_water', 'last_changed': , 'last_updated': , - 'state': '780', + 'state': '100', }) # --- # name: test_all_entities.19 StateSnapshot({ 'attributes': ReadOnlyDict({ - 'device_class': 'duration', - 'friendly_name': 'henk Time to wakeup', - 'icon': 'mdi:sleep-off', + 'device_class': 'weight', + 'friendly_name': 'henk Intracellular water', 'state_class': , - 'unit_of_measurement': , + 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.henk_time_to_wakeup', + 'entity_id': 'sensor.henk_intracellular_water', 'last_changed': , 'last_updated': , - 'state': '996', + 'state': '100', }) # --- # name: test_all_entities.2 @@ -194,6 +189,67 @@ }) # --- # name: test_all_entities.20 + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'henk Breathing disturbances intensity', + 'state_class': , + }), + 'context': , + 'entity_id': 'sensor.henk_breathing_disturbances_intensity', + 'last_changed': , + 'last_updated': , + 'state': '10', + }) +# --- +# name: test_all_entities.21 + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'duration', + 'friendly_name': 'henk Deep sleep', + 'icon': 'mdi:sleep', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.henk_deep_sleep', + 'last_changed': , + 'last_updated': , + 'state': '26220', + }) +# --- +# name: test_all_entities.22 + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'duration', + 'friendly_name': 'henk Time to sleep', + 'icon': 'mdi:sleep', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.henk_time_to_sleep', + 'last_changed': , + 'last_updated': , + 'state': '780', + }) +# --- +# name: test_all_entities.23 + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'duration', + 'friendly_name': 'henk Time to wakeup', + 'icon': 'mdi:sleep-off', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.henk_time_to_wakeup', + 'last_changed': , + 'last_updated': , + 'state': '996', + }) +# --- +# name: test_all_entities.24 StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'henk Average heart rate', @@ -208,7 +264,7 @@ 'state': '83', }) # --- -# name: test_all_entities.21 +# name: test_all_entities.25 StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'henk Maximum heart rate', @@ -223,7 +279,7 @@ 'state': '108', }) # --- -# name: test_all_entities.22 +# name: test_all_entities.26 StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'henk Minimum heart rate', @@ -238,7 +294,7 @@ 'state': '58', }) # --- -# name: test_all_entities.23 +# name: test_all_entities.27 StateSnapshot({ 'attributes': ReadOnlyDict({ 'device_class': 'duration', @@ -254,7 +310,7 @@ 'state': '58440', }) # --- -# name: test_all_entities.24 +# name: test_all_entities.28 StateSnapshot({ 'attributes': ReadOnlyDict({ 'device_class': 'duration', @@ -270,7 +326,7 @@ 'state': '17280', }) # --- -# name: test_all_entities.25 +# name: test_all_entities.29 StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'henk Average respiratory rate', @@ -284,62 +340,6 @@ 'state': '14', }) # --- -# name: test_all_entities.26 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'henk Maximum respiratory rate', - 'state_class': , - 'unit_of_measurement': 'br/min', - }), - 'context': , - 'entity_id': 'sensor.henk_maximum_respiratory_rate', - 'last_changed': , - 'last_updated': , - 'state': '20', - }) -# --- -# name: test_all_entities.27 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'henk Minimum respiratory rate', - 'state_class': , - 'unit_of_measurement': 'br/min', - }), - 'context': , - 'entity_id': 'sensor.henk_minimum_respiratory_rate', - 'last_changed': , - 'last_updated': , - 'state': '10', - }) -# --- -# name: test_all_entities.28 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'henk Sleep score', - 'icon': 'mdi:medal', - 'state_class': , - 'unit_of_measurement': 'points', - }), - 'context': , - 'entity_id': 'sensor.henk_sleep_score', - 'last_changed': , - 'last_updated': , - 'state': '90', - }) -# --- -# name: test_all_entities.29 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'henk Snoring', - 'state_class': , - }), - 'context': , - 'entity_id': 'sensor.henk_snoring', - 'last_changed': , - 'last_updated': , - 'state': '1044', - }) -# --- # name: test_all_entities.3 StateSnapshot({ 'attributes': ReadOnlyDict({ @@ -356,6 +356,62 @@ }) # --- # name: test_all_entities.30 + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'henk Maximum respiratory rate', + 'state_class': , + 'unit_of_measurement': 'br/min', + }), + 'context': , + 'entity_id': 'sensor.henk_maximum_respiratory_rate', + 'last_changed': , + 'last_updated': , + 'state': '20', + }) +# --- +# name: test_all_entities.31 + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'henk Minimum respiratory rate', + 'state_class': , + 'unit_of_measurement': 'br/min', + }), + 'context': , + 'entity_id': 'sensor.henk_minimum_respiratory_rate', + 'last_changed': , + 'last_updated': , + 'state': '10', + }) +# --- +# name: test_all_entities.32 + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'henk Sleep score', + 'icon': 'mdi:medal', + 'state_class': , + 'unit_of_measurement': 'points', + }), + 'context': , + 'entity_id': 'sensor.henk_sleep_score', + 'last_changed': , + 'last_updated': , + 'state': '90', + }) +# --- +# name: test_all_entities.33 + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'henk Snoring', + 'state_class': , + }), + 'context': , + 'entity_id': 'sensor.henk_snoring', + 'last_changed': , + 'last_updated': , + 'state': '1044', + }) +# --- +# name: test_all_entities.34 StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'henk Snoring episode count', @@ -368,7 +424,7 @@ 'state': '87', }) # --- -# name: test_all_entities.31 +# name: test_all_entities.35 StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'henk Wakeup count', @@ -383,7 +439,7 @@ 'state': '8', }) # --- -# name: test_all_entities.32 +# name: test_all_entities.36 StateSnapshot({ 'attributes': ReadOnlyDict({ 'device_class': 'duration', @@ -399,163 +455,6 @@ 'state': '3468', }) # --- -# name: test_all_entities.33 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Withings sleep_breathing_disturbances_intensity henk', - 'state_class': , - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_breathing_disturbances_intensity_henk', - 'last_changed': , - 'last_updated': , - 'state': '160.0', - }) -# --- -# name: test_all_entities.34 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_deep_duration_seconds_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': , - 'original_icon': 'mdi:sleep', - 'original_name': 'Withings sleep_deep_duration_seconds henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_deep_duration_seconds', - 'unit_of_measurement': , - }) -# --- -# name: test_all_entities.35 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'device_class': 'duration', - 'friendly_name': 'Withings sleep_deep_duration_seconds henk', - 'icon': 'mdi:sleep', - 'state_class': , - 'unit_of_measurement': , - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_deep_duration_seconds_henk', - 'last_changed': , - 'last_updated': , - 'state': '322', - }) -# --- -# name: test_all_entities.36 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_tosleep_duration_seconds_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': , - 'original_icon': 'mdi:sleep', - 'original_name': 'Withings sleep_tosleep_duration_seconds henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_tosleep_duration_seconds', - 'unit_of_measurement': , - }) -# --- -# name: test_all_entities.37 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'device_class': 'duration', - 'friendly_name': 'Withings sleep_tosleep_duration_seconds henk', - 'icon': 'mdi:sleep', - 'state_class': , - 'unit_of_measurement': , - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_tosleep_duration_seconds_henk', - 'last_changed': , - 'last_updated': , - 'state': '162.0', - }) -# --- -# name: test_all_entities.38 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_towakeup_duration_seconds_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': , - 'original_icon': 'mdi:sleep-off', - 'original_name': 'Withings sleep_towakeup_duration_seconds henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_towakeup_duration_seconds', - 'unit_of_measurement': , - }) -# --- -# name: test_all_entities.39 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'device_class': 'duration', - 'friendly_name': 'Withings sleep_towakeup_duration_seconds henk', - 'icon': 'mdi:sleep-off', - 'state_class': , - 'unit_of_measurement': , - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_towakeup_duration_seconds_henk', - 'last_changed': , - 'last_updated': , - 'state': '163.0', - }) -# --- # name: test_all_entities.4 StateSnapshot({ 'attributes': ReadOnlyDict({ @@ -572,243 +471,6 @@ 'state': '10', }) # --- -# name: test_all_entities.40 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_heart_rate_average_bpm_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': None, - 'original_icon': 'mdi:heart-pulse', - 'original_name': 'Withings sleep_heart_rate_average_bpm henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_heart_rate_average_bpm', - 'unit_of_measurement': 'bpm', - }) -# --- -# name: test_all_entities.41 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Withings sleep_heart_rate_average_bpm henk', - 'icon': 'mdi:heart-pulse', - 'state_class': , - 'unit_of_measurement': 'bpm', - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_heart_rate_average_bpm_henk', - 'last_changed': , - 'last_updated': , - 'state': '164.0', - }) -# --- -# name: test_all_entities.42 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_heart_rate_max_bpm_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': None, - 'original_icon': 'mdi:heart-pulse', - 'original_name': 'Withings sleep_heart_rate_max_bpm henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_heart_rate_max_bpm', - 'unit_of_measurement': 'bpm', - }) -# --- -# name: test_all_entities.43 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Withings sleep_heart_rate_max_bpm henk', - 'icon': 'mdi:heart-pulse', - 'state_class': , - 'unit_of_measurement': 'bpm', - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_heart_rate_max_bpm_henk', - 'last_changed': , - 'last_updated': , - 'state': '165.0', - }) -# --- -# name: test_all_entities.44 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_heart_rate_min_bpm_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': None, - 'original_icon': 'mdi:heart-pulse', - 'original_name': 'Withings sleep_heart_rate_min_bpm henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_heart_rate_min_bpm', - 'unit_of_measurement': 'bpm', - }) -# --- -# name: test_all_entities.45 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Withings sleep_heart_rate_min_bpm henk', - 'icon': 'mdi:heart-pulse', - 'state_class': , - 'unit_of_measurement': 'bpm', - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_heart_rate_min_bpm_henk', - 'last_changed': , - 'last_updated': , - 'state': '166.0', - }) -# --- -# name: test_all_entities.46 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_light_duration_seconds_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': , - 'original_icon': 'mdi:sleep', - 'original_name': 'Withings sleep_light_duration_seconds henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_light_duration_seconds', - 'unit_of_measurement': , - }) -# --- -# name: test_all_entities.47 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'device_class': 'duration', - 'friendly_name': 'Withings sleep_light_duration_seconds henk', - 'icon': 'mdi:sleep', - 'state_class': , - 'unit_of_measurement': , - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_light_duration_seconds_henk', - 'last_changed': , - 'last_updated': , - 'state': '334', - }) -# --- -# name: test_all_entities.48 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_rem_duration_seconds_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': , - 'original_icon': 'mdi:sleep', - 'original_name': 'Withings sleep_rem_duration_seconds henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_rem_duration_seconds', - 'unit_of_measurement': , - }) -# --- -# name: test_all_entities.49 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'device_class': 'duration', - 'friendly_name': 'Withings sleep_rem_duration_seconds henk', - 'icon': 'mdi:sleep', - 'state_class': , - 'unit_of_measurement': , - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_rem_duration_seconds_henk', - 'last_changed': , - 'last_updated': , - 'state': '336', - }) -# --- # name: test_all_entities.5 StateSnapshot({ 'attributes': ReadOnlyDict({ @@ -824,236 +486,6 @@ 'state': '2', }) # --- -# name: test_all_entities.50 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_respiratory_average_bpm_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': None, - 'original_icon': None, - 'original_name': 'Withings sleep_respiratory_average_bpm henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_respiratory_average_bpm', - 'unit_of_measurement': 'br/min', - }) -# --- -# name: test_all_entities.51 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Withings sleep_respiratory_average_bpm henk', - 'state_class': , - 'unit_of_measurement': 'br/min', - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_respiratory_average_bpm_henk', - 'last_changed': , - 'last_updated': , - 'state': '169.0', - }) -# --- -# name: test_all_entities.52 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_respiratory_max_bpm_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': None, - 'original_icon': None, - 'original_name': 'Withings sleep_respiratory_max_bpm henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_respiratory_max_bpm', - 'unit_of_measurement': 'br/min', - }) -# --- -# name: test_all_entities.53 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Withings sleep_respiratory_max_bpm henk', - 'state_class': , - 'unit_of_measurement': 'br/min', - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_respiratory_max_bpm_henk', - 'last_changed': , - 'last_updated': , - 'state': '170.0', - }) -# --- -# name: test_all_entities.54 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_respiratory_min_bpm_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': None, - 'original_icon': None, - 'original_name': 'Withings sleep_respiratory_min_bpm henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_respiratory_min_bpm', - 'unit_of_measurement': 'br/min', - }) -# --- -# name: test_all_entities.55 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Withings sleep_respiratory_min_bpm henk', - 'state_class': , - 'unit_of_measurement': 'br/min', - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_respiratory_min_bpm_henk', - 'last_changed': , - 'last_updated': , - 'state': '171.0', - }) -# --- -# name: test_all_entities.56 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_score_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': None, - 'original_icon': 'mdi:medal', - 'original_name': 'Withings sleep_score henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_score', - 'unit_of_measurement': 'points', - }) -# --- -# name: test_all_entities.57 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Withings sleep_score henk', - 'icon': 'mdi:medal', - 'state_class': , - 'unit_of_measurement': 'points', - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_score_henk', - 'last_changed': , - 'last_updated': , - 'state': '222', - }) -# --- -# name: test_all_entities.58 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_snoring_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': None, - 'original_icon': None, - 'original_name': 'Withings sleep_snoring henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_snoring', - 'unit_of_measurement': None, - }) -# --- -# name: test_all_entities.59 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Withings sleep_snoring henk', - 'state_class': , - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_snoring_henk', - 'last_changed': , - 'last_updated': , - 'state': '173.0', - }) -# --- # name: test_all_entities.6 StateSnapshot({ 'attributes': ReadOnlyDict({ @@ -1069,146 +501,6 @@ 'state': '40', }) # --- -# name: test_all_entities.60 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_snoring_eposode_count_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': None, - 'original_icon': None, - 'original_name': 'Withings sleep_snoring_eposode_count henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_snoring_eposode_count', - 'unit_of_measurement': None, - }) -# --- -# name: test_all_entities.61 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Withings sleep_snoring_eposode_count henk', - 'state_class': , - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_snoring_eposode_count_henk', - 'last_changed': , - 'last_updated': , - 'state': '348', - }) -# --- -# name: test_all_entities.62 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_wakeup_count_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': None, - 'original_icon': 'mdi:sleep-off', - 'original_name': 'Withings sleep_wakeup_count henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_wakeup_count', - 'unit_of_measurement': 'times', - }) -# --- -# name: test_all_entities.63 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Withings sleep_wakeup_count henk', - 'icon': 'mdi:sleep-off', - 'state_class': , - 'unit_of_measurement': 'times', - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_wakeup_count_henk', - 'last_changed': , - 'last_updated': , - 'state': '350', - }) -# --- -# name: test_all_entities.64 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.withings_sleep_wakeup_duration_seconds_henk', - 'has_entity_name': False, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': , - 'original_icon': 'mdi:sleep-off', - 'original_name': 'Withings sleep_wakeup_duration_seconds henk', - 'platform': 'withings', - 'supported_features': 0, - 'translation_key': None, - 'unique_id': 'withings_12345_sleep_wakeup_duration_seconds', - 'unit_of_measurement': , - }) -# --- -# name: test_all_entities.65 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'device_class': 'duration', - 'friendly_name': 'Withings sleep_wakeup_duration_seconds henk', - 'icon': 'mdi:sleep-off', - 'state_class': , - 'unit_of_measurement': , - }), - 'context': , - 'entity_id': 'sensor.withings_sleep_wakeup_duration_seconds_henk', - 'last_changed': , - 'last_updated': , - 'state': '176.0', - }) -# --- # name: test_all_entities.7 StateSnapshot({ 'attributes': ReadOnlyDict({ diff --git a/tests/components/withings/test_sensor.py b/tests/components/withings/test_sensor.py index 96a0397257d..8351598df69 100644 --- a/tests/components/withings/test_sensor.py +++ b/tests/components/withings/test_sensor.py @@ -36,8 +36,9 @@ async def test_all_entities( ) for entity in entities: - if entity.platform == Platform.SENSOR: + if entity.domain == Platform.SENSOR: assert hass.states.get(entity.entity_id) == snapshot + assert entities async def test_update_failed(