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 thermostat.fan_mode == SPEED_LOW thermostat._cur_settings = None assert thermostat.fan_mode is None
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 thermostat.state == HVAC_MODE_HEAT thermostat._cur_settings = None assert thermostat.state is None
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.state == HVAC_MODE_HEAT thermostat._cur_settings = None assert thermostat.hvac_action is None
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 thermostat.target_temperature == 16 thermostat._cur_settings = None assert thermostat.target_temperature is None
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
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
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
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
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
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 thermostat.fan_mode == SPEED_MEDIUM api.async_send.return_value = AsyncMock(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.fan_mode assert thermostat._cur_settings is None
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