From 818750dfd181752cf2c423dbed1eff25d5a98129 Mon Sep 17 00:00:00 2001 From: "Mr. Bubbles" Date: Fri, 21 Jun 2024 11:07:45 +0200 Subject: [PATCH] Add icons to One-Time Password (OTP) (#120066) --- homeassistant/components/otp/icons.json | 9 +++++++++ homeassistant/components/otp/sensor.py | 2 +- tests/components/otp/snapshots/test_sensor.ambr | 1 - 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 homeassistant/components/otp/icons.json diff --git a/homeassistant/components/otp/icons.json b/homeassistant/components/otp/icons.json new file mode 100644 index 00000000000..1cab872e8f8 --- /dev/null +++ b/homeassistant/components/otp/icons.json @@ -0,0 +1,9 @@ +{ + "entity": { + "sensor": { + "token": { + "default": "mdi:lock-clock" + } + } + } +} diff --git a/homeassistant/components/otp/sensor.py b/homeassistant/components/otp/sensor.py index 0c87afb86b7..466fc994cdb 100644 --- a/homeassistant/components/otp/sensor.py +++ b/homeassistant/components/otp/sensor.py @@ -69,7 +69,7 @@ async def async_setup_entry( class TOTPSensor(SensorEntity): """Representation of a TOTP sensor.""" - _attr_icon = "mdi:update" + _attr_translation_key = "token" _attr_should_poll = False _attr_native_value: StateType = None _next_expiration: float | None = None diff --git a/tests/components/otp/snapshots/test_sensor.ambr b/tests/components/otp/snapshots/test_sensor.ambr index fbd8741b8b5..5329b03ad9e 100644 --- a/tests/components/otp/snapshots/test_sensor.ambr +++ b/tests/components/otp/snapshots/test_sensor.ambr @@ -3,7 +3,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ 'friendly_name': 'OTP Sensor', - 'icon': 'mdi:update', }), 'context': , 'entity_id': 'sensor.otp_sensor',