diff --git a/homeassistant/components/fritz/button.py b/homeassistant/components/fritz/button.py index 5b4a3f5a20c..de34056b0d7 100644 --- a/homeassistant/components/fritz/button.py +++ b/homeassistant/components/fritz/button.py @@ -59,7 +59,6 @@ BUTTONS: Final = [ FritzButtonDescription( key="cleanup", translation_key="cleanup", - icon="mdi:broom", entity_category=EntityCategory.CONFIG, press_action=lambda avm_wrapper: avm_wrapper.async_trigger_cleanup(), ), diff --git a/homeassistant/components/fritz/icons.json b/homeassistant/components/fritz/icons.json new file mode 100644 index 00000000000..d2154dc7232 --- /dev/null +++ b/homeassistant/components/fritz/icons.json @@ -0,0 +1,59 @@ +{ + "entity": { + "button": { + "cleanup": { + "default": "mdi:broom" + } + }, + "sensor": { + "external_ip": { + "default": "mdi:earth" + }, + "external_ipv6": { + "default": "mdi:earth" + }, + "kb_s_sent": { + "default": "mdi:upload" + }, + "kb_s_received": { + "default": "mdi:download" + }, + "max_kb_s_sent": { + "default": "mdi:upload" + }, + "max_kb_s_received": { + "default": "mdi:download" + }, + "gb_sent": { + "default": "mdi:upload" + }, + "gb_received": { + "default": "mdi:download" + }, + "link_kb_s_sent": { + "default": "mdi:upload" + }, + "link_kb_s_received": { + "default": "mdi:download" + }, + "link_noise_margin_sent": { + "default": "mdi:upload" + }, + "link_noise_margin_received": { + "default": "mdi:download" + }, + "link_attenuation_sent": { + "default": "mdi:upload" + }, + "link_attenuation_received": { + "default": "mdi:download" + } + } + }, + "services": { + "reconnect": "mdi:connection", + "reboot": "mdi:refresh", + "cleanup": "mdi:broom", + "set_guest_wifi_password": "mdi:form-textbox-password" + } +} diff --git a/homeassistant/components/fritz/sensor.py b/homeassistant/components/fritz/sensor.py index 980d86e2455..7fcc4944ec5 100644 --- a/homeassistant/components/fritz/sensor.py +++ b/homeassistant/components/fritz/sensor.py @@ -153,13 +153,11 @@ SENSOR_TYPES: tuple[FritzSensorEntityDescription, ...] = ( FritzSensorEntityDescription( key="external_ip", translation_key="external_ip", - icon="mdi:earth", value_fn=_retrieve_external_ip_state, ), FritzSensorEntityDescription( key="external_ipv6", translation_key="external_ipv6", - icon="mdi:earth", value_fn=_retrieve_external_ipv6_state, is_suitable=lambda info: info.ipv6_active, ), @@ -184,7 +182,6 @@ SENSOR_TYPES: tuple[FritzSensorEntityDescription, ...] = ( state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfDataRate.KILOBYTES_PER_SECOND, device_class=SensorDeviceClass.DATA_RATE, - icon="mdi:upload", value_fn=_retrieve_kb_s_sent_state, ), FritzSensorEntityDescription( @@ -193,7 +190,6 @@ SENSOR_TYPES: tuple[FritzSensorEntityDescription, ...] = ( state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfDataRate.KILOBYTES_PER_SECOND, device_class=SensorDeviceClass.DATA_RATE, - icon="mdi:download", value_fn=_retrieve_kb_s_received_state, ), FritzSensorEntityDescription( @@ -201,7 +197,6 @@ SENSOR_TYPES: tuple[FritzSensorEntityDescription, ...] = ( translation_key="max_kb_s_sent", native_unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND, device_class=SensorDeviceClass.DATA_RATE, - icon="mdi:upload", entity_category=EntityCategory.DIAGNOSTIC, value_fn=_retrieve_max_kb_s_sent_state, ), @@ -210,7 +205,6 @@ SENSOR_TYPES: tuple[FritzSensorEntityDescription, ...] = ( translation_key="max_kb_s_received", native_unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND, device_class=SensorDeviceClass.DATA_RATE, - icon="mdi:download", entity_category=EntityCategory.DIAGNOSTIC, value_fn=_retrieve_max_kb_s_received_state, ), @@ -220,7 +214,6 @@ SENSOR_TYPES: tuple[FritzSensorEntityDescription, ...] = ( state_class=SensorStateClass.TOTAL_INCREASING, native_unit_of_measurement=UnitOfInformation.GIGABYTES, device_class=SensorDeviceClass.DATA_SIZE, - icon="mdi:upload", value_fn=_retrieve_gb_sent_state, ), FritzSensorEntityDescription( @@ -229,7 +222,6 @@ SENSOR_TYPES: tuple[FritzSensorEntityDescription, ...] = ( state_class=SensorStateClass.TOTAL_INCREASING, native_unit_of_measurement=UnitOfInformation.GIGABYTES, device_class=SensorDeviceClass.DATA_SIZE, - icon="mdi:download", value_fn=_retrieve_gb_received_state, ), FritzSensorEntityDescription( @@ -237,7 +229,6 @@ SENSOR_TYPES: tuple[FritzSensorEntityDescription, ...] = ( translation_key="link_kb_s_sent", native_unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND, device_class=SensorDeviceClass.DATA_RATE, - icon="mdi:upload", value_fn=_retrieve_link_kb_s_sent_state, ), FritzSensorEntityDescription( @@ -245,14 +236,12 @@ SENSOR_TYPES: tuple[FritzSensorEntityDescription, ...] = ( translation_key="link_kb_s_received", native_unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND, device_class=SensorDeviceClass.DATA_RATE, - icon="mdi:download", value_fn=_retrieve_link_kb_s_received_state, ), FritzSensorEntityDescription( key="link_noise_margin_sent", translation_key="link_noise_margin_sent", native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS, - icon="mdi:upload", value_fn=_retrieve_link_noise_margin_sent_state, is_suitable=lambda info: info.wan_enabled and info.connection == DSL_CONNECTION, ), @@ -260,7 +249,6 @@ SENSOR_TYPES: tuple[FritzSensorEntityDescription, ...] = ( key="link_noise_margin_received", translation_key="link_noise_margin_received", native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS, - icon="mdi:download", value_fn=_retrieve_link_noise_margin_received_state, is_suitable=lambda info: info.wan_enabled and info.connection == DSL_CONNECTION, ), @@ -268,7 +256,6 @@ SENSOR_TYPES: tuple[FritzSensorEntityDescription, ...] = ( key="link_attenuation_sent", translation_key="link_attenuation_sent", native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS, - icon="mdi:upload", value_fn=_retrieve_link_attenuation_sent_state, is_suitable=lambda info: info.wan_enabled and info.connection == DSL_CONNECTION, ), @@ -276,7 +263,6 @@ SENSOR_TYPES: tuple[FritzSensorEntityDescription, ...] = ( key="link_attenuation_received", translation_key="link_attenuation_received", native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS, - icon="mdi:download", value_fn=_retrieve_link_attenuation_received_state, is_suitable=lambda info: info.wan_enabled and info.connection == DSL_CONNECTION, ), diff --git a/tests/components/fritz/test_sensor.py b/tests/components/fritz/test_sensor.py index eefa65274d7..9265d1337f0 100644 --- a/tests/components/fritz/test_sensor.py +++ b/tests/components/fritz/test_sensor.py @@ -17,7 +17,6 @@ from homeassistant.components.sensor import ( from homeassistant.config_entries import ConfigEntryState from homeassistant.const import ( ATTR_DEVICE_CLASS, - ATTR_ICON, ATTR_STATE, ATTR_UNIT_OF_MEASUREMENT, STATE_UNAVAILABLE, @@ -32,11 +31,9 @@ from tests.common import MockConfigEntry, async_fire_time_changed SENSOR_STATES: dict[str, dict[str, Any]] = { "sensor.mock_title_external_ip": { ATTR_STATE: "1.2.3.4", - ATTR_ICON: "mdi:earth", }, "sensor.mock_title_external_ipv6": { ATTR_STATE: "fec0::1", - ATTR_ICON: "mdi:earth", }, "sensor.mock_title_last_restart": { # ATTR_STATE: "2022-02-05T17:46:04+00:00", @@ -50,65 +47,53 @@ SENSOR_STATES: dict[str, dict[str, Any]] = { ATTR_STATE: "3.4", ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT, ATTR_UNIT_OF_MEASUREMENT: "kB/s", - ATTR_ICON: "mdi:upload", }, "sensor.mock_title_download_throughput": { ATTR_STATE: "67.6", ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT, ATTR_UNIT_OF_MEASUREMENT: "kB/s", - ATTR_ICON: "mdi:download", }, "sensor.mock_title_max_connection_upload_throughput": { ATTR_STATE: "2105.0", ATTR_UNIT_OF_MEASUREMENT: "kbit/s", - ATTR_ICON: "mdi:upload", }, "sensor.mock_title_max_connection_download_throughput": { ATTR_STATE: "10087.0", ATTR_UNIT_OF_MEASUREMENT: "kbit/s", - ATTR_ICON: "mdi:download", }, "sensor.mock_title_gb_sent": { ATTR_STATE: "1.7", ATTR_STATE_CLASS: SensorStateClass.TOTAL_INCREASING, ATTR_UNIT_OF_MEASUREMENT: "GB", - ATTR_ICON: "mdi:upload", }, "sensor.mock_title_gb_received": { ATTR_STATE: "5.2", ATTR_STATE_CLASS: SensorStateClass.TOTAL_INCREASING, ATTR_UNIT_OF_MEASUREMENT: "GB", - ATTR_ICON: "mdi:download", }, "sensor.mock_title_link_upload_throughput": { ATTR_STATE: "51805.0", ATTR_UNIT_OF_MEASUREMENT: "kbit/s", - ATTR_ICON: "mdi:upload", }, "sensor.mock_title_link_download_throughput": { ATTR_STATE: "318557.0", ATTR_UNIT_OF_MEASUREMENT: "kbit/s", - ATTR_ICON: "mdi:download", }, "sensor.mock_title_link_upload_noise_margin": { ATTR_STATE: "9.0", ATTR_UNIT_OF_MEASUREMENT: "dB", - ATTR_ICON: "mdi:upload", }, "sensor.mock_title_link_download_noise_margin": { ATTR_STATE: "8.0", ATTR_UNIT_OF_MEASUREMENT: "dB", - ATTR_ICON: "mdi:download", }, "sensor.mock_title_link_upload_power_attenuation": { ATTR_STATE: "7.0", ATTR_UNIT_OF_MEASUREMENT: "dB", - ATTR_ICON: "mdi:upload", }, "sensor.mock_title_link_download_power_attenuation": { ATTR_STATE: "12.0", ATTR_UNIT_OF_MEASUREMENT: "dB", - ATTR_ICON: "mdi:download", }, }