Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 7 additions & 0 deletions homeassistant/components/tuya/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@
entity_category=EntityCategory.CONFIG,
),
),
DeviceCategory.SP: (
ButtonEntityDescription(
key=DPCode.DEVICE_RESTART,
translation_key="device_restart",
Comment thread
epenet marked this conversation as resolved.
Outdated
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="brightness",
entity_category=EntityCategory.CONFIG,
),
Comment thread
mik-laj marked this conversation as resolved.
NumberEntityDescription(
key=DPCode.IPC_CONTRAST,
translation_key="contrast",
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.IPC_SHARP,
Comment thread
mik-laj marked this conversation as resolved.
translation_key="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
18 changes: 18 additions & 0 deletions homeassistant/components/tuya/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
}
},
"button": {
"device_restart": {
"name": "Device restart"
},
"factory_reset": {
"name": "Factory reset"
},
Expand Down Expand Up @@ -169,9 +172,15 @@
"battery_backup_reserve": {
"name": "Battery backup reserve"
},
"brightness": {
"name": "Brightness"
},
"cloud_recipe": {
"name": "Cloud recipe"
},
"contrast": {
"name": "Contrast"
},
"cook_temperature": {
"name": "Cooking temperature"
},
Expand Down Expand Up @@ -238,6 +247,9 @@
"sensitivity": {
"name": "Sensitivity"
},
"sharpness": {
"name": "Sharpness"
},
"siren_duration": {
"name": "Siren duration"
},
Expand Down Expand Up @@ -918,6 +930,9 @@
}
},
"switch": {
"activity_area": {
"name": "Activity area"
},
"anion": {
"name": "Anion"
},
Expand Down Expand Up @@ -1068,6 +1083,9 @@
"time_watermark": {
"name": "Time watermark"
},
"trigger_siren": {
"name": "Trigger siren"
},
"uv_sterilization": {
"name": "UV sterilization"
},
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="activity_area",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly is this? I don't understand it from the translation_key or the translation string.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a description of this control in PR description. This is what it looks like in the app:
Screenshot_20260507-130141.png

I couldn't think of a better name.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "specific_area_monitoring" / "Monitor specific area" would be more understable for english users and for translators

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the name to "Motion Detection Zone". What do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add "Use" prefix? Use motion detection zone

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

entity_category=EntityCategory.CONFIG,
),
Comment thread
mik-laj marked this conversation as resolved.
SwitchEntityDescription(
key=DPCode.IPC_AUTO_SIREN,
translation_key="trigger_siren",
Comment thread
epenet marked this conversation as resolved.
Outdated
Comment thread
epenet marked this conversation as resolved.
Outdated
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
150 changes: 150 additions & 0 deletions tests/components/tuya/snapshots/test_button.ambr
Original file line number Diff line number Diff line change
@@ -1,4 +1,104 @@
# serializer version: 1
# name: test_platform_setup_and_discovery[button.c9_device_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_device_restart',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Device restart',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Device restart',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'device_restart',
'unique_id': 'tuya.fjdyw5ld2f5f5ddspsdevice_restart',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[button.c9_device_restart-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'C9 Device restart',
}),
'context': <ANY>,
'entity_id': 'button.c9_device_restart',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_platform_setup_and_discovery[button.intercom_device_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_device_restart',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Device restart',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Device restart',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'device_restart',
'unique_id': 'tuya.qt0o5jlatiqf2rscpsdevice_restart',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[button.intercom_device_restart-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Intercom Device restart',
}),
'context': <ANY>,
'entity_id': 'button.intercom_device_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 +299,56 @@
'state': 'unknown',
})
# ---
# name: test_platform_setup_and_discovery[button.security_camera_device_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_device_restart',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Device restart',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Device restart',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'device_restart',
'unique_id': 'tuya.xihygtyd0d1faknkpsdevice_restart',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[button.security_camera_device_restart-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Security Camera Device restart',
}),
'context': <ANY>,
'entity_id': 'button.security_camera_device_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
Loading