Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion homeassistant/components/tuya/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -63,6 +67,13 @@
entity_category=EntityCategory.CONFIG,
),
),
DeviceCategory.SP: (
ButtonEntityDescription(
key=DPCode.DEVICE_RESTART,
device_class=ButtonDeviceClass.RESTART,
entity_category=EntityCategory.CONFIG,
),
Comment thread
mik-laj marked this conversation as resolved.
Comment thread
epenet marked this conversation as resolved.
),
Comment thread
mik-laj marked this conversation as resolved.
Comment thread
mik-laj marked this conversation as resolved.
Comment thread
epenet marked this conversation as resolved.
}
Comment thread
epenet marked this conversation as resolved.


Expand Down
6 changes: 6 additions & 0 deletions homeassistant/components/tuya/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions homeassistant/components/tuya/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,21 @@
translation_key="volume",
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.IPC_BRIGHT,
translation_key="video_brightness",
entity_category=EntityCategory.CONFIG,
),
Comment thread
mik-laj marked this conversation as resolved.
NumberEntityDescription(
key=DPCode.IPC_CONTRAST,
translation_key="video_contrast",
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.IPC_SHARP,
Comment thread
mik-laj marked this conversation as resolved.
translation_key="video_sharpness",
entity_category=EntityCategory.CONFIG,
),
Comment thread
mik-laj marked this conversation as resolved.
Comment on lines +302 to +316
),
DeviceCategory.SZJQR: (
NumberEntityDescription(
Expand Down
15 changes: 15 additions & 0 deletions homeassistant/components/tuya/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -927,6 +936,9 @@
"auto_clean": {
"name": "Auto clean"
},
"auto_siren": {
"name": "Auto-trigger siren"
},
"battery_lock": {
"name": "Battery lock"
},
Expand Down Expand Up @@ -981,6 +993,9 @@
"motion_alarm": {
"name": "Motion alarm"
},
"motion_detection_zone": {
"name": "Use motion detection zone"
},
"motion_recording": {
"name": "Motion recording"
},
Expand Down
10 changes: 10 additions & 0 deletions homeassistant/components/tuya/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Comment thread
mik-laj marked this conversation as resolved.
SwitchEntityDescription(
key=DPCode.IPC_AUTO_SIREN,
translation_key="auto_siren",
entity_category=EntityCategory.CONFIG,
),
Comment thread
mik-laj marked this conversation as resolved.
Comment thread
mik-laj marked this conversation as resolved.
Comment on lines +720 to +729
),
DeviceCategory.SZ: (
SwitchEntityDescription(
Expand Down
153 changes: 153 additions & 0 deletions tests/components/tuya/snapshots/test_button.ambr
Original file line number Diff line number Diff line change
@@ -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': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.c9_restart',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Restart',
'options': dict({
}),
'original_device_class': <ButtonDeviceClass.RESTART: 'restart'>,
'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': <ANY>,
'entity_id': 'button.c9_restart',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_platform_setup_and_discovery[button.intercom_restart-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': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.intercom_restart',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Restart',
'options': dict({
}),
'original_device_class': <ButtonDeviceClass.RESTART: 'restart'>,
'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': <ANY>,
'entity_id': 'button.intercom_restart',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_platform_setup_and_discovery[button.kattenbak_factory_reset-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
Expand Down Expand Up @@ -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': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'button',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'button.security_camera_restart',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Restart',
'options': dict({
}),
'original_device_class': <ButtonDeviceClass.RESTART: 'restart'>,
'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': <ANY>,
'entity_id': 'button.security_camera_restart',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_platform_setup_and_discovery[button.v20_reset_duster_cloth-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
Expand Down
Loading