|
38 | 38 | async_remove_orphaned_entities, |
39 | 39 | get_blu_trv_device_info, |
40 | 40 | get_device_entry_gen, |
41 | | - get_entity_translation_attributes, |
42 | | - get_rpc_channel_name, |
43 | 41 | get_rpc_custom_name, |
44 | 42 | get_rpc_key, |
45 | 43 | is_block_momentary_input, |
@@ -83,27 +81,14 @@ def __init__( |
83 | 81 | super().__init__(coordinator, key, attribute, description) |
84 | 82 |
|
85 | 83 | if not description.role: |
86 | | - if description.key == "input": |
87 | | - if custom_name := get_rpc_custom_name(coordinator.device, key): |
88 | | - self._attr_name = custom_name |
89 | | - else: |
90 | | - _, _, component_id = get_rpc_key(key) |
91 | | - self._attr_translation_placeholders = {"input_number": component_id} |
92 | | - self._attr_translation_key = "input_with_number" |
| 84 | + if description.key != "input": |
| 85 | + self.configure_translation_attributes() |
| 86 | + elif custom_name := get_rpc_custom_name(coordinator.device, key): |
| 87 | + self._attr_name = custom_name |
93 | 88 | else: |
94 | | - translation_placeholders, translation_key = ( |
95 | | - get_entity_translation_attributes( |
96 | | - get_rpc_channel_name(coordinator.device, key), |
97 | | - description.translation_key, |
98 | | - description.device_class, |
99 | | - self._default_to_device_class_name(), |
100 | | - ) |
101 | | - ) |
102 | | - |
103 | | - if translation_placeholders: |
104 | | - self._attr_translation_placeholders = translation_placeholders |
105 | | - if translation_key: |
106 | | - self._attr_translation_key = translation_key |
| 89 | + _, _, component_id = get_rpc_key(key) |
| 90 | + self._attr_translation_placeholders = {"input_number": component_id} |
| 91 | + self._attr_translation_key = "input_with_number" |
107 | 92 |
|
108 | 93 | @property |
109 | 94 | def is_on(self) -> bool: |
@@ -508,19 +493,7 @@ def __init__( |
508 | 493 | super().__init__(coordinator, key, attribute, description, entry) |
509 | 494 |
|
510 | 495 | if coordinator.device.initialized: |
511 | | - translation_placeholders, translation_key = ( |
512 | | - get_entity_translation_attributes( |
513 | | - get_rpc_channel_name(coordinator.device, key), |
514 | | - description.translation_key, |
515 | | - description.device_class, |
516 | | - self._default_to_device_class_name(), |
517 | | - ) |
518 | | - ) |
519 | | - |
520 | | - if translation_placeholders: |
521 | | - self._attr_translation_placeholders = translation_placeholders |
522 | | - if translation_key: |
523 | | - self._attr_translation_key = translation_key |
| 496 | + self.configure_translation_attributes() |
524 | 497 |
|
525 | 498 | async def async_added_to_hass(self) -> None: |
526 | 499 | """Handle entity which will be added.""" |
|
0 commit comments