Fix light template to return brightness as int (#12447)
parent
b651cdd8f2
commit
fcf97524a2
|
@ -237,7 +237,6 @@ class LightTemplate(Light):
|
|||
@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()
|
||||
|
@ -262,7 +261,7 @@ class LightTemplate(Light):
|
|||
self._state = None
|
||||
|
||||
if 0 <= int(brightness) <= 255:
|
||||
self._brightness = brightness
|
||||
self._brightness = int(brightness)
|
||||
else:
|
||||
_LOGGER.error(
|
||||
'Received invalid brightness : %s' +
|
||||
|
|
|
@ -586,7 +586,7 @@ class TestTemplateLight:
|
|||
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."""
|
||||
|
|
Loading…
Reference in New Issue