File tree Expand file tree Collapse file tree 2 files changed +18
-19
lines changed
homeassistant/components/shelly Expand file tree Collapse file tree 2 files changed +18
-19
lines changed Original file line number Diff line number Diff line change 6363 get_blu_trv_device_info ,
6464 get_device_entry_gen ,
6565 get_device_uptime ,
66+ get_entity_translation_attributes ,
6667 get_rpc_channel_name ,
6768 get_shelly_air_lamp_life ,
6869 get_virtual_component_unit ,
7374PARALLEL_UPDATES = 0
7475
7576
76- def get_entity_translation_attributes (
77- channel_name : str | None ,
78- translation_key : str | None ,
79- device_class : str | None ,
80- default_to_device_class_name : bool ,
81- ) -> tuple [dict [str , str ] | None , str | None ]:
82- """Translation attributes for entity with channel name."""
83- if channel_name is None :
84- return None , None
85-
86- key = translation_key
87- if key is None and default_to_device_class_name :
88- key = device_class
89-
90- final_translation_key = f"{ key } _with_channel_name" if key else None
91-
92- return {"channel_name" : channel_name }, final_translation_key
93-
94-
9577@dataclass (frozen = True , kw_only = True )
9678class BlockSensorDescription (BlockEntityDescription , SensorEntityDescription ):
9779 """Class to describe a BLOCK sensor."""
Original file line number Diff line number Diff line change @@ -459,6 +459,23 @@ def get_rpc_entity_name(
459459 return channel_name
460460
461461
462+ def get_entity_translation_attributes (
463+ channel_name : str | None ,
464+ translation_key : str | None ,
465+ device_class : str | None ,
466+ default_to_device_class_name : bool ,
467+ ) -> tuple [dict [str , str ] | None , str | None ]:
468+ """Translation attributes for entity with channel name."""
469+ if channel_name is None :
470+ return None , None
471+
472+ key = translation_key
473+ if key is None and default_to_device_class_name :
474+ key = device_class
475+
476+ return {"channel_name" : channel_name }, f"{ key } _with_channel_name" if key else None
477+
478+
462479def get_device_entry_gen (entry : ConfigEntry ) -> int :
463480 """Return the device generation from config entry."""
464481 return entry .data .get (CONF_GEN , 1 ) # type: ignore[no-any-return]
You can’t perform that action at this time.
0 commit comments