RocketChat issue with HA 0.88.1

Hi to all, i configured rocketchat with this parameters:
notify:
- platform: rocketchat
name: RC
url: !secret rc_url
username: !secret rc_usr
password: !secret rc_pwd
room: !secret rc_room
(like “component page” describe Rocket.Chat - Home Assistant)

but i can’t see it in the notify service and it show me one error:

Log Details (ERROR)
Tue Feb 26 2019 22:53:00 GMT+0100 (Ora standard dell’Europa centrale)
Error setting up platform rocketchat
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/notify/init.py”, line 76, in async_setup_platform
platform.get_service, hass, p_config, discovery_info)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/notify/rocketchat.py”, line 41, in get_service
return RocketChatNotificationService(url, username, password, room)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/notify/rocketchat.py”, line 60, in init
self._server = RocketChat(username, password, server_url=url)
File “/usr/local/lib/python3.7/site-packages/rocketchat_API/rocketchat.py”, line 19, in init
self.login(user, password)
File “/usr/local/lib/python3.7/site-packages/rocketchat_API/rocketchat.py”, line 63, in login
if login_request.json().get(‘status’) == “success”:
File “/usr/local/lib/python3.7/site-packages/requests/models.py”, line 897, in json
return complexjson.loads(self.text, **kwargs)
File “/usr/local/lib/python3.7/site-packages/simplejson/init.py”, line 518, in loads
return _default_decoder.decode(s)
File “/usr/local/lib/python3.7/site-packages/simplejson/decoder.py”, line 370, in decode
obj, end = self.raw_decode(s)
File “/usr/local/lib/python3.7/site-packages/simplejson/decoder.py”, line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Connessione persa. Riconnessione…

I noticed that the link to the .py is no longer eistente and the component is no longer present under the gitub folder (core/homeassistant/components/rocketchat/notify.py at dev · home-assistant/core · GitHub) …

is it still supported? because I would prefer it to Slack

thanks in advance for your help

Resurrecting an old thread. I was eventually able to get this to work with rocketchat.

I created these folders and files in config:

image

/config/custom_components/rocketchat/init.py

"""The rocketchat component."""

/config/custom_components/rocketchat/manifest.json

{
    "domain": "rocketchat",
    "name": "Rocket.Chat",
    "documentation": "https://www.home-assistant.io/integrations/rocketchat",
    "requirements": ["rocketchat-API==0.6.1"],
    "codeowners": []
  }

/config/custom_components/rocketchat/notify.py

"""Rocket.Chat notification service."""
import logging

from rocketchat_API.APIExceptions.RocketExceptions import (
    RocketAuthenticationException,
    RocketConnectionException,
)
from rocketchat_API.rocketchat import RocketChat
import voluptuous as vol

from homeassistant.components.notify import (
    ATTR_DATA,
    PLATFORM_SCHEMA,
    BaseNotificationService,
)
from homeassistant.const import (
    CONF_PASSWORD,
    CONF_ROOM,
    CONF_URL,
    CONF_USERNAME,
    HTTP_OK,
)
import homeassistant.helpers.config_validation as cv

_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."""

    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."""

        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 == HTTP_OK:
            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
            )

Then I added this to configurations.yaml

Note: Prismbot is the name of my user in my rocketchat server, you’ll need to pick your own. This is what will show up when you use the service dropdown.

notify:
  - platform: rocketchat
    name: PRISMBOT
    url: http://local ip redacted:3000
    username: redacted
    password: redacted
    room: "#homeautomation"

At this point you’ll need to do a full reboot. When it boots, it will pull this new service into its services list. notify.prismbot should show up in the drop-down, if it doesn’t you probably missed a step somewhere.

(This was a motion sensor to tell me that my dog snuck downstairs to rifle through our pantry lol)

Note: The user that you use for login has to be a member of the channel you’re posting to and also needs to have ADMIN privs! I couldn’t get it to work without this.

I hope this helps someone, this is my first time posting here and I’m new to hassio but I really like rocketchat and am trying to build it into the centerpiece of my entire self-hosted empire.

If anyone knows how to get rocketchat to send commands to home-assistant, feel free to point me in the right direction. That’s my next goal!