mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Change SkyConnect integration type back to hardware
and fix multi-PAN migration bug (#116474)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
1641df18ce
commit
963d8d6a76
@ -597,6 +597,21 @@ class HomeAssistantSkyConnectMultiPanOptionsFlowHandler(
|
|||||||
"""Return the name of the hardware."""
|
"""Return the name of the hardware."""
|
||||||
return self._hw_variant.full_name
|
return self._hw_variant.full_name
|
||||||
|
|
||||||
|
async def async_step_flashing_complete(
|
||||||
|
self, user_input: dict[str, Any] | None = None
|
||||||
|
) -> ConfigFlowResult:
|
||||||
|
"""Finish flashing and update the config entry."""
|
||||||
|
self.hass.config_entries.async_update_entry(
|
||||||
|
entry=self.config_entry,
|
||||||
|
data={
|
||||||
|
**self.config_entry.data,
|
||||||
|
"firmware": ApplicationType.EZSP.value,
|
||||||
|
},
|
||||||
|
options=self.config_entry.options,
|
||||||
|
)
|
||||||
|
|
||||||
|
return await super().async_step_flashing_complete(user_input)
|
||||||
|
|
||||||
|
|
||||||
class HomeAssistantSkyConnectOptionsFlowHandler(
|
class HomeAssistantSkyConnectOptionsFlowHandler(
|
||||||
BaseFirmwareInstallFlow, OptionsFlowWithConfigEntry
|
BaseFirmwareInstallFlow, OptionsFlowWithConfigEntry
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"dependencies": ["hardware", "usb", "homeassistant_hardware"],
|
"dependencies": ["hardware", "usb", "homeassistant_hardware"],
|
||||||
"documentation": "https://www.home-assistant.io/integrations/homeassistant_sky_connect",
|
"documentation": "https://www.home-assistant.io/integrations/homeassistant_sky_connect",
|
||||||
"integration_type": "device",
|
"integration_type": "hardware",
|
||||||
"usb": [
|
"usb": [
|
||||||
{
|
{
|
||||||
"vid": "10C4",
|
"vid": "10C4",
|
||||||
|
@ -2565,11 +2565,6 @@
|
|||||||
"integration_type": "virtual",
|
"integration_type": "virtual",
|
||||||
"supported_by": "netatmo"
|
"supported_by": "netatmo"
|
||||||
},
|
},
|
||||||
"homeassistant_sky_connect": {
|
|
||||||
"name": "Home Assistant SkyConnect",
|
|
||||||
"integration_type": "device",
|
|
||||||
"config_flow": true
|
|
||||||
},
|
|
||||||
"homematic": {
|
"homematic": {
|
||||||
"name": "Homematic",
|
"name": "Homematic",
|
||||||
"integrations": {
|
"integrations": {
|
||||||
|
@ -11,6 +11,8 @@ from universal_silabs_flasher.const import ApplicationType
|
|||||||
from homeassistant.components import usb
|
from homeassistant.components import usb
|
||||||
from homeassistant.components.hassio.addon_manager import AddonInfo, AddonState
|
from homeassistant.components.hassio.addon_manager import AddonInfo, AddonState
|
||||||
from homeassistant.components.homeassistant_hardware.silabs_multiprotocol_addon import (
|
from homeassistant.components.homeassistant_hardware.silabs_multiprotocol_addon import (
|
||||||
|
CONF_DISABLE_MULTI_PAN,
|
||||||
|
get_flasher_addon_manager,
|
||||||
get_multiprotocol_addon_manager,
|
get_multiprotocol_addon_manager,
|
||||||
)
|
)
|
||||||
from homeassistant.components.homeassistant_sky_connect.config_flow import (
|
from homeassistant.components.homeassistant_sky_connect.config_flow import (
|
||||||
@ -869,11 +871,25 @@ async def test_options_flow_multipan_uninstall(
|
|||||||
version="1.0.0",
|
version="1.0.0",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
mock_flasher_manager = Mock(spec_set=get_flasher_addon_manager(hass))
|
||||||
|
mock_flasher_manager.async_get_addon_info.return_value = AddonInfo(
|
||||||
|
available=True,
|
||||||
|
hostname=None,
|
||||||
|
options={},
|
||||||
|
state=AddonState.NOT_RUNNING,
|
||||||
|
update_available=False,
|
||||||
|
version="1.0.0",
|
||||||
|
)
|
||||||
|
|
||||||
with (
|
with (
|
||||||
patch(
|
patch(
|
||||||
"homeassistant.components.homeassistant_hardware.silabs_multiprotocol_addon.get_multiprotocol_addon_manager",
|
"homeassistant.components.homeassistant_hardware.silabs_multiprotocol_addon.get_multiprotocol_addon_manager",
|
||||||
return_value=mock_multipan_manager,
|
return_value=mock_multipan_manager,
|
||||||
),
|
),
|
||||||
|
patch(
|
||||||
|
"homeassistant.components.homeassistant_hardware.silabs_multiprotocol_addon.get_flasher_addon_manager",
|
||||||
|
return_value=mock_flasher_manager,
|
||||||
|
),
|
||||||
patch(
|
patch(
|
||||||
"homeassistant.components.homeassistant_hardware.silabs_multiprotocol_addon.is_hassio",
|
"homeassistant.components.homeassistant_hardware.silabs_multiprotocol_addon.is_hassio",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
@ -883,3 +899,25 @@ async def test_options_flow_multipan_uninstall(
|
|||||||
assert result["type"] is FlowResultType.MENU
|
assert result["type"] is FlowResultType.MENU
|
||||||
assert result["step_id"] == "addon_menu"
|
assert result["step_id"] == "addon_menu"
|
||||||
assert "uninstall_addon" in result["menu_options"]
|
assert "uninstall_addon" in result["menu_options"]
|
||||||
|
|
||||||
|
# Pick the uninstall option
|
||||||
|
result = await hass.config_entries.options.async_configure(
|
||||||
|
result["flow_id"],
|
||||||
|
user_input={"next_step_id": "uninstall_addon"},
|
||||||
|
)
|
||||||
|
|
||||||
|
# Check the box
|
||||||
|
result = await hass.config_entries.options.async_configure(
|
||||||
|
result["flow_id"], user_input={CONF_DISABLE_MULTI_PAN: True}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Finish the flow
|
||||||
|
result = await hass.config_entries.options.async_configure(result["flow_id"])
|
||||||
|
await hass.async_block_till_done(wait_background_tasks=True)
|
||||||
|
result = await hass.config_entries.options.async_configure(result["flow_id"])
|
||||||
|
await hass.async_block_till_done(wait_background_tasks=True)
|
||||||
|
result = await hass.config_entries.options.async_configure(result["flow_id"])
|
||||||
|
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||||
|
|
||||||
|
# We've reverted the firmware back to Zigbee
|
||||||
|
assert config_entry.data["firmware"] == "ezsp"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user