-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
author: epenet | ||
authorURL: https://github.com/epenet | ||
title: "Relocate dhcp/ssdp/usb/zeroconf ServiceInfo models" | ||
--- | ||
|
||
### Summary of changes | ||
|
||
To reduce current reliance on optional integrations for names that are in essence used as helpers, the following ServiceInfo models have been relocated: | ||
- `DhcpServiceInfo` from `homeassistant.components.dhcp` to `homeassistant.helpers.service_info.dhcp` | ||
- `SsdpServiceInfo` from `homeassistant.components.ssdp` to `homeassistant.helpers.service_info.ssdp` | ||
- `UsbServiceInfo` from `homeassistant.components.usb` to `homeassistant.helpers.service_info.usb` | ||
- `ZeroconfServiceInfo` from `homeassistant.components.zeroconf` to `homeassistant.helpers.service_info.zeroconf` | ||
|
||
|
||
To update your integration: | ||
1. Replace the import statements as shown in the examples below | ||
2. Test your integration with the new imports | ||
|
||
The old import locations are deprecated and will be removed in Home Assistant 2026.2. | ||
|
||
|
||
### Examples | ||
|
||
```python | ||
# Old | ||
# from homeassistant.components.dhcp import DhcpServiceInfo | ||
# from homeassistant.components.ssdp import SsdpServiceInfo | ||
# from homeassistant.components.usb import UsbServiceInfo | ||
# from homeassistant.components.zeroconf import ZeroconfServiceInfo | ||
|
||
# New | ||
from homeassistant.helpers.service_info.dhcp import DhcpServiceInfo | ||
from homeassistant.helpers.service_info.ssdp import SsdpServiceInfo | ||
from homeassistant.helpers.service_info.usb import UsbServiceInfo | ||
from homeassistant.helpers.service_info.zeroconf import ZeroconfServiceInfo | ||
|
||
class MyConfigFlow(ConfigFlow, domain=DOMAIN): | ||
"""Handle a config flow.""" | ||
|
||
async def async_step_dhcp(self, discovery_info: DhcpServiceInfo) -> ConfigFlowResult: | ||
"""Handle dhcp discovery.""" | ||
... | ||
|
||
async def async_step_ssdp(self, discovery_info: SsdpServiceInfo) -> ConfigFlowResult: | ||
"""Handle ssdp discovery.""" | ||
... | ||
|
||
async def async_step_usb(self, discovery_info: UsbServiceInfo) -> ConfigFlowResult: | ||
"""Handle usb discovery.""" | ||
... | ||
|
||
async def async_step_zeroconf(self, discovery_info: ZeroconfServiceInfo) -> ConfigFlowResult: | ||
"""Handle zeroconf discovery.""" | ||
... | ||
``` |