mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Do not add outside temperature sensor for FGLair if reading is None (#140298)
* Do not add outside temperature sensor if reading is None * Fix comments
This commit is contained in:
parent
bf50ee9b5e
commit
37213503b1
@ -24,6 +24,7 @@ async def async_setup_entry(
|
||||
async_add_entities(
|
||||
FGLairOutsideTemperature(entry.runtime_data, device)
|
||||
for device in entry.runtime_data.data.values()
|
||||
if device.outdoor_temperature is not None
|
||||
)
|
||||
|
||||
|
||||
|
@ -31,3 +31,20 @@ async def test_entities(
|
||||
assert await integration_setup()
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
||||
|
||||
async def test_no_outside_temperature(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
mock_ayla_api: AsyncMock,
|
||||
integration_setup: Callable[[], Awaitable[bool]],
|
||||
) -> None:
|
||||
"""Test that the outside sensor doesn't get added if the reading is None."""
|
||||
mock_ayla_api.async_get_devices.return_value[0].outdoor_temperature = None
|
||||
|
||||
assert await integration_setup()
|
||||
|
||||
assert (
|
||||
len(entity_registry.entities)
|
||||
== len(mock_ayla_api.async_get_devices.return_value) - 1
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user