updated zeroconf address
This commit is contained in:
@@ -551,13 +551,30 @@ class Timer:
|
|||||||
self._task.cancel()
|
self._task.cancel()
|
||||||
|
|
||||||
|
|
||||||
|
def get_local_ip():
|
||||||
|
"""Get local ip address."""
|
||||||
|
connection = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
|
try:
|
||||||
|
connection.connect(("192.255.255.255", 1))
|
||||||
|
address = connection.getsockname()[0]
|
||||||
|
except socket.error:
|
||||||
|
address = "127.0.0.1"
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
|
return address
|
||||||
|
|
||||||
|
|
||||||
def start_zeroconf():
|
def start_zeroconf():
|
||||||
"""Start Zeroconf server."""
|
"""Start Zeroconf server."""
|
||||||
|
|
||||||
|
host = get_local_ip()
|
||||||
|
|
||||||
|
print("Using host", host, "for Zeroconf")
|
||||||
|
|
||||||
info = ServiceInfo(
|
info = ServiceInfo(
|
||||||
SD_ZEROCONF,
|
SD_ZEROCONF,
|
||||||
f"Stream Deck API Server.{SD_ZEROCONF}",
|
f"Stream Deck API Server.{SD_ZEROCONF}",
|
||||||
addresses=[socket.inet_aton("127.0.0.1")],
|
addresses=[socket.inet_aton(host)],
|
||||||
port=PLUGIN_PORT,
|
port=PLUGIN_PORT,
|
||||||
properties={'path': '/sd/info'},
|
properties={'path': '/sd/info'},
|
||||||
server="pythonserver.local.",
|
server="pythonserver.local.",
|
||||||
|
|||||||
Reference in New Issue
Block a user