Skip to content

Notify ciscospark #6130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 26, 2017
Merged

Notify ciscospark #6130

merged 5 commits into from
Feb 26, 2017

Conversation

shenning00
Copy link
Contributor

@shenning00 shenning00 commented Feb 20, 2017

Description:

Add a new notifier for Cisco Spark

Related issue (if applicable): fixes #

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2104

I couldn't verify the documentation.

Example entry for configuration.yaml (if applicable):

notify:
  - name: ciscospark
    platform: ciscospark
    token: <CISCO_SPARK_DEVELOPER_TOKEN>
    roomid: <CISCO_SPARK_ROOM_ID>

Checklist:

If user exposed functionality or configuration variables are added/changed:

Working on it.

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).
  • [x ] New dependencies are only imported inside functions that use them (example).
  • [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.

@mention-bot
Copy link

@shenning00, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @fabaff and @rmkraus to be potential reviewers.

title = kwargs.get(ATTR_TITLE) + ": "
self._spark.messages.create(roomId=self._default_room, text=title + message)
except SparkApiError as api_error:
_LOGGER.error("Could not send CiscoSpark notification. Error: %s", api_error)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (89 > 79 characters)

title = ""
if kwargs.get(ATTR_TITLE) is not None:
title = kwargs.get(ATTR_TITLE) + ": "
self._spark.messages.create(roomId=self._default_room, text=title + message)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (88 > 79 characters)

config.get(CONF_TOKEN),
config.get(CONF_ROOMID))

class CiscoSparkNotificationService(BaseNotificationService):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

})

# pylint: disable=unused-variable
def get_service(hass, config, discovery_info=None):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

self._spark.messages.create(roomId=self._default_room,
text=title + message)
except SparkApiError as api_error:
_LOGGER.error("Could not send CiscoSpark notification. Error: %s",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

title = ""
if kwargs.get(ATTR_TITLE) is not None:
title = kwargs.get(ATTR_TITLE) + ": "
self._spark.messages.create(roomId=self._default_room,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

def send_message(self, message="", **kwargs):
"""
Send a message to a user.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

self._spark = CiscoSparkAPI(access_token=self._token)


def send_message(self, message="", **kwargs):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too many blank lines (2)

Initialize the service.

Args:
token: Cisco Spark Developer's Token

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

def __init__(self, token, default_room):
"""
Initialize the service.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

@shenning00
Copy link
Contributor Author

I will now start on the PR for the documentation.

@shenning00
Copy link
Contributor Author

I added documentation but could not verify it locally.

@balloob balloob merged commit e2014eb into home-assistant:dev Feb 26, 2017
@balloob
Copy link
Member

balloob commented Feb 26, 2017

Looks great 🐬 thanks

@shenning00 shenning00 deleted the notify_ciscospark branch February 27, 2017 02:12
@home-assistant home-assistant locked and limited conversation to collaborators Jun 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants