Device discovery

Hi,

i am writing a component for Sony Bravia TVs and it works fine.
I wrote a netdisco script for discovery and would like to use that but… i can’t seem to make sense of the other components which feature a discovery script. They all seem to work in a different way. How is it supposed to be? Tantalizingly close to a working integration :slight_smile:

There is only 1 way if netdisco is involved in discovering your platform:

  1. Tell discovery component to load specific component that has support for Bravia: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/discovery.py#L31
  2. I’m assuming it will be media player, tell media player to load your platform when service is discovered: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/media_player/init.py#L33

This should probably be added to our docs: https://home-assistant.io/developers/component_discovery/

Ok, thanks.
I will try to work from there.

It works fine, thanks :slight_smile:

can you share your netdisco script? just getting setup with home assistant and need to write some component code…

I used something like this sample below to get my MyStrom switches. Nothing more than the sample the netdisco README is providing.

from netdisco.discovery import NetworkDiscovery

print("Press Ctrl+c to stop the scanning ...")

nd = NetworkDiscovery()
nd.scan()

for dev in nd.discover():
    if dev == 'mystrom':
        print('myStrom device found:', nd.get_info(dev))

@fabaff, yes true, but from the README it looks like it is only discovering devices supported by Netdisco.

I believe what I’m looking for is a way to add my devices so that netdisco can discover them.

edit: it looks simple enough. Just not sure where the netdisco stuff is on my pi!

root@raspberrypi:/srv/hass# find * | grep netdi
root@raspberrypi:/srv/hass#

edit2: I found it. It’s in the hass user home path.

/home/hass/.homeassistant