-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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
Optional persistence in generic_thermostat #10636
Changes from 5 commits
43ae96b
79b90a2
9ff4021
ad51e4b
106c50b
b9cb475
30a11ec
81f9121
0d9c404
ef8db94
56471bd
2b9625c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -892,3 +892,27 @@ def test_custom_setup_params(hass): | |
assert state.attributes.get('min_temp') == MIN_TEMP | ||
assert state.attributes.get('max_temp') == MAX_TEMP | ||
assert state.attributes.get('temperature') == TARGET_TEMP | ||
|
||
|
||
@asyncio.coroutine | ||
def test_restore_state(hass): | ||
"""Ensure states are restored on startup.""" | ||
mock_restore_cache(hass, ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. undefined name 'mock_restore_cache' |
||
State('climate.test_thermostat', '0', {ATTR_TEMPERATURE: "20"}), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. undefined name 'State' |
||
State('climate.test_thermostat', '0', {'operation_mode': STATE_OFF}), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. undefined name 'State' |
||
)) | ||
|
||
hass.state = CoreState.starting | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. undefined name 'CoreState' |
||
|
||
yield from async_setup_component( | ||
hass, climate.DOMAIN, {'climate': { | ||
'platform': 'generic_thermostat', | ||
'name': 'test_thermostat', | ||
'heater': ENT_SWITCH, | ||
'target_sensor': ENT_SENSOR, | ||
'persistence': 'both', | ||
}}) | ||
|
||
state = hass.states.get('climate.test_thermostat') | ||
assert(state.attributes[ATTR_TEMPERATURE] == 20) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. undefined name 'ATTR_TEMPERATURE' |
||
assert(state.attributes['operation_mode'] == STATE_OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redefinition of unused 'async_added_to_hass' from line 129