From 1a61c6db1c9838a4f7d898500504e6b0abe221d3 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Wed, 28 Feb 2024 08:50:57 +0100 Subject: [PATCH] Add icon translations to Fireservicerota (#111537) --- .../components/fireservicerota/binary_sensor.py | 15 +-------------- .../components/fireservicerota/icons.json | 12 ++++++++++++ 2 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 homeassistant/components/fireservicerota/icons.json diff --git a/homeassistant/components/fireservicerota/binary_sensor.py b/homeassistant/components/fireservicerota/binary_sensor.py index 27f2c4a4526..d2f4e2e11f2 100644 --- a/homeassistant/components/fireservicerota/binary_sensor.py +++ b/homeassistant/components/fireservicerota/binary_sensor.py @@ -49,23 +49,10 @@ class ResponseBinarySensor(CoordinatorEntity, BinarySensorEntity): self._client = client self._attr_unique_id = f"{entry.unique_id}_Duty" - self._state: bool | None = None - - @property - def icon(self) -> str: - """Return the icon to use in the frontend.""" - if self._state: - return "mdi:calendar-check" - - return "mdi:calendar-remove" - @property def is_on(self) -> bool | None: """Return the state of the binary sensor.""" - - self._state = self._client.on_duty - - return self._state + return self._client.on_duty @property def extra_state_attributes(self) -> dict[str, Any]: diff --git a/homeassistant/components/fireservicerota/icons.json b/homeassistant/components/fireservicerota/icons.json new file mode 100644 index 00000000000..8de4c444ca8 --- /dev/null +++ b/homeassistant/components/fireservicerota/icons.json @@ -0,0 +1,12 @@ +{ + "entity": { + "binary_sensor": { + "duty": { + "default": "mdi:calendar-remove", + "state": { + "on": "mdi:calendar-check" + } + } + } + } +}