From d7a66e6e4c3529fb9c9c872a2c0c9a785522ca6e Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Wed, 27 Nov 2019 21:52:03 +0200 Subject: [PATCH] Return Jewish Calendar holiday type id support (#29168) * Bring back holiday type id as a attribute to the holiday sensor * Add test for holiday type id attribute --- homeassistant/components/jewish_calendar/sensor.py | 3 ++- tests/components/jewish_calendar/test_sensor.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/jewish_calendar/sensor.py b/homeassistant/components/jewish_calendar/sensor.py index 54a3d1497aa..d0376694a44 100644 --- a/homeassistant/components/jewish_calendar/sensor.py +++ b/homeassistant/components/jewish_calendar/sensor.py @@ -122,8 +122,9 @@ class JewishCalendarSensor(Entity): # Compute the weekly portion based on the upcoming shabbat. return after_tzais_date.upcoming_shabbat.parasha if self._type == "holiday": - self._holiday_attrs["type"] = after_shkia_date.holiday_type.name self._holiday_attrs["id"] = after_shkia_date.holiday_name + self._holiday_attrs["type"] = after_shkia_date.holiday_type.name + self._holiday_attrs["type_id"] = after_shkia_date.holiday_type.value return after_shkia_date.holiday_description if self._type == "omer_count": return after_shkia_date.omer_day diff --git a/tests/components/jewish_calendar/test_sensor.py b/tests/components/jewish_calendar/test_sensor.py index 07e0b7cb192..60ffdea8c70 100644 --- a/tests/components/jewish_calendar/test_sensor.py +++ b/tests/components/jewish_calendar/test_sensor.py @@ -180,8 +180,9 @@ async def test_jewish_calendar_sensor( assert sensor_object.state == str(result) if sensor == "holiday": - assert sensor_object.attributes.get("type") == "YOM_TOV" assert sensor_object.attributes.get("id") == "rosh_hashana_i" + assert sensor_object.attributes.get("type") == "YOM_TOV" + assert sensor_object.attributes.get("type_id") == 1 SHABBAT_PARAMS = [