mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Add numbers configuration to Tuya alarm (#148907)
This commit is contained in:
parent
72d1c3cfc8
commit
79b8e74d87
@ -98,6 +98,7 @@ class DPCode(StrEnum):
|
|||||||
|
|
||||||
AIR_QUALITY = "air_quality"
|
AIR_QUALITY = "air_quality"
|
||||||
AIR_QUALITY_INDEX = "air_quality_index"
|
AIR_QUALITY_INDEX = "air_quality_index"
|
||||||
|
ALARM_DELAY_TIME = "alarm_delay_time"
|
||||||
ALARM_SWITCH = "alarm_switch" # Alarm switch
|
ALARM_SWITCH = "alarm_switch" # Alarm switch
|
||||||
ALARM_TIME = "alarm_time" # Alarm time
|
ALARM_TIME = "alarm_time" # Alarm time
|
||||||
ALARM_VOLUME = "alarm_volume" # Alarm volume
|
ALARM_VOLUME = "alarm_volume" # Alarm volume
|
||||||
@ -176,6 +177,7 @@ class DPCode(StrEnum):
|
|||||||
DECIBEL_SWITCH = "decibel_switch"
|
DECIBEL_SWITCH = "decibel_switch"
|
||||||
DEHUMIDITY_SET_ENUM = "dehumidify_set_enum"
|
DEHUMIDITY_SET_ENUM = "dehumidify_set_enum"
|
||||||
DEHUMIDITY_SET_VALUE = "dehumidify_set_value"
|
DEHUMIDITY_SET_VALUE = "dehumidify_set_value"
|
||||||
|
DELAY_SET = "delay_set"
|
||||||
DISINFECTION = "disinfection"
|
DISINFECTION = "disinfection"
|
||||||
DO_NOT_DISTURB = "do_not_disturb"
|
DO_NOT_DISTURB = "do_not_disturb"
|
||||||
DOORCONTACT_STATE = "doorcontact_state" # Status of door window sensor
|
DOORCONTACT_STATE = "doorcontact_state" # Status of door window sensor
|
||||||
|
@ -170,6 +170,30 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
|||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
# Alarm Host
|
||||||
|
# https://developer.tuya.com/en/docs/iot/alarm-hosts?id=K9gf48r87hyjk
|
||||||
|
"mal": (
|
||||||
|
NumberEntityDescription(
|
||||||
|
key=DPCode.DELAY_SET,
|
||||||
|
# This setting is called "Arm Delay" in the official Tuya app
|
||||||
|
translation_key="arm_delay",
|
||||||
|
device_class=NumberDeviceClass.DURATION,
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
),
|
||||||
|
NumberEntityDescription(
|
||||||
|
key=DPCode.ALARM_DELAY_TIME,
|
||||||
|
translation_key="alarm_delay",
|
||||||
|
device_class=NumberDeviceClass.DURATION,
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
),
|
||||||
|
NumberEntityDescription(
|
||||||
|
key=DPCode.ALARM_TIME,
|
||||||
|
# This setting is called "Siren Duration" in the official Tuya app
|
||||||
|
translation_key="siren_duration",
|
||||||
|
device_class=NumberDeviceClass.DURATION,
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
),
|
||||||
|
),
|
||||||
# Sous Vide Cooker
|
# Sous Vide Cooker
|
||||||
# https://developer.tuya.com/en/docs/iot/categorymzj?id=Kaiuz2vy130ux
|
# https://developer.tuya.com/en/docs/iot/categorymzj?id=Kaiuz2vy130ux
|
||||||
"mzj": (
|
"mzj": (
|
||||||
|
@ -222,6 +222,15 @@
|
|||||||
},
|
},
|
||||||
"temp_correction": {
|
"temp_correction": {
|
||||||
"name": "Temperature correction"
|
"name": "Temperature correction"
|
||||||
|
},
|
||||||
|
"arm_delay": {
|
||||||
|
"name": "Arm delay"
|
||||||
|
},
|
||||||
|
"alarm_delay": {
|
||||||
|
"name": "Alarm delay"
|
||||||
|
},
|
||||||
|
"siren_duration": {
|
||||||
|
"name": "Siren duration"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"select": {
|
"select": {
|
||||||
|
@ -114,6 +114,7 @@ DEVICE_MOCKS = {
|
|||||||
"mal_alarm_host": [
|
"mal_alarm_host": [
|
||||||
# Alarm Host support
|
# Alarm Host support
|
||||||
Platform.ALARM_CONTROL_PANEL,
|
Platform.ALARM_CONTROL_PANEL,
|
||||||
|
Platform.NUMBER,
|
||||||
Platform.SWITCH,
|
Platform.SWITCH,
|
||||||
],
|
],
|
||||||
"mcs_door_sensor": [
|
"mcs_door_sensor": [
|
||||||
|
@ -116,6 +116,183 @@
|
|||||||
'state': '1.0',
|
'state': '1.0',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_platform_setup_and_discovery[mal_alarm_host][number.multifunction_alarm_alarm_delay-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': dict({
|
||||||
|
'max': 999.0,
|
||||||
|
'min': 0.0,
|
||||||
|
'mode': <NumberMode.AUTO: 'auto'>,
|
||||||
|
'step': 1.0,
|
||||||
|
}),
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'config_subentry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'number',
|
||||||
|
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||||
|
'entity_id': 'number.multifunction_alarm_alarm_delay',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <NumberDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Alarm delay',
|
||||||
|
'platform': 'tuya',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'suggested_object_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'alarm_delay',
|
||||||
|
'unique_id': 'tuya.123123aba12312312dazubalarm_delay_time',
|
||||||
|
'unit_of_measurement': 's',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_platform_setup_and_discovery[mal_alarm_host][number.multifunction_alarm_alarm_delay-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'duration',
|
||||||
|
'friendly_name': 'Multifunction alarm Alarm delay',
|
||||||
|
'max': 999.0,
|
||||||
|
'min': 0.0,
|
||||||
|
'mode': <NumberMode.AUTO: 'auto'>,
|
||||||
|
'step': 1.0,
|
||||||
|
'unit_of_measurement': 's',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'number.multifunction_alarm_alarm_delay',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '20.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_platform_setup_and_discovery[mal_alarm_host][number.multifunction_alarm_arm_delay-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': dict({
|
||||||
|
'max': 999.0,
|
||||||
|
'min': 0.0,
|
||||||
|
'mode': <NumberMode.AUTO: 'auto'>,
|
||||||
|
'step': 1.0,
|
||||||
|
}),
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'config_subentry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'number',
|
||||||
|
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||||
|
'entity_id': 'number.multifunction_alarm_arm_delay',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <NumberDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Arm delay',
|
||||||
|
'platform': 'tuya',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'suggested_object_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'arm_delay',
|
||||||
|
'unique_id': 'tuya.123123aba12312312dazubdelay_set',
|
||||||
|
'unit_of_measurement': 's',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_platform_setup_and_discovery[mal_alarm_host][number.multifunction_alarm_arm_delay-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'duration',
|
||||||
|
'friendly_name': 'Multifunction alarm Arm delay',
|
||||||
|
'max': 999.0,
|
||||||
|
'min': 0.0,
|
||||||
|
'mode': <NumberMode.AUTO: 'auto'>,
|
||||||
|
'step': 1.0,
|
||||||
|
'unit_of_measurement': 's',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'number.multifunction_alarm_arm_delay',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '15.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_platform_setup_and_discovery[mal_alarm_host][number.multifunction_alarm_siren_duration-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': dict({
|
||||||
|
'max': 999.0,
|
||||||
|
'min': 0.0,
|
||||||
|
'mode': <NumberMode.AUTO: 'auto'>,
|
||||||
|
'step': 1.0,
|
||||||
|
}),
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'config_subentry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'number',
|
||||||
|
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||||
|
'entity_id': 'number.multifunction_alarm_siren_duration',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <NumberDeviceClass.DURATION: 'duration'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Siren duration',
|
||||||
|
'platform': 'tuya',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'suggested_object_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'siren_duration',
|
||||||
|
'unique_id': 'tuya.123123aba12312312dazubalarm_time',
|
||||||
|
'unit_of_measurement': 'min',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_platform_setup_and_discovery[mal_alarm_host][number.multifunction_alarm_siren_duration-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'duration',
|
||||||
|
'friendly_name': 'Multifunction alarm Siren duration',
|
||||||
|
'max': 999.0,
|
||||||
|
'min': 0.0,
|
||||||
|
'mode': <NumberMode.AUTO: 'auto'>,
|
||||||
|
'step': 1.0,
|
||||||
|
'unit_of_measurement': 'min',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'number.multifunction_alarm_siren_duration',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '3.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_platform_setup_and_discovery[wk_wifi_smart_gas_boiler_thermostat][number.wifi_smart_gas_boiler_thermostat_temperature_correction-entry]
|
# name: test_platform_setup_and_discovery[wk_wifi_smart_gas_boiler_thermostat][number.wifi_smart_gas_boiler_thermostat_temperature_correction-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user