diff --git a/homeassistant/components/systemmonitor/icons.json b/homeassistant/components/systemmonitor/icons.json new file mode 100644 index 00000000000..b0ea54acc98 --- /dev/null +++ b/homeassistant/components/systemmonitor/icons.json @@ -0,0 +1,51 @@ +{ + "entity": { + "sensor": { + "disk_free": { + "default": "mdi:harddisk" + }, + "disk_use": { + "default": "mdi:harddisk" + }, + "disk_use_percent": { + "default": "mdi:harddisk" + }, + "ipv4_address": { + "default": "mdi:ip-network" + }, + "ipv6_address": { + "default": "mdi:ip-network" + }, + "memory_free": { + "default": "mdi:memory" + }, + "memory_use": { + "default": "mdi:memory" + }, + "memory_use_percent": { + "default": "mdi:memory" + }, + "network_in": { + "default": "mdi:server-network" + }, + "network_out": { + "default": "mdi:server-network" + }, + "packets_in": { + "default": "mdi:server-network" + }, + "packets_out": { + "default": "mdi:server-network" + }, + "swap_free": { + "default": "mdi:harddisk" + }, + "swap_use": { + "default": "mdi:harddisk" + }, + "swap_use_percent": { + "default": "mdi:harddisk" + } + } + } +} diff --git a/homeassistant/components/systemmonitor/sensor.py b/homeassistant/components/systemmonitor/sensor.py index f32e089a1d9..94fc1719c4a 100644 --- a/homeassistant/components/systemmonitor/sensor.py +++ b/homeassistant/components/systemmonitor/sensor.py @@ -164,7 +164,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { placeholder="mount_point", native_unit_of_measurement=UnitOfInformation.GIBIBYTES, device_class=SensorDeviceClass.DATA_SIZE, - icon="mdi:harddisk", state_class=SensorStateClass.MEASUREMENT, value_fn=lambda entity: round( entity.coordinator.data.disk_usage[entity.argument].free / 1024**3, 1 @@ -180,7 +179,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { placeholder="mount_point", native_unit_of_measurement=UnitOfInformation.GIBIBYTES, device_class=SensorDeviceClass.DATA_SIZE, - icon="mdi:harddisk", state_class=SensorStateClass.MEASUREMENT, value_fn=lambda entity: round( entity.coordinator.data.disk_usage[entity.argument].used / 1024**3, 1 @@ -195,7 +193,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { translation_key="disk_use_percent", placeholder="mount_point", native_unit_of_measurement=PERCENTAGE, - icon="mdi:harddisk", state_class=SensorStateClass.MEASUREMENT, value_fn=lambda entity: entity.coordinator.data.disk_usage[ entity.argument @@ -209,7 +206,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { key="ipv4_address", translation_key="ipv4_address", placeholder="ip_address", - icon="mdi:ip-network", mandatory_arg=True, value_fn=get_ip_address, add_to_update=lambda entity: ("addresses", ""), @@ -218,7 +214,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { key="ipv6_address", translation_key="ipv6_address", placeholder="ip_address", - icon="mdi:ip-network", mandatory_arg=True, value_fn=get_ip_address, add_to_update=lambda entity: ("addresses", ""), @@ -259,7 +254,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { translation_key="memory_free", native_unit_of_measurement=UnitOfInformation.MEBIBYTES, device_class=SensorDeviceClass.DATA_SIZE, - icon="mdi:memory", state_class=SensorStateClass.MEASUREMENT, value_fn=lambda entity: round( entity.coordinator.data.memory.available / 1024**2, 1 @@ -271,7 +265,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { translation_key="memory_use", native_unit_of_measurement=UnitOfInformation.MEBIBYTES, device_class=SensorDeviceClass.DATA_SIZE, - icon="mdi:memory", state_class=SensorStateClass.MEASUREMENT, value_fn=lambda entity: round( ( @@ -287,7 +280,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { key="memory_use_percent", translation_key="memory_use_percent", native_unit_of_measurement=PERCENTAGE, - icon="mdi:memory", state_class=SensorStateClass.MEASUREMENT, value_fn=lambda entity: entity.coordinator.data.memory.percent, add_to_update=lambda entity: ("memory", ""), @@ -298,7 +290,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { placeholder="interface", native_unit_of_measurement=UnitOfInformation.MEBIBYTES, device_class=SensorDeviceClass.DATA_SIZE, - icon="mdi:server-network", state_class=SensorStateClass.TOTAL_INCREASING, mandatory_arg=True, value_fn=get_network, @@ -310,7 +301,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { placeholder="interface", native_unit_of_measurement=UnitOfInformation.MEBIBYTES, device_class=SensorDeviceClass.DATA_SIZE, - icon="mdi:server-network", state_class=SensorStateClass.TOTAL_INCREASING, mandatory_arg=True, value_fn=get_network, @@ -320,7 +310,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { key="packets_in", translation_key="packets_in", placeholder="interface", - icon="mdi:server-network", state_class=SensorStateClass.TOTAL_INCREASING, mandatory_arg=True, value_fn=get_packets, @@ -330,7 +319,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { key="packets_out", translation_key="packets_out", placeholder="interface", - icon="mdi:server-network", state_class=SensorStateClass.TOTAL_INCREASING, mandatory_arg=True, value_fn=get_packets, @@ -395,7 +383,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { translation_key="swap_free", native_unit_of_measurement=UnitOfInformation.MEBIBYTES, device_class=SensorDeviceClass.DATA_SIZE, - icon="mdi:harddisk", state_class=SensorStateClass.MEASUREMENT, value_fn=lambda entity: round(entity.coordinator.data.swap.free / 1024**2, 1), add_to_update=lambda entity: ("swap", ""), @@ -405,7 +392,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { translation_key="swap_use", native_unit_of_measurement=UnitOfInformation.MEBIBYTES, device_class=SensorDeviceClass.DATA_SIZE, - icon="mdi:harddisk", state_class=SensorStateClass.MEASUREMENT, value_fn=lambda entity: round(entity.coordinator.data.swap.used / 1024**2, 1), add_to_update=lambda entity: ("swap", ""), @@ -414,7 +400,6 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = { key="swap_use_percent", translation_key="swap_use_percent", native_unit_of_measurement=PERCENTAGE, - icon="mdi:harddisk", state_class=SensorStateClass.MEASUREMENT, value_fn=lambda entity: entity.coordinator.data.swap.percent, add_to_update=lambda entity: ("swap", ""), diff --git a/tests/components/systemmonitor/snapshots/test_sensor.ambr b/tests/components/systemmonitor/snapshots/test_sensor.ambr index 952aaaa7ec2..5374ea886d3 100644 --- a/tests/components/systemmonitor/snapshots/test_sensor.ambr +++ b/tests/components/systemmonitor/snapshots/test_sensor.ambr @@ -3,7 +3,6 @@ ReadOnlyDict({ 'device_class': 'data_size', 'friendly_name': 'System Monitor Disk free /', - 'icon': 'mdi:harddisk', 'state_class': , 'unit_of_measurement': , }) @@ -15,7 +14,6 @@ ReadOnlyDict({ 'device_class': 'data_size', 'friendly_name': 'System Monitor Disk free /media/share', - 'icon': 'mdi:harddisk', 'state_class': , 'unit_of_measurement': , }) @@ -26,7 +24,6 @@ # name: test_sensor[System Monitor Disk usage / - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor Disk usage /', - 'icon': 'mdi:harddisk', 'state_class': , 'unit_of_measurement': '%', }) @@ -37,7 +34,6 @@ # name: test_sensor[System Monitor Disk usage /home/notexist/ - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor Disk usage /home/notexist/', - 'icon': 'mdi:harddisk', 'state_class': , 'unit_of_measurement': '%', }) @@ -48,7 +44,6 @@ # name: test_sensor[System Monitor Disk usage /media/share - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor Disk usage /media/share', - 'icon': 'mdi:harddisk', 'state_class': , 'unit_of_measurement': '%', }) @@ -60,7 +55,6 @@ ReadOnlyDict({ 'device_class': 'data_size', 'friendly_name': 'System Monitor Disk use /', - 'icon': 'mdi:harddisk', 'state_class': , 'unit_of_measurement': , }) @@ -72,7 +66,6 @@ ReadOnlyDict({ 'device_class': 'data_size', 'friendly_name': 'System Monitor Disk use /media/share', - 'icon': 'mdi:harddisk', 'state_class': , 'unit_of_measurement': , }) @@ -83,7 +76,6 @@ # name: test_sensor[System Monitor IPv4 address eth0 - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor IPv4 address eth0', - 'icon': 'mdi:ip-network', }) # --- # name: test_sensor[System Monitor IPv4 address eth0 - state] @@ -92,7 +84,6 @@ # name: test_sensor[System Monitor IPv4 address eth1 - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor IPv4 address eth1', - 'icon': 'mdi:ip-network', }) # --- # name: test_sensor[System Monitor IPv4 address eth1 - state] @@ -101,7 +92,6 @@ # name: test_sensor[System Monitor IPv6 address eth0 - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor IPv6 address eth0', - 'icon': 'mdi:ip-network', }) # --- # name: test_sensor[System Monitor IPv6 address eth0 - state] @@ -110,7 +100,6 @@ # name: test_sensor[System Monitor IPv6 address eth1 - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor IPv6 address eth1', - 'icon': 'mdi:ip-network', }) # --- # name: test_sensor[System Monitor IPv6 address eth1 - state] @@ -159,7 +148,6 @@ ReadOnlyDict({ 'device_class': 'data_size', 'friendly_name': 'System Monitor Memory free', - 'icon': 'mdi:memory', 'state_class': , 'unit_of_measurement': , }) @@ -170,7 +158,6 @@ # name: test_sensor[System Monitor Memory usage - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor Memory usage', - 'icon': 'mdi:memory', 'state_class': , 'unit_of_measurement': '%', }) @@ -182,7 +169,6 @@ ReadOnlyDict({ 'device_class': 'data_size', 'friendly_name': 'System Monitor Memory use', - 'icon': 'mdi:memory', 'state_class': , 'unit_of_measurement': , }) @@ -194,7 +180,6 @@ ReadOnlyDict({ 'device_class': 'data_size', 'friendly_name': 'System Monitor Network in eth0', - 'icon': 'mdi:server-network', 'state_class': , 'unit_of_measurement': , }) @@ -206,7 +191,6 @@ ReadOnlyDict({ 'device_class': 'data_size', 'friendly_name': 'System Monitor Network in eth1', - 'icon': 'mdi:server-network', 'state_class': , 'unit_of_measurement': , }) @@ -218,7 +202,6 @@ ReadOnlyDict({ 'device_class': 'data_size', 'friendly_name': 'System Monitor Network out eth0', - 'icon': 'mdi:server-network', 'state_class': , 'unit_of_measurement': , }) @@ -230,7 +213,6 @@ ReadOnlyDict({ 'device_class': 'data_size', 'friendly_name': 'System Monitor Network out eth1', - 'icon': 'mdi:server-network', 'state_class': , 'unit_of_measurement': , }) @@ -285,7 +267,6 @@ # name: test_sensor[System Monitor Packets in eth0 - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor Packets in eth0', - 'icon': 'mdi:server-network', 'state_class': , }) # --- @@ -295,7 +276,6 @@ # name: test_sensor[System Monitor Packets in eth1 - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor Packets in eth1', - 'icon': 'mdi:server-network', 'state_class': , }) # --- @@ -305,7 +285,6 @@ # name: test_sensor[System Monitor Packets out eth0 - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor Packets out eth0', - 'icon': 'mdi:server-network', 'state_class': , }) # --- @@ -315,7 +294,6 @@ # name: test_sensor[System Monitor Packets out eth1 - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor Packets out eth1', - 'icon': 'mdi:server-network', 'state_class': , }) # --- @@ -366,7 +344,6 @@ ReadOnlyDict({ 'device_class': 'data_size', 'friendly_name': 'System Monitor Swap free', - 'icon': 'mdi:harddisk', 'state_class': , 'unit_of_measurement': , }) @@ -377,7 +354,6 @@ # name: test_sensor[System Monitor Swap usage - attributes] ReadOnlyDict({ 'friendly_name': 'System Monitor Swap usage', - 'icon': 'mdi:harddisk', 'state_class': , 'unit_of_measurement': '%', }) @@ -389,7 +365,6 @@ ReadOnlyDict({ 'device_class': 'data_size', 'friendly_name': 'System Monitor Swap use', - 'icon': 'mdi:harddisk', 'state_class': , 'unit_of_measurement': , }) diff --git a/tests/components/systemmonitor/test_sensor.py b/tests/components/systemmonitor/test_sensor.py index e67dd31a1de..11dd002c2f7 100644 --- a/tests/components/systemmonitor/test_sensor.py +++ b/tests/components/systemmonitor/test_sensor.py @@ -60,7 +60,6 @@ async def test_sensor( "state_class": "measurement", "unit_of_measurement": "MiB", "device_class": "data_size", - "icon": "mdi:memory", "friendly_name": "System Monitor Memory free", }