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

Use the IP address resolved by the transport #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions pywizlight/bulb.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,12 @@ async def _ensure_connection(self) -> None:
self.transport = cast(asyncio.DatagramTransport, transport_proto[0])
self.protocol = cast(WizProtocol, transport_proto[1])

# The transport expects us to send to the same address we connected to here
ip, port = self.transport.get_extra_info("peername")
if (self.ip, self.port) != (ip, port):
_LOGGER.debug("Resolved %s:%s to %s:%s", self.ip, self.port, ip, port)
self.ip, self.port = ip, port

def register(self) -> None:
"""Call register to keep alive push updates."""
if self.push_running:
Expand Down
Loading