From 3d4654976bc43247c0f0ebc21fbca485c517c563 Mon Sep 17 00:00:00 2001 From: Oleksandr B <7982859+o-borovets@users.noreply.github.com> Date: Tue, 8 Sep 2026 15:36:38 +0300 Subject: [PATCH] Add number platform to Tuya qccdz (EV charger) (#181641) --- homeassistant/components/tuya/const.py | 1 + homeassistant/components/tuya/number.py | 7 +++ homeassistant/components/tuya/strings.json | 3 + .../tuya/snapshots/test_number.ambr | 61 +++++++++++++++++++ 4 files changed, 72 insertions(+) diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py index 4a4a2505f8c6..c788359ea4fc 100644 --- a/homeassistant/components/tuya/const.py +++ b/homeassistant/components/tuya/const.py @@ -641,6 +641,7 @@ 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" CHARGE_STATE = "charge_state" CHILD_LOCK = "child_lock" # Child lock CISTERN = "cistern" diff --git a/homeassistant/components/tuya/number.py b/homeassistant/components/tuya/number.py index 150c0138f0d1..e16e4a622dc8 100644 --- a/homeassistant/components/tuya/number.py +++ b/homeassistant/components/tuya/number.py @@ -226,6 +226,13 @@ NUMBERS: dict[DeviceCategory, tuple[NumberEntityDescription, ...]] = { 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, diff --git a/homeassistant/components/tuya/strings.json b/homeassistant/components/tuya/strings.json index b3aaf5fedd0e..cacfe96f945b 100644 --- a/homeassistant/components/tuya/strings.json +++ b/homeassistant/components/tuya/strings.json @@ -190,6 +190,9 @@ "battery_backup_reserve": { "name": "Battery backup reserve" }, + "charging_current": { + "name": "Charging current" + }, "cloud_recipe": { "name": "Cloud recipe" }, diff --git a/tests/components/tuya/snapshots/test_number.ambr b/tests/components/tuya/snapshots/test_number.ambr index be01c8d633d3..2ab761a8cb3d 100644 --- a/tests/components/tuya/snapshots/test_number.ambr +++ b/tests/components/tuya/snapshots/test_number.ambr @@ -785,6 +785,67 @@ 'state': '1.0', }) # --- +# name: test_platform_setup_and_discovery[number.ev_charger_charging_current-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : 255.0, + : 1.0, + : , + : 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.ev_charger_charging_current', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Charging current', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Charging current', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'charging_current', + 'unique_id': 'tuya.lr7th3bpx7masmsdzdccqcharge_cur_set', + 'unit_of_measurement': 'A', + }) +# --- +# name: test_platform_setup_and_discovery[number.ev_charger_charging_current-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'current', + : 'EV Charger Charging current', + : 255.0, + : 1.0, + : , + : 1.0, + : 'A', + }), + 'context': , + 'entity_id': 'number.ev_charger_charging_current', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '10.0', + }) +# --- # name: test_platform_setup_and_discovery[number.garden_valve_yard_irrigation_duration-entry] EntityRegistryEntrySnapshot({ 'aliases': list([