Use translation_placeholders in tuya cover descriptions (#149248)

Co-authored-by: Simone Chemelli <simone.chemelli@gmail.com>
This commit is contained in:
epenet 2025-07-22 22:21:59 +02:00 committed by GitHub
parent 55ac4d8855
commit 34eb99530f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 19 deletions

View File

@ -44,21 +44,24 @@ COVERS: dict[str, tuple[TuyaCoverEntityDescription, ...]] = {
"ckmkzq": ( "ckmkzq": (
TuyaCoverEntityDescription( TuyaCoverEntityDescription(
key=DPCode.SWITCH_1, key=DPCode.SWITCH_1,
translation_key="door", translation_key="indexed_door",
translation_placeholders={"index": "1"},
current_state=DPCode.DOORCONTACT_STATE, current_state=DPCode.DOORCONTACT_STATE,
current_state_inverse=True, current_state_inverse=True,
device_class=CoverDeviceClass.GARAGE, device_class=CoverDeviceClass.GARAGE,
), ),
TuyaCoverEntityDescription( TuyaCoverEntityDescription(
key=DPCode.SWITCH_2, key=DPCode.SWITCH_2,
translation_key="door_2", translation_key="indexed_door",
translation_placeholders={"index": "2"},
current_state=DPCode.DOORCONTACT_STATE_2, current_state=DPCode.DOORCONTACT_STATE_2,
current_state_inverse=True, current_state_inverse=True,
device_class=CoverDeviceClass.GARAGE, device_class=CoverDeviceClass.GARAGE,
), ),
TuyaCoverEntityDescription( TuyaCoverEntityDescription(
key=DPCode.SWITCH_3, key=DPCode.SWITCH_3,
translation_key="door_3", translation_key="indexed_door",
translation_placeholders={"index": "3"},
current_state=DPCode.DOORCONTACT_STATE_3, current_state=DPCode.DOORCONTACT_STATE_3,
current_state_inverse=True, current_state_inverse=True,
device_class=CoverDeviceClass.GARAGE, device_class=CoverDeviceClass.GARAGE,
@ -78,14 +81,16 @@ COVERS: dict[str, tuple[TuyaCoverEntityDescription, ...]] = {
), ),
TuyaCoverEntityDescription( TuyaCoverEntityDescription(
key=DPCode.CONTROL_2, key=DPCode.CONTROL_2,
translation_key="curtain_2", translation_key="indexed_curtain",
translation_placeholders={"index": "2"},
current_position=DPCode.PERCENT_STATE_2, current_position=DPCode.PERCENT_STATE_2,
set_position=DPCode.PERCENT_CONTROL_2, set_position=DPCode.PERCENT_CONTROL_2,
device_class=CoverDeviceClass.CURTAIN, device_class=CoverDeviceClass.CURTAIN,
), ),
TuyaCoverEntityDescription( TuyaCoverEntityDescription(
key=DPCode.CONTROL_3, key=DPCode.CONTROL_3,
translation_key="curtain_3", translation_key="indexed_curtain",
translation_placeholders={"index": "3"},
current_position=DPCode.PERCENT_STATE_3, current_position=DPCode.PERCENT_STATE_3,
set_position=DPCode.PERCENT_CONTROL_3, set_position=DPCode.PERCENT_CONTROL_3,
device_class=CoverDeviceClass.CURTAIN, device_class=CoverDeviceClass.CURTAIN,
@ -122,7 +127,8 @@ COVERS: dict[str, tuple[TuyaCoverEntityDescription, ...]] = {
), ),
TuyaCoverEntityDescription( TuyaCoverEntityDescription(
key=DPCode.CONTROL_2, key=DPCode.CONTROL_2,
translation_key="curtain_2", translation_key="indexed_curtain",
translation_placeholders={"index": "2"},
current_position=DPCode.PERCENT_CONTROL_2, current_position=DPCode.PERCENT_CONTROL_2,
set_position=DPCode.PERCENT_CONTROL_2, set_position=DPCode.PERCENT_CONTROL_2,
device_class=CoverDeviceClass.CURTAIN, device_class=CoverDeviceClass.CURTAIN,

View File

@ -94,20 +94,11 @@
"curtain": { "curtain": {
"name": "[%key:component::cover::entity_component::curtain::name%]" "name": "[%key:component::cover::entity_component::curtain::name%]"
}, },
"curtain_2": { "indexed_curtain": {
"name": "Curtain 2" "name": "Curtain {index}"
}, },
"curtain_3": { "indexed_door": {
"name": "Curtain 3" "name": "Door {index}"
},
"door": {
"name": "[%key:component::cover::entity_component::door::name%]"
},
"door_2": {
"name": "Door 2"
},
"door_3": {
"name": "Door 3"
} }
}, },
"event": { "event": {