mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Remove deprecated GNTP integration (#65741)
This commit is contained in:
parent
e242796394
commit
313387fda5
@ -401,7 +401,6 @@ omit =
|
|||||||
homeassistant/components/glances/__init__.py
|
homeassistant/components/glances/__init__.py
|
||||||
homeassistant/components/glances/const.py
|
homeassistant/components/glances/const.py
|
||||||
homeassistant/components/glances/sensor.py
|
homeassistant/components/glances/sensor.py
|
||||||
homeassistant/components/gntp/notify.py
|
|
||||||
homeassistant/components/goalfeed/*
|
homeassistant/components/goalfeed/*
|
||||||
homeassistant/components/goodwe/__init__.py
|
homeassistant/components/goodwe/__init__.py
|
||||||
homeassistant/components/goodwe/const.py
|
homeassistant/components/goodwe/const.py
|
||||||
|
@ -1 +0,0 @@
|
|||||||
"""The gntp component."""
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"domain": "gntp",
|
|
||||||
"name": "Growl (GnGNTP)",
|
|
||||||
"documentation": "https://www.home-assistant.io/integrations/gntp",
|
|
||||||
"requirements": ["gntp==1.0.3"],
|
|
||||||
"codeowners": [],
|
|
||||||
"iot_class": "local_push",
|
|
||||||
"loggers": ["gntp"]
|
|
||||||
}
|
|
@ -1,96 +0,0 @@
|
|||||||
"""GNTP (aka Growl) notification service."""
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
|
|
||||||
import gntp.errors
|
|
||||||
import gntp.notifier
|
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
from homeassistant.components.notify import (
|
|
||||||
ATTR_TITLE,
|
|
||||||
ATTR_TITLE_DEFAULT,
|
|
||||||
PLATFORM_SCHEMA,
|
|
||||||
BaseNotificationService,
|
|
||||||
)
|
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_PORT
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
CONF_APP_NAME = "app_name"
|
|
||||||
CONF_APP_ICON = "app_icon"
|
|
||||||
CONF_HOSTNAME = "hostname"
|
|
||||||
|
|
||||||
DEFAULT_APP_NAME = "HomeAssistant"
|
|
||||||
DEFAULT_HOST = "localhost"
|
|
||||||
DEFAULT_PORT = 23053
|
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|
||||||
{
|
|
||||||
vol.Optional(CONF_APP_NAME, default=DEFAULT_APP_NAME): cv.string,
|
|
||||||
vol.Optional(CONF_APP_ICON): vol.Url,
|
|
||||||
vol.Optional(CONF_HOSTNAME, default=DEFAULT_HOST): cv.string,
|
|
||||||
vol.Optional(CONF_PASSWORD): cv.string,
|
|
||||||
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def get_service(hass, config, discovery_info=None):
|
|
||||||
"""Get the GNTP notification service."""
|
|
||||||
_LOGGER.warning(
|
|
||||||
"The GNTP (Growl) integration has been deprecated and is going to be "
|
|
||||||
"removed in Home Assistant Core 2021.6. The Growl project has retired"
|
|
||||||
)
|
|
||||||
|
|
||||||
logging.getLogger("gntp").setLevel(logging.ERROR)
|
|
||||||
|
|
||||||
if config.get(CONF_APP_ICON) is None:
|
|
||||||
icon_file = os.path.join(
|
|
||||||
os.path.dirname(__file__),
|
|
||||||
"..",
|
|
||||||
"frontend",
|
|
||||||
"www_static",
|
|
||||||
"icons",
|
|
||||||
"favicon-192x192.png",
|
|
||||||
)
|
|
||||||
with open(icon_file, "rb") as file:
|
|
||||||
app_icon = file.read()
|
|
||||||
else:
|
|
||||||
app_icon = config.get(CONF_APP_ICON)
|
|
||||||
|
|
||||||
return GNTPNotificationService(
|
|
||||||
config.get(CONF_APP_NAME),
|
|
||||||
app_icon,
|
|
||||||
config.get(CONF_HOSTNAME),
|
|
||||||
config.get(CONF_PASSWORD),
|
|
||||||
config.get(CONF_PORT),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class GNTPNotificationService(BaseNotificationService):
|
|
||||||
"""Implement the notification service for GNTP."""
|
|
||||||
|
|
||||||
def __init__(self, app_name, app_icon, hostname, password, port):
|
|
||||||
"""Initialize the service."""
|
|
||||||
self.gntp = gntp.notifier.GrowlNotifier(
|
|
||||||
applicationName=app_name,
|
|
||||||
notifications=["Notification"],
|
|
||||||
applicationIcon=app_icon,
|
|
||||||
hostname=hostname,
|
|
||||||
password=password,
|
|
||||||
port=port,
|
|
||||||
)
|
|
||||||
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."""
|
|
||||||
self.gntp.notify(
|
|
||||||
noteType="Notification",
|
|
||||||
title=kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT),
|
|
||||||
description=message,
|
|
||||||
)
|
|
@ -745,9 +745,6 @@ gitterpy==0.1.7
|
|||||||
# homeassistant.components.glances
|
# homeassistant.components.glances
|
||||||
glances_api==0.3.4
|
glances_api==0.3.4
|
||||||
|
|
||||||
# homeassistant.components.gntp
|
|
||||||
gntp==1.0.3
|
|
||||||
|
|
||||||
# homeassistant.components.goalzero
|
# homeassistant.components.goalzero
|
||||||
goalzero==0.2.1
|
goalzero==0.2.1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user