• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python common.async_set_temperature函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.components.climate.common.async_set_temperature函数的典型用法代码示例。如果您正苦于以下问题:Python async_set_temperature函数的具体用法?Python async_set_temperature怎么用?Python async_set_temperature使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了async_set_temperature函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:Martwall,项目名称:home-assistant,代码行数:26,代码来源:test_generic_thermostat.py


示例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)
开发者ID:Martwall,项目名称:home-assistant,代码行数:8,代码来源:test_generic_thermostat.py


示例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)
开发者ID:Martwall,项目名称:home-assistant,代码行数:8,代码来源:test_generic_thermostat.py


示例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')
开发者ID:Martwall,项目名称:home-assistant,代码行数:8,代码来源:test_generic_thermostat.py


示例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)
开发者ID:Martwall,项目名称:home-assistant,代码行数:8,代码来源:test_generic_thermostat.py


示例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)
开发者ID:Martwall,项目名称:home-assistant,代码行数:9,代码来源:test_generic_thermostat.py


示例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')
开发者ID:Martwall,项目名称:home-assistant,代码行数:10,代码来源:test_generic_thermostat.py


示例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')
开发者ID:Martwall,项目名称:home-assistant,代码行数:10,代码来源:test_generic_thermostat.py


示例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)
开发者ID:Martwall,项目名称:home-assistant,代码行数:10,代码来源:test_generic_thermostat.py


示例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')
开发者ID:Martwall,项目名称:home-assistant,代码行数:10,代码来源:test_generic_thermostat.py


示例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']
开发者ID:Martwall,项目名称:home-assistant,代码行数:12,代码来源:test_generic_thermostat.py


示例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']
开发者ID:Martwall,项目名称:home-assistant,代码行数:12,代码来源:test_generic_thermostat.py


示例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']
开发者ID:Martwall,项目名称:home-assistant,代码行数:12,代码来源:test_generic_thermostat.py


示例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']
开发者ID:Martwall,项目名称:home-assistant,代码行数:12,代码来源:test_generic_thermostat.py


示例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']
开发者ID:Martwall,项目名称:home-assistant,代码行数:12,代码来源:test_generic_thermostat.py


示例16: test_set_away_mode_and_restore_prev_temp

async def test_set_away_mode_and_restore_prev_temp(hass, setup_comp_2):
    """Test the setting and removing away mode.

    Verify original temperature is restored.
    """
    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')
    common.async_set_away_mode(hass, False)
    await hass.async_block_till_done()
    state = hass.states.get(ENTITY)
    assert 23 == state.attributes.get('temperature')
开发者ID:Martwall,项目名称:home-assistant,代码行数:15,代码来源:test_generic_thermostat.py


示例17: test_mode_change_ac_trigger_on_not_long_enough_2

async def test_mode_change_ac_trigger_on_not_long_enough_2(hass, setup_comp_5):
    """Test if mode change turns ac on despite minimum cycle."""
    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)
    common.async_set_operation_mode(hass, climate.STATE_HEAT)
    await hass.async_block_till_done()
    assert 1 == len(calls)
    call = calls[0]
    assert 'homeassistant' == call.domain
    assert SERVICE_TURN_ON == call.service
    assert ENT_SWITCH == call.data['entity_id']
开发者ID:Martwall,项目名称:home-assistant,代码行数:15,代码来源:test_generic_thermostat.py


示例18: test_mode_change_heater_trigger_off_not_long_enough

async def test_mode_change_heater_trigger_off_not_long_enough(
        hass, setup_comp_6):
    """Test if mode change turns heater off despite minimum cycle."""
    calls = _setup_switch(hass, True)
    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)
    common.async_set_operation_mode(hass, STATE_OFF)
    await hass.async_block_till_done()
    assert 1 == len(calls)
    call = calls[0]
    assert 'homeassistant' == call.domain
    assert SERVICE_TURN_OFF == call.service
    assert ENT_SWITCH == call.data['entity_id']
开发者ID:fbradyirl,项目名称:home-assistant,代码行数:16,代码来源:test_climate.py


示例19: test_temp_change_heater_trigger_off_long_enough

async def test_temp_change_heater_trigger_off_long_enough(hass, setup_comp_6):
    """Test if temperature change turn heater off after min cycle."""
    fake_changed = datetime.datetime(1918, 11, 11, 11, 11, 11,
                                     tzinfo=datetime.timezone.utc)
    with mock.patch('homeassistant.helpers.condition.dt_util.utcnow',
                    return_value=fake_changed):
        calls = _setup_switch(hass, True)
    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_OFF == call.service
    assert ENT_SWITCH == call.data['entity_id']
开发者ID:Martwall,项目名称:home-assistant,代码行数:16,代码来源:test_generic_thermostat.py


示例20: test_operating_mode_cool

async def test_operating_mode_cool(hass, setup_comp_3):
    """Test change mode from OFF to COOL.

    Switch turns on when temp below setpoint and mode changes.
    """
    common.async_set_operation_mode(hass, STATE_OFF)
    common.async_set_temperature(hass, 25)
    _setup_sensor(hass, 30)
    await hass.async_block_till_done()
    calls = _setup_switch(hass, False)
    common.async_set_operation_mode(hass, climate.STATE_COOL)
    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']
开发者ID:Martwall,项目名称:home-assistant,代码行数:17,代码来源:test_generic_thermostat.py



注:本文中的tests.components.climate.common.async_set_temperature函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python common.turn_on函数代码示例发布时间:2022-05-27
下一篇:
Python common.async_set_operation_mode函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap