Skip to content

Commit

Permalink
Make Arlo battery_level icon dynamic (home-assistant#9747)
Browse files Browse the repository at this point in the history
* Make Arlo battery_level icon dynamic

* makes lint happy
  • Loading branch information
tchellomello authored and pvizeli committed Oct 8, 2017
1 parent 9eff9fa commit f56bdd2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions homeassistant/components/sensor/arlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (ATTR_ATTRIBUTION, CONF_MONITORED_CONDITIONS)
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.icon import icon_for_battery_level

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -84,6 +85,9 @@ def state(self):
@property
def icon(self):
"""Icon to use in the frontend, if any."""
if self._sensor_type == 'battery_level' and self._state is not None:
return icon_for_battery_level(battery_level=int(self._state),
charging=False)
return self._icon

@property
Expand Down

0 comments on commit f56bdd2

Please sign in to comment.