From 1719bc6fd3e6ba780b584812c443e037584096ef Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 10 Oct 2019 18:30:15 +0200 Subject: [PATCH] Remove hipchat (#27399) * Delete hipchat integration * Remove hipchat --- .coveragerc | 1 - homeassistant/components/hipchat/__init__.py | 1 - .../components/hipchat/manifest.json | 10 -- homeassistant/components/hipchat/notify.py | 108 ------------------ requirements_all.txt | 3 - 5 files changed, 123 deletions(-) delete mode 100644 homeassistant/components/hipchat/__init__.py delete mode 100644 homeassistant/components/hipchat/manifest.json delete mode 100644 homeassistant/components/hipchat/notify.py diff --git a/.coveragerc b/.coveragerc index 3de008439de..d241260fdf0 100644 --- a/.coveragerc +++ b/.coveragerc @@ -275,7 +275,6 @@ omit = homeassistant/components/heatmiser/climate.py homeassistant/components/hikvision/binary_sensor.py homeassistant/components/hikvisioncam/switch.py - homeassistant/components/hipchat/notify.py homeassistant/components/hitron_coda/device_tracker.py homeassistant/components/hive/* homeassistant/components/hlk_sw16/* diff --git a/homeassistant/components/hipchat/__init__.py b/homeassistant/components/hipchat/__init__.py deleted file mode 100644 index 8b79982fa43..00000000000 --- a/homeassistant/components/hipchat/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""The hipchat component.""" diff --git a/homeassistant/components/hipchat/manifest.json b/homeassistant/components/hipchat/manifest.json deleted file mode 100644 index 9d563719a2e..00000000000 --- a/homeassistant/components/hipchat/manifest.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "domain": "hipchat", - "name": "Hipchat", - "documentation": "https://www.home-assistant.io/integrations/hipchat", - "requirements": [ - "hipnotify==1.0.8" - ], - "dependencies": [], - "codeowners": [] -} diff --git a/homeassistant/components/hipchat/notify.py b/homeassistant/components/hipchat/notify.py deleted file mode 100644 index 03556db386a..00000000000 --- a/homeassistant/components/hipchat/notify.py +++ /dev/null @@ -1,108 +0,0 @@ -"""HipChat platform for notify component.""" -import logging - -import voluptuous as vol - -from homeassistant.const import CONF_HOST, CONF_ROOM, CONF_TOKEN -import homeassistant.helpers.config_validation as cv - -from homeassistant.components.notify import ( - ATTR_DATA, - ATTR_TARGET, - PLATFORM_SCHEMA, - BaseNotificationService, -) - -_LOGGER = logging.getLogger(__name__) - -CONF_COLOR = "color" -CONF_NOTIFY = "notify" -CONF_FORMAT = "format" - -DEFAULT_COLOR = "yellow" -DEFAULT_FORMAT = "text" -DEFAULT_HOST = "https://api.hipchat.com/" -DEFAULT_NOTIFY = False - -VALID_COLORS = {"yellow", "green", "red", "purple", "gray", "random"} -VALID_FORMATS = {"text", "html"} - -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( - { - vol.Required(CONF_ROOM): vol.Coerce(int), - vol.Required(CONF_TOKEN): cv.string, - vol.Optional(CONF_COLOR, default=DEFAULT_COLOR): vol.In(VALID_COLORS), - vol.Optional(CONF_FORMAT, default=DEFAULT_FORMAT): vol.In(VALID_FORMATS), - vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string, - vol.Optional(CONF_NOTIFY, default=DEFAULT_NOTIFY): cv.boolean, - } -) - - -def get_service(hass, config, discovery_info=None): - """Get the HipChat notification service.""" - return HipchatNotificationService( - config[CONF_TOKEN], - config[CONF_ROOM], - config[CONF_COLOR], - config[CONF_NOTIFY], - config[CONF_FORMAT], - config[CONF_HOST], - ) - - -class HipchatNotificationService(BaseNotificationService): - """Implement the notification service for HipChat.""" - - def __init__( - self, token, default_room, default_color, default_notify, default_format, host - ): - """Initialize the service.""" - self._token = token - self._default_room = default_room - self._default_color = default_color - self._default_notify = default_notify - self._default_format = default_format - self._host = host - - self._rooms = {} - self._get_room(self._default_room) - - def _get_room(self, room): - """Get Room object, creating it if necessary.""" - from hipnotify import Room - - if room not in self._rooms: - self._rooms[room] = Room( - token=self._token, room_id=room, endpoint_url=self._host - ) - return self._rooms[room] - - def send_message(self, message="", **kwargs): - """Send a message.""" - color = self._default_color - notify = self._default_notify - message_format = self._default_format - - if kwargs.get(ATTR_DATA) is not None: - data = kwargs.get(ATTR_DATA) - if (data.get(CONF_COLOR) is not None) and ( - data.get(CONF_COLOR) in VALID_COLORS - ): - color = data.get(CONF_COLOR) - if (data.get(CONF_NOTIFY) is not None) and isinstance( - data.get(CONF_NOTIFY), bool - ): - notify = data.get(CONF_NOTIFY) - if (data.get(CONF_FORMAT) is not None) and ( - data.get(CONF_FORMAT) in VALID_FORMATS - ): - message_format = data.get(CONF_FORMAT) - - targets = kwargs.get(ATTR_TARGET, [self._default_room]) - - for target in targets: - room = self._get_room(target) - room.notify( - msg=message, color=color, notify=notify, message_format=message_format - ) diff --git a/requirements_all.txt b/requirements_all.txt index 01ef364fdc6..001f199cdb8 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -627,9 +627,6 @@ herepy==0.6.3.1 # homeassistant.components.hikvisioncam hikvision==0.4 -# homeassistant.components.hipchat -hipnotify==1.0.8 - # homeassistant.components.harman_kardon_avr hkavr==0.0.5