This repository was archived by the owner on Oct 1, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 1
1
"""Add support for discovering mDNS services."""
2
+ import logging
2
3
from typing import List # noqa: F401
3
4
4
- from zeroconf import (
5
- Zeroconf ,
6
- ServiceBrowser ,
7
- ServiceInfo ,
8
- DNSRecord ,
9
- DNSPointer ,
10
- ServiceStateChange ,
11
- )
5
+ from zeroconf import DNSPointer , DNSRecord
6
+ from zeroconf import Error as ZeroconfError
7
+ from zeroconf import ServiceBrowser , ServiceInfo , ServiceStateChange , Zeroconf
8
+
9
+ _LOGGER = logging .getLogger (__name__ )
12
10
13
11
14
12
class FastServiceBrowser (ServiceBrowser ):
@@ -51,7 +49,10 @@ def start(self):
51
49
def _service_update (zeroconf , service_type , name , state_change ):
52
50
if state_change == ServiceStateChange .Added :
53
51
for service in services_by_type [service_type ]:
54
- service .add_service (zeroconf , service_type , name )
52
+ try :
53
+ service .add_service (zeroconf , service_type , name )
54
+ except ZeroconfError :
55
+ _LOGGER .exception ("Failed to add service %s" , name )
55
56
elif state_change == ServiceStateChange .Removed :
56
57
for service in services_by_type [service_type ]:
57
58
service .remove_service (zeroconf , service_type , name )
You can’t perform that action at this time.
0 commit comments