diff --git a/homeassistant/components/tuya/button.py b/homeassistant/components/tuya/button.py index 02e571b5ee742f..021d4a76510dde 100644 --- a/homeassistant/components/tuya/button.py +++ b/homeassistant/components/tuya/button.py @@ -6,7 +6,11 @@ ) from tuya_sharing import CustomerDevice, Manager -from homeassistant.components.button import ButtonEntity, ButtonEntityDescription +from homeassistant.components.button import ( + ButtonDeviceClass, + ButtonEntity, + ButtonEntityDescription, +) from homeassistant.const import EntityCategory from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -63,6 +67,13 @@ entity_category=EntityCategory.CONFIG, ), ), + DeviceCategory.SP: ( + ButtonEntityDescription( + key=DPCode.DEVICE_RESTART, + device_class=ButtonDeviceClass.RESTART, + entity_category=EntityCategory.CONFIG, + ), + ), } diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py index ff668ccd5d9b7b..55c393a23a13bf 100644 --- a/homeassistant/components/tuya/const.py +++ b/homeassistant/components/tuya/const.py @@ -696,6 +696,7 @@ class DPCode(StrEnum): DEHUMIDITY_SET_VALUE = "dehumidify_set_value" DELAY_CLEAN_TIME = "delay_clean_time" DELAY_SET = "delay_set" + DEVICE_RESTART = "device_restart" DEW_POINT_TEMP = "dew_point_temp" DISINFECTION = "disinfection" DO_NOT_DISTURB = "do_not_disturb" @@ -751,6 +752,10 @@ class DPCode(StrEnum): HUMIDITY_VALUE = "humidity_value" # Humidity INSTALLATION_HEIGHT = "installation_height" INVERTER_OUTPUT_POWER = "inverter_output_power" + IPC_AUTO_SIREN = "ipc_auto_siren" + IPC_BRIGHT = "ipc_bright" + IPC_CONTRAST = "ipc_contrast" + IPC_SHARP = "ipc_sharp" IPC_WORK_MODE = "ipc_work_mode" LED_TYPE_1 = "led_type_1" LED_TYPE_2 = "led_type_2" @@ -776,6 +781,7 @@ class DPCode(StrEnum): MINI_SET = "mini_set" MODE = "mode" # Working mode / Mode MOODLIGHTING = "moodlighting" # Mood light + MOTION_AREA_SWITCH = "motion_area_switch" # Activity area MOTION_RECORD = "motion_record" MOTION_SENSITIVITY = "motion_sensitivity" MOTION_SWITCH = "motion_switch" # Motion switch diff --git a/homeassistant/components/tuya/number.py b/homeassistant/components/tuya/number.py index 2c058d2d0ba780..c93f91bf68d4d6 100644 --- a/homeassistant/components/tuya/number.py +++ b/homeassistant/components/tuya/number.py @@ -299,6 +299,21 @@ translation_key="volume", entity_category=EntityCategory.CONFIG, ), + NumberEntityDescription( + key=DPCode.IPC_BRIGHT, + translation_key="video_brightness", + entity_category=EntityCategory.CONFIG, + ), + NumberEntityDescription( + key=DPCode.IPC_CONTRAST, + translation_key="video_contrast", + entity_category=EntityCategory.CONFIG, + ), + NumberEntityDescription( + key=DPCode.IPC_SHARP, + translation_key="video_sharpness", + entity_category=EntityCategory.CONFIG, + ), ), DeviceCategory.SZJQR: ( NumberEntityDescription( diff --git a/homeassistant/components/tuya/strings.json b/homeassistant/components/tuya/strings.json index b843f06dd0772b..359459d7e6d205 100644 --- a/homeassistant/components/tuya/strings.json +++ b/homeassistant/components/tuya/strings.json @@ -256,6 +256,15 @@ "time": { "name": "Time" }, + "video_brightness": { + "name": "Video brightness" + }, + "video_contrast": { + "name": "Video contrast" + }, + "video_sharpness": { + "name": "Video sharpness" + }, "voice_times": { "name": "Voice times" }, @@ -927,6 +936,9 @@ "auto_clean": { "name": "Auto clean" }, + "auto_siren": { + "name": "Auto-trigger siren" + }, "battery_lock": { "name": "Battery lock" }, @@ -981,6 +993,9 @@ "motion_alarm": { "name": "Motion alarm" }, + "motion_detection_zone": { + "name": "Use motion detection zone" + }, "motion_recording": { "name": "Motion recording" }, diff --git a/homeassistant/components/tuya/switch.py b/homeassistant/components/tuya/switch.py index a23431fc2cc740..752a392a0941b4 100644 --- a/homeassistant/components/tuya/switch.py +++ b/homeassistant/components/tuya/switch.py @@ -717,6 +717,16 @@ translation_key="motion_alarm", entity_category=EntityCategory.CONFIG, ), + SwitchEntityDescription( + key=DPCode.MOTION_AREA_SWITCH, + translation_key="motion_detection_zone", + entity_category=EntityCategory.CONFIG, + ), + SwitchEntityDescription( + key=DPCode.IPC_AUTO_SIREN, + translation_key="auto_siren", + entity_category=EntityCategory.CONFIG, + ), ), DeviceCategory.SZ: ( SwitchEntityDescription( diff --git a/tests/components/tuya/snapshots/test_button.ambr b/tests/components/tuya/snapshots/test_button.ambr index bf236873afc343..ff50b32ab82fcf 100644 --- a/tests/components/tuya/snapshots/test_button.ambr +++ b/tests/components/tuya/snapshots/test_button.ambr @@ -1,4 +1,106 @@ # serializer version: 1 +# name: test_platform_setup_and_discovery[button.c9_restart-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'button', + 'entity_category': , + 'entity_id': 'button.c9_restart', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Restart', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Restart', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'tuya.fjdyw5ld2f5f5ddspsdevice_restart', + 'unit_of_measurement': None, + }) +# --- +# name: test_platform_setup_and_discovery[button.c9_restart-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'restart', + 'friendly_name': 'C9 Restart', + }), + 'context': , + 'entity_id': 'button.c9_restart', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_platform_setup_and_discovery[button.intercom_restart-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'button', + 'entity_category': , + 'entity_id': 'button.intercom_restart', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Restart', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Restart', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'tuya.qt0o5jlatiqf2rscpsdevice_restart', + 'unit_of_measurement': None, + }) +# --- +# name: test_platform_setup_and_discovery[button.intercom_restart-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'restart', + 'friendly_name': 'Intercom Restart', + }), + 'context': , + 'entity_id': 'button.intercom_restart', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- # name: test_platform_setup_and_discovery[button.kattenbak_factory_reset-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ @@ -199,6 +301,57 @@ 'state': 'unknown', }) # --- +# name: test_platform_setup_and_discovery[button.security_camera_restart-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'button', + 'entity_category': , + 'entity_id': 'button.security_camera_restart', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Restart', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Restart', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'tuya.xihygtyd0d1faknkpsdevice_restart', + 'unit_of_measurement': None, + }) +# --- +# name: test_platform_setup_and_discovery[button.security_camera_restart-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'restart', + 'friendly_name': 'Security Camera Restart', + }), + 'context': , + 'entity_id': 'button.security_camera_restart', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- # name: test_platform_setup_and_discovery[button.v20_reset_duster_cloth-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ diff --git a/tests/components/tuya/snapshots/test_number.ambr b/tests/components/tuya/snapshots/test_number.ambr index 1bb0caf4aaf741..d7255ae8bf4efc 100644 --- a/tests/components/tuya/snapshots/test_number.ambr +++ b/tests/components/tuya/snapshots/test_number.ambr @@ -2301,6 +2301,186 @@ 'state': '0.1', }) # --- +# name: test_platform_setup_and_discovery[number.security_camera_video_brightness-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + 'max': 100.0, + 'min': 0.0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': , + 'entity_id': 'number.security_camera_video_brightness', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Video brightness', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Video brightness', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'video_brightness', + 'unique_id': 'tuya.xihygtyd0d1faknkpsipc_bright', + 'unit_of_measurement': '%', + }) +# --- +# name: test_platform_setup_and_discovery[number.security_camera_video_brightness-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Security Camera Video brightness', + 'max': 100.0, + 'min': 0.0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': '%', + }), + 'context': , + 'entity_id': 'number.security_camera_video_brightness', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '50.0', + }) +# --- +# name: test_platform_setup_and_discovery[number.security_camera_video_contrast-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + 'max': 100.0, + 'min': 0.0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': , + 'entity_id': 'number.security_camera_video_contrast', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Video contrast', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Video contrast', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'video_contrast', + 'unique_id': 'tuya.xihygtyd0d1faknkpsipc_contrast', + 'unit_of_measurement': '%', + }) +# --- +# name: test_platform_setup_and_discovery[number.security_camera_video_contrast-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Security Camera Video contrast', + 'max': 100.0, + 'min': 0.0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': '%', + }), + 'context': , + 'entity_id': 'number.security_camera_video_contrast', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '50.0', + }) +# --- +# name: test_platform_setup_and_discovery[number.security_camera_video_sharpness-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + 'max': 100.0, + 'min': 0.0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': , + 'entity_id': 'number.security_camera_video_sharpness', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Video sharpness', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Video sharpness', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'video_sharpness', + 'unique_id': 'tuya.xihygtyd0d1faknkpsipc_sharp', + 'unit_of_measurement': '%', + }) +# --- +# name: test_platform_setup_and_discovery[number.security_camera_video_sharpness-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Security Camera Video sharpness', + 'max': 100.0, + 'min': 0.0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': '%', + }), + 'context': , + 'entity_id': 'number.security_camera_video_sharpness', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '50.0', + }) +# --- # name: test_platform_setup_and_discovery[number.siren_time-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ diff --git a/tests/components/tuya/snapshots/test_switch.ambr b/tests/components/tuya/snapshots/test_switch.ambr index 7d88812ae705f7..5d8c2c337d76b0 100644 --- a/tests/components/tuya/snapshots/test_switch.ambr +++ b/tests/components/tuya/snapshots/test_switch.ambr @@ -1820,6 +1820,56 @@ 'state': 'on', }) # --- +# name: test_platform_setup_and_discovery[switch.c9_auto_trigger_siren-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': , + 'entity_id': 'switch.c9_auto_trigger_siren', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Auto-trigger siren', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Auto-trigger siren', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'auto_siren', + 'unique_id': 'tuya.fjdyw5ld2f5f5ddspsipc_auto_siren', + 'unit_of_measurement': None, + }) +# --- +# name: test_platform_setup_and_discovery[switch.c9_auto_trigger_siren-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'C9 Auto-trigger siren', + }), + 'context': , + 'entity_id': 'switch.c9_auto_trigger_siren', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- # name: test_platform_setup_and_discovery[switch.c9_flip-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ @@ -4789,6 +4839,56 @@ 'state': 'on', }) # --- +# name: test_platform_setup_and_discovery[switch.garage_camera_use_motion_detection_zone-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': , + 'entity_id': 'switch.garage_camera_use_motion_detection_zone', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Use motion detection zone', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Use motion detection zone', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'motion_detection_zone', + 'unique_id': 'tuya.53fnjncm3jywuaznpsmotion_area_switch', + 'unit_of_measurement': None, + }) +# --- +# name: test_platform_setup_and_discovery[switch.garage_camera_use_motion_detection_zone-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Garage Camera Use motion detection zone', + }), + 'context': , + 'entity_id': 'switch.garage_camera_use_motion_detection_zone', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- # name: test_platform_setup_and_discovery[switch.garage_camera_video_recording-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ @@ -9125,6 +9225,56 @@ 'state': 'on', }) # --- +# name: test_platform_setup_and_discovery[switch.security_camera_auto_trigger_siren-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': , + 'entity_id': 'switch.security_camera_auto_trigger_siren', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Auto-trigger siren', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Auto-trigger siren', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'auto_siren', + 'unique_id': 'tuya.xihygtyd0d1faknkpsipc_auto_siren', + 'unit_of_measurement': None, + }) +# --- +# name: test_platform_setup_and_discovery[switch.security_camera_auto_trigger_siren-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Security Camera Auto-trigger siren', + }), + 'context': , + 'entity_id': 'switch.security_camera_auto_trigger_siren', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- # name: test_platform_setup_and_discovery[switch.security_camera_flip-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ @@ -9425,6 +9575,56 @@ 'state': 'on', }) # --- +# name: test_platform_setup_and_discovery[switch.security_camera_use_motion_detection_zone-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': , + 'entity_id': 'switch.security_camera_use_motion_detection_zone', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Use motion detection zone', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Use motion detection zone', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'motion_detection_zone', + 'unique_id': 'tuya.xihygtyd0d1faknkpsmotion_area_switch', + 'unit_of_measurement': None, + }) +# --- +# name: test_platform_setup_and_discovery[switch.security_camera_use_motion_detection_zone-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Security Camera Use motion detection zone', + }), + 'context': , + 'entity_id': 'switch.security_camera_use_motion_detection_zone', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- # name: test_platform_setup_and_discovery[switch.security_camera_video_recording-entry] EntityRegistryEntrySnapshot({ 'aliases': list([