本文整理汇总了Python中tests.components.climate.common.async_set_temperature函数的典型用法代码示例。如果您正苦于以下问题:Python async_set_temperature函数的具体用法?Python async_set_temperature怎么用?Python async_set_temperature使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了async_set_temperature函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_heater_switch
async def test_heater_switch(hass, setup_comp_1):
"""Test heater switching test switch."""
platform = loader.get_component(hass, 'switch.test')
platform.init()
switch_1 = platform.DEVICES[1]
assert await async_setup_component(hass, switch.DOMAIN, {'switch': {
'platform': 'test'}})
heater_switch = switch_1.entity_id
assert await async_setup_component(hass, climate.DOMAIN, {'climate': {
'platform': 'generic_thermostat',
'name': 'test',
'heater': heater_switch,
'target_sensor': ENT_SENSOR
}})
assert STATE_OFF == \
hass.states.get(heater_switch).state
_setup_sensor(hass, 18)
await hass.async_block_till_done()
common.async_set_temperature(hass, 23)
await hass.async_block_till_done()
assert STATE_ON == \
hass.states.get(heater_switch).state
示例2: test_temp_change_ac_on_within_tolerance
async def test_temp_change_ac_on_within_tolerance(hass, setup_comp_3):
"""Test if temperature change doesn't turn ac on within tolerance."""
calls = _setup_switch(hass, False)
common.async_set_temperature(hass, 25)
await hass.async_block_till_done()
_setup_sensor(hass, 25.2)
await hass.async_block_till_done()
assert 0 == len(calls)
示例3: test_temp_change_heater_off_within_tolerance
async def test_temp_change_heater_off_within_tolerance(hass, setup_comp_2):
"""Test if temperature change doesn't turn off within tolerance."""
calls = _setup_switch(hass, True)
common.async_set_temperature(hass, 30)
await hass.async_block_till_done()
_setup_sensor(hass, 33)
await hass.async_block_till_done()
assert 0 == len(calls)
示例4: test_set_away_mode
async def test_set_away_mode(hass, setup_comp_2):
"""Test the setting away mode."""
common.async_set_temperature(hass, 23)
await hass.async_block_till_done()
common.async_set_away_mode(hass, True)
await hass.async_block_till_done()
state = hass.states.get(ENTITY)
assert 16 == state.attributes.get('temperature')
示例5: test_temp_change_ac_trigger_on_not_long_enough_2
async def test_temp_change_ac_trigger_on_not_long_enough_2(hass, setup_comp_5):
"""Test if temperature change turn ac on."""
calls = _setup_switch(hass, False)
common.async_set_temperature(hass, 25)
await hass.async_block_till_done()
_setup_sensor(hass, 30)
await hass.async_block_till_done()
assert 0 == len(calls)
示例6: test_temp_change_heater_trigger_on_not_long_enough
async def test_temp_change_heater_trigger_on_not_long_enough(
hass, setup_comp_6):
"""Test if temp change doesn't turn heater on because of time."""
calls = _setup_switch(hass, False)
common.async_set_temperature(hass, 30)
await hass.async_block_till_done()
_setup_sensor(hass, 25)
await hass.async_block_till_done()
assert 0 == len(calls)
示例7: test_precision
async def test_precision(hass, setup_comp_10):
"""Test that setting precision to tenths works as intended."""
common.async_set_operation_mode(hass, STATE_OFF)
await hass.async_block_till_done()
await hass.services.async_call('climate', SERVICE_TURN_OFF)
await hass.async_block_till_done()
common.async_set_temperature(hass, 23.27)
await hass.async_block_till_done()
state = hass.states.get(ENTITY)
assert 23.3 == state.attributes.get('temperature')
示例8: test_turn_away_mode_on_cooling
async def test_turn_away_mode_on_cooling(hass, setup_comp_3):
"""Test the setting away mode when cooling."""
_setup_sensor(hass, 25)
await hass.async_block_till_done()
common.async_set_temperature(hass, 19)
await hass.async_block_till_done()
common.async_set_away_mode(hass, True)
await hass.async_block_till_done()
state = hass.states.get(ENTITY)
assert 30 == state.attributes.get('temperature')
示例9: test_no_state_change_when_operation_mode_off_2
async def test_no_state_change_when_operation_mode_off_2(hass, setup_comp_3):
"""Test that the switch doesn't turn on when enabled is False."""
calls = _setup_switch(hass, False)
common.async_set_temperature(hass, 30)
await hass.async_block_till_done()
common.async_set_operation_mode(hass, STATE_OFF)
await hass.async_block_till_done()
_setup_sensor(hass, 35)
await hass.async_block_till_done()
assert 0 == len(calls)
示例10: test_set_target_temp
async def test_set_target_temp(hass, setup_comp_2):
"""Test the setting of the target temperature."""
common.async_set_temperature(hass, 30)
await hass.async_block_till_done()
state = hass.states.get(ENTITY)
assert 30.0 == state.attributes.get('temperature')
common.async_set_temperature(hass, None)
await hass.async_block_till_done()
state = hass.states.get(ENTITY)
assert 30.0 == state.attributes.get('temperature')
示例11: test_running_when_operating_mode_is_off_2
async def test_running_when_operating_mode_is_off_2(hass, setup_comp_3):
"""Test that the switch turns off when enabled is set False."""
calls = _setup_switch(hass, True)
common.async_set_temperature(hass, 30)
await hass.async_block_till_done()
common.async_set_operation_mode(hass, STATE_OFF)
await hass.async_block_till_done()
assert 1 == len(calls)
call = calls[0]
assert HASS_DOMAIN == call.domain
assert SERVICE_TURN_OFF == call.service
assert ENT_SWITCH == call.data['entity_id']
示例12: test_set_target_temp_ac_off
async def test_set_target_temp_ac_off(hass, setup_comp_3):
"""Test if target temperature turn ac off."""
calls = _setup_switch(hass, True)
_setup_sensor(hass, 25)
await hass.async_block_till_done()
common.async_set_temperature(hass, 30)
await hass.async_block_till_done()
assert 2 == len(calls)
call = calls[0]
assert HASS_DOMAIN == call.domain
assert SERVICE_TURN_OFF == call.service
assert ENT_SWITCH == call.data['entity_id']
示例13: test_temp_change_heater_off_outside_tolerance
async def test_temp_change_heater_off_outside_tolerance(hass, setup_comp_2):
"""Test if temperature change turn heater off outside hot tolerance."""
calls = _setup_switch(hass, True)
common.async_set_temperature(hass, 30)
await hass.async_block_till_done()
_setup_sensor(hass, 35)
await hass.async_block_till_done()
assert 1 == len(calls)
call = calls[0]
assert HASS_DOMAIN == call.domain
assert SERVICE_TURN_OFF == call.service
assert ENT_SWITCH == call.data['entity_id']
示例14: test_set_target_temp_heater_on
async def test_set_target_temp_heater_on(hass, setup_comp_2):
"""Test if target temperature turn heater on."""
calls = _setup_switch(hass, False)
_setup_sensor(hass, 25)
await hass.async_block_till_done()
common.async_set_temperature(hass, 30)
await hass.async_block_till_done()
assert 1 == len(calls)
call = calls[0]
assert HASS_DOMAIN == call.domain
assert SERVICE_TURN_ON == call.service
assert ENT_SWITCH == call.data['entity_id']
示例15: test_temp_change_ac_on_outside_tolerance
async def test_temp_change_ac_on_outside_tolerance(hass, setup_comp_3):
"""Test if temperature change turn ac on."""
calls = _setup_switch(hass, False)
common.async_set_temperature(hass, 25)
await hass.async_block_till_done()
_setup_sensor(hass, 30)
await hass.async_block_till_done()
assert 1 == len(calls)
call = calls[0]
assert HASS_DOMAIN == call.domain
assert SERVICE_TURN_ON == call.service
assert ENT_SWITCH == call.data['entity_id']