Skip to content

Commit ba034c6

Browse files
authored
Add alarm_state to Tuya siren alarm (home-assistant#151221)
1 parent 008bb85 commit ba034c6

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

homeassistant/components/tuya/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ class DPCode(StrEnum):
607607
ALARM_DELAY_TIME = "alarm_delay_time"
608608
ALARM_MESSAGE = "alarm_message"
609609
ALARM_MSG = "alarm_msg"
610+
ALARM_STATE = "alarm_state"
610611
ALARM_SWITCH = "alarm_switch" # Alarm switch
611612
ALARM_TIME = "alarm_time" # Alarm time
612613
ALARM_VOLUME = "alarm_volume" # Alarm volume

homeassistant/components/tuya/select.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@
207207
),
208208
),
209209
DeviceCategory.SGBJ: (
210+
SelectEntityDescription(
211+
key=DPCode.ALARM_STATE,
212+
translation_key="siren_mode",
213+
entity_category=EntityCategory.CONFIG,
214+
),
210215
SelectEntityDescription(
211216
key=DPCode.ALARM_VOLUME,
212217
translation_key="volume",

homeassistant/components/tuya/strings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,15 @@
494494
"power_on": "[%key:common::state::on%]"
495495
}
496496
},
497+
"siren_mode": {
498+
"name": "Siren mode",
499+
"state": {
500+
"alarm_light": "Light",
501+
"alarm_sound": "Sound",
502+
"alarm_sound_light": "Sound & light",
503+
"normal": "[%key:common::state::normal%]"
504+
}
505+
},
497506
"target_humidity": {
498507
"name": "Target humidity"
499508
},

tests/components/tuya/snapshots/test_select.ambr

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4389,6 +4389,67 @@
43894389
'state': 'power_on',
43904390
})
43914391
# ---
4392+
# name: test_platform_setup_and_discovery[select.siren_siren_mode-entry]
4393+
EntityRegistryEntrySnapshot({
4394+
'aliases': set({
4395+
}),
4396+
'area_id': None,
4397+
'capabilities': dict({
4398+
'options': list([
4399+
'alarm_sound',
4400+
'alarm_light',
4401+
'alarm_sound_light',
4402+
'normal',
4403+
]),
4404+
}),
4405+
'config_entry_id': <ANY>,
4406+
'config_subentry_id': <ANY>,
4407+
'device_class': None,
4408+
'device_id': <ANY>,
4409+
'disabled_by': None,
4410+
'domain': 'select',
4411+
'entity_category': <EntityCategory.CONFIG: 'config'>,
4412+
'entity_id': 'select.siren_siren_mode',
4413+
'has_entity_name': True,
4414+
'hidden_by': None,
4415+
'icon': None,
4416+
'id': <ANY>,
4417+
'labels': set({
4418+
}),
4419+
'name': None,
4420+
'options': dict({
4421+
}),
4422+
'original_device_class': None,
4423+
'original_icon': None,
4424+
'original_name': 'Siren mode',
4425+
'platform': 'tuya',
4426+
'previous_unique_id': None,
4427+
'suggested_object_id': None,
4428+
'supported_features': 0,
4429+
'translation_key': 'siren_mode',
4430+
'unique_id': 'tuya.okwwus27jhqqe2mijbgsalarm_state',
4431+
'unit_of_measurement': None,
4432+
})
4433+
# ---
4434+
# name: test_platform_setup_and_discovery[select.siren_siren_mode-state]
4435+
StateSnapshot({
4436+
'attributes': ReadOnlyDict({
4437+
'friendly_name': 'Siren Siren mode',
4438+
'options': list([
4439+
'alarm_sound',
4440+
'alarm_light',
4441+
'alarm_sound_light',
4442+
'normal',
4443+
]),
4444+
}),
4445+
'context': <ANY>,
4446+
'entity_id': 'select.siren_siren_mode',
4447+
'last_changed': <ANY>,
4448+
'last_reported': <ANY>,
4449+
'last_updated': <ANY>,
4450+
'state': 'normal',
4451+
})
4452+
# ---
43924453
# name: test_platform_setup_and_discovery[select.siren_veranda_volume-entry]
43934454
EntityRegistryEntrySnapshot({
43944455
'aliases': set({

0 commit comments

Comments
 (0)