Skip to content

Commit

Permalink
Merge pull request #1 from Guzz-T/issue/292/coordinator
Browse files Browse the repository at this point in the history
  • Loading branch information
Guzz-T authored Nov 26, 2024
2 parents bbab400 + ea84b58 commit 8ea6ea9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
9 changes: 7 additions & 2 deletions custom_components/luxtronik/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,13 @@ async def async_step_dhcp(self, discovery_info: DhcpServiceInfo) -> FlowResult:
discovery_info.ip,
)
# Validate dhcp result with socket broadcast:
broadcast_discover_ip, broadcast_discover_port = discover()[0]
if broadcast_discover_ip != discovery_info.ip:
heatpump_list = discover()
broadcast_discover_ip = ''
for heatpump in heatpump_list:
if heatpump[0] == discovery_info.ip:
broadcast_discover_ip = heatpump[0]
broadcast_discover_port = heatpump[1]
if broadcast_discover_ip == '':
return self.async_abort(reason="no_devices_found")
config = dict[str, Any]()
config[CONF_HOST] = broadcast_discover_ip
Expand Down
6 changes: 2 additions & 4 deletions custom_components/luxtronik/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ async def wrapper(
class LuxtronikCoordinator(DataUpdateCoordinator[LuxtronikCoordinatorData]):
"""Representation of a Luxtronik Coordinator."""

device_infos = dict[str, DeviceInfo]()
update_reason_write = False
client: Luxtronik = None

def __init__(
self,
hass: HomeAssistant,
Expand All @@ -86,6 +82,8 @@ def __init__(
self.lock = threading.Lock()
self.client = client
self._config = config
self.device_infos = dict[str, DeviceInfo]()
self.update_reason_write = False
super().__init__(
hass,
LOGGER,
Expand Down
1 change: 1 addition & 0 deletions custom_components/luxtronik/lux_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def discover() -> list[tuple[str, int | None]]:
"an old Luxtronic software version might be the reason"
)
results.append((ip_address, res_port))
continue
LOGGER.debug(
"Received response from %s, but with wrong content, skipping",
ip_address,
Expand Down

0 comments on commit 8ea6ea9

Please sign in to comment.