diff --git a/homeassistant/components/tailscale/binary_sensor.py b/homeassistant/components/tailscale/binary_sensor.py index 00fa21279ea..2424837354d 100644 --- a/homeassistant/components/tailscale/binary_sensor.py +++ b/homeassistant/components/tailscale/binary_sensor.py @@ -38,42 +38,36 @@ BINARY_SENSORS: tuple[TailscaleBinarySensorEntityDescription, ...] = ( TailscaleBinarySensorEntityDescription( key="client_supports_hair_pinning", translation_key="client_supports_hair_pinning", - icon="mdi:wan", entity_category=EntityCategory.DIAGNOSTIC, is_on_fn=lambda device: device.client_connectivity.client_supports.hair_pinning, ), TailscaleBinarySensorEntityDescription( key="client_supports_ipv6", translation_key="client_supports_ipv6", - icon="mdi:wan", entity_category=EntityCategory.DIAGNOSTIC, is_on_fn=lambda device: device.client_connectivity.client_supports.ipv6, ), TailscaleBinarySensorEntityDescription( key="client_supports_pcp", translation_key="client_supports_pcp", - icon="mdi:wan", entity_category=EntityCategory.DIAGNOSTIC, is_on_fn=lambda device: device.client_connectivity.client_supports.pcp, ), TailscaleBinarySensorEntityDescription( key="client_supports_pmp", translation_key="client_supports_pmp", - icon="mdi:wan", entity_category=EntityCategory.DIAGNOSTIC, is_on_fn=lambda device: device.client_connectivity.client_supports.pmp, ), TailscaleBinarySensorEntityDescription( key="client_supports_udp", translation_key="client_supports_udp", - icon="mdi:wan", entity_category=EntityCategory.DIAGNOSTIC, is_on_fn=lambda device: device.client_connectivity.client_supports.udp, ), TailscaleBinarySensorEntityDescription( key="client_supports_upnp", translation_key="client_supports_upnp", - icon="mdi:wan", entity_category=EntityCategory.DIAGNOSTIC, is_on_fn=lambda device: device.client_connectivity.client_supports.upnp, ), diff --git a/homeassistant/components/tailscale/icons.json b/homeassistant/components/tailscale/icons.json new file mode 100644 index 00000000000..a5d3bec1884 --- /dev/null +++ b/homeassistant/components/tailscale/icons.json @@ -0,0 +1,29 @@ +{ + "entity": { + "binary_sensor": { + "client_supports_hair_pinning": { + "default": "mdi:wan" + }, + "client_supports_ipv6": { + "default": "mdi:wan" + }, + "client_supports_pcp": { + "default": "mdi:wan" + }, + "client_supports_pmp": { + "default": "mdi:wan" + }, + "client_supports_udp": { + "default": "mdi:wan" + }, + "client_supports_upnp": { + "default": "mdi:wan" + } + }, + "sensor": { + "ip": { + "default": "mdi:ip-network" + } + } + } +} diff --git a/homeassistant/components/tailscale/sensor.py b/homeassistant/components/tailscale/sensor.py index 5d2e615945b..61044eda56c 100644 --- a/homeassistant/components/tailscale/sensor.py +++ b/homeassistant/components/tailscale/sensor.py @@ -39,7 +39,6 @@ SENSORS: tuple[TailscaleSensorEntityDescription, ...] = ( TailscaleSensorEntityDescription( key="ip", translation_key="ip", - icon="mdi:ip-network", entity_category=EntityCategory.DIAGNOSTIC, value_fn=lambda device: device.addresses[0] if device.addresses else None, ), diff --git a/tests/components/tailscale/test_binary_sensor.py b/tests/components/tailscale/test_binary_sensor.py index b258abd1ed4..bd7ca7087bb 100644 --- a/tests/components/tailscale/test_binary_sensor.py +++ b/tests/components/tailscale/test_binary_sensor.py @@ -5,12 +5,7 @@ from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, ) from homeassistant.components.tailscale.const import DOMAIN -from homeassistant.const import ( - ATTR_DEVICE_CLASS, - ATTR_FRIENDLY_NAME, - ATTR_ICON, - EntityCategory, -) +from homeassistant.const import ATTR_DEVICE_CLASS, ATTR_FRIENDLY_NAME, EntityCategory from homeassistant.core import HomeAssistant from homeassistant.helpers import device_registry as dr, entity_registry as er @@ -34,7 +29,6 @@ async def test_tailscale_binary_sensors( assert state.state == STATE_ON assert state.attributes.get(ATTR_FRIENDLY_NAME) == "frencks-iphone Client" assert state.attributes.get(ATTR_DEVICE_CLASS) == BinarySensorDeviceClass.UPDATE - assert ATTR_ICON not in state.attributes state = hass.states.get("binary_sensor.frencks_iphone_supports_hairpinning") entry = entity_registry.async_get( @@ -49,7 +43,6 @@ async def test_tailscale_binary_sensors( state.attributes.get(ATTR_FRIENDLY_NAME) == "frencks-iphone Supports hairpinning" ) - assert state.attributes.get(ATTR_ICON) == "mdi:wan" assert ATTR_DEVICE_CLASS not in state.attributes state = hass.states.get("binary_sensor.frencks_iphone_supports_ipv6") @@ -60,7 +53,6 @@ async def test_tailscale_binary_sensors( assert entry.entity_category == EntityCategory.DIAGNOSTIC assert state.state == STATE_OFF assert state.attributes.get(ATTR_FRIENDLY_NAME) == "frencks-iphone Supports IPv6" - assert state.attributes.get(ATTR_ICON) == "mdi:wan" assert ATTR_DEVICE_CLASS not in state.attributes state = hass.states.get("binary_sensor.frencks_iphone_supports_pcp") @@ -71,7 +63,6 @@ async def test_tailscale_binary_sensors( assert entry.entity_category == EntityCategory.DIAGNOSTIC assert state.state == STATE_OFF assert state.attributes.get(ATTR_FRIENDLY_NAME) == "frencks-iphone Supports PCP" - assert state.attributes.get(ATTR_ICON) == "mdi:wan" assert ATTR_DEVICE_CLASS not in state.attributes state = hass.states.get("binary_sensor.frencks_iphone_supports_nat_pmp") @@ -82,7 +73,6 @@ async def test_tailscale_binary_sensors( assert entry.entity_category == EntityCategory.DIAGNOSTIC assert state.state == STATE_OFF assert state.attributes.get(ATTR_FRIENDLY_NAME) == "frencks-iphone Supports NAT-PMP" - assert state.attributes.get(ATTR_ICON) == "mdi:wan" assert ATTR_DEVICE_CLASS not in state.attributes state = hass.states.get("binary_sensor.frencks_iphone_supports_udp") @@ -93,7 +83,6 @@ async def test_tailscale_binary_sensors( assert entry.entity_category == EntityCategory.DIAGNOSTIC assert state.state == STATE_ON assert state.attributes.get(ATTR_FRIENDLY_NAME) == "frencks-iphone Supports UDP" - assert state.attributes.get(ATTR_ICON) == "mdi:wan" assert ATTR_DEVICE_CLASS not in state.attributes state = hass.states.get("binary_sensor.frencks_iphone_supports_upnp") @@ -104,7 +93,6 @@ async def test_tailscale_binary_sensors( assert entry.entity_category == EntityCategory.DIAGNOSTIC assert state.state == STATE_OFF assert state.attributes.get(ATTR_FRIENDLY_NAME) == "frencks-iphone Supports UPnP" - assert state.attributes.get(ATTR_ICON) == "mdi:wan" assert ATTR_DEVICE_CLASS not in state.attributes assert entry.device_id diff --git a/tests/components/tailscale/test_sensor.py b/tests/components/tailscale/test_sensor.py index 1ea91d1b4b6..7fce057d3e7 100644 --- a/tests/components/tailscale/test_sensor.py +++ b/tests/components/tailscale/test_sensor.py @@ -1,12 +1,7 @@ """Tests for the sensors provided by the Tailscale integration.""" from homeassistant.components.sensor import SensorDeviceClass from homeassistant.components.tailscale.const import DOMAIN -from homeassistant.const import ( - ATTR_DEVICE_CLASS, - ATTR_FRIENDLY_NAME, - ATTR_ICON, - EntityCategory, -) +from homeassistant.const import ATTR_DEVICE_CLASS, ATTR_FRIENDLY_NAME, EntityCategory from homeassistant.core import HomeAssistant from homeassistant.helpers import device_registry as dr, entity_registry as er @@ -30,7 +25,6 @@ async def test_tailscale_sensors( assert state.state == "2022-02-25T09:49:06+00:00" assert state.attributes.get(ATTR_FRIENDLY_NAME) == "router Expires" assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TIMESTAMP - assert ATTR_ICON not in state.attributes state = hass.states.get("sensor.router_last_seen") entry = entity_registry.async_get("sensor.router_last_seen") @@ -41,7 +35,6 @@ async def test_tailscale_sensors( assert state.state == "2021-11-15T20:37:03+00:00" assert state.attributes.get(ATTR_FRIENDLY_NAME) == "router Last seen" assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TIMESTAMP - assert ATTR_ICON not in state.attributes state = hass.states.get("sensor.router_ip_address") entry = entity_registry.async_get("sensor.router_ip_address") @@ -51,7 +44,6 @@ async def test_tailscale_sensors( assert entry.entity_category == EntityCategory.DIAGNOSTIC assert state.state == "100.11.11.112" assert state.attributes.get(ATTR_FRIENDLY_NAME) == "router IP address" - assert state.attributes.get(ATTR_ICON) == "mdi:ip-network" assert ATTR_DEVICE_CLASS not in state.attributes assert entry.device_id