diff --git a/homeassistant/components/input_slider.py b/homeassistant/components/input_slider.py index d10120e673be6f..c4976bb43e8c36 100644 --- a/homeassistant/components/input_slider.py +++ b/homeassistant/components/input_slider.py @@ -174,8 +174,8 @@ def async_added_to_hass(self): state = yield from async_get_last_state(self.hass, self.entity_id) value = state and float(state.state) - # Check against False because value can be 0 - if value is not False and self._minimum < value < self._maximum: + # Check against None because value can be 0 + if value is not None and self._minimum <= value <= self._maximum: self._current_value = value else: self._current_value = self._minimum diff --git a/tests/components/test_input_slider.py b/tests/components/test_input_slider.py index 7097e87e6463bd..f550091e31fb43 100644 --- a/tests/components/test_input_slider.py +++ b/tests/components/test_input_slider.py @@ -133,3 +133,21 @@ def test_initial_state_overrules_restore_state(hass): state = hass.states.get('input_slider.b2') assert state assert float(state.state) == 60 + + +@asyncio.coroutine +def test_no_initial_state_and_no_restore_state(hass): + """Ensure that entity is create without initial and restore feature.""" + hass.state = CoreState.starting + + yield from async_setup_component(hass, DOMAIN, { + DOMAIN: { + 'b1': { + 'min': 0, + 'max': 100, + }, + }}) + + state = hass.states.get('input_slider.b1') + assert state + assert float(state.state) == 0