Skip to content
Draft
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
7 changes: 7 additions & 0 deletions homeassistant/components/tuya/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ class DPCode(StrEnum):
BRIGHTNESS_MIN_1 = "brightness_min_1"
BRIGHTNESS_MIN_2 = "brightness_min_2"
BRIGHTNESS_MIN_3 = "brightness_min_3"
BODY_RESISTANCE = "body_r"
C_F = "c_f" # Temperature unit switching
CAT_WEIGHT = "cat_weight"
CH2O_STATE = "ch2o_state"
Expand Down Expand Up @@ -697,6 +698,8 @@ class DPCode(StrEnum):
DELAY_CLEAN_TIME = "delay_clean_time"
DELAY_SET = "delay_set"
DEW_POINT_TEMP = "dew_point_temp"
DATA_IDENTIFICATION = "data_identification"
DATA_REPORT = "data_report"
DISINFECTION = "disinfection"
DO_NOT_DISTURB = "do_not_disturb"
DOORBELL_PIC = "doorbell_pic"
Expand Down Expand Up @@ -738,6 +741,7 @@ class DPCode(StrEnum):
GAS_SENSOR_STATE = "gas_sensor_state"
GAS_SENSOR_STATUS = "gas_sensor_status"
GAS_SENSOR_VALUE = "gas_sensor_value"
HEART_RATE = "heart_rate"
HEAT_INDEX = "heat_index"
HUMIDIFIER = "humidifier" # Humidification
HUMIDITY = "humidity" # Humidity
Expand Down Expand Up @@ -824,6 +828,7 @@ class DPCode(StrEnum):
PV_POWER_TOTAL = "pv_power_total"
RAIN_24H = "rain_24h" # Total daily rainfall in mm
RAIN_RATE = "rain_rate" # Rain intensity in mm/h
REALTIME_DATA = "realtime_data"
RECORD_MODE = "record_mode"
RECORD_SWITCH = "record_switch" # Recording switch
RELAY_STATUS = "relay_status"
Expand Down Expand Up @@ -944,6 +949,7 @@ class DPCode(StrEnum):
TOTAL_POWER = "total_power"
TOTAL_TIME = "total_time"
TVOC = "tvoc"
UNIT_SWITCH = "unit_switch"
UP_DOWN = "up_down"
UPPER_TEMP = "upper_temp"
UPPER_TEMP_F = "upper_temp_f"
Expand Down Expand Up @@ -977,6 +983,7 @@ class DPCode(StrEnum):
WIND_DIRECT = "wind_direct"
WIRELESS_BATTERYLOCK = "wireless_batterylock"
WIRELESS_ELECTRICITY = "wireless_electricity"
WEIGHT = "weight"
WORK_MODE = "work_mode" # Working mode
WORK_POWER = "work_power"
WORK_STATE_E = "work_state_e"
Expand Down
35 changes: 35 additions & 0 deletions homeassistant/components/tuya/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
UnitOfElectricCurrent,
UnitOfElectricPotential,
UnitOfEnergy,
UnitOfMass,
UnitOfPower,
UnitOfTime,
)
Expand Down Expand Up @@ -391,6 +392,12 @@ class TuyaSensorEntityDescription(SensorEntityDescription):
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
TuyaSensorEntityDescription(
key=DPCode.CUR_NEUTRAL,
translation_key="total_production",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
Comment on lines +395 to +400
TuyaSensorEntityDescription(
key=DPCode.SUPPLY_FREQUENCY,
translation_key="supply_frequency",
Expand Down Expand Up @@ -1621,6 +1628,34 @@ class TuyaSensorEntityDescription(SensorEntityDescription):
),
*BATTERY_SENSORS,
),
DeviceCategory.TZC1: (
TuyaSensorEntityDescription(
key=DPCode.WEIGHT,
translation_key="weight",
device_class=SensorDeviceClass.WEIGHT,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfMass.KILOGRAMS,
),
TuyaSensorEntityDescription(
key=DPCode.REALTIME_DATA,
translation_key="realtime_weight",
device_class=SensorDeviceClass.WEIGHT,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfMass.KILOGRAMS,
),
TuyaSensorEntityDescription(
key=DPCode.HEART_RATE,
translation_key="heart_rate",
native_unit_of_measurement="bpm",
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.BODY_RESISTANCE,
translation_key="body_resistance",
native_unit_of_measurement="ohm",
state_class=SensorStateClass.MEASUREMENT,
),
),
}

# Socket (duplicate of `kg`)
Expand Down
12 changes: 12 additions & 0 deletions homeassistant/components/tuya/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,9 @@
"battery_state": {
"name": "Battery state"
},
"body_resistance": {
"name": "Body resistance"
},
"carbon_dioxide": {
"name": "[%key:component::sensor::entity_component::carbon_dioxide::name%]"
},
Expand Down Expand Up @@ -685,6 +688,9 @@
"gas": {
"name": "Gas"
},
"heart_rate": {
"name": "Heart rate"
},
"heat_index_temperature": {
"name": "Heat index"
},
Expand Down Expand Up @@ -810,6 +816,9 @@
"pv_channel_power": {
"name": "PV channel {index} power"
},
"realtime_weight": {
"name": "Realtime weight"
},
"remaining_time": {
"name": "Remaining time"
},
Expand Down Expand Up @@ -910,6 +919,9 @@
"water_time": {
"name": "Water usage duration"
},
"weight": {
"name": "Weight"
},
"wind_chill_index_temperature": {
"name": "Wind chill index"
},
Expand Down
Loading
Loading