mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
Catch a gntp networkerror (#2099)
This commit is contained in:
parent
8d34b76d51
commit
a565cc4b73
@ -41,8 +41,9 @@ class GNTPNotificationService(BaseNotificationService):
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, app_name, app_icon, hostname, password, port):
|
||||
"""Initialize the service."""
|
||||
from gntp import notifier
|
||||
self.gntp = notifier.GrowlNotifier(
|
||||
import gntp.notifier
|
||||
import gntp.errors
|
||||
self.gntp = gntp.notifier.GrowlNotifier(
|
||||
applicationName=app_name,
|
||||
notifications=["Notification"],
|
||||
applicationIcon=app_icon,
|
||||
@ -50,7 +51,11 @@ class GNTPNotificationService(BaseNotificationService):
|
||||
password=password,
|
||||
port=port
|
||||
)
|
||||
self.gntp.register()
|
||||
try:
|
||||
self.gntp.register()
|
||||
except gntp.errors.NetworkError:
|
||||
_LOGGER.error('Unable to register with the GNTP host.')
|
||||
return
|
||||
|
||||
def send_message(self, message="", **kwargs):
|
||||
"""Send a message to a user."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user