From 40faa156e26fb9c480760c2204c9eb495d99ba96 Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Tue, 20 May 2025 18:35:24 +0300 Subject: [PATCH] Jewish calendar : icon translations (#145329) * Move icons to icons.json * Fix tests --- .../jewish_calendar/binary_sensor.py | 1 - .../components/jewish_calendar/icons.json | 32 +++++++++++++++++++ .../components/jewish_calendar/sensor.py | 23 ------------- .../components/jewish_calendar/test_sensor.py | 4 --- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/homeassistant/components/jewish_calendar/binary_sensor.py b/homeassistant/components/jewish_calendar/binary_sensor.py index 2e7edbefd3b..c336bce5ed3 100644 --- a/homeassistant/components/jewish_calendar/binary_sensor.py +++ b/homeassistant/components/jewish_calendar/binary_sensor.py @@ -41,7 +41,6 @@ BINARY_SENSORS: tuple[JewishCalendarBinarySensorEntityDescription, ...] = ( JewishCalendarBinarySensorEntityDescription( key="issur_melacha_in_effect", translation_key="issur_melacha_in_effect", - icon="mdi:power-plug-off", is_on=lambda state, now: bool(state.issur_melacha_in_effect(now)), ), JewishCalendarBinarySensorEntityDescription( diff --git a/homeassistant/components/jewish_calendar/icons.json b/homeassistant/components/jewish_calendar/icons.json index 24b922df7a2..ae2f752f0f6 100644 --- a/homeassistant/components/jewish_calendar/icons.json +++ b/homeassistant/components/jewish_calendar/icons.json @@ -3,5 +3,37 @@ "count_omer": { "service": "mdi:counter" } + }, + "entity": { + "binary_sensor": { + "issur_melacha_in_effect": { "default": "mdi:power-plug-off" }, + "erev_shabbat_hag": { "default": "mdi:candle-light" }, + "motzei_shabbat_hag": { "default": "mdi:fire" } + }, + "sensor": { + "hebrew_date": { "default": "mdi:star-david" }, + "weekly_portion": { "default": "mdi:book-open-variant" }, + "holiday": { "default": "mdi:calendar-star" }, + "omer_count": { "default": "mdi:counter" }, + "daf_yomi": { "default": "mdi:book-open-variant" }, + "alot_hashachar": { "default": "mdi:weather-sunset-up" }, + "talit_and_tefillin": { "default": "mdi:calendar-clock" }, + "netz_hachama": { "default": "mdi:calendar-clock" }, + "sof_zman_shema_gra": { "default": "mdi:calendar-clock" }, + "sof_zman_shema_mga": { "default": "mdi:calendar-clock" }, + "sof_zman_tfilla_gra": { "default": "mdi:calendar-clock" }, + "sof_zman_tfilla_mga": { "default": "mdi:calendar-clock" }, + "chatzot_hayom": { "default": "mdi:calendar-clock" }, + "mincha_gedola": { "default": "mdi:calendar-clock" }, + "mincha_ketana": { "default": "mdi:calendar-clock" }, + "plag_hamincha": { "default": "mdi:weather-sunset-down" }, + "shkia": { "default": "mdi:weather-sunset" }, + "tset_hakohavim_tsom": { "default": "mdi:weather-night" }, + "tset_hakohavim_shabbat": { "default": "mdi:weather-night" }, + "upcoming_shabbat_candle_lighting": { "default": "mdi:candle" }, + "upcoming_shabbat_havdalah": { "default": "mdi:weather-night" }, + "upcoming_candle_lighting": { "default": "mdi:candle" }, + "upcoming_havdalah": { "default": "mdi:weather-night" } + } } } diff --git a/homeassistant/components/jewish_calendar/sensor.py b/homeassistant/components/jewish_calendar/sensor.py index 973d354d368..9a54f162056 100644 --- a/homeassistant/components/jewish_calendar/sensor.py +++ b/homeassistant/components/jewish_calendar/sensor.py @@ -30,30 +30,25 @@ INFO_SENSORS: tuple[SensorEntityDescription, ...] = ( SensorEntityDescription( key="date", translation_key="hebrew_date", - icon="mdi:star-david", ), SensorEntityDescription( key="weekly_portion", translation_key="weekly_portion", - icon="mdi:book-open-variant", device_class=SensorDeviceClass.ENUM, ), SensorEntityDescription( key="holiday", translation_key="holiday", - icon="mdi:calendar-star", device_class=SensorDeviceClass.ENUM, ), SensorEntityDescription( key="omer_count", translation_key="omer_count", - icon="mdi:counter", entity_registry_enabled_default=False, ), SensorEntityDescription( key="daf_yomi", translation_key="daf_yomi", - icon="mdi:book-open-variant", entity_registry_enabled_default=False, ), ) @@ -62,106 +57,88 @@ TIME_SENSORS: tuple[SensorEntityDescription, ...] = ( SensorEntityDescription( key="alot_hashachar", translation_key="alot_hashachar", - icon="mdi:weather-sunset-up", entity_registry_enabled_default=False, ), SensorEntityDescription( key="talit_and_tefillin", translation_key="talit_and_tefillin", - icon="mdi:calendar-clock", entity_registry_enabled_default=False, ), SensorEntityDescription( key="netz_hachama", translation_key="netz_hachama", - icon="mdi:calendar-clock", ), SensorEntityDescription( key="sof_zman_shema_gra", translation_key="sof_zman_shema_gra", - icon="mdi:calendar-clock", entity_registry_enabled_default=False, ), SensorEntityDescription( key="sof_zman_shema_mga", translation_key="sof_zman_shema_mga", - icon="mdi:calendar-clock", entity_registry_enabled_default=False, ), SensorEntityDescription( key="sof_zman_tfilla_gra", translation_key="sof_zman_tfilla_gra", - icon="mdi:calendar-clock", entity_registry_enabled_default=False, ), SensorEntityDescription( key="sof_zman_tfilla_mga", translation_key="sof_zman_tfilla_mga", - icon="mdi:calendar-clock", entity_registry_enabled_default=False, ), SensorEntityDescription( key="chatzot_hayom", translation_key="chatzot_hayom", - icon="mdi:calendar-clock", entity_registry_enabled_default=False, ), SensorEntityDescription( key="mincha_gedola", translation_key="mincha_gedola", - icon="mdi:calendar-clock", entity_registry_enabled_default=False, ), SensorEntityDescription( key="mincha_ketana", translation_key="mincha_ketana", - icon="mdi:calendar-clock", entity_registry_enabled_default=False, ), SensorEntityDescription( key="plag_hamincha", translation_key="plag_hamincha", - icon="mdi:weather-sunset-down", entity_registry_enabled_default=False, ), SensorEntityDescription( key="shkia", translation_key="shkia", - icon="mdi:weather-sunset", ), SensorEntityDescription( key="tset_hakohavim_tsom", translation_key="tset_hakohavim_tsom", - icon="mdi:weather-night", entity_registry_enabled_default=False, ), SensorEntityDescription( key="tset_hakohavim_shabbat", translation_key="tset_hakohavim_shabbat", - icon="mdi:weather-night", entity_registry_enabled_default=False, ), SensorEntityDescription( key="upcoming_shabbat_candle_lighting", translation_key="upcoming_shabbat_candle_lighting", - icon="mdi:candle", entity_registry_enabled_default=False, ), SensorEntityDescription( key="upcoming_shabbat_havdalah", translation_key="upcoming_shabbat_havdalah", - icon="mdi:weather-night", entity_registry_enabled_default=False, ), SensorEntityDescription( key="upcoming_candle_lighting", translation_key="upcoming_candle_lighting", - icon="mdi:candle", ), SensorEntityDescription( key="upcoming_havdalah", translation_key="upcoming_havdalah", - icon="mdi:weather-night", ), ) diff --git a/tests/components/jewish_calendar/test_sensor.py b/tests/components/jewish_calendar/test_sensor.py index 9364fcda40c..0cc1e60efc8 100644 --- a/tests/components/jewish_calendar/test_sensor.py +++ b/tests/components/jewish_calendar/test_sensor.py @@ -59,7 +59,6 @@ TEST_PARAMS = [ "attr": { "device_class": "enum", "friendly_name": "Jewish Calendar Holiday", - "icon": "mdi:calendar-star", "id": "rosh_hashana_i", "type": "YOM_TOV", "options": lambda: HolidayDatabase(False).get_all_names(), @@ -77,7 +76,6 @@ TEST_PARAMS = [ "attr": { "device_class": "enum", "friendly_name": "Jewish Calendar Holiday", - "icon": "mdi:calendar-star", "id": "chanukah, rosh_chodesh", "type": "MELACHA_PERMITTED_HOLIDAY, ROSH_CHODESH", "options": lambda: HolidayDatabase(False).get_all_names(), @@ -95,7 +93,6 @@ TEST_PARAMS = [ "attr": { "device_class": "enum", "friendly_name": "Jewish Calendar Weekly Torah portion", - "icon": "mdi:book-open-variant", "options": [str(p) for p in Parasha], }, }, @@ -144,7 +141,6 @@ TEST_PARAMS = [ "hebrew_year": "5779", "hebrew_month_name": "מרחשוון", "hebrew_day": "6", - "icon": "mdi:star-david", "friendly_name": "Jewish Calendar Date", }, },