mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add icon translations to Vodafone Station (#112349)
This commit is contained in:
parent
4a7eab92bb
commit
e076b6aacf
@ -61,6 +61,8 @@ def async_add_new_tracked_entities(
|
||||
class VodafoneStationTracker(CoordinatorEntity[VodafoneStationRouter], ScannerEntity):
|
||||
"""Representation of a Vodafone Station device."""
|
||||
|
||||
_attr_translation_key = "device_tracker"
|
||||
|
||||
def __init__(
|
||||
self, coordinator: VodafoneStationRouter, device_info: VodafoneStationDeviceInfo
|
||||
) -> None:
|
||||
@ -98,11 +100,6 @@ class VodafoneStationTracker(CoordinatorEntity[VodafoneStationRouter], ScannerEn
|
||||
"""Return the hostname of device."""
|
||||
return self._attr_name
|
||||
|
||||
@property
|
||||
def icon(self) -> str:
|
||||
"""Return device icon."""
|
||||
return "mdi:lan-connect" if self._device.connected else "mdi:lan-disconnect"
|
||||
|
||||
@property
|
||||
def ip_address(self) -> str | None:
|
||||
"""Return the primary ip address of the device."""
|
||||
|
44
homeassistant/components/vodafone_station/icons.json
Normal file
44
homeassistant/components/vodafone_station/icons.json
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"entity": {
|
||||
"device_tracker": {
|
||||
"device_tracker": {
|
||||
"default": "mdi:lan-disconnect",
|
||||
"state": {
|
||||
"home": "mdi:lan-connect"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"external_ipv4": {
|
||||
"default": "mdi:earth"
|
||||
},
|
||||
"external_ipv6": {
|
||||
"default": "mdi:earth"
|
||||
},
|
||||
"external_ip_key": {
|
||||
"default": "mdi:earth"
|
||||
},
|
||||
"active_connection": {
|
||||
"default": "mdi:wan"
|
||||
},
|
||||
"fw_version": {
|
||||
"default": "mdi:new-box"
|
||||
},
|
||||
"phone_num1": {
|
||||
"default": "mdi:phone"
|
||||
},
|
||||
"phone_num2": {
|
||||
"default": "mdi:phone"
|
||||
},
|
||||
"sys_cpu_usage": {
|
||||
"default": "mdi:chip"
|
||||
},
|
||||
"sys_memory_usage": {
|
||||
"default": "mdi:memory"
|
||||
},
|
||||
"sys_reboot_cause": {
|
||||
"default": "mdi:restart-alert"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -72,26 +72,22 @@ SENSOR_TYPES: Final = (
|
||||
VodafoneStationEntityDescription(
|
||||
key="wan_ip4_addr",
|
||||
translation_key="external_ipv4",
|
||||
icon="mdi:earth",
|
||||
is_suitable=lambda info: info["wan_ip4_addr"] not in NOT_AVAILABLE,
|
||||
),
|
||||
VodafoneStationEntityDescription(
|
||||
key="wan_ip6_addr",
|
||||
translation_key="external_ipv6",
|
||||
icon="mdi:earth",
|
||||
is_suitable=lambda info: info["wan_ip6_addr"] not in NOT_AVAILABLE,
|
||||
),
|
||||
VodafoneStationEntityDescription(
|
||||
key="vf_internet_key_ip_addr",
|
||||
translation_key="external_ip_key",
|
||||
icon="mdi:earth",
|
||||
is_suitable=lambda info: info["vf_internet_key_ip_addr"] not in NOT_AVAILABLE,
|
||||
),
|
||||
VodafoneStationEntityDescription(
|
||||
key="inter_ip_address",
|
||||
translation_key="active_connection",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
icon="mdi:wan",
|
||||
options=LINE_TYPES,
|
||||
value=_line_connection,
|
||||
),
|
||||
@ -112,19 +108,16 @@ SENSOR_TYPES: Final = (
|
||||
VodafoneStationEntityDescription(
|
||||
key="fw_version",
|
||||
translation_key="fw_version",
|
||||
icon="mdi:new-box",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
VodafoneStationEntityDescription(
|
||||
key="phone_num1",
|
||||
translation_key="phone_num1",
|
||||
icon="mdi:phone",
|
||||
is_suitable=lambda info: info["phone_unavailable1"] == "0",
|
||||
),
|
||||
VodafoneStationEntityDescription(
|
||||
key="phone_num2",
|
||||
translation_key="phone_num2",
|
||||
icon="mdi:phone",
|
||||
is_suitable=lambda info: info["phone_unavailable2"] == "0",
|
||||
),
|
||||
VodafoneStationEntityDescription(
|
||||
@ -137,7 +130,6 @@ SENSOR_TYPES: Final = (
|
||||
VodafoneStationEntityDescription(
|
||||
key="sys_cpu_usage",
|
||||
translation_key="sys_cpu_usage",
|
||||
icon="mdi:chip",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value=lambda coordinator, key: float(coordinator.data.sensors[key][:-1]),
|
||||
@ -145,7 +137,6 @@ SENSOR_TYPES: Final = (
|
||||
VodafoneStationEntityDescription(
|
||||
key="sys_memory_usage",
|
||||
translation_key="sys_memory_usage",
|
||||
icon="mdi:memory",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value=lambda coordinator, key: float(coordinator.data.sensors[key][:-1]),
|
||||
@ -153,7 +144,6 @@ SENSOR_TYPES: Final = (
|
||||
VodafoneStationEntityDescription(
|
||||
key="sys_reboot_cause",
|
||||
translation_key="sys_reboot_cause",
|
||||
icon="mdi:restart-alert",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user