Add switch platform to Tuya ZNJDQ (circuit breaker) (#181517)

Co-authored-by: Thomas Munzer <tmunzer@juniper.net>
This commit is contained in:
Thomas Munzer
2026-09-07 10:35:25 +02:00
committed by GitHub
co-authored by Thomas Munzer
parent ec82dee53d
commit 2da171b84e
4 changed files with 117 additions and 1 deletions
+2
View File
@@ -574,6 +574,8 @@ class DeviceCategory(StrEnum):
"""Tank Level Sensor (undocumented)"""
ZNNBQ = "znnbq"
"""VESKA-micro inverter (undocumented)"""
ZNJDQ = "znjdq"
"""Circuit breaker (undocumented)"""
ZWJCY = "zwjcy"
"""Soil sensor - plant monitor (undocumented)"""
ZNJXS = "znjxs"
+13
View File
@@ -894,6 +894,19 @@ SWITCHES: dict[DeviceCategory, tuple[SwitchEntityDescription, ...]] = {
translation_key="switch",
),
),
DeviceCategory.ZNJDQ: (
SwitchEntityDescription(
key=DPCode.SWITCH_1,
translation_key="indexed_switch",
translation_placeholders={"index": "1"},
),
SwitchEntityDescription(
key=DPCode.CHILD_LOCK,
translation_key="child_lock",
icon="mdi:account-lock",
entity_category=EntityCategory.CONFIG,
),
),
DeviceCategory.ZNJXS: (
SwitchEntityDescription(
key=DPCode.SWITCH,
@@ -5090,7 +5090,7 @@
'labels': set({
}),
'manufacturer': 'Tuya',
'model': '63A Smart Circuit Breaker (unsupported)',
'model': '63A Smart Circuit Breaker',
'model_id': 'au6dqazvkxqnpaak',
'name': 'Smart Circuit Breaker',
'name_by_user': None,
@@ -10130,6 +10130,107 @@
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[switch.smart_circuit_breaker_child_lock-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'switch.smart_circuit_breaker_child_lock',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Child lock',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:account-lock',
'original_name': 'Child lock',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'child_lock',
'unique_id': 'tuya.kaapnqxkvzaqd6uaqdjnzchild_lock',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[switch.smart_circuit_breaker_child_lock-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Smart Circuit Breaker Child lock',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:account-lock',
}),
'context': <ANY>,
'entity_id': 'switch.smart_circuit_breaker_child_lock',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[switch.smart_circuit_breaker_switch_1-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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.smart_circuit_breaker_switch_1',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Switch 1',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Switch 1',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'indexed_switch',
'unique_id': 'tuya.kaapnqxkvzaqd6uaqdjnzswitch_1',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[switch.smart_circuit_breaker_switch_1-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Smart Circuit Breaker Switch 1',
}),
'context': <ANY>,
'entity_id': 'switch.smart_circuit_breaker_switch_1',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_platform_setup_and_discovery[switch.smart_kettle_start-entry]
EntityRegistryEntrySnapshot({
'aliases': list([