question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[dev] Implement IP address autodiscovery (zeroconf)

See original GitHub issue

Discovery should be implemented, in order to detect the Google Home device’s IP. By using the pychromecast API, this can be achieved, for example, with the following snippet:

import pychromecast

VALID_GOOGLE_HOME_MODELS = [
    "Google Home",
    "Google Home Mini",
    "Lenovo Smart Clock"
]


def discover_google_home():
    print("Discovering Google Homes...")
    services, browser = pychromecast.discovery.discover_chromecasts()
    for service in services:
        model = service[2]
        name = service[3]
        ip = service[4]
        access_port = service[5]
        if model in VALID_GOOGLE_HOME_MODELS:
            print(f"{name} ({ip}:{access_port}) - {model}")
            print()

The port is more or less useless, since as far as I know, for every Google Home the port is the same: 8009, but, who knows.

This should be added to the integration in the discovery.py file, as stated by the Home Assistant documentation.

I will start working on that, and see if we can make the device configuration easier.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ArnyminerZcommented, Feb 11, 2021

For now, will move the conversation to glocaltokens and once it’s implemented there, we will start working at ha-glocaltokens. Will reopen as soon as it’s ready there.

1reaction
DurgNomis-drolcommented, Feb 10, 2021

Using mDNS(pychromecast) we can make an reverse lookup and get the IP from that. If we can find the string in homegraph. Then we can make an reverse lookup with socket.gethostbyname in python by adding ._tcp.local afterwards. But I don’t know if this will work or if homegraph has this string included

Or we could just show the user a list were they have to enter the IP of each device. This could at least be the solution until we can finde a better one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Zero-configuration networking - Wikipedia
Zero-configuration networking (zeroconf) is a set of technologies that automatically creates a usable computer network based on the Internet Protocol Suite ...
Read more >
[REQUEST] Zeroconf (mDNS) automatic network discovery ...
When an mDNS client needs to resolve a local hostname to an IP address, it sends a DNS request for that name to...
Read more >
DNS Service Discovery and Zero Configuration Networking ...
Configuring the network parameters (e.g., IP address, netmask, etc.) ... configuration of network devices and the automatic discovery of network services.
Read more >
Automatic Configuration and Service Discovery for Networked ...
Zeroconf uses DHCP and AutoIP for address assignment if no DHCP server is available. A special variant of the well-known DNS protocol, multicast...
Read more >
How to use Bonjour? - Server Fault
Here I found out that Bonjour enables automatic discovery of computers, devices, and services on IP networks. But I thought that it not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found