mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 09:23:17 -04:00
Add switch support for Tuya WG2 alarm panel (Duosmart C30) (#165835)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
This commit is contained in:
co-authored by
epenet
parent
0e5d6b52f9
commit
7ee22de22c
@@ -893,6 +893,7 @@ class DPCode(StrEnum):
|
||||
SWITCH_7 = "switch_7" # Switch 7
|
||||
SWITCH_8 = "switch_8" # Switch 8
|
||||
SWITCH_ALARM_LIGHT = "switch_alarm_light"
|
||||
SWITCH_ALARM_PROPEL = "switch_alarm_propel"
|
||||
SWITCH_ALARM_SOUND = "switch_alarm_sound"
|
||||
SWITCH_BACKLIGHT = "switch_backlight" # Backlight switch
|
||||
SWITCH_CHARGE = "switch_charge"
|
||||
@@ -900,6 +901,7 @@ class DPCode(StrEnum):
|
||||
SWITCH_DISTURB = "switch_disturb"
|
||||
SWITCH_FAN = "switch_fan"
|
||||
SWITCH_HORIZONTAL = "switch_horizontal" # Horizontal swing flap switch
|
||||
SWITCH_KB_SOUND = "switch_kb_sound"
|
||||
SWITCH_LED = "switch_led" # Switch
|
||||
SWITCH_LED_1 = "switch_led_1"
|
||||
SWITCH_LED_2 = "switch_led_2"
|
||||
|
||||
@@ -1058,6 +1058,9 @@
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"alarm_push_notifications": {
|
||||
"name": "Alarm push notifications"
|
||||
},
|
||||
"anion": {
|
||||
"name": "Anion"
|
||||
},
|
||||
@@ -1121,6 +1124,9 @@
|
||||
"ionizer": {
|
||||
"name": "Ionizer"
|
||||
},
|
||||
"keypad_sound": {
|
||||
"name": "Keypad sound"
|
||||
},
|
||||
"motion_alarm": {
|
||||
"name": "Motion alarm"
|
||||
},
|
||||
|
||||
@@ -800,6 +800,18 @@ SWITCHES: dict[DeviceCategory, tuple[SwitchEntityDescription, ...]] = {
|
||||
translation_key="mute",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
SwitchEntityDescription(
|
||||
key=DPCode.SWITCH_KB_SOUND,
|
||||
# Poorly translated as "Key tone switch of host" in the official Tuya app
|
||||
translation_key="keypad_sound",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
SwitchEntityDescription(
|
||||
key=DPCode.SWITCH_ALARM_PROPEL,
|
||||
# Poorly translated as "alarm push switch" in the official Tuya app
|
||||
translation_key="alarm_push_notifications",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
),
|
||||
DeviceCategory.WK: (
|
||||
SwitchEntityDescription(
|
||||
|
||||
@@ -1820,6 +1820,106 @@
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[switch.c30_alarm_push_notifications-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.c30_alarm_push_notifications',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Alarm push notifications',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Alarm push notifications',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'alarm_push_notifications',
|
||||
'unique_id': 'tuya.rirsc4vhpbv2whkp2gwswitch_alarm_propel',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[switch.c30_alarm_push_notifications-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'C30 Alarm push notifications',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.c30_alarm_push_notifications',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[switch.c30_keypad_sound-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.c30_keypad_sound',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Keypad sound',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Keypad sound',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'keypad_sound',
|
||||
'unique_id': 'tuya.rirsc4vhpbv2whkp2gwswitch_kb_sound',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[switch.c30_keypad_sound-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'C30 Keypad sound',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.c30_keypad_sound',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[switch.c9_auto_trigger_siren-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
|
||||
Reference in New Issue
Block a user