diff --git a/homeassistant/components/tuya/number.py b/homeassistant/components/tuya/number.py index 68777d75a90..5aee426da8c 100644 --- a/homeassistant/components/tuya/number.py +++ b/homeassistant/components/tuya/number.py @@ -381,6 +381,8 @@ class TuyaNumberEntity(TuyaEntity, NumberEntity): self._attr_native_max_value = self._number.max_scaled self._attr_native_min_value = self._number.min_scaled self._attr_native_step = self._number.step_scaled + if description.native_unit_of_measurement is None: + self._attr_native_unit_of_measurement = int_type.unit # Logic to ensure the set device class and API received Unit Of Measurement # match Home Assistants requirements. diff --git a/tests/components/tuya/snapshots/test_number.ambr b/tests/components/tuya/snapshots/test_number.ambr index 125a0680de9..1b19d5827ab 100644 --- a/tests/components/tuya/snapshots/test_number.ambr +++ b/tests/components/tuya/snapshots/test_number.ambr @@ -95,7 +95,7 @@ 'supported_features': 0, 'translation_key': 'feed', 'unique_id': 'tuya.bfd0273e59494eb34esvrxmanual_feed', - 'unit_of_measurement': None, + 'unit_of_measurement': '', }) # --- # name: test_platform_setup_and_discovery[cwwsq_cleverio_pf100][number.cleverio_pf100_feed-state] @@ -106,6 +106,7 @@ 'min': 1.0, 'mode': , 'step': 1.0, + 'unit_of_measurement': '', }), 'context': , 'entity_id': 'number.cleverio_pf100_feed', @@ -152,7 +153,7 @@ 'supported_features': 0, 'translation_key': 'temp_correction', 'unique_id': 'tuya.bfb45cb8a9452fba66lexgtemp_correction', - 'unit_of_measurement': None, + 'unit_of_measurement': '℃', }) # --- # name: test_platform_setup_and_discovery[wk_wifi_smart_gas_boiler_thermostat][number.wifi_smart_gas_boiler_thermostat_temperature_correction-state] @@ -163,6 +164,7 @@ 'min': -9.9, 'mode': , 'step': 0.1, + 'unit_of_measurement': '℃', }), 'context': , 'entity_id': 'number.wifi_smart_gas_boiler_thermostat_temperature_correction',