Skip to content

Commit

Permalink
remove zeroconf
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Aug 9, 2021
1 parent ff20b75 commit 7e10b85
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 151 deletions.
12 changes: 0 additions & 12 deletions jarbas_hive_mind/discovery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from ovos_utils.xml_helper import xml2dict
from jarbas_hive_mind.slave import HiveMindSlave
from jarbas_hive_mind.slave.terminal import HiveMindTerminal
from jarbas_hive_mind.discovery.zero import ZeroScanner
import requests


Expand Down Expand Up @@ -160,16 +159,6 @@ def __init__(self, *args, **kwargs):
self.blacklist = []
self.running = False
self.connected = False
self.zero = ZeroScanner()
self.zero.on_new_node = self.on_new_zeroconf_node
self.zero.daemon = True
self.zero.start()

def on_new_zeroconf_node(self, node):
node = HiveMindNode(_Device(node["address"]))
LOG.info("ZeroConf Node Found: " + str(node.address))
self._nodes[node.address] = node
self.on_new_node(node)

def on_new_upnp_node(self, node):
LOG.info("UpNp Node Found: " + node.xml)
Expand Down Expand Up @@ -213,7 +202,6 @@ def run(self) -> None:

def stop(self):
self.running = False
self.zero.stop()

def search_and_connect(self, *args, **kwargs):
while True:
Expand Down
123 changes: 0 additions & 123 deletions jarbas_hive_mind/discovery/zero.py

This file was deleted.

14 changes: 1 addition & 13 deletions jarbas_hive_mind/nodes/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from jarbas_hive_mind.message import HiveMessage, HiveMessageType
from jarbas_hive_mind.discovery.ssdp import SSDPServer
from jarbas_hive_mind.discovery.upnp_server import UPNPHTTPServer
from jarbas_hive_mind.discovery.zero import ZeroConfAnnounce
from jarbas_hive_mind.nodes import HiveMindNodeType
import uuid
from ovos_utils.messagebus import FakeBus
Expand Down Expand Up @@ -151,7 +150,7 @@ def sendMessage(self,
class HiveMind(WebSocketServerFactory):
node_type = HiveMindNodeType.MIND

def __init__(self, bus=None, announce=False, *args, **kwargs):
def __init__(self, bus=None, announce=True, *args, **kwargs):
super(HiveMind, self).__init__(*args, **kwargs)
# list of clients
self.listener = None
Expand All @@ -170,23 +169,12 @@ def __init__(self, bus=None, announce=False, *args, **kwargs):
self.announce = announce
self.upnp_server = None
self.ssdp = None
self.zero = None

def start_announcing(self):
device_uuid = uuid.uuid4()
local_ip_address = get_ip()
hivemind_socket = self.listener.address.replace("0.0.0.0",
local_ip_address)

if self.zero is None:
LOG.info("Registering zeroconf:HiveMind-websocket " +
hivemind_socket)
self.zero = ZeroConfAnnounce(uuid=device_uuid,
port=self.port,
host=hivemind_socket)
self.zero.daemon = True
self.zero.start()

if self.ssdp is None or self.upnp_server is None:
self.upnp_server = UPNPHTTPServer(8088,
friendly_name="JarbasHiveMind Master",
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ ovos_utils>=0.0.9a2
json_database>=0.2.6
pycryptodomex
upnpclient>=0.0.8
zeroconf>=0.1.6
mycroft-messagebus-client>=0.9.1
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='jarbas_hive_mind',
version='0.10.8',
version='0.10.9a1',
packages=['jarbas_hive_mind',
'jarbas_hive_mind.nodes',
'jarbas_hive_mind.configuration',
Expand All @@ -20,7 +20,6 @@
"ovos_utils>=0.0.6",
"json_database>=0.2.6",
"pycryptodomex",
"zeroconf>=0.1.6",
"upnpclient>=0.0.8"],
url='https://github.com/JarbasAl/hive_mind',
license='MIT',
Expand Down

0 comments on commit 7e10b85

Please sign in to comment.