Add alarm_state to Tuya siren alarm

This commit is contained in:
epenet
2025-08-27 06:12:53 +00:00
parent 0bb16befbd
commit 3f021e672c
4 changed files with 76 additions and 0 deletions

View File

@@ -103,6 +103,7 @@ class DPCode(StrEnum):
ALARM_DELAY_TIME = "alarm_delay_time"
ALARM_MESSAGE = "alarm_message"
ALARM_MSG = "alarm_msg"
ALARM_STATE = "alarm_state"
ALARM_SWITCH = "alarm_switch" # Alarm switch
ALARM_TIME = "alarm_time" # Alarm time
ALARM_VOLUME = "alarm_volume" # Alarm volume

View File

@@ -237,6 +237,11 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
# Siren Alarm
# https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu
"sgbj": (
SelectEntityDescription(
key=DPCode.ALARM_STATE,
translation_key="alarm_state",
entity_category=EntityCategory.CONFIG,
),
SelectEntityDescription(
key=DPCode.ALARM_VOLUME,
translation_key="volume",

View File

@@ -496,6 +496,15 @@
"smart": "Smart",
"interim": "Interim"
}
},
"alarm_state": {
"name": "Alarm state",
"state": {
"normal": "[%key:common::state::normal%]",
"alarm_light": "Light",
"alarm_sound": "Sound",
"alarm_sound_light": "Sound & light"
}
}
},
"sensor": {

View File

@@ -3372,6 +3372,67 @@
'state': 'power_on',
})
# ---
# name: test_platform_setup_and_discovery[select.siren_alarm_state-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'options': list([
'alarm_sound',
'alarm_light',
'alarm_sound_light',
'normal',
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'select',
'entity_category': None,
'entity_id': 'select.siren_alarm_state',
'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': 'Alarm state',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'alarm_state',
'unique_id': 'tuya.okwwus27jhqqe2mijbgsalarm_state',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[select.siren_alarm_state-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Siren Alarm state',
'options': list([
'alarm_sound',
'alarm_light',
'alarm_sound_light',
'normal',
]),
}),
'context': <ANY>,
'entity_id': 'select.siren_alarm_state',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'normal',
})
# ---
# name: test_platform_setup_and_discovery[select.siren_veranda_volume-entry]
EntityRegistryEntrySnapshot({
'aliases': set({