summaryrefslogtreecommitdiff
path: root/netdisco/discoverables/homekit.py
blob: 690cb63f30558ee314e03fc05abfe250bf51f25d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Discover Homekit devices."""
from . import MDNSDiscoverable

from ..const import ATTR_NAME


class Discoverable(MDNSDiscoverable):
    """Add support for discovering HomeKit devices."""

    def __init__(self, nd):
        super(Discoverable, self).__init__(nd, '_hap._tcp.local.')

    def info_from_entry(self, entry):
        info = super(Discoverable, self).info_from_entry(entry)
        name = entry.name
        name = name.replace('._hap._tcp.local.', '')
        info[ATTR_NAME] = name
        return info