Use translation_placeholders in tuya light descriptions (#149249)

This commit is contained in:
epenet 2025-07-22 19:44:51 +02:00 committed by GitHub
parent 316ac6253b
commit ef3fb50018
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 12 deletions

View File

@ -121,7 +121,8 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
# Based on multiple reports: manufacturer customized Dimmer 2 switches # Based on multiple reports: manufacturer customized Dimmer 2 switches
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_1, key=DPCode.SWITCH_1,
translation_key="light", translation_key="indexed_light",
translation_placeholders={"index": "1"},
brightness=DPCode.BRIGHT_VALUE_1, brightness=DPCode.BRIGHT_VALUE_1,
), ),
), ),
@ -149,7 +150,8 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
), ),
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED, key=DPCode.SWITCH_LED,
translation_key="light_2", translation_key="indexed_light",
translation_placeholders={"index": "2"},
brightness=DPCode.BRIGHT_VALUE_1, brightness=DPCode.BRIGHT_VALUE_1,
), ),
), ),
@ -313,21 +315,24 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
"tgkg": ( "tgkg": (
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED_1, key=DPCode.SWITCH_LED_1,
translation_key="light", translation_key="indexed_light",
translation_placeholders={"index": "1"},
brightness=DPCode.BRIGHT_VALUE_1, brightness=DPCode.BRIGHT_VALUE_1,
brightness_max=DPCode.BRIGHTNESS_MAX_1, brightness_max=DPCode.BRIGHTNESS_MAX_1,
brightness_min=DPCode.BRIGHTNESS_MIN_1, brightness_min=DPCode.BRIGHTNESS_MIN_1,
), ),
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED_2, key=DPCode.SWITCH_LED_2,
translation_key="light_2", translation_key="indexed_light",
translation_placeholders={"index": "2"},
brightness=DPCode.BRIGHT_VALUE_2, brightness=DPCode.BRIGHT_VALUE_2,
brightness_max=DPCode.BRIGHTNESS_MAX_2, brightness_max=DPCode.BRIGHTNESS_MAX_2,
brightness_min=DPCode.BRIGHTNESS_MIN_2, brightness_min=DPCode.BRIGHTNESS_MIN_2,
), ),
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED_3, key=DPCode.SWITCH_LED_3,
translation_key="light_3", translation_key="indexed_light",
translation_placeholders={"index": "3"},
brightness=DPCode.BRIGHT_VALUE_3, brightness=DPCode.BRIGHT_VALUE_3,
brightness_max=DPCode.BRIGHTNESS_MAX_3, brightness_max=DPCode.BRIGHTNESS_MAX_3,
brightness_min=DPCode.BRIGHTNESS_MIN_3, brightness_min=DPCode.BRIGHTNESS_MIN_3,
@ -345,12 +350,14 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
), ),
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED_1, key=DPCode.SWITCH_LED_1,
translation_key="light", translation_key="indexed_light",
translation_placeholders={"index": "1"},
brightness=DPCode.BRIGHT_VALUE_1, brightness=DPCode.BRIGHT_VALUE_1,
), ),
TuyaLightEntityDescription( TuyaLightEntityDescription(
key=DPCode.SWITCH_LED_2, key=DPCode.SWITCH_LED_2,
translation_key="light_2", translation_key="indexed_light",
translation_placeholders={"index": "2"},
brightness=DPCode.BRIGHT_VALUE_2, brightness=DPCode.BRIGHT_VALUE_2,
), ),
), ),

View File

@ -131,11 +131,8 @@
"light": { "light": {
"name": "[%key:component::light::title%]" "name": "[%key:component::light::title%]"
}, },
"light_2": { "indexed_light": {
"name": "Light 2" "name": "Light {index}"
},
"light_3": {
"name": "Light 3"
}, },
"night_light": { "night_light": {
"name": "Night light" "name": "Night light"