Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the device_info and similar fields to instance variables. #301

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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