diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py index 2b598a83277..ab963ad6b38 100644 --- a/homeassistant/components/tuya/const.py +++ b/homeassistant/components/tuya/const.py @@ -84,6 +84,7 @@ DEVICE_CLASS_TUYA_LIGHT_MODE = "tuya__light_mode" DEVICE_CLASS_TUYA_MOTION_SENSITIVITY = "tuya__motion_sensitivity" DEVICE_CLASS_TUYA_RECORD_MODE = "tuya__record_mode" DEVICE_CLASS_TUYA_RELAY_STATUS = "tuya__relay_status" +DEVICE_CLASS_TUYA_STATUS = "tuya__status" TUYA_DISCOVERY_NEW = "tuya_discovery_new" TUYA_HA_SIGNAL_UPDATE_ENTITY = "tuya_entry_update" @@ -285,6 +286,8 @@ class DPCode(str, Enum): SWITCH_USB6 = "switch_usb6" # USB 6 SWITCH_VERTICAL = "switch_vertical" # Vertical swing flap switch SWITCH_VOICE = "switch_voice" # Voice switch + TEMP_BOILING_C = "temp_boiling_c" + TEMP_BOILING_F = "temp_boiling_f" TEMP_CONTROLLER = "temp_controller" TEMP_CURRENT = "temp_current" # Current temperature in °C TEMP_CURRENT_F = "temp_current_f" # Current temperature in °F diff --git a/homeassistant/components/tuya/number.py b/homeassistant/components/tuya/number.py index c69756d2998..c724f6e79a3 100644 --- a/homeassistant/components/tuya/number.py +++ b/homeassistant/components/tuya/number.py @@ -21,6 +21,40 @@ from .const import DOMAIN, TUYA_DISCOVERY_NEW, DPCode # default instructions set of each category end up being a number. # https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = { + # Smart Kettle + # https://developer.tuya.com/en/docs/iot/fbh?id=K9gf484m21yq7 + "bh": ( + NumberEntityDescription( + key=DPCode.TEMP_SET, + name="Temperature", + icon="mdi:thermometer", + entity_category=ENTITY_CATEGORY_CONFIG, + ), + NumberEntityDescription( + key=DPCode.TEMP_SET_F, + name="Temperature", + icon="mdi:thermometer", + entity_category=ENTITY_CATEGORY_CONFIG, + ), + NumberEntityDescription( + key=DPCode.TEMP_BOILING_C, + name="Temperature After Boiling", + icon="mdi:thermometer", + entity_category=ENTITY_CATEGORY_CONFIG, + ), + NumberEntityDescription( + key=DPCode.TEMP_BOILING_F, + name="Temperature After Boiling", + icon="mdi:thermometer", + entity_category=ENTITY_CATEGORY_CONFIG, + ), + NumberEntityDescription( + key=DPCode.WARM_TIME, + name="Heat Preservation Time", + icon="mdi:timer", + entity_category=ENTITY_CATEGORY_CONFIG, + ), + ), # Human Presence Sensor # https://developer.tuya.com/en/docs/iot/categoryhps?id=Kaiuz42yhn1hs "hps": ( diff --git a/homeassistant/components/tuya/sensor.py b/homeassistant/components/tuya/sensor.py index a69ce86d0e3..4abd77fb7bd 100644 --- a/homeassistant/components/tuya/sensor.py +++ b/homeassistant/components/tuya/sensor.py @@ -38,6 +38,7 @@ from homeassistant.helpers.typing import StateType from . import HomeAssistantTuyaData from .base import EnumTypeData, IntegerTypeData, TuyaEntity from .const import ( + DEVICE_CLASS_TUYA_STATUS, DEVICE_CLASS_UNITS, DOMAIN, TUYA_DISCOVERY_NEW, @@ -82,6 +83,27 @@ BATTERY_SENSORS: tuple[SensorEntityDescription, ...] = ( # end up being a sensor. # https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { + # Smart Kettle + # https://developer.tuya.com/en/docs/iot/fbh?id=K9gf484m21yq7 + "bh": ( + SensorEntityDescription( + key=DPCode.TEMP_CURRENT, + name="Current Temperature", + device_class=DEVICE_CLASS_TEMPERATURE, + state_class=STATE_CLASS_MEASUREMENT, + ), + SensorEntityDescription( + key=DPCode.TEMP_CURRENT_F, + name="Current Temperature", + device_class=DEVICE_CLASS_TEMPERATURE, + state_class=STATE_CLASS_MEASUREMENT, + ), + SensorEntityDescription( + key=DPCode.STATUS, + name="Status", + device_class=DEVICE_CLASS_TUYA_STATUS, + ), + ), # CO2 Detector # https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy "co2bj": ( @@ -515,6 +537,7 @@ class TuyaSensorEntity(TuyaEntity, SensorEntity): # match Home Assistants requirements. if ( self.device_class is not None + and not self.device_class.startswith(DOMAIN) and description.native_unit_of_measurement is None ): # We cannot have a device class, if the UOM isn't set or the diff --git a/homeassistant/components/tuya/strings.sensor.json b/homeassistant/components/tuya/strings.sensor.json new file mode 100644 index 00000000000..ff246817f61 --- /dev/null +++ b/homeassistant/components/tuya/strings.sensor.json @@ -0,0 +1,15 @@ +{ + "state": { + "tuya__status": { + "boiling_temp": "Boiling temperature", + "cooling": "Cooling", + "heating_temp": "Heating temperature", + "heating": "Heating", + "reserve_1": "Reserve 1", + "reserve_2": "Reserve 2", + "reserve_3": "Reserve 3", + "standby": "Standby", + "warm": "Heat preservation" + } + } +} diff --git a/homeassistant/components/tuya/switch.py b/homeassistant/components/tuya/switch.py index 1a37af30e2b..bc83c085783 100644 --- a/homeassistant/components/tuya/switch.py +++ b/homeassistant/components/tuya/switch.py @@ -34,7 +34,7 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = { ), SwitchEntityDescription( key=DPCode.WARM, - name="Heat preservation", + name="Heat Preservation", entity_category=ENTITY_CATEGORY_CONFIG, ), ), diff --git a/homeassistant/components/tuya/translations/sensor.en.json b/homeassistant/components/tuya/translations/sensor.en.json new file mode 100644 index 00000000000..4057f75c1ea --- /dev/null +++ b/homeassistant/components/tuya/translations/sensor.en.json @@ -0,0 +1,15 @@ +{ + "state": { + "tuya__status": { + "boiling_temp": "Boiling temperature", + "cooling": "Cooling", + "heating": "Heating", + "heating_temp": "Heating temperature", + "reserve_1": "Reserve 1", + "reserve_2": "Reserve 2", + "reserve_3": "Reserve 3", + "standby": "Standby", + "warm": "Heat preservation" + } + } +} \ No newline at end of file