From c3da51db4e12d6192c6616eade0d33e35f0543da Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis <jbouwh@users.noreply.github.com> Date: Sun, 21 Jan 2024 14:57:00 +0100 Subject: [PATCH] Icon translation for imap mail count sensor (#108576) --- homeassistant/components/imap/icons.json | 12 ++++++++++++ homeassistant/components/imap/sensor.py | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 homeassistant/components/imap/icons.json diff --git a/homeassistant/components/imap/icons.json b/homeassistant/components/imap/icons.json new file mode 100644 index 00000000000..a4a79aef60e --- /dev/null +++ b/homeassistant/components/imap/icons.json @@ -0,0 +1,12 @@ +{ + "entity": { + "sensor": { + "imap_mail_count": { + "default": "mdi:email-alert-outline", + "state": { + "0": "mdi:email-check-outline" + } + } + } + } +} diff --git a/homeassistant/components/imap/sensor.py b/homeassistant/components/imap/sensor.py index 92a66fabe49..07e77b31470 100644 --- a/homeassistant/components/imap/sensor.py +++ b/homeassistant/components/imap/sensor.py @@ -20,6 +20,8 @@ IMAP_MAIL_COUNT_DESCRIPTION = SensorEntityDescription( key="imap_mail_count", state_class=SensorStateClass.MEASUREMENT, suggested_display_precision=0, + translation_key="imap_mail_count", + name=None, ) @@ -40,9 +42,7 @@ class ImapSensor( ): """Representation of an IMAP sensor.""" - _attr_icon = "mdi:email-outline" _attr_has_entity_name = True - _attr_name = None def __init__( self, -- GitLab