From afdb7d15cab385a32e63d896221cdceb0973af46 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Tue, 5 Mar 2024 13:59:08 +0100 Subject: [PATCH] Add icon translations to YouTube (#112365) * Add icon translations to YouTube * Add icon translations to YouTube --- homeassistant/components/youtube/icons.json | 12 ++++++++++++ homeassistant/components/youtube/sensor.py | 2 -- tests/components/youtube/snapshots/test_sensor.ambr | 4 ---- 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 homeassistant/components/youtube/icons.json diff --git a/homeassistant/components/youtube/icons.json b/homeassistant/components/youtube/icons.json new file mode 100644 index 00000000000..34867058633 --- /dev/null +++ b/homeassistant/components/youtube/icons.json @@ -0,0 +1,12 @@ +{ + "entity": { + "sensor": { + "latest_upload": { + "default": "mdi:youtube" + }, + "subscribers": { + "default": "mdi:youtube-subscription" + } + } + } +} diff --git a/homeassistant/components/youtube/sensor.py b/homeassistant/components/youtube/sensor.py index d037a8c3c4b..e6205ad1646 100644 --- a/homeassistant/components/youtube/sensor.py +++ b/homeassistant/components/youtube/sensor.py @@ -45,7 +45,6 @@ SENSOR_TYPES = [ YouTubeSensorEntityDescription( key="latest_upload", translation_key="latest_upload", - icon="mdi:youtube", available_fn=lambda channel: channel[ATTR_LATEST_VIDEO] is not None, value_fn=lambda channel: channel[ATTR_LATEST_VIDEO][ATTR_TITLE], entity_picture_fn=lambda channel: channel[ATTR_LATEST_VIDEO][ATTR_THUMBNAIL], @@ -57,7 +56,6 @@ SENSOR_TYPES = [ YouTubeSensorEntityDescription( key="subscribers", translation_key="subscribers", - icon="mdi:youtube-subscription", native_unit_of_measurement="subscribers", available_fn=lambda _: True, value_fn=lambda channel: channel[ATTR_SUBSCRIBER_COUNT], diff --git a/tests/components/youtube/snapshots/test_sensor.ambr b/tests/components/youtube/snapshots/test_sensor.ambr index e3bfa4ec4bd..bea70279dd3 100644 --- a/tests/components/youtube/snapshots/test_sensor.ambr +++ b/tests/components/youtube/snapshots/test_sensor.ambr @@ -4,7 +4,6 @@ 'attributes': ReadOnlyDict({ 'entity_picture': 'https://i.ytimg.com/vi/wysukDrMdqU/maxresdefault.jpg', 'friendly_name': 'Google for Developers Latest upload', - 'icon': 'mdi:youtube', 'published_at': datetime.datetime(2023, 5, 11, 0, 20, 46, tzinfo=datetime.timezone.utc), 'video_id': 'wysukDrMdqU', }), @@ -20,7 +19,6 @@ 'attributes': ReadOnlyDict({ 'entity_picture': 'https://yt3.ggpht.com/fca_HuJ99xUxflWdex0XViC3NfctBFreIl8y4i9z411asnGTWY-Ql3MeH_ybA4kNaOjY7kyA=s800-c-k-c0x00ffffff-no-rj', 'friendly_name': 'Google for Developers Subscribers', - 'icon': 'mdi:youtube-subscription', 'unit_of_measurement': 'subscribers', }), 'context': , @@ -34,7 +32,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'Google for Developers Latest upload', - 'icon': 'mdi:youtube', }), 'context': , 'entity_id': 'sensor.google_for_developers_latest_upload', @@ -48,7 +45,6 @@ 'attributes': ReadOnlyDict({ 'entity_picture': 'https://yt3.ggpht.com/fca_HuJ99xUxflWdex0XViC3NfctBFreIl8y4i9z411asnGTWY-Ql3MeH_ybA4kNaOjY7kyA=s800-c-k-c0x00ffffff-no-rj', 'friendly_name': 'Google for Developers Subscribers', - 'icon': 'mdi:youtube-subscription', 'unit_of_measurement': 'subscribers', }), 'context': ,