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
This commit is contained in:
Tsvi Mostovicz 2019-11-27 21:52:03 +02:00 committed by Franck Nijhof
parent fa1622fe8b
commit d7a66e6e4c
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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 = [