From 28833b23a29170e18b2eb7522ec899832ce2d342 Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Thu, 26 Sep 2019 17:29:36 +0300 Subject: [PATCH 01/10] Standardize times in time sensors Jewish calendar --- .../components/jewish_calendar/__init__.py | 5 + .../components/jewish_calendar/sensor.py | 107 +++++++++++++----- .../components/jewish_calendar/test_sensor.py | 18 ++- 3 files changed, 94 insertions(+), 36 deletions(-) diff --git a/homeassistant/components/jewish_calendar/__init__.py b/homeassistant/components/jewish_calendar/__init__.py index c7bbbdb2d907a9..aae025843f34db 100644 --- a/homeassistant/components/jewish_calendar/__init__.py +++ b/homeassistant/components/jewish_calendar/__init__.py @@ -44,10 +44,12 @@ CONF_LANGUAGE = "language" CONF_CANDLE_LIGHT_MINUTES = "candle_lighting_minutes_before_sunset" CONF_HAVDALAH_OFFSET_MINUTES = "havdalah_minutes_after_sunset" +CONF_TIME_FORMAT = "time_format" CANDLE_LIGHT_DEFAULT = 18 DEFAULT_NAME = "Jewish Calendar" +DEFAULT_TIME_FORMAT = "%H:%M" CONFIG_SCHEMA = vol.Schema( { @@ -65,6 +67,7 @@ ): int, # Default of 0 means use 8.5 degrees / 'three_stars' time. vol.Optional(CONF_HAVDALAH_OFFSET_MINUTES, default=0): int, + vol.Optional(CONF_TIME_FORMAT, default=DEFAULT_TIME_FORMAT): cv.string, } ) }, @@ -83,6 +86,7 @@ async def async_setup(hass, config): candle_lighting_offset = config[DOMAIN][CONF_CANDLE_LIGHT_MINUTES] havdalah_offset = config[DOMAIN][CONF_HAVDALAH_OFFSET_MINUTES] + time_format = config[DOMAIN][CONF_TIME_FORMAT] location = hdate.Location( latitude=latitude, @@ -98,6 +102,7 @@ async def async_setup(hass, config): "candle_lighting_offset": candle_lighting_offset, "havdalah_offset": havdalah_offset, "diaspora": diaspora, + "time_format": time_format, } hass.async_create_task(async_load_platform(hass, "sensor", DOMAIN, {}, config)) diff --git a/homeassistant/components/jewish_calendar/sensor.py b/homeassistant/components/jewish_calendar/sensor.py index 405838b1fb10f9..cee52ad12bfbff 100644 --- a/homeassistant/components/jewish_calendar/sensor.py +++ b/homeassistant/components/jewish_calendar/sensor.py @@ -23,7 +23,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= for sensor, sensor_info in SENSOR_TYPES["data"].items() ] sensors.extend( - JewishCalendarSensor(hass.data[DOMAIN], sensor, sensor_info) + JewishCalendarTimeSensor(hass.data[DOMAIN], sensor, sensor_info) for sensor, sensor_info in SENSOR_TYPES["time"].items() ) @@ -43,6 +43,7 @@ def __init__(self, data, sensor, sensor_info): self._candle_lighting_offset = data["candle_lighting_offset"] self._havdalah_offset = data["havdalah_offset"] self._diaspora = data["diaspora"] + self._time_format = data["time_format"] self._state = None @property @@ -72,16 +73,6 @@ async def async_update(self): _LOGGER.debug("Now: %s Sunset: %s", now, sunset) - def make_zmanim(date): - """Create a Zmanim object.""" - return hdate.Zmanim( - date=date, - location=self._location, - candle_lighting_offset=self._candle_lighting_offset, - havdalah_offset=self._havdalah_offset, - hebrew=self._hebrew, - ) - date = hdate.HDate(today, diaspora=self._diaspora, hebrew=self._hebrew) # The Jewish day starts after darkness (called "tzais") and finishes at @@ -92,7 +83,7 @@ def make_zmanim(date): # tomorrow based on sunset ("shkia"), for others based on "tzais". # Hence the following variables. after_tzais_date = after_shkia_date = date - today_times = make_zmanim(today) + today_times = self.make_zmanim(today) if now > sunset: after_shkia_date = date.next_day @@ -100,37 +91,91 @@ def make_zmanim(date): if today_times.havdalah and now > today_times.havdalah: after_tzais_date = date.next_day + self._state = self.get_state(after_shkia_date, after_tzais_date) + _LOGGER.debug("New value: %s", self._state) + + def make_zmanim(self, date): + """Create a Zmanim object.""" + return hdate.Zmanim( + date=date, + location=self._location, + candle_lighting_offset=self._candle_lighting_offset, + havdalah_offset=self._havdalah_offset, + hebrew=self._hebrew, + ) + + def get_state(self, after_shkia_date, after_tzais_date): + """For a given type of sensor, return the state.""" # Terminology note: by convention in py-libhdate library, "upcoming" # refers to "current" or "upcoming" dates. if self._type == "date": - self._state = after_shkia_date.hebrew_date + return after_shkia_date.hebrew_date elif self._type == "weekly_portion": # Compute the weekly portion based on the upcoming shabbat. - self._state = after_tzais_date.upcoming_shabbat.parasha + return after_tzais_date.upcoming_shabbat.parasha elif self._type == "holiday_name": - self._state = after_shkia_date.holiday_description + return after_shkia_date.holiday_description elif self._type == "holiday_type": - self._state = after_shkia_date.holiday_type - elif self._type == "upcoming_shabbat_candle_lighting": - times = make_zmanim(after_tzais_date.upcoming_shabbat.previous_day.gdate) - self._state = times.candle_lighting + return after_shkia_date.holiday_type + elif self._type == "omer_count": + return after_shkia_date.omer_day + + +class JewishCalendarTimeSensor(JewishCalendarSensor): + """Implement attrbutes for sensors returning times.""" + + @property + def state(self): + """Return the state of the sensor.""" + return ( + self._state.strftime(self._time_format) + if self._state is not None + else self._state + ) + + @property + def device_class(self): + """Return the class of this sensor.""" + return "timestamp" + + @property + def state_attributes(self): + """Return the state attributes.""" + attrs = {} + + if self._state is None: + return attrs + + attrs["year"] = self._state.year + attrs["month"] = self._state.month + attrs["day"] = self._state.day + attrs["hour"] = self._state.hour + attrs["minute"] = self._state.minute + attrs["second"] = self._state.second + attrs["timestamp"] = self._state.timestamp() + + return attrs + + def get_state(self, after_shkia_date, after_tzais_date): + """For a given type of sensor, return the state.""" + if self._type == "upcoming_shabbat_candle_lighting": + times = self.make_zmanim( + after_tzais_date.upcoming_shabbat.previous_day.gdate + ) + return times.candle_lighting elif self._type == "upcoming_candle_lighting": - times = make_zmanim( + times = self.make_zmanim( after_tzais_date.upcoming_shabbat_or_yom_tov.first_day.previous_day.gdate ) - self._state = times.candle_lighting + return times.candle_lighting elif self._type == "upcoming_shabbat_havdalah": - times = make_zmanim(after_tzais_date.upcoming_shabbat.gdate) - self._state = times.havdalah + times = self.make_zmanim(after_tzais_date.upcoming_shabbat.gdate) + return times.havdalah elif self._type == "upcoming_havdalah": - times = make_zmanim( + times = self.make_zmanim( after_tzais_date.upcoming_shabbat_or_yom_tov.last_day.gdate ) - self._state = times.havdalah - elif self._type == "omer_count": - self._state = after_shkia_date.omer_day + return times.havdalah else: - times = make_zmanim(today).zmanim - self._state = times[self._type].time() - - _LOGGER.debug("New value: %s", self._state) + times = self.make_zmanim(dt_util.now()).zmanim + return times[self._type] diff --git a/tests/components/jewish_calendar/test_sensor.py b/tests/components/jewish_calendar/test_sensor.py index 8d72830b3698ab..f41023d198013d 100644 --- a/tests/components/jewish_calendar/test_sensor.py +++ b/tests/components/jewish_calendar/test_sensor.py @@ -1,5 +1,5 @@ """The tests for the Jewish calendar sensors.""" -from datetime import time, timedelta +from datetime import timedelta from datetime import datetime as dt import pytest @@ -81,7 +81,7 @@ async def test_jewish_calendar_hebrew(hass): "hebrew", "t_set_hakochavim", True, - time(19, 48), + dt(2018, 9, 8, 19, 48), ), ( dt(2018, 9, 8), @@ -91,7 +91,7 @@ async def test_jewish_calendar_hebrew(hass): "hebrew", "t_set_hakochavim", False, - time(19, 21), + dt(2018, 9, 8, 19, 21), ), ( dt(2018, 10, 14), @@ -183,6 +183,8 @@ async def test_jewish_calendar_sensor( async_fire_time_changed(hass, future) await hass.async_block_till_done() + result = result.strftime("%H:%M") if isinstance(result, dt) else result + assert hass.states.get(f"sensor.test_{sensor}").state == str(result) @@ -524,8 +526,14 @@ async def test_shabbat_times_sensor( sensor_type = sensor_type.replace(f"{language}_", "") - assert hass.states.get(f"sensor.test_{sensor_type}").state == str( - result_value + result_value = ( + result_value.strftime("%H:%M") + if isinstance(result_value, dt) + else result_value + ) + + assert ( + hass.states.get(f"sensor.test_{sensor_type}").state == result_value ), f"Value for {sensor_type}" From eaa166c82d503918d62aae548c573e712798abd7 Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Fri, 27 Sep 2019 01:29:09 +0300 Subject: [PATCH 02/10] Fix pylint errors --- .../components/jewish_calendar/sensor.py | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/jewish_calendar/sensor.py b/homeassistant/components/jewish_calendar/sensor.py index cee52ad12bfbff..542eb1cdc0cd13 100644 --- a/homeassistant/components/jewish_calendar/sensor.py +++ b/homeassistant/components/jewish_calendar/sensor.py @@ -110,16 +110,18 @@ def get_state(self, after_shkia_date, after_tzais_date): # refers to "current" or "upcoming" dates. if self._type == "date": return after_shkia_date.hebrew_date - elif self._type == "weekly_portion": + if self._type == "weekly_portion": # Compute the weekly portion based on the upcoming shabbat. return after_tzais_date.upcoming_shabbat.parasha - elif self._type == "holiday_name": + if self._type == "holiday_name": return after_shkia_date.holiday_description - elif self._type == "holiday_type": + if self._type == "holiday_type": return after_shkia_date.holiday_type - elif self._type == "omer_count": + if self._type == "omer_count": return after_shkia_date.omer_day + return None + class JewishCalendarTimeSensor(JewishCalendarSensor): """Implement attrbutes for sensors returning times.""" @@ -163,19 +165,19 @@ def get_state(self, after_shkia_date, after_tzais_date): after_tzais_date.upcoming_shabbat.previous_day.gdate ) return times.candle_lighting - elif self._type == "upcoming_candle_lighting": + if self._type == "upcoming_candle_lighting": times = self.make_zmanim( after_tzais_date.upcoming_shabbat_or_yom_tov.first_day.previous_day.gdate ) return times.candle_lighting - elif self._type == "upcoming_shabbat_havdalah": + if self._type == "upcoming_shabbat_havdalah": times = self.make_zmanim(after_tzais_date.upcoming_shabbat.gdate) return times.havdalah - elif self._type == "upcoming_havdalah": + if self._type == "upcoming_havdalah": times = self.make_zmanim( after_tzais_date.upcoming_shabbat_or_yom_tov.last_day.gdate ) return times.havdalah - else: - times = self.make_zmanim(dt_util.now()).zmanim - return times[self._type] + + times = self.make_zmanim(dt_util.now()).zmanim + return times[self._type] From f5e23c64c6c3b478ba770c514f504bee19cae720 Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Fri, 27 Sep 2019 06:53:36 +0300 Subject: [PATCH 03/10] Add non-default time format test --- tests/components/jewish_calendar/test_sensor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/components/jewish_calendar/test_sensor.py b/tests/components/jewish_calendar/test_sensor.py index f41023d198013d..8b98a82a52228b 100644 --- a/tests/components/jewish_calendar/test_sensor.py +++ b/tests/components/jewish_calendar/test_sensor.py @@ -174,6 +174,7 @@ async def test_jewish_calendar_sensor( "name": "test", "language": language, "diaspora": diaspora, + "time_format": "%c" } }, ) @@ -183,7 +184,7 @@ async def test_jewish_calendar_sensor( async_fire_time_changed(hass, future) await hass.async_block_till_done() - result = result.strftime("%H:%M") if isinstance(result, dt) else result + result = result.strftime("%c") if isinstance(result, dt) else result assert hass.states.get(f"sensor.test_{sensor}").state == str(result) From 48d50ab76e1b9ffb875cf85eb8be12339538cf16 Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Fri, 27 Sep 2019 07:08:57 +0300 Subject: [PATCH 04/10] Make black happy --- tests/components/jewish_calendar/test_sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/components/jewish_calendar/test_sensor.py b/tests/components/jewish_calendar/test_sensor.py index 8b98a82a52228b..0c1543a7bfde65 100644 --- a/tests/components/jewish_calendar/test_sensor.py +++ b/tests/components/jewish_calendar/test_sensor.py @@ -174,7 +174,7 @@ async def test_jewish_calendar_sensor( "name": "test", "language": language, "diaspora": diaspora, - "time_format": "%c" + "time_format": "%c", } }, ) From 0e1a75fa0a3263157376d36c79cf09bb5c642806 Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Fri, 27 Sep 2019 11:42:49 +0300 Subject: [PATCH 05/10] Remove timestamp device class Timestamp device class requires ISO 8601 format --- homeassistant/components/jewish_calendar/sensor.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/homeassistant/components/jewish_calendar/sensor.py b/homeassistant/components/jewish_calendar/sensor.py index 542eb1cdc0cd13..e254d843fd247b 100644 --- a/homeassistant/components/jewish_calendar/sensor.py +++ b/homeassistant/components/jewish_calendar/sensor.py @@ -135,11 +135,6 @@ def state(self): else self._state ) - @property - def device_class(self): - """Return the class of this sensor.""" - return "timestamp" - @property def state_attributes(self): """Return the state attributes.""" From 9bc9bbef17c74c65e89b650fe90909f8d15e63ff Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Sun, 6 Oct 2019 15:12:16 +0300 Subject: [PATCH 06/10] Revert "Remove timestamp device class" This reverts commit 8a2fda39831bc750c3a77aa774b84b054d78032c. --- homeassistant/components/jewish_calendar/sensor.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/homeassistant/components/jewish_calendar/sensor.py b/homeassistant/components/jewish_calendar/sensor.py index e254d843fd247b..542eb1cdc0cd13 100644 --- a/homeassistant/components/jewish_calendar/sensor.py +++ b/homeassistant/components/jewish_calendar/sensor.py @@ -135,6 +135,11 @@ def state(self): else self._state ) + @property + def device_class(self): + """Return the class of this sensor.""" + return "timestamp" + @property def state_attributes(self): """Return the state attributes.""" From 74ce45f1020a3b1a039a91593228a71466ce41fa Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Sun, 6 Oct 2019 15:32:53 +0300 Subject: [PATCH 07/10] Remove time_format As this is part of the UI decision, it should be decided by lovelace. A nice addition for a future PR, might be the option to hint to lovelace the preferred way to display some data. --- .../components/jewish_calendar/__init__.py | 5 ----- homeassistant/components/jewish_calendar/sensor.py | 7 +------ tests/components/jewish_calendar/test_sensor.py | 13 +++---------- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/homeassistant/components/jewish_calendar/__init__.py b/homeassistant/components/jewish_calendar/__init__.py index aae025843f34db..c7bbbdb2d907a9 100644 --- a/homeassistant/components/jewish_calendar/__init__.py +++ b/homeassistant/components/jewish_calendar/__init__.py @@ -44,12 +44,10 @@ CONF_LANGUAGE = "language" CONF_CANDLE_LIGHT_MINUTES = "candle_lighting_minutes_before_sunset" CONF_HAVDALAH_OFFSET_MINUTES = "havdalah_minutes_after_sunset" -CONF_TIME_FORMAT = "time_format" CANDLE_LIGHT_DEFAULT = 18 DEFAULT_NAME = "Jewish Calendar" -DEFAULT_TIME_FORMAT = "%H:%M" CONFIG_SCHEMA = vol.Schema( { @@ -67,7 +65,6 @@ ): int, # Default of 0 means use 8.5 degrees / 'three_stars' time. vol.Optional(CONF_HAVDALAH_OFFSET_MINUTES, default=0): int, - vol.Optional(CONF_TIME_FORMAT, default=DEFAULT_TIME_FORMAT): cv.string, } ) }, @@ -86,7 +83,6 @@ async def async_setup(hass, config): candle_lighting_offset = config[DOMAIN][CONF_CANDLE_LIGHT_MINUTES] havdalah_offset = config[DOMAIN][CONF_HAVDALAH_OFFSET_MINUTES] - time_format = config[DOMAIN][CONF_TIME_FORMAT] location = hdate.Location( latitude=latitude, @@ -102,7 +98,6 @@ async def async_setup(hass, config): "candle_lighting_offset": candle_lighting_offset, "havdalah_offset": havdalah_offset, "diaspora": diaspora, - "time_format": time_format, } hass.async_create_task(async_load_platform(hass, "sensor", DOMAIN, {}, config)) diff --git a/homeassistant/components/jewish_calendar/sensor.py b/homeassistant/components/jewish_calendar/sensor.py index 542eb1cdc0cd13..ca9458cb354d8e 100644 --- a/homeassistant/components/jewish_calendar/sensor.py +++ b/homeassistant/components/jewish_calendar/sensor.py @@ -43,7 +43,6 @@ def __init__(self, data, sensor, sensor_info): self._candle_lighting_offset = data["candle_lighting_offset"] self._havdalah_offset = data["havdalah_offset"] self._diaspora = data["diaspora"] - self._time_format = data["time_format"] self._state = None @property @@ -129,11 +128,7 @@ class JewishCalendarTimeSensor(JewishCalendarSensor): @property def state(self): """Return the state of the sensor.""" - return ( - self._state.strftime(self._time_format) - if self._state is not None - else self._state - ) + return self._state @property def device_class(self): diff --git a/tests/components/jewish_calendar/test_sensor.py b/tests/components/jewish_calendar/test_sensor.py index 0c1543a7bfde65..2381905db3f151 100644 --- a/tests/components/jewish_calendar/test_sensor.py +++ b/tests/components/jewish_calendar/test_sensor.py @@ -174,7 +174,6 @@ async def test_jewish_calendar_sensor( "name": "test", "language": language, "diaspora": diaspora, - "time_format": "%c", } }, ) @@ -184,7 +183,7 @@ async def test_jewish_calendar_sensor( async_fire_time_changed(hass, future) await hass.async_block_till_done() - result = result.strftime("%c") if isinstance(result, dt) else result + result = time_zone.localize(result) if isinstance(result, dt) else result assert hass.states.get(f"sensor.test_{sensor}").state == str(result) @@ -527,14 +526,8 @@ async def test_shabbat_times_sensor( sensor_type = sensor_type.replace(f"{language}_", "") - result_value = ( - result_value.strftime("%H:%M") - if isinstance(result_value, dt) - else result_value - ) - - assert ( - hass.states.get(f"sensor.test_{sensor_type}").state == result_value + assert hass.states.get(f"sensor.test_{sensor_type}").state == str( + result_value ), f"Value for {sensor_type}" From e7fab9b71b3355e44bd967a53eaabe7e5ffbfd13 Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Mon, 7 Oct 2019 19:41:12 +0300 Subject: [PATCH 08/10] Update name of state_attributes --- homeassistant/components/jewish_calendar/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/jewish_calendar/sensor.py b/homeassistant/components/jewish_calendar/sensor.py index ca9458cb354d8e..f33495d1979ae3 100644 --- a/homeassistant/components/jewish_calendar/sensor.py +++ b/homeassistant/components/jewish_calendar/sensor.py @@ -136,7 +136,7 @@ def device_class(self): return "timestamp" @property - def state_attributes(self): + def device_state_attributes(self): """Return the state attributes.""" attrs = {} From a2455123bbcfc843ac88d1f0d5ca85856efe1d11 Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Thu, 10 Oct 2019 18:59:55 +0300 Subject: [PATCH 09/10] State of timestamp variable to be shown in UTC Although I don't understand it, I give up :) --- homeassistant/components/jewish_calendar/sensor.py | 6 +++--- tests/components/jewish_calendar/test_sensor.py | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/jewish_calendar/sensor.py b/homeassistant/components/jewish_calendar/sensor.py index f33495d1979ae3..f9080cc4db1a08 100644 --- a/homeassistant/components/jewish_calendar/sensor.py +++ b/homeassistant/components/jewish_calendar/sensor.py @@ -63,7 +63,7 @@ def state(self): async def async_update(self): """Update the state of the sensor.""" now = dt_util.now() - _LOGGER.debug("Now: %s Timezone = %s", now, now.tzinfo) + _LOGGER.debug("Now: %s Location: %r", now, self._location) today = now.date() sunset = dt_util.as_local( @@ -91,7 +91,7 @@ async def async_update(self): after_tzais_date = date.next_day self._state = self.get_state(after_shkia_date, after_tzais_date) - _LOGGER.debug("New value: %s", self._state) + _LOGGER.debug("New value for %s: %s", self._type, self._state) def make_zmanim(self, date): """Create a Zmanim object.""" @@ -128,7 +128,7 @@ class JewishCalendarTimeSensor(JewishCalendarSensor): @property def state(self): """Return the state of the sensor.""" - return self._state + return dt_util.as_utc(self._state) if self._state is not None else None @property def device_class(self): diff --git a/tests/components/jewish_calendar/test_sensor.py b/tests/components/jewish_calendar/test_sensor.py index 2381905db3f151..94b26f80d2dfce 100644 --- a/tests/components/jewish_calendar/test_sensor.py +++ b/tests/components/jewish_calendar/test_sensor.py @@ -183,7 +183,9 @@ async def test_jewish_calendar_sensor( async_fire_time_changed(hass, future) await hass.async_block_till_done() - result = time_zone.localize(result) if isinstance(result, dt) else result + result = ( + dt_util.as_utc(time_zone.localize(result)) if isinstance(result, dt) else result + ) assert hass.states.get(f"sensor.test_{sensor}").state == str(result) @@ -526,6 +528,12 @@ async def test_shabbat_times_sensor( sensor_type = sensor_type.replace(f"{language}_", "") + result_value = ( + dt_util.as_utc(result_value) + if isinstance(result_value, dt) + else result_value + ) + assert hass.states.get(f"sensor.test_{sensor_type}").state == str( result_value ), f"Value for {sensor_type}" From dec465d08384f920838bfc54bac4eff4cfccb68b Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Thu, 10 Oct 2019 19:36:55 +0300 Subject: [PATCH 10/10] Remove unnecessary attributes I don't really see the value in these attributes, if there are any they should be implemented in the sensor component for the timestamp device class --- homeassistant/components/jewish_calendar/sensor.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/homeassistant/components/jewish_calendar/sensor.py b/homeassistant/components/jewish_calendar/sensor.py index f9080cc4db1a08..453b3de4bae31e 100644 --- a/homeassistant/components/jewish_calendar/sensor.py +++ b/homeassistant/components/jewish_calendar/sensor.py @@ -143,12 +143,6 @@ def device_state_attributes(self): if self._state is None: return attrs - attrs["year"] = self._state.year - attrs["month"] = self._state.month - attrs["day"] = self._state.day - attrs["hour"] = self._state.hour - attrs["minute"] = self._state.minute - attrs["second"] = self._state.second attrs["timestamp"] = self._state.timestamp() return attrs