mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add Smart Kettle (bh) device support to Tuya (#58347)
This commit is contained in:
parent
640a7fee9d
commit
367c4d3676
@ -84,6 +84,7 @@ DEVICE_CLASS_TUYA_LIGHT_MODE = "tuya__light_mode"
|
|||||||
DEVICE_CLASS_TUYA_MOTION_SENSITIVITY = "tuya__motion_sensitivity"
|
DEVICE_CLASS_TUYA_MOTION_SENSITIVITY = "tuya__motion_sensitivity"
|
||||||
DEVICE_CLASS_TUYA_RECORD_MODE = "tuya__record_mode"
|
DEVICE_CLASS_TUYA_RECORD_MODE = "tuya__record_mode"
|
||||||
DEVICE_CLASS_TUYA_RELAY_STATUS = "tuya__relay_status"
|
DEVICE_CLASS_TUYA_RELAY_STATUS = "tuya__relay_status"
|
||||||
|
DEVICE_CLASS_TUYA_STATUS = "tuya__status"
|
||||||
|
|
||||||
TUYA_DISCOVERY_NEW = "tuya_discovery_new"
|
TUYA_DISCOVERY_NEW = "tuya_discovery_new"
|
||||||
TUYA_HA_SIGNAL_UPDATE_ENTITY = "tuya_entry_update"
|
TUYA_HA_SIGNAL_UPDATE_ENTITY = "tuya_entry_update"
|
||||||
@ -285,6 +286,8 @@ class DPCode(str, Enum):
|
|||||||
SWITCH_USB6 = "switch_usb6" # USB 6
|
SWITCH_USB6 = "switch_usb6" # USB 6
|
||||||
SWITCH_VERTICAL = "switch_vertical" # Vertical swing flap switch
|
SWITCH_VERTICAL = "switch_vertical" # Vertical swing flap switch
|
||||||
SWITCH_VOICE = "switch_voice" # Voice switch
|
SWITCH_VOICE = "switch_voice" # Voice switch
|
||||||
|
TEMP_BOILING_C = "temp_boiling_c"
|
||||||
|
TEMP_BOILING_F = "temp_boiling_f"
|
||||||
TEMP_CONTROLLER = "temp_controller"
|
TEMP_CONTROLLER = "temp_controller"
|
||||||
TEMP_CURRENT = "temp_current" # Current temperature in °C
|
TEMP_CURRENT = "temp_current" # Current temperature in °C
|
||||||
TEMP_CURRENT_F = "temp_current_f" # Current temperature in °F
|
TEMP_CURRENT_F = "temp_current_f" # Current temperature in °F
|
||||||
|
@ -21,6 +21,40 @@ from .const import DOMAIN, TUYA_DISCOVERY_NEW, DPCode
|
|||||||
# default instructions set of each category end up being a number.
|
# default instructions set of each category end up being a number.
|
||||||
# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq
|
# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq
|
||||||
NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
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
|
# Human Presence Sensor
|
||||||
# https://developer.tuya.com/en/docs/iot/categoryhps?id=Kaiuz42yhn1hs
|
# https://developer.tuya.com/en/docs/iot/categoryhps?id=Kaiuz42yhn1hs
|
||||||
"hps": (
|
"hps": (
|
||||||
|
@ -38,6 +38,7 @@ from homeassistant.helpers.typing import StateType
|
|||||||
from . import HomeAssistantTuyaData
|
from . import HomeAssistantTuyaData
|
||||||
from .base import EnumTypeData, IntegerTypeData, TuyaEntity
|
from .base import EnumTypeData, IntegerTypeData, TuyaEntity
|
||||||
from .const import (
|
from .const import (
|
||||||
|
DEVICE_CLASS_TUYA_STATUS,
|
||||||
DEVICE_CLASS_UNITS,
|
DEVICE_CLASS_UNITS,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
TUYA_DISCOVERY_NEW,
|
TUYA_DISCOVERY_NEW,
|
||||||
@ -82,6 +83,27 @@ BATTERY_SENSORS: tuple[SensorEntityDescription, ...] = (
|
|||||||
# end up being a sensor.
|
# end up being a sensor.
|
||||||
# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq
|
# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq
|
||||||
SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
|
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
|
# CO2 Detector
|
||||||
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
|
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
|
||||||
"co2bj": (
|
"co2bj": (
|
||||||
@ -515,6 +537,7 @@ class TuyaSensorEntity(TuyaEntity, SensorEntity):
|
|||||||
# match Home Assistants requirements.
|
# match Home Assistants requirements.
|
||||||
if (
|
if (
|
||||||
self.device_class is not None
|
self.device_class is not None
|
||||||
|
and not self.device_class.startswith(DOMAIN)
|
||||||
and description.native_unit_of_measurement is None
|
and description.native_unit_of_measurement is None
|
||||||
):
|
):
|
||||||
# We cannot have a device class, if the UOM isn't set or the
|
# We cannot have a device class, if the UOM isn't set or the
|
||||||
|
15
homeassistant/components/tuya/strings.sensor.json
Normal file
15
homeassistant/components/tuya/strings.sensor.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -34,7 +34,7 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
|||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.WARM,
|
key=DPCode.WARM,
|
||||||
name="Heat preservation",
|
name="Heat Preservation",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=ENTITY_CATEGORY_CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
15
homeassistant/components/tuya/translations/sensor.en.json
Normal file
15
homeassistant/components/tuya/translations/sensor.en.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user