8000 Add Smart Kettle (bh) device support to Tuya by frenck · Pull Request #58347 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add Smart Kettle (bh) device support to Tuya #58347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions homeassistant/components/tuya/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
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"
Expand Down Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions homeassistant/components/tuya/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,40 @@
# 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": (
Expand Down
23 changes: 23 additions & 0 deletions homeassistant/components/tuya/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from . import HomeAssistantTuyaData
from .base import EnumTypeData, IntegerTypeData, TuyaEntity
from .const import (
DEVICE_CLASS_TUYA_STATUS,
DEVICE_CLASS_UNITS,
DOMAIN,
TUYA_DISCOVERY_NEW,
Expand Down Expand Up @@ -75,6 +76,27 @@
# 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": (
Expand Down Expand Up @@ -473,6 +495,7 @@ def __init__(
# 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
Expand Down
15 changes: 15 additions & 0 deletions homeassistant/components/tuya/strings.sensor.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
2 changes: 1 addition & 1 deletion homeassistant/components/tuya/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
),
SwitchEntityDescription(
key=DPCode.WARM,
name="Heat preservation",
name="Heat Preservation",
entity_category=ENTITY_CATEGORY_CONFIG,
),
),
Expand Down
15 changes: 15 additions & 0 deletions homeassistant/components/tuya/translations/sensor.en.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
0