Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/signal_messenger/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"documentation": "https://www.home-assistant.io/integrations/signal_messenger",
"dependencies": [],
"codeowners": ["@bbernhard"],
"requirements": ["pysignalclirestapi==0.1.4"]
"requirements": ["pysignalclirestapi==0.2.4"]
}
14 changes: 6 additions & 8 deletions homeassistant/components/signal_messenger/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
CONF_SENDER_NR = "number"
CONF_RECP_NR = "recipients"
CONF_SIGNAL_CLI_REST_API = "url"
ATTR_FILENAME = "attachment"
ATTR_FILENAMES = "attachments"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
Expand All @@ -34,9 +34,7 @@ def get_service(hass, config, discovery_info=None):
recp_nrs = config[CONF_RECP_NR]
signal_cli_rest_api_url = config[CONF_SIGNAL_CLI_REST_API]

signal_cli_rest_api = SignalCliRestApi(
signal_cli_rest_api_url, sender_nr, api_version=1
)
signal_cli_rest_api = SignalCliRestApi(signal_cli_rest_api_url, sender_nr)

return SignalNotificationService(recp_nrs, signal_cli_rest_api)

Expand All @@ -60,12 +58,12 @@ def send_message(self, message="", **kwargs):

data = kwargs.get(ATTR_DATA)

filename = None
if data is not None and ATTR_FILENAME in data:
filename = data[ATTR_FILENAME]
filenames = None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would prefer that we avoid the breaking change unnecessarily here.

This could be done by allowing both the attribute filename as well as the attribute filenames to be provided and then internally adding the filename to the list of filenames.

@bbernhard bbernhard Jan 27, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good to me 👍 I'll adapt the PR, thanks!

Should the attachment option also be mentioned in the documentation then, or would you see that primarily as a way to stay backwards compatible and as something that's not worth mentioning in the documentation?

@rohankapoorcom rohankapoorcom Jan 27, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would mark it as deprecated and log a warning that it's deprecated and will be removed in version x.y.z (pick a version that's like 3 versions out).

If you are using vol to validate the schema of the service call, we have the deprecated validation helper in config_validation

Alternatively we could keep using attachment as the key and accept both a singular string or a list of strings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot for your suggestions, very much appreciated!

I've updated the PR, please let me know if there's anything else that needs to be changed.

(I've also removed the Breaking changes section from the PR description)

if data is not None and ATTR_FILENAMES in data:
filenames = data[ATTR_FILENAMES]

try:
self._signal_cli_rest_api.send_message(message, self._recp_nrs, filename)
self._signal_cli_rest_api.send_message(message, self._recp_nrs, filenames)
except SignalCliRestApiError as ex:
_LOGGER.error("%s", ex)
raise ex
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ pysesame2==1.0.1
pysher==1.0.1

# homeassistant.components.signal_messenger
pysignalclirestapi==0.1.4
pysignalclirestapi==0.2.4

# homeassistant.components.sma
pysma==0.3.4
Expand Down