mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-11-06 17:51:36 +00:00
Initial Configuration Push
This commit is contained in:
21
deps/netdisco/discoverables/homekit.py
vendored
Normal file
21
deps/netdisco/discoverables/homekit.py
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"""Discover myStrom devices."""
|
||||
from . import MDNSDiscoverable
|
||||
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
class Discoverable(MDNSDiscoverable):
|
||||
"""Add support for discovering myStrom switches."""
|
||||
|
||||
def __init__(self, nd):
|
||||
super(Discoverable, self).__init__(nd, '_hap._tcp.local.')
|
||||
|
||||
def info_from_entry(self, entry):
|
||||
"""Return the most important info from mDNS entries."""
|
||||
info = {key.decode('utf-8'): value.decode('utf-8')
|
||||
for key, value in entry.properties.items()}
|
||||
info['host'] = 'http://{}'.format(self.ip_from_host(entry.server))
|
||||
return info
|
||||
|
||||
def get_info(self):
|
||||
"""Get details from myStrom devices."""
|
||||
return [self.info_from_entry(entry) for entry in self.get_entries()]
|
||||
Reference in New Issue
Block a user