mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Updating helper's icon_for_battery_level location (#9594)
This commit is contained in:
parent
ffb19381f1
commit
7b116b0207
@ -17,6 +17,7 @@ from homeassistant.const import (
|
|||||||
CONF_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS,
|
CONF_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS,
|
||||||
STATE_UNKNOWN, ATTR_ATTRIBUTION)
|
STATE_UNKNOWN, ATTR_ATTRIBUTION)
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
from homeassistant.helpers.icon import icon_for_battery_level
|
||||||
|
|
||||||
DEPENDENCIES = ['ring']
|
DEPENDENCIES = ['ring']
|
||||||
|
|
||||||
@ -108,6 +109,9 @@ class RingSensor(Entity):
|
|||||||
@property
|
@property
|
||||||
def icon(self):
|
def icon(self):
|
||||||
"""Icon to use in the frontend, if any."""
|
"""Icon to use in the frontend, if any."""
|
||||||
|
if self._sensor_type == 'battery' and self._state is not STATE_UNKNOWN:
|
||||||
|
return icon_for_battery_level(battery_level=int(self._state),
|
||||||
|
charging=False)
|
||||||
return self._icon
|
return self._icon
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user