8000 Bugfix slider by pvizeli · Pull Request #7047 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Bugfix slider #7047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/components/input_slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions tests/components/test_input_slider.py
70C5
Original file line number Diff line numberDiff line change
Expand Up @@ -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
0