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
3 changes: 3 additions & 0 deletions homeassistant/components/tuya/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,8 @@ class DPCode(StrEnum):
CH2O_VALUE = "ch2o_value"
CH4_SENSOR_STATE = "ch4_sensor_state"
CH4_SENSOR_VALUE = "ch4_sensor_value"
CHARGE_CUR_SET = "charge_cur_set" # Charging current setpoint
CHARGE_ENERGY_ONCE = "charge_energy_once" # Energy of the current charging session
CHARGE_STATE = "charge_state"
CHILD_LOCK = "child_lock" # Child lock
CISTERN = "cistern"
Expand Down Expand Up @@ -856,6 +858,7 @@ class DPCode(StrEnum):
SENSOR_TEMPERATURE = "sensor_temperature"
SHAKE = "shake" # Oscillating
SHOCK_STATE = "shock_state" # Vibration status
SIGLE_PHASE_POWER = "sigle_phase_power" # Single-phase power (Tuya's spelling)
SIREN_SWITCH = "siren_switch"
SITUATION_SET = "situation_set"
SLEEP = "sleep" # Sleep function
Expand Down
7 changes: 7 additions & 0 deletions homeassistant/components/tuya/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@
entity_category=EntityCategory.CONFIG,
),
),
DeviceCategory.QCCDZ: (
NumberEntityDescription(
key=DPCode.CHARGE_CUR_SET,
translation_key="charging_current",
device_class=NumberDeviceClass.CURRENT,
),
),
DeviceCategory.SWTZ: (
NumberEntityDescription(
key=DPCode.COOK_TEMPERATURE,
Expand Down
6 changes: 6 additions & 0 deletions homeassistant/components/tuya/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@
translation_key="countdown",
),
),
DeviceCategory.QCCDZ: (
SelectEntityDescription(
key=DPCode.WORK_MODE,
translation_key="charger_work_mode",
),
),
DeviceCategory.QN: (
SelectEntityDescription(
key=DPCode.LEVEL,
Expand Down
37 changes: 37 additions & 0 deletions homeassistant/components/tuya/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,43 @@ class TuyaSensorEntityDescription(SensorEntityDescription):
),
*BATTERY_SENSORS,
),
DeviceCategory.QCCDZ: (
TuyaSensorEntityDescription(
key=DPCode.WORK_STATE,
translation_key="charger_status",
),
TuyaSensorEntityDescription(
key=DPCode.FORWARD_ENERGY_TOTAL,
translation_key="total_energy",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
TuyaSensorEntityDescription(
key=DPCode.CHARGE_ENERGY_ONCE,
translation_key="session_energy",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
TuyaSensorEntityDescription(
key=DPCode.SIGLE_PHASE_POWER,
translation_key="single_phase_power",
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.POWER_TOTAL,
translation_key="total_power",
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.TEMP_CURRENT,
translation_key="temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
),
DeviceCategory.QN: (
TuyaSensorEntityDescription(
key=DPCode.WORK_POWER,
Expand Down
31 changes: 31 additions & 0 deletions homeassistant/components/tuya/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@
"battery_backup_reserve": {
"name": "Battery backup reserve"
},
"charging_current": {
"name": "Charging current"
},
"cloud_recipe": {
"name": "Cloud recipe"
},
Expand Down Expand Up @@ -340,6 +343,15 @@
"brightness": {
"name": "Brightness"
},
"charger_work_mode": {
"name": "Charging mode",
"state": {
"charge_energy": "Charge by energy",
"charge_now": "Charge now",
"charge_pct": "Charge to percentage",
"charge_schedule": "Scheduled"
}
},
"concentration": {
"name": "Concentration"
},
Expand Down Expand Up @@ -696,6 +708,19 @@
"cat_weight": {
"name": "Cat weight"
},
"charger_status": {
"name": "Status",
"state": {
"charger_charging": "[%key:common::state::charging%]",
"charger_end": "Finished",
"charger_fault": "[%key:common::state::fault%]",
"charger_free": "[%key:common::state::idle%]",
"charger_free_fault": "Fault while idle",
"charger_insert": "Plugged in",
"charger_pause": "[%key:common::state::paused%]",
"charger_wait": "Waiting"
}
},
"cleaning_area": {
"name": "Cleaning area"
},
Expand Down Expand Up @@ -926,9 +951,15 @@
"rolling_brush_life": {
"name": "Rolling brush lifetime"
},
"session_energy": {
"name": "Session energy"
},
"side_brush_life": {
"name": "Side brush lifetime"
},
"single_phase_power": {
"name": "Single-phase power"
},
"smoke_amount": {
"name": "Smoke amount"
},
Expand Down
157 changes: 157 additions & 0 deletions tests/components/tuya/fixtures/qccdz_dsmsam7xpb3ht7rl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"endpoint": "https://apigw.tuyaeu.com",
"mqtt_connected": true,
"disabled_by": null,
"disabled_polling": false,
"name": "EV Charger",
"category": "qccdz",
"product_id": "dsmsam7xpb3ht7rl",
"product_name": "EV Charger",
"online": true,
"sub": false,
"time_zone": "+03:00",
"active_time": "2026-09-04T09:07:25+00:00",
"create_time": "2026-09-04T09:07:25+00:00",
"update_time": "2026-09-04T09:07:25+00:00",
"function": {
"charge_cur_set": {
"type": "Integer",
"value": {
"unit": "A",
"min": 1,
"max": 255,
"scale": 0,
"step": 1
}
},
"work_mode": {
"type": "Enum",
"value": {
"range": [
"charge_now",
"charge_pct",
"charge_energy",
"charge_schedule"
]
}
},
"switch": {
"type": "Boolean",
"value": {}
}
},
"status_range": {
"forward_energy_total": {
"type": "Integer",
"value": {
"unit": "kW·h",
"min": 0,
"max": 99999999,
"scale": 2,
"step": 1
},
"report_type": "minux"
},
"work_state": {
"type": "Enum",
"value": {
"range": [
"charger_free",
"charger_insert",
"charger_free_fault",
"charger_wait",
"charger_charging",
"charger_pause",
"charger_end",
"charger_fault"
]
},
"report_type": null
},
"charge_cur_set": {
"type": "Integer",
"value": {
"unit": "A",
"min": 1,
"max": 255,
"scale": 0,
"step": 1
},
"report_type": null
},
"sigle_phase_power": {
"type": "Integer",
"value": {
"unit": "kW",
"min": 0,
"max": 99999999,
"scale": 3,
"step": 1
},
"report_type": null
},
"power_total": {
"type": "Integer",
"value": {
"unit": "kW",
"min": 0,
"max": 99999999,
"scale": 3,
"step": 1
},
"report_type": null
},
"work_mode": {
"type": "Enum",
"value": {
"range": [
"charge_now",
"charge_pct",
"charge_energy",
"charge_schedule"
]
},
"report_type": null
},
"switch": {
"type": "Boolean",
"value": {},
"report_type": null
},
"temp_current": {
"type": "Integer",
"value": {
"unit": "℃",
"min": -40,
"max": 200,
"scale": 0,
"step": 1
},
"report_type": null
},
"charge_energy_once": {
"type": "Integer",
"value": {
"unit": "kW·h",
"min": 0,
"max": 999999,
"scale": 2,
"step": 1
},
"report_type": null
}
},
"status": {
"forward_energy_total": 20,
"work_state": "charger_free",
"charge_cur_set": 10,
"sigle_phase_power": 0,
"power_total": 0,
"work_mode": "charge_now",
"switch": false,
"temp_current": 24,
"charge_energy_once": 0
},
"set_up": true,
"support_local": true
}
30 changes: 30 additions & 0 deletions tests/components/tuya/snapshots/test_init.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -5549,6 +5549,36 @@
'via_device_id': None,
})
# ---
# name: test_device_registry[lr7th3bpx7masmsdzdccq]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'configuration_url': None,
'connections': set({
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'tuya',
'lr7th3bpx7masmsdzdccq',
),
}),
'labels': set({
}),
'manufacturer': 'Tuya',
'model': 'EV Charger',
'model_id': 'dsmsam7xpb3ht7rl',
'name': 'EV Charger',
'name_by_user': None,
'serial_number': None,
'sw_version': None,
'via_device_id': None,
})
# ---
# name: test_device_registry[mgcpxpmovasazerdps]
DeviceRegistryEntrySnapshot({
'area_id': None,
Expand Down
Loading
Loading