mirror of
https://github.com/home-assistant/core
synced 2024-10-04 07:58:43 +02:00
Bug fix for clicksend (#17713)
* Bug fix Current version causes 500 error since it is sending an array of from numbers to ClickSend. Changing the from number to 'hass' identifies all messages as coming from Home Assistant making them more recognisable and removes the bug. * Amendment Changed it to use 'hass' as the default instead of defaulting to the recipient which is the array. Would have worked if users set their own name but users who were using the default were experiencing the issue. * Added DEFAULT_SENDER variable
This commit is contained in:
parent
324587b2db
commit
44e35b7f52
@ -22,6 +22,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
BASE_API_URL = 'https://rest.clicksend.com/v3'
|
BASE_API_URL = 'https://rest.clicksend.com/v3'
|
||||||
|
|
||||||
|
DEFAULT_SENDER = 'hass'
|
||||||
|
|
||||||
HEADERS = {CONTENT_TYPE: CONTENT_TYPE_JSON}
|
HEADERS = {CONTENT_TYPE: CONTENT_TYPE_JSON}
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +31,7 @@ def validate_sender(config):
|
|||||||
"""Set the optional sender name if sender name is not provided."""
|
"""Set the optional sender name if sender name is not provided."""
|
||||||
if CONF_SENDER in config:
|
if CONF_SENDER in config:
|
||||||
return config
|
return config
|
||||||
config[CONF_SENDER] = config[CONF_RECIPIENT]
|
config[CONF_SENDER] = DEFAULT_SENDER
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
@ -61,7 +63,7 @@ class ClicksendNotificationService(BaseNotificationService):
|
|||||||
self.username = config.get(CONF_USERNAME)
|
self.username = config.get(CONF_USERNAME)
|
||||||
self.api_key = config.get(CONF_API_KEY)
|
self.api_key = config.get(CONF_API_KEY)
|
||||||
self.recipients = config.get(CONF_RECIPIENT)
|
self.recipients = config.get(CONF_RECIPIENT)
|
||||||
self.sender = config.get(CONF_SENDER, CONF_RECIPIENT)
|
self.sender = config.get(CONF_SENDER)
|
||||||
|
|
||||||
def send_message(self, message="", **kwargs):
|
def send_message(self, message="", **kwargs):
|
||||||
"""Send a message to a user."""
|
"""Send a message to a user."""
|
||||||
|
Loading…
Reference in New Issue
Block a user