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

Add binary_sensor to Version integration (#66539)

* Add binary_sensor to version integration

* Add test to check we not create for local

* Move _attr_icon to sensor

* Update homeassistant/components/version/binary_sensor.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Joakim Sørensen
2022-02-15 16:39:34 +01:00
committed by GitHub
parent af4e37339a
commit 0d2712e436
6 changed files with 130 additions and 29 deletions

View File

@@ -52,9 +52,17 @@ async def mock_get_version_update(
await hass.async_block_till_done()
async def setup_version_integration(hass: HomeAssistant) -> MockConfigEntry:
async def setup_version_integration(
hass: HomeAssistant,
entry_data: dict[str, Any] | None = None,
) -> MockConfigEntry:
"""Set up the Version integration."""
mock_entry = MockConfigEntry(**MOCK_VERSION_CONFIG_ENTRY_DATA)
mock_entry = MockConfigEntry(
**{
**MOCK_VERSION_CONFIG_ENTRY_DATA,
"data": entry_data or MOCK_VERSION_CONFIG_ENTRY_DATA["data"],
}
)
mock_entry.add_to_hass(hass)
with patch(
@@ -65,7 +73,6 @@ async def setup_version_integration(hass: HomeAssistant) -> MockConfigEntry:
assert await hass.config_entries.async_setup(mock_entry.entry_id)
await hass.async_block_till_done()
assert hass.states.get("sensor.local_installation").state == MOCK_VERSION
assert mock_entry.state == config_entries.ConfigEntryState.LOADED
return mock_entry