Added "time" attribute

This commit is contained in:
Yuval Aboulafia
2020-10-07 14:25:13 +03:00
parent 0f3489f5cb
commit 8adab9b788

View File

@@ -3,7 +3,7 @@ import logging
import hdate
from homeassistant.const import SUN_EVENT_SUNSET
from homeassistant.const import DEVICE_CLASS_TIMESTAMP, SUN_EVENT_SUNSET
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.sun import get_astral_event_date
import homeassistant.util.dt as dt_util
@@ -150,7 +150,7 @@ class JewishCalendarTimeSensor(JewishCalendarSensor):
@property
def device_class(self):
"""Return the class of this sensor."""
return "timestamp"
return DEVICE_CLASS_TIMESTAMP
@property
def device_state_attributes(self):
@@ -161,6 +161,7 @@ class JewishCalendarTimeSensor(JewishCalendarSensor):
return attrs
attrs["timestamp"] = self._state.timestamp()
attrs["time"] = self._state.strftime("%H:%M")
return attrs