예제 #1
0
async def test_current_fan_mode(hass):
    """Test current_fan_mode property."""
    with patch('homeassistant.components.melissa'):
        api = melissa_mock()
        device = (await api.async_fetch_devices())[_SERIAL]
        thermostat = MelissaClimate(api, _SERIAL, device)
        await thermostat.async_update()
        assert SPEED_LOW == thermostat.current_fan_mode

        thermostat._cur_settings = None
        assert thermostat.current_fan_mode is None
예제 #2
0
async def test_target_temperature(hass):
    """Test target temperature."""
    with patch('homeassistant.components.melissa'):
        api = melissa_mock()
        device = (await api.async_fetch_devices())[_SERIAL]
        thermostat = MelissaClimate(api, _SERIAL, device)
        await thermostat.async_update()
        assert 16 == thermostat.target_temperature

        thermostat._cur_settings = None
        assert thermostat.target_temperature is None
예제 #3
0
async def test_is_on(hass):
    """Test name property."""
    with patch('homeassistant.components.melissa'):
        api = melissa_mock()
        device = (await api.async_fetch_devices())[_SERIAL]
        thermostat = MelissaClimate(api, _SERIAL, device)
        await thermostat.async_update()
        assert thermostat.is_on

        thermostat._cur_settings = None
        assert not thermostat.is_on
예제 #4
0
async def test_state(hass):
    """Test state."""
    with patch('homeassistant.components.melissa'):
        api = melissa_mock()
        device = (await api.async_fetch_devices())[_SERIAL]
        thermostat = MelissaClimate(api, _SERIAL, device)
        await thermostat.async_update()
        assert STATE_ON == thermostat.state

        thermostat._cur_settings = None
        assert thermostat.state is None
예제 #5
0
async def test_current_fan_mode(hass):
    """Test current_fan_mode property."""
    with patch('homeassistant.components.melissa'):
        api = melissa_mock()
        device = (await api.async_fetch_devices())[_SERIAL]
        thermostat = MelissaClimate(api, _SERIAL, device)
        await thermostat.async_update()
        assert SPEED_LOW == thermostat.current_fan_mode

        thermostat._cur_settings = None
        assert thermostat.current_fan_mode is None
예제 #6
0
async def test_current_operation(hass):
    """Test current operation."""
    with patch('homeassistant.components.melissa'):
        api = melissa_mock()
        device = (await api.async_fetch_devices())[_SERIAL]
        thermostat = MelissaClimate(api, _SERIAL, device)
        await thermostat.async_update()
        assert thermostat.current_operation == STATE_HEAT

        thermostat._cur_settings = None
        assert thermostat.current_operation is None
예제 #7
0
async def test_is_on(hass):
    """Test name property."""
    with patch('homeassistant.components.melissa'):
        api = melissa_mock()
        device = (await api.async_fetch_devices())[_SERIAL]
        thermostat = MelissaClimate(api, _SERIAL, device)
        await thermostat.async_update()
        assert thermostat.is_on

        thermostat._cur_settings = None
        assert not thermostat.is_on
예제 #8
0
async def test_state(hass):
    """Test state."""
    with patch('homeassistant.components.melissa'):
        api = melissa_mock()
        device = (await api.async_fetch_devices())[_SERIAL]
        thermostat = MelissaClimate(api, _SERIAL, device)
        await thermostat.async_update()
        assert STATE_ON == thermostat.state

        thermostat._cur_settings = None
        assert thermostat.state is None
예제 #9
0
async def test_target_temperature(hass):
    """Test target temperature."""
    with patch('homeassistant.components.melissa'):
        api = melissa_mock()
        device = (await api.async_fetch_devices())[_SERIAL]
        thermostat = MelissaClimate(api, _SERIAL, device)
        await thermostat.async_update()
        assert 16 == thermostat.target_temperature

        thermostat._cur_settings = None
        assert thermostat.target_temperature is None
예제 #10
0
async def test_current_operation(hass):
    """Test current operation."""
    with patch('homeassistant.components.melissa'):
        api = melissa_mock()
        device = (await api.async_fetch_devices())[_SERIAL]
        thermostat = MelissaClimate(api, _SERIAL, device)
        await thermostat.async_update()
        assert thermostat.current_operation == STATE_HEAT

        thermostat._cur_settings = None
        assert thermostat.current_operation is None
예제 #11
0
async def test_send(hass):
    """Test send."""
    with patch('homeassistant.components.melissa'):
        api = melissa_mock()
        device = (await api.async_fetch_devices())[_SERIAL]
        thermostat = MelissaClimate(api, _SERIAL, device)
        await thermostat.async_update()
        await hass.async_block_till_done()
        await thermostat.async_send({'fan': api.FAN_MEDIUM})
        await hass.async_block_till_done()
        assert SPEED_MEDIUM == thermostat.current_fan_mode
        api.async_send.return_value = mock_coro_func(return_value=False)
        thermostat._cur_settings = None
        await thermostat.async_send({'fan': api.FAN_LOW})
        await hass.async_block_till_done()
        assert SPEED_LOW != thermostat.current_fan_mode
        assert thermostat._cur_settings is None
예제 #12
0
async def test_send(hass):
    """Test send."""
    with patch('homeassistant.components.melissa'):
        api = melissa_mock()
        device = (await api.async_fetch_devices())[_SERIAL]
        thermostat = MelissaClimate(api, _SERIAL, device)
        await thermostat.async_update()
        await hass.async_block_till_done()
        await thermostat.async_send({'fan': api.FAN_MEDIUM})
        await hass.async_block_till_done()
        assert SPEED_MEDIUM == thermostat.current_fan_mode
        api.async_send.return_value = mock_coro_func(return_value=False)
        thermostat._cur_settings = None
        await thermostat.async_send({'fan': api.FAN_LOW})
        await hass.async_block_till_done()
        assert SPEED_LOW != thermostat.current_fan_mode
        assert thermostat._cur_settings is None