Add icon translations to TP-Link Omada (#112318)

* Add icon translations to TP-Link Omada

* Add icon translations to TP-Link Omada
pull/112497/head
Joost Lekkerkerker 2024-03-06 12:36:20 +01:00 committed by GitHub
parent a4444925c8
commit 503d39ef0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 29 deletions

View File

@ -0,0 +1,9 @@
{
"entity": {
"switch": {
"poe_control": {
"default": "mdi:ethernet"
}
}
}
}

View File

@ -17,8 +17,6 @@ from .const import DOMAIN
from .controller import OmadaSiteController, OmadaSwitchPortCoordinator
from .entity import OmadaDeviceEntity
POE_SWITCH_ICON = "mdi:ethernet"
async def async_setup_entry(
hass: HomeAssistant,
@ -62,8 +60,8 @@ class OmadaNetworkSwitchPortPoEControl(
"""Representation of a PoE control toggle on a single network port on a switch."""
_attr_has_entity_name = True
_attr_translation_key = "poe_control"
_attr_entity_category = EntityCategory.CONFIG
_attr_icon = POE_SWITCH_ICON
def __init__(
self,
@ -74,8 +72,8 @@ class OmadaNetworkSwitchPortPoEControl(
"""Initialize the PoE switch."""
super().__init__(coordinator, device)
self.port_id = port_id
self.port_details = self.coordinator.data[port_id]
self.omada_client = self.coordinator.omada_client
self.port_details = coordinator.data[port_id]
self.omada_client = coordinator.omada_client
self._attr_unique_id = f"{device.mac}_{port_id}_poe"
self._attr_name = f"{get_port_base_name(self.port_details)} PoE"

View File

@ -3,7 +3,6 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Test PoE Switch Port 1 PoE',
'icon': 'mdi:ethernet',
}),
'context': <ANY>,
'entity_id': 'switch.test_poe_switch_port_1_poe',
@ -35,12 +34,12 @@
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:ethernet',
'original_icon': None,
'original_name': 'Port 1 PoE',
'platform': 'tplink_omada',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'translation_key': 'poe_control',
'unique_id': '54-AF-97-00-00-01_000000000000000000000001_poe',
'unit_of_measurement': None,
})
@ -49,7 +48,6 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Test PoE Switch Port 6 PoE',
'icon': 'mdi:ethernet',
}),
'context': <ANY>,
'entity_id': 'switch.test_poe_switch_port_6_poe',
@ -81,12 +79,12 @@
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:ethernet',
'original_icon': None,
'original_name': 'Port 6 PoE',
'platform': 'tplink_omada',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'translation_key': 'poe_control',
'unique_id': '54-AF-97-00-00-01_000000000000000000000006_poe',
'unit_of_measurement': None,
})
@ -95,7 +93,6 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Test PoE Switch Port 7 PoE',
'icon': 'mdi:ethernet',
}),
'context': <ANY>,
'entity_id': 'switch.test_poe_switch_port_7_poe',
@ -127,12 +124,12 @@
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:ethernet',
'original_icon': None,
'original_name': 'Port 7 PoE',
'platform': 'tplink_omada',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'translation_key': 'poe_control',
'unique_id': '54-AF-97-00-00-01_000000000000000000000007_poe',
'unit_of_measurement': None,
})
@ -141,7 +138,6 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Test PoE Switch Port 8 PoE',
'icon': 'mdi:ethernet',
}),
'context': <ANY>,
'entity_id': 'switch.test_poe_switch_port_8_poe',
@ -173,12 +169,12 @@
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:ethernet',
'original_icon': None,
'original_name': 'Port 8 PoE',
'platform': 'tplink_omada',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'translation_key': 'poe_control',
'unique_id': '54-AF-97-00-00-01_000000000000000000000008_poe',
'unit_of_measurement': None,
})
@ -187,7 +183,6 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Test PoE Switch Port 2 PoE',
'icon': 'mdi:ethernet',
}),
'context': <ANY>,
'entity_id': 'switch.test_poe_switch_port_2_poe',
@ -219,12 +214,12 @@
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:ethernet',
'original_icon': None,
'original_name': 'Port 2 PoE',
'platform': 'tplink_omada',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'translation_key': 'poe_control',
'unique_id': '54-AF-97-00-00-01_000000000000000000000002_poe',
'unit_of_measurement': None,
})
@ -233,7 +228,6 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Test PoE Switch Port 3 PoE',
'icon': 'mdi:ethernet',
}),
'context': <ANY>,
'entity_id': 'switch.test_poe_switch_port_3_poe',
@ -265,12 +259,12 @@
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:ethernet',
'original_icon': None,
'original_name': 'Port 3 PoE',
'platform': 'tplink_omada',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'translation_key': 'poe_control',
'unique_id': '54-AF-97-00-00-01_000000000000000000000003_poe',
'unit_of_measurement': None,
})
@ -279,7 +273,6 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Test PoE Switch Port 4 PoE',
'icon': 'mdi:ethernet',
}),
'context': <ANY>,
'entity_id': 'switch.test_poe_switch_port_4_poe',
@ -311,12 +304,12 @@
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:ethernet',
'original_icon': None,
'original_name': 'Port 4 PoE',
'platform': 'tplink_omada',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'translation_key': 'poe_control',
'unique_id': '54-AF-97-00-00-01_000000000000000000000004_poe',
'unit_of_measurement': None,
})
@ -325,7 +318,6 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Test PoE Switch Port 5 PoE',
'icon': 'mdi:ethernet',
}),
'context': <ANY>,
'entity_id': 'switch.test_poe_switch_port_5_poe',
@ -357,12 +349,12 @@
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:ethernet',
'original_icon': None,
'original_name': 'Port 5 PoE',
'platform': 'tplink_omada',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'translation_key': 'poe_control',
'unique_id': '54-AF-97-00-00-01_000000000000000000000005_poe',
'unit_of_measurement': None,
})