Add notification platform for Rocket.Chat.
diff --git a/.coveragerc b/.coveragerc
index 60375fbb97ec..34959f53299f 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -420,6 +420,7 @@ omit =
     homeassistant/components/notify/pushover.py
     homeassistant/components/notify/pushsafer.py
     homeassistant/components/notify/rest.py
+    homeassistant/components/notify/rocketchat.py
     homeassistant/components/notify/sendgrid.py
     homeassistant/components/notify/simplepush.py
     homeassistant/components/notify/slack.py
diff --git a/homeassistant/components/notify/rocketchat.py b/homeassistant/components/notify/rocketchat.py
new file mode 100644
index 000000000000..f2898c8b9989
--- /dev/null
+++ b/homeassistant/components/notify/rocketchat.py
@@ -0,0 +1,76 @@
+"""
+Rocket.Chat notification service.
+
+For more details about this platform, please refer to the documentation at
+https://home-assistant.io/components/notify.rocketchat/
+"""
+import logging
+
+import voluptuous as vol
+
+from homeassistant.const import (
+    CONF_URL, CONF_USERNAME, CONF_PASSWORD)
+from homeassistant.components.notify import (
+    ATTR_DATA, PLATFORM_SCHEMA,
+    BaseNotificationService)
+import homeassistant.helpers.config_validation as cv
+
+REQUIREMENTS = ['rocketchat-API==0.6.1']
+
+CONF_ROOM = 'room'
+
+_LOGGER = logging.getLogger(__name__)
+
+# pylint: disable=no-value-for-parameter
+PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
+    vol.Required(CONF_URL): vol.Url(),
+    vol.Required(CONF_USERNAME): cv.string,
+    vol.Required(CONF_PASSWORD): cv.string,
+    vol.Required(CONF_ROOM): cv.string,
+})
+
+
+def get_service(hass, config, discovery_info=None):
+    """Return the notify service."""
+    from rocketchat_API.APIExceptions.RocketExceptions import (
+        RocketConnectionException, RocketAuthenticationException)
+    username = config.get(CONF_USERNAME)
+    password = config.get(CONF_PASSWORD)
+
+    url = config.get(CONF_URL)
+    room = config.get(CONF_ROOM)
+
+    try:
+        return RocketChatNotificationService(url, username, password, room)
+    except RocketConnectionException:
+        _LOGGER.warning(
+            "Unable to connect to Rocket.Chat server at %s.", url)
+    except RocketAuthenticationException:
+        _LOGGER.warning(
+            "Rocket.Chat authentication failed for user %s.", username)
+        _LOGGER.info("Please check your username/password.")
+
+    return None
+
+
+class RocketChatNotificationService(BaseNotificationService):
+    """Implement the notification service for Rocket.Chat."""
+
+    def __init__(self, url, username, password, room):
+        """Initialize the service."""
+        from rocketchat_API.rocketchat import RocketChat
+        self._room = room
+        self._server = RocketChat(username, password, server_url=url)
+
+    def send_message(self, message="", **kwargs):
+        """Send a message to Rocket.Chat."""
+        data = kwargs.get(ATTR_DATA) or {}
+        resp = self._server.chat_post_message(message, channel=self._room,
+                                              **data)
+        if resp.status_code == 200:
+            success = resp.json()["success"]
+            if not success:
+                _LOGGER.error("Unable to post Rocket.Chat message")
+        else:
+            _LOGGER.error("Incorrect status code when posting message: %d",
+                          resp.status_code)
diff --git a/requirements_all.txt b/requirements_all.txt
index 7ce8cc5ae9d9..c8ed0adcdbc1 100644
--- a/requirements_all.txt
+++ b/requirements_all.txt
@@ -865,6 +865,9 @@ rflink==0.0.34
 # homeassistant.components.ring
 ring_doorbell==0.1.4
 
+# homeassistant.components.notify.rocketchat
+rocketchat-API==0.6.1
+
 # homeassistant.components.vacuum.roomba
 roombapy==1.3.1
 

## Description:


**Related issue (if applicable):** N/A

**Pull request in [home-assistant.github.io](https://github.com/home-assistant/home-assistant.github.io) with documentation (if applicable):** home-assistant/home-assistant.github.io#3424

## Example entry for `configuration.yaml` (if applicable):
```yaml
notify:
  - platform: rocketchat
    name: NOTIFIER_NAME
    url: https://rocketchat.example.com
    username: USERNAME
    password: PASSWORD
    room: my-awesome-room
```

## Checklist:

If user exposed functionality or configuration variables are added/changed:
  - [x] Documentation added/updated in [home-assistant.github.io](https://github.com/home-assistant/home-assistant.github.io)

If the code communicates with devices, web services, or third-party tools:
  - [x] Local tests with `tox` run successfully. **Your PR cannot be merged unless tests pass**
  - [x] New dependencies have been added to the `REQUIREMENTS` variable ([example][ex-requir]).
  - [x] New dependencies are only imported inside functions that use them ([example][ex-import]).
  - [x] New dependencies have been added to `requirements_all.txt` by running `script/gen_requirements_all.py`.
  - [x] New files were added to `.coveragerc`.

If the code does not interact with devices:
  - [ ] Local tests with `tox` run successfully. **Your PR cannot be merged unless tests pass**
  - [ ] Tests have been added to verify that the new code works.

[ex-requir]: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/keyboard.py#L14
[ex-import]: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/keyboard.py#L54
