1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Blebox add thermoBox to climate (#81090)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Michał Huryn
2022-12-06 14:43:35 +01:00
committed by GitHub
parent 9f36412076
commit 923fa473e1
9 changed files with 223 additions and 125 deletions

View File

@@ -55,11 +55,11 @@ def tempsensor_fixture():
return (feature, "sensor.tempsensor_0_temperature")
async def test_init(tempsensor, hass, config):
async def test_init(tempsensor, hass):
"""Test sensor default state."""
_, entity_id = tempsensor
entry = await async_setup_entity(hass, config, entity_id)
entry = await async_setup_entity(hass, entity_id)
assert entry.unique_id == "BleBox-tempSensor-1afe34db9437-0.temperature"
state = hass.states.get(entity_id)
@@ -79,7 +79,7 @@ async def test_init(tempsensor, hass, config):
assert device.sw_version == "1.23"
async def test_update(tempsensor, hass, config):
async def test_update(tempsensor, hass):
"""Test sensor update."""
feature_mock, entity_id = tempsensor
@@ -88,30 +88,30 @@ async def test_update(tempsensor, hass, config):
feature_mock.native_value = 25.18
feature_mock.async_update = AsyncMock(side_effect=initial_update)
await async_setup_entity(hass, config, entity_id)
await async_setup_entity(hass, entity_id)
state = hass.states.get(entity_id)
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == TEMP_CELSIUS
assert state.state == "25.18"
async def test_update_failure(tempsensor, hass, config, caplog):
async def test_update_failure(tempsensor, hass, caplog):
"""Test that update failures are logged."""
caplog.set_level(logging.ERROR)
feature_mock, entity_id = tempsensor
feature_mock.async_update = AsyncMock(side_effect=blebox_uniapi.error.ClientError)
await async_setup_entity(hass, config, entity_id)
await async_setup_entity(hass, entity_id)
assert f"Updating '{feature_mock.full_name}' failed: " in caplog.text
async def test_airsensor_init(airsensor, hass, config):
async def test_airsensor_init(airsensor, hass):
"""Test airSensor default state."""
_, entity_id = airsensor
entry = await async_setup_entity(hass, config, entity_id)
entry = await async_setup_entity(hass, entity_id)
assert entry.unique_id == "BleBox-airSensor-1afe34db9437-0.air"
state = hass.states.get(entity_id)
@@ -130,7 +130,7 @@ async def test_airsensor_init(airsensor, hass, config):
assert device.sw_version == "1.23"
async def test_airsensor_update(airsensor, hass, config):
async def test_airsensor_update(airsensor, hass):
"""Test air quality sensor state after update."""
feature_mock, entity_id = airsensor
@@ -139,7 +139,7 @@ async def test_airsensor_update(airsensor, hass, config):
feature_mock.native_value = 49
feature_mock.async_update = AsyncMock(side_effect=initial_update)
await async_setup_entity(hass, config, entity_id)
await async_setup_entity(hass, entity_id)
state = hass.states.get(entity_id)
assert (