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

Python common.async_set_operation_mode函数代码示例

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

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



在下文中一共展示了async_set_operation_mode函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: 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


示例2: 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


示例3: 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


示例4: test_turn_off_when_off

async def test_turn_off_when_off(hass, setup_comp_9):
    """Test if climate.turn_off does nothing to a turned off device."""
    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()
    state_heat = hass.states.get(HEAT_ENTITY)
    state_cool = hass.states.get(COOL_ENTITY)
    assert STATE_OFF == \
        state_heat.attributes.get('operation_mode')
    assert STATE_OFF == \
        state_cool.attributes.get('operation_mode')
开发者ID:Martwall,项目名称:home-assistant,代码行数:12,代码来源:test_generic_thermostat.py


示例5: 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


示例6: 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


示例7: 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


示例8: test_invalid_operating_mode

async def test_invalid_operating_mode(log_mock, hass, setup_comp_2):
    """Test error handling for invalid operation mode."""
    common.async_set_operation_mode(hass, 'invalid mode')
    await hass.async_block_till_done()
    assert log_mock.call_count == 1
开发者ID:Martwall,项目名称:home-assistant,代码行数:5,代码来源:test_generic_thermostat.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python common.async_set_temperature函数代码示例发布时间:2022-05-27
下一篇:
Python component.ComponentTestGitRepository类代码示例发布时间: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