Clean holiday attributes code in Jewish calendar (#55080)

* Clean repetitive code in jewish calendar

* do not return none

* fix holiday
pull/55650/head
Yuval Aboulafia 2021-09-03 12:07:53 +03:00 committed by GitHub
parent 91cd6951f3
commit 173b87e675
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -230,9 +230,11 @@ class JewishCalendarSensor(SensorEntity):
# Compute the weekly portion based on the upcoming shabbat.
return after_tzais_date.upcoming_shabbat.parasha
if self.entity_description.key == "holiday":
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
self._holiday_attrs = {
"id": after_shkia_date.holiday_name,
"type": after_shkia_date.holiday_type.name,
"type_id": after_shkia_date.holiday_type.value,
}
return after_shkia_date.holiday_description
if self.entity_description.key == "omer_count":
return after_shkia_date.omer_day