Skip to content

Commit

Permalink
Fix light template to return brightness as int (#12447)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-git authored and balloob committed Feb 16, 2018
1 parent 1f041d5 commit 13d6e56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions homeassistant/components/light/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ def async_turn_off(self, **kwargs):
@asyncio.coroutine
def async_update(self):
"""Update the state from the template."""
print("ASYNC UPDATE")
if self._template is not None:
try:
state = self._template.async_render().lower()
Expand All @@ -262,7 +261,7 @@ def async_update(self):
self._state = None

if 0 <= int(brightness) <= 255:
self._brightness = brightness
self._brightness = int(brightness)
else:
_LOGGER.error(
'Received invalid brightness : %s' +
Expand Down
2 changes: 1 addition & 1 deletion tests/components/light/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def test_level_template(self):
state = self.hass.states.get('light.test_template_light')
assert state is not None

assert state.attributes.get('brightness') == '42'
assert state.attributes.get('brightness') == 42

def test_friendly_name(self):
"""Test the accessibility of the friendly_name attribute."""
Expand Down

0 comments on commit 13d6e56

Please sign in to comment.