mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
IntelliFire DHCP Discovery Patch (#72617)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
0a65f53356
commit
d6e9118f36
@ -31,15 +31,16 @@ class DiscoveredHostInfo:
|
|||||||
serial: str | None
|
serial: str | None
|
||||||
|
|
||||||
|
|
||||||
async def validate_host_input(host: str) -> str:
|
async def validate_host_input(host: str, dhcp_mode: bool = False) -> str:
|
||||||
"""Validate the user input allows us to connect.
|
"""Validate the user input allows us to connect.
|
||||||
|
|
||||||
Data has the keys from STEP_USER_DATA_SCHEMA with values provided by the user.
|
Data has the keys from STEP_USER_DATA_SCHEMA with values provided by the user.
|
||||||
"""
|
"""
|
||||||
LOGGER.debug("Instantiating IntellifireAPI with host: [%s]", host)
|
LOGGER.debug("Instantiating IntellifireAPI with host: [%s]", host)
|
||||||
api = IntellifireAPILocal(fireplace_ip=host)
|
api = IntellifireAPILocal(fireplace_ip=host)
|
||||||
await api.poll()
|
await api.poll(supress_warnings=dhcp_mode)
|
||||||
serial = api.data.serial
|
serial = api.data.serial
|
||||||
|
|
||||||
LOGGER.debug("Found a fireplace: %s", serial)
|
LOGGER.debug("Found a fireplace: %s", serial)
|
||||||
# Return the serial number which will be used to calculate a unique ID for the device/sensors
|
# Return the serial number which will be used to calculate a unique ID for the device/sensors
|
||||||
return serial
|
return serial
|
||||||
@ -240,14 +241,17 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
async def async_step_dhcp(self, discovery_info: DhcpServiceInfo) -> FlowResult:
|
async def async_step_dhcp(self, discovery_info: DhcpServiceInfo) -> FlowResult:
|
||||||
"""Handle DHCP Discovery."""
|
"""Handle DHCP Discovery."""
|
||||||
|
|
||||||
LOGGER.debug("STEP: dhcp")
|
|
||||||
# Run validation logic on ip
|
# Run validation logic on ip
|
||||||
host = discovery_info.ip
|
host = discovery_info.ip
|
||||||
|
LOGGER.debug("STEP: dhcp for host %s", host)
|
||||||
|
|
||||||
self._async_abort_entries_match({CONF_HOST: host})
|
self._async_abort_entries_match({CONF_HOST: host})
|
||||||
try:
|
try:
|
||||||
self._serial = await validate_host_input(host)
|
self._serial = await validate_host_input(host, dhcp_mode=True)
|
||||||
except (ConnectionError, ClientConnectionError):
|
except (ConnectionError, ClientConnectionError):
|
||||||
|
LOGGER.debug(
|
||||||
|
"DHCP Discovery has determined %s is not an IntelliFire device", host
|
||||||
|
)
|
||||||
return self.async_abort(reason="not_intellifire_device")
|
return self.async_abort(reason="not_intellifire_device")
|
||||||
|
|
||||||
await self.async_set_unique_id(self._serial)
|
await self.async_set_unique_id(self._serial)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "IntelliFire",
|
"name": "IntelliFire",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/intellifire",
|
"documentation": "https://www.home-assistant.io/integrations/intellifire",
|
||||||
"requirements": ["intellifire4py==2.0.0"],
|
"requirements": ["intellifire4py==2.0.1"],
|
||||||
"codeowners": ["@jeeftor"],
|
"codeowners": ["@jeeftor"],
|
||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
"loggers": ["intellifire4py"],
|
"loggers": ["intellifire4py"],
|
||||||
|
@ -894,7 +894,7 @@ influxdb==5.3.1
|
|||||||
insteon-frontend-home-assistant==0.1.1
|
insteon-frontend-home-assistant==0.1.1
|
||||||
|
|
||||||
# homeassistant.components.intellifire
|
# homeassistant.components.intellifire
|
||||||
intellifire4py==2.0.0
|
intellifire4py==2.0.1
|
||||||
|
|
||||||
# homeassistant.components.iotawatt
|
# homeassistant.components.iotawatt
|
||||||
iotawattpy==0.1.0
|
iotawattpy==0.1.0
|
||||||
|
@ -637,7 +637,7 @@ influxdb==5.3.1
|
|||||||
insteon-frontend-home-assistant==0.1.1
|
insteon-frontend-home-assistant==0.1.1
|
||||||
|
|
||||||
# homeassistant.components.intellifire
|
# homeassistant.components.intellifire
|
||||||
intellifire4py==2.0.0
|
intellifire4py==2.0.1
|
||||||
|
|
||||||
# homeassistant.components.iotawatt
|
# homeassistant.components.iotawatt
|
||||||
iotawattpy==0.1.0
|
iotawattpy==0.1.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user