[dev] Implement IP address autodiscovery (zeroconf)
See original GitHub issueDiscovery 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:
- Created 3 years ago
- Comments:21 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For now, will move the conversation to
glocaltokens
and once it’s implemented there, we will start working atha-glocaltokens
. Will reopen as soon as it’s ready there.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.