mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Use icon translations for system bridge entities (#155090)
This commit is contained in:
@@ -39,13 +39,11 @@ BASE_BINARY_SENSOR_TYPES: tuple[SystemBridgeBinarySensorEntityDescription, ...]
|
||||
SystemBridgeBinarySensorEntityDescription(
|
||||
key="camera_in_use",
|
||||
translation_key="camera_in_use",
|
||||
icon="mdi:webcam",
|
||||
value_fn=camera_in_use,
|
||||
),
|
||||
SystemBridgeBinarySensorEntityDescription(
|
||||
key="pending_reboot",
|
||||
translation_key="pending_reboot",
|
||||
icon="mdi:restart",
|
||||
value_fn=lambda data: data.system.pending_reboot,
|
||||
),
|
||||
SystemBridgeBinarySensorEntityDescription(
|
||||
|
||||
@@ -1,4 +1,60 @@
|
||||
{
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"camera_in_use": {
|
||||
"default": "mdi:webcam"
|
||||
},
|
||||
"pending_reboot": {
|
||||
"default": "mdi:restart"
|
||||
}
|
||||
},
|
||||
"media_player": {
|
||||
"media": {
|
||||
"default": "mdi:volume-high"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"boot_time": {
|
||||
"default": "mdi:av-timer"
|
||||
},
|
||||
"cpu_power_package": {
|
||||
"default": "mdi:chip"
|
||||
},
|
||||
"cpu_speed": {
|
||||
"default": "mdi:speedometer"
|
||||
},
|
||||
"displays_connected": {
|
||||
"default": "mdi:monitor"
|
||||
},
|
||||
"kernel": {
|
||||
"default": "mdi:devices"
|
||||
},
|
||||
"load": {
|
||||
"default": "mdi:percent"
|
||||
},
|
||||
"memory_free": {
|
||||
"default": "mdi:memory"
|
||||
},
|
||||
"memory_used": {
|
||||
"default": "mdi:memory"
|
||||
},
|
||||
"os": {
|
||||
"default": "mdi:devices"
|
||||
},
|
||||
"power_usage": {
|
||||
"default": "mdi:power-plug"
|
||||
},
|
||||
"processes": {
|
||||
"default": "mdi:counter"
|
||||
},
|
||||
"version": {
|
||||
"default": "mdi:counter"
|
||||
},
|
||||
"version_latest": {
|
||||
"default": "mdi:counter"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"get_process_by_id": {
|
||||
"service": "mdi:console"
|
||||
|
||||
@@ -57,7 +57,6 @@ MEDIA_PLAYER_DESCRIPTION: Final[MediaPlayerEntityDescription] = (
|
||||
MediaPlayerEntityDescription(
|
||||
key="media",
|
||||
translation_key="media",
|
||||
icon="mdi:volume-high",
|
||||
device_class=MediaPlayerDeviceClass.RECEIVER,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -233,7 +233,6 @@ BASE_SENSOR_TYPES: tuple[SystemBridgeSensorEntityDescription, ...] = (
|
||||
key="boot_time",
|
||||
translation_key="boot_time",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
icon="mdi:av-timer",
|
||||
value=lambda data: datetime.fromtimestamp(data.system.boot_time, tz=UTC),
|
||||
),
|
||||
SystemBridgeSensorEntityDescription(
|
||||
@@ -242,7 +241,6 @@ BASE_SENSOR_TYPES: tuple[SystemBridgeSensorEntityDescription, ...] = (
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suggested_display_precision=2,
|
||||
icon="mdi:chip",
|
||||
value=lambda data: data.cpu.power,
|
||||
),
|
||||
SystemBridgeSensorEntityDescription(
|
||||
@@ -252,7 +250,6 @@ BASE_SENSOR_TYPES: tuple[SystemBridgeSensorEntityDescription, ...] = (
|
||||
native_unit_of_measurement=UnitOfFrequency.GIGAHERTZ,
|
||||
device_class=SensorDeviceClass.FREQUENCY,
|
||||
suggested_display_precision=2,
|
||||
icon="mdi:speedometer",
|
||||
value=cpu_speed,
|
||||
),
|
||||
SystemBridgeSensorEntityDescription(
|
||||
@@ -278,7 +275,6 @@ BASE_SENSOR_TYPES: tuple[SystemBridgeSensorEntityDescription, ...] = (
|
||||
SystemBridgeSensorEntityDescription(
|
||||
key="kernel",
|
||||
translation_key="kernel",
|
||||
icon="mdi:devices",
|
||||
value=lambda data: data.system.platform,
|
||||
),
|
||||
SystemBridgeSensorEntityDescription(
|
||||
@@ -288,7 +284,6 @@ BASE_SENSOR_TYPES: tuple[SystemBridgeSensorEntityDescription, ...] = (
|
||||
native_unit_of_measurement=UnitOfInformation.GIGABYTES,
|
||||
device_class=SensorDeviceClass.DATA_SIZE,
|
||||
suggested_display_precision=2,
|
||||
icon="mdi:memory",
|
||||
value=memory_free,
|
||||
),
|
||||
SystemBridgeSensorEntityDescription(
|
||||
@@ -307,20 +302,17 @@ BASE_SENSOR_TYPES: tuple[SystemBridgeSensorEntityDescription, ...] = (
|
||||
native_unit_of_measurement=UnitOfInformation.GIGABYTES,
|
||||
device_class=SensorDeviceClass.DATA_SIZE,
|
||||
suggested_display_precision=2,
|
||||
icon="mdi:memory",
|
||||
value=memory_used,
|
||||
),
|
||||
SystemBridgeSensorEntityDescription(
|
||||
key="os",
|
||||
translation_key="os",
|
||||
icon="mdi:devices",
|
||||
value=lambda data: f"{data.system.platform} {data.system.platform_version}",
|
||||
),
|
||||
SystemBridgeSensorEntityDescription(
|
||||
key="processes_count",
|
||||
translation_key="processes",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
icon="mdi:counter",
|
||||
value=lambda data: len(data.processes),
|
||||
),
|
||||
SystemBridgeSensorEntityDescription(
|
||||
@@ -329,7 +321,6 @@ BASE_SENSOR_TYPES: tuple[SystemBridgeSensorEntityDescription, ...] = (
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
suggested_display_precision=1,
|
||||
icon="mdi:percent",
|
||||
value=lambda data: data.cpu.usage,
|
||||
),
|
||||
SystemBridgeSensorEntityDescription(
|
||||
@@ -339,19 +330,16 @@ BASE_SENSOR_TYPES: tuple[SystemBridgeSensorEntityDescription, ...] = (
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
suggested_display_precision=2,
|
||||
icon="mdi:power-plug",
|
||||
value=lambda data: data.system.power_usage,
|
||||
),
|
||||
SystemBridgeSensorEntityDescription(
|
||||
key="version",
|
||||
translation_key="version",
|
||||
icon="mdi:counter",
|
||||
value=lambda data: data.system.version,
|
||||
),
|
||||
SystemBridgeSensorEntityDescription(
|
||||
key="version_latest",
|
||||
translation_key="version_latest",
|
||||
icon="mdi:counter",
|
||||
value=lambda data: data.system.version_latest,
|
||||
),
|
||||
)
|
||||
@@ -429,7 +417,6 @@ async def async_setup_entry(
|
||||
key="displays_connected",
|
||||
translation_key="displays_connected",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
icon="mdi:monitor",
|
||||
value=lambda data: len(data.displays) if data.displays else None,
|
||||
),
|
||||
entry.data[CONF_PORT],
|
||||
|
||||
Reference in New Issue
Block a user