Use translation_placeholders in tuya number descriptions (#149250)

This commit is contained in:
epenet 2025-07-22 19:06:14 +02:00 committed by GitHub
parent 252a46d141
commit 316ac6253b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 20 deletions

View File

@ -266,32 +266,38 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
"tgkg": ( "tgkg": (
NumberEntityDescription( NumberEntityDescription(
key=DPCode.BRIGHTNESS_MIN_1, key=DPCode.BRIGHTNESS_MIN_1,
translation_key="minimum_brightness", translation_key="indexed_minimum_brightness",
translation_placeholders={"index": "1"},
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
NumberEntityDescription( NumberEntityDescription(
key=DPCode.BRIGHTNESS_MAX_1, key=DPCode.BRIGHTNESS_MAX_1,
translation_key="maximum_brightness", translation_key="indexed_maximum_brightness",
translation_placeholders={"index": "1"},
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
NumberEntityDescription( NumberEntityDescription(
key=DPCode.BRIGHTNESS_MIN_2, key=DPCode.BRIGHTNESS_MIN_2,
translation_key="minimum_brightness_2", translation_key="indexed_minimum_brightness",
translation_placeholders={"index": "2"},
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
NumberEntityDescription( NumberEntityDescription(
key=DPCode.BRIGHTNESS_MAX_2, key=DPCode.BRIGHTNESS_MAX_2,
translation_key="maximum_brightness_2", translation_key="indexed_maximum_brightness",
translation_placeholders={"index": "2"},
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
NumberEntityDescription( NumberEntityDescription(
key=DPCode.BRIGHTNESS_MIN_3, key=DPCode.BRIGHTNESS_MIN_3,
translation_key="minimum_brightness_3", translation_key="indexed_minimum_brightness",
translation_placeholders={"index": "3"},
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
NumberEntityDescription( NumberEntityDescription(
key=DPCode.BRIGHTNESS_MAX_3, key=DPCode.BRIGHTNESS_MAX_3,
translation_key="maximum_brightness_3", translation_key="indexed_maximum_brightness",
translation_placeholders={"index": "3"},
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
), ),
@ -300,22 +306,26 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
"tgq": ( "tgq": (
NumberEntityDescription( NumberEntityDescription(
key=DPCode.BRIGHTNESS_MIN_1, key=DPCode.BRIGHTNESS_MIN_1,
translation_key="minimum_brightness", translation_key="indexed_minimum_brightness",
translation_placeholders={"index": "1"},
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
NumberEntityDescription( NumberEntityDescription(
key=DPCode.BRIGHTNESS_MAX_1, key=DPCode.BRIGHTNESS_MAX_1,
translation_key="maximum_brightness", translation_key="indexed_maximum_brightness",
translation_placeholders={"index": "1"},
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
NumberEntityDescription( NumberEntityDescription(
key=DPCode.BRIGHTNESS_MIN_2, key=DPCode.BRIGHTNESS_MIN_2,
translation_key="minimum_brightness_2", translation_key="indexed_minimum_brightness",
translation_placeholders={"index": "2"},
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
NumberEntityDescription( NumberEntityDescription(
key=DPCode.BRIGHTNESS_MAX_2, key=DPCode.BRIGHTNESS_MAX_2,
translation_key="maximum_brightness_2", translation_key="indexed_maximum_brightness",
translation_placeholders={"index": "2"},
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
), ),

View File

@ -199,17 +199,11 @@
"maximum_brightness": { "maximum_brightness": {
"name": "Maximum brightness" "name": "Maximum brightness"
}, },
"minimum_brightness_2": { "indexed_minimum_brightness": {
"name": "Minimum brightness 2" "name": "Minimum brightness {index}"
}, },
"maximum_brightness_2": { "indexed_maximum_brightness": {
"name": "Maximum brightness 2" "name": "Maximum brightness {index}"
},
"minimum_brightness_3": {
"name": "Minimum brightness 3"
},
"maximum_brightness_3": {
"name": "Maximum brightness 3"
}, },
"move_down": { "move_down": {
"name": "Move down" "name": "Move down"