diff --git a/homeassistant/components/drop_connect/binary_sensor.py b/homeassistant/components/drop_connect/binary_sensor.py index 1bce60f87b35..73e0e2546079 100644 --- a/homeassistant/components/drop_connect/binary_sensor.py +++ b/homeassistant/components/drop_connect/binary_sensor.py @@ -31,11 +31,6 @@ from .entity import DROPEntity _LOGGER = logging.getLogger(__name__) -LEAK_ICON = "mdi:pipe-leak" -NOTIFICATION_ICON = "mdi:bell-ring" -PUMP_ICON = "mdi:water-pump" -SALT_ICON = "mdi:shaker" -WATER_ICON = "mdi:water" # Binary sensor type constants LEAK_DETECTED = "leak" @@ -56,32 +51,27 @@ BINARY_SENSORS: list[DROPBinarySensorEntityDescription] = [ DROPBinarySensorEntityDescription( key=LEAK_DETECTED, translation_key=LEAK_DETECTED, - icon=LEAK_ICON, device_class=BinarySensorDeviceClass.MOISTURE, value_fn=lambda device: device.drop_api.leak_detected(), ), DROPBinarySensorEntityDescription( key=PENDING_NOTIFICATION, translation_key=PENDING_NOTIFICATION, - icon=NOTIFICATION_ICON, value_fn=lambda device: device.drop_api.notification_pending(), ), DROPBinarySensorEntityDescription( key=SALT_LOW, translation_key=SALT_LOW, - icon=SALT_ICON, value_fn=lambda device: device.drop_api.salt_low(), ), DROPBinarySensorEntityDescription( key=RESERVE_IN_USE, translation_key=RESERVE_IN_USE, - icon=WATER_ICON, value_fn=lambda device: device.drop_api.reserve_in_use(), ), DROPBinarySensorEntityDescription( key=PUMP_STATUS, translation_key=PUMP_STATUS, - icon=PUMP_ICON, value_fn=lambda device: device.drop_api.pump_status(), ), ] diff --git a/homeassistant/components/drop_connect/icons.json b/homeassistant/components/drop_connect/icons.json new file mode 100644 index 000000000000..9392da79f0c2 --- /dev/null +++ b/homeassistant/components/drop_connect/icons.json @@ -0,0 +1,65 @@ +{ + "entity": { + "binary_sensor": { + "leak": { + "default": "mdi:pipe-leak" + }, + "pending_notification": { + "default": "mdi:bell-ring" + }, + "pump": { + "default": "mdi:water-pump" + }, + "reserve_in_use": { + "default": "mdi:water" + }, + "salt": { + "default": "mdi:shaker" + } + }, + "select": { + "protect_mode": { + "default": "mdi:home-flood" + } + }, + "sensor": { + "current_flow_rate": { + "default": "mdi:shower-head" + }, + "peak_flow_rate": { + "default": "mdi:shower-head" + }, + "inlet_tds": { + "default": "mdi:water-opacity" + }, + "outlet_tds": { + "default": "mdi:water-opacity" + }, + "cart1": { + "default": "mdi:gauge" + }, + "cart2": { + "default": "mdi:gauge" + }, + "cart3": { + "default": "mdi:gauge" + } + }, + "switch": { + "water": { + "default": "mdi:valve", + "state": { + "on": "mdi:valve-open", + "off": "mdi:valve-closed" + } + }, + "bypass": { + "default": "mdi:valve", + "state": { + "on": "mdi:valve-open", + "off": "mdi:valve-closed" + } + } + } + } +} diff --git a/homeassistant/components/drop_connect/select.py b/homeassistant/components/drop_connect/select.py index e026cfcd59e7..ad06576c9f31 100644 --- a/homeassistant/components/drop_connect/select.py +++ b/homeassistant/components/drop_connect/select.py @@ -23,8 +23,6 @@ PROTECT_MODE = "protect_mode" PROTECT_MODE_OPTIONS = ["away", "home", "schedule"] -FLOOD_ICON = "mdi:home-flood" - @dataclass(kw_only=True, frozen=True) class DROPSelectEntityDescription(SelectEntityDescription): @@ -38,7 +36,6 @@ SELECTS: list[DROPSelectEntityDescription] = [ DROPSelectEntityDescription( key=PROTECT_MODE, translation_key=PROTECT_MODE, - icon=FLOOD_ICON, options=PROTECT_MODE_OPTIONS, value_fn=lambda device: device.drop_api.protect_mode(), set_fn=lambda device, value: device.set_protect_mode(value), diff --git a/homeassistant/components/drop_connect/sensor.py b/homeassistant/components/drop_connect/sensor.py index c5215df8395f..c9450440473d 100644 --- a/homeassistant/components/drop_connect/sensor.py +++ b/homeassistant/components/drop_connect/sensor.py @@ -39,9 +39,6 @@ from .entity import DROPEntity _LOGGER = logging.getLogger(__name__) -FLOW_ICON = "mdi:shower-head" -GAUGE_ICON = "mdi:gauge" -TDS_ICON = "mdi:water-opacity" # Sensor type constants CURRENT_FLOW_RATE = "current_flow_rate" @@ -72,7 +69,6 @@ SENSORS: list[DROPSensorEntityDescription] = [ DROPSensorEntityDescription( key=CURRENT_FLOW_RATE, translation_key=CURRENT_FLOW_RATE, - icon="mdi:shower-head", native_unit_of_measurement="gpm", suggested_display_precision=1, value_fn=lambda device: device.drop_api.current_flow_rate(), @@ -81,7 +77,6 @@ SENSORS: list[DROPSensorEntityDescription] = [ DROPSensorEntityDescription( key=PEAK_FLOW_RATE, translation_key=PEAK_FLOW_RATE, - icon="mdi:shower-head", native_unit_of_measurement="gpm", suggested_display_precision=1, value_fn=lambda device: device.drop_api.peak_flow_rate(), @@ -161,7 +156,6 @@ SENSORS: list[DROPSensorEntityDescription] = [ DROPSensorEntityDescription( key=INLET_TDS, translation_key=INLET_TDS, - icon=TDS_ICON, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, suggested_display_precision=0, @@ -170,7 +164,6 @@ SENSORS: list[DROPSensorEntityDescription] = [ DROPSensorEntityDescription( key=OUTLET_TDS, translation_key=OUTLET_TDS, - icon=TDS_ICON, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, suggested_display_precision=0, @@ -179,7 +172,6 @@ SENSORS: list[DROPSensorEntityDescription] = [ DROPSensorEntityDescription( key=CARTRIDGE_1_LIFE, translation_key=CARTRIDGE_1_LIFE, - icon=GAUGE_ICON, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -189,7 +181,6 @@ SENSORS: list[DROPSensorEntityDescription] = [ DROPSensorEntityDescription( key=CARTRIDGE_2_LIFE, translation_key=CARTRIDGE_2_LIFE, - icon=GAUGE_ICON, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -199,7 +190,6 @@ SENSORS: list[DROPSensorEntityDescription] = [ DROPSensorEntityDescription( key=CARTRIDGE_3_LIFE, translation_key=CARTRIDGE_3_LIFE, - icon=GAUGE_ICON, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, diff --git a/homeassistant/components/drop_connect/switch.py b/homeassistant/components/drop_connect/switch.py index b0ebe4b5a859..98841d7ca24e 100644 --- a/homeassistant/components/drop_connect/switch.py +++ b/homeassistant/components/drop_connect/switch.py @@ -25,11 +25,6 @@ from .entity import DROPEntity _LOGGER = logging.getLogger(__name__) -ICON_VALVE_OPEN = "mdi:valve-open" -ICON_VALVE_CLOSED = "mdi:valve-closed" -ICON_VALVE_UNKNOWN = "mdi:valve" -ICON_VALVE = {False: ICON_VALVE_CLOSED, True: ICON_VALVE_OPEN, None: ICON_VALVE_UNKNOWN} - SWITCH_VALUE: dict[int | None, bool] = {0: False, 1: True} # Switch type constants @@ -49,14 +44,12 @@ SWITCHES: list[DROPSwitchEntityDescription] = [ DROPSwitchEntityDescription( key=WATER_SWITCH, translation_key=WATER_SWITCH, - icon=ICON_VALVE_UNKNOWN, value_fn=lambda device: device.drop_api.water(), set_fn=lambda device, value: device.set_water(value), ), DROPSwitchEntityDescription( key=BYPASS_SWITCH, translation_key=BYPASS_SWITCH, - icon=ICON_VALVE_UNKNOWN, value_fn=lambda device: device.drop_api.bypass(), set_fn=lambda device, value: device.set_bypass(value), ), @@ -117,8 +110,3 @@ class DROPSwitch(DROPEntity, SwitchEntity): async def async_turn_off(self, **kwargs: Any) -> None: """Turn switch off.""" await self.entity_description.set_fn(self.coordinator, 0) - - @property - def icon(self) -> str: - """Return the icon to use for dynamic states.""" - return ICON_VALVE[self.is_on] diff --git a/tests/components/drop_connect/snapshots/test_binary_sensor.ambr b/tests/components/drop_connect/snapshots/test_binary_sensor.ambr index 045289f8c908..8f39e76538c7 100644 --- a/tests/components/drop_connect/snapshots/test_binary_sensor.ambr +++ b/tests/components/drop_connect/snapshots/test_binary_sensor.ambr @@ -22,7 +22,7 @@ 'options': dict({ }), 'original_device_class': , - 'original_icon': 'mdi:pipe-leak', + 'original_icon': None, 'original_name': 'Leak detected', 'platform': 'drop_connect', 'previous_unique_id': None, @@ -37,7 +37,6 @@ 'attributes': ReadOnlyDict({ 'device_class': 'moisture', 'friendly_name': 'Hub DROP-1_C0FFEE Leak detected', - 'icon': 'mdi:pipe-leak', }), 'context': , 'entity_id': 'binary_sensor.hub_drop_1_c0ffee_leak_detected', @@ -69,7 +68,7 @@ 'options': dict({ }), 'original_device_class': None, - 'original_icon': 'mdi:bell-ring', + 'original_icon': None, 'original_name': 'Notification unread', 'platform': 'drop_connect', 'previous_unique_id': None, @@ -83,7 +82,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'Hub DROP-1_C0FFEE Notification unread', - 'icon': 'mdi:bell-ring', }), 'context': , 'entity_id': 'binary_sensor.hub_drop_1_c0ffee_notification_unread', @@ -115,7 +113,7 @@ 'options': dict({ }), 'original_device_class': , - 'original_icon': 'mdi:pipe-leak', + 'original_icon': None, 'original_name': 'Leak detected', 'platform': 'drop_connect', 'previous_unique_id': None, @@ -130,7 +128,6 @@ 'attributes': ReadOnlyDict({ 'device_class': 'moisture', 'friendly_name': 'Leak Detector Leak detected', - 'icon': 'mdi:pipe-leak', }), 'context': , 'entity_id': 'binary_sensor.leak_detector_leak_detected', @@ -162,7 +159,7 @@ 'options': dict({ }), 'original_device_class': , - 'original_icon': 'mdi:pipe-leak', + 'original_icon': None, 'original_name': 'Leak detected', 'platform': 'drop_connect', 'previous_unique_id': None, @@ -177,7 +174,6 @@ 'attributes': ReadOnlyDict({ 'device_class': 'moisture', 'friendly_name': 'Protection Valve Leak detected', - 'icon': 'mdi:pipe-leak', }), 'context': , 'entity_id': 'binary_sensor.protection_valve_leak_detected', @@ -209,7 +205,7 @@ 'options': dict({ }), 'original_device_class': , - 'original_icon': 'mdi:pipe-leak', + 'original_icon': None, 'original_name': 'Leak detected', 'platform': 'drop_connect', 'previous_unique_id': None, @@ -224,7 +220,6 @@ 'attributes': ReadOnlyDict({ 'device_class': 'moisture', 'friendly_name': 'Pump Controller Leak detected', - 'icon': 'mdi:pipe-leak', }), 'context': , 'entity_id': 'binary_sensor.pump_controller_leak_detected', @@ -256,7 +251,7 @@ 'options': dict({ }), 'original_device_class': None, - 'original_icon': 'mdi:water-pump', + 'original_icon': None, 'original_name': 'Pump status', 'platform': 'drop_connect', 'previous_unique_id': None, @@ -270,7 +265,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'Pump Controller Pump status', - 'icon': 'mdi:water-pump', }), 'context': , 'entity_id': 'binary_sensor.pump_controller_pump_status', @@ -302,7 +296,7 @@ 'options': dict({ }), 'original_device_class': , - 'original_icon': 'mdi:pipe-leak', + 'original_icon': None, 'original_name': 'Leak detected', 'platform': 'drop_connect', 'previous_unique_id': None, @@ -317,7 +311,6 @@ 'attributes': ReadOnlyDict({ 'device_class': 'moisture', 'friendly_name': 'RO Filter Leak detected', - 'icon': 'mdi:pipe-leak', }), 'context': , 'entity_id': 'binary_sensor.ro_filter_leak_detected', @@ -349,7 +342,7 @@ 'options': dict({ }), 'original_device_class': None, - 'original_icon': 'mdi:water', + 'original_icon': None, 'original_name': 'Reserve capacity in use', 'platform': 'drop_connect', 'previous_unique_id': None, @@ -363,7 +356,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'Softener Reserve capacity in use', - 'icon': 'mdi:water', }), 'context': , 'entity_id': 'binary_sensor.softener_reserve_capacity_in_use',