Add initial support for tuya qccdz (#148874)

This commit is contained in:
epenet 2025-07-16 12:28:18 +02:00 committed by GitHub
parent a6828898d1
commit e28f02d163
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 165 additions and 0 deletions

View File

@ -545,6 +545,14 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
device_class=SwitchDeviceClass.OUTLET,
),
),
# AC charging
# Not documented
"qccdz": (
SwitchEntityDescription(
key=DPCode.SWITCH,
translation_key="switch",
),
),
# Unknown product with switch capabilities
# Fond in some diffusers, plugs and PIR flood lights
# Not documented

View File

@ -113,6 +113,10 @@ DEVICE_MOCKS = {
Platform.BINARY_SENSOR,
Platform.SENSOR,
],
"qccdz_ac_charging_control": [
# https://github.com/home-assistant/core/issues/136207
Platform.SWITCH,
],
"qxj_temp_humidity_external_probe": [
# https://github.com/home-assistant/core/issues/136472
Platform.SENSOR,

View File

@ -0,0 +1,105 @@
{
"endpoint": "https://apigw.tuyaeu.com",
"terminal_id": "1737479380414pasuj4",
"mqtt_connected": true,
"disabled_by": null,
"disabled_polling": false,
"id": "bf83514d9c14b426f0fz5y",
"name": "AC charging control box",
"category": "qccdz",
"product_id": "7bvgooyjhiua1yyq",
"product_name": "AC charging control box",
"online": true,
"sub": false,
"time_zone": "+01:00",
"active_time": "2025-01-21T17:00:03+00:00",
"create_time": "2025-01-21T17:00:03+00:00",
"update_time": "2025-01-21T17:00:03+00:00",
"function": {
"work_mode": {
"type": "Enum",
"value": {
"range": [
"charge_now",
"charge_pct",
"charge_energy",
"charge_schedule"
]
}
},
"clear_energy": {
"type": "Boolean",
"value": {}
},
"switch": {
"type": "Boolean",
"value": {}
}
},
"status_range": {
"work_state": {
"type": "Enum",
"value": {
"range": [
"charger_free",
"charger_insert",
"charger_free_fault",
"charger_wait",
"charger_charging",
"charger_pause",
"charger_end",
"charger_fault"
]
}
},
"work_mode": {
"type": "Enum",
"value": {
"range": [
"charge_now",
"charge_pct",
"charge_energy",
"charge_schedule"
]
}
},
"balance_energy": {
"type": "Integer",
"value": {
"unit": "kW\u00b7h",
"min": 0,
"max": 99999999,
"scale": 3,
"step": 1
}
},
"clear_energy": {
"type": "Boolean",
"value": {}
},
"switch": {
"type": "Boolean",
"value": {}
},
"charge_energy_once": {
"type": "Integer",
"value": {
"unit": "kW\u00b7h",
"min": 1,
"max": 999999,
"scale": 2,
"step": 1
}
}
},
"status": {
"work_state": "charger_free",
"work_mode": "charge_now",
"balance_energy": 0,
"clear_energy": false,
"switch": false,
"charge_energy_once": 1
},
"set_up": false,
"support_local": true
}

View File

@ -869,6 +869,54 @@
'state': 'on',
})
# ---
# name: test_platform_setup_and_discovery[qccdz_ac_charging_control][switch.ac_charging_control_box_switch-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.ac_charging_control_box_switch',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Switch',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'switch',
'unique_id': 'tuya.bf83514d9c14b426f0fz5yswitch',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[qccdz_ac_charging_control][switch.ac_charging_control_box_switch-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'AC charging control box Switch',
}),
'context': <ANY>,
'entity_id': 'switch.ac_charging_control_box_switch',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[sfkzq_valve_controller][switch.sprinkler_cesare_switch-entry]
EntityRegistryEntrySnapshot({
'aliases': set({