mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Added egg age to the eggminder sensor (#20758)
* Added egg age to the eggminder sensor
This commit is contained in:
parent
3bb5caabe2
commit
d13b2ca6ef
@ -8,7 +8,6 @@ import logging
|
||||
|
||||
from homeassistant.components.wink import DOMAIN, WinkDevice
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -47,7 +46,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
_LOGGER.info("Device is not a sensor")
|
||||
|
||||
|
||||
class WinkSensorDevice(WinkDevice, Entity):
|
||||
class WinkSensorDevice(WinkDevice):
|
||||
"""Representation of a Wink sensor."""
|
||||
|
||||
def __init__(self, wink, hass):
|
||||
@ -87,3 +86,15 @@ class WinkSensorDevice(WinkDevice, Entity):
|
||||
def unit_of_measurement(self):
|
||||
"""Return the unit of measurement of this entity, if any."""
|
||||
return self._unit_of_measurement
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
super_attrs = super().device_state_attributes
|
||||
_LOGGER.debug("Adding in eggs if egg minder")
|
||||
try:
|
||||
super_attrs['egg_times'] = self.wink.eggs()
|
||||
_LOGGER.debug("Its an egg minder")
|
||||
except AttributeError:
|
||||
_LOGGER.debug("Not an eggtray")
|
||||
return super_attrs
|
||||
|
Loading…
x
Reference in New Issue
Block a user