Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
Include device name in Homekit info
Browse files Browse the repository at this point in the history
The device name is helpful when presenting information to users, but
isn't present in the device properties. Extend info_from_entry in the
homekit discoverable to add it in.
  • Loading branch information
mjg59 committed Jul 4, 2018
1 parent 25b8a61 commit 6705404
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions netdisco/discoverables/homekit.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
"""Discover Homekit devices."""
from . import MDNSDiscoverable

from ..const import ATTR_NAME


# pylint: disable=too-few-public-methods
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

0 comments on commit 6705404

Please sign in to comment.