diff --git a/custom_components/ntfy/manifest.json b/custom_components/ntfy/manifest.json index 9d13bb7..842d1df 100644 --- a/custom_components/ntfy/manifest.json +++ b/custom_components/ntfy/manifest.json @@ -16,6 +16,6 @@ "requirements": ["requests"], "ssdp": [], "usb": [], - "version": "0.2.2", + "version": "0.2.3", "zeroconf": [] } diff --git a/custom_components/ntfy/notify.py b/custom_components/ntfy/notify.py index 0be5f2c..22ac308 100644 --- a/custom_components/ntfy/notify.py +++ b/custom_components/ntfy/notify.py @@ -68,33 +68,24 @@ def send_message(self, message="", **kwargs): req_headers={ "Title": title.encode('utf-8') } - - if "tags" in data: - req_headers["Tags"] = data["tags"] - - - - - if "priority" in data: - schema_click = ['max','urgent','high','default','low','min'] - - if str(data["priority"]) not in schema_click: - raise SyntaxError('Incorrect value for attribute priority given') - - req_headers["Priority"] = data["priority"] - - - - if "click" in data: - schema_url = vol.Schema(vol.Url()) - - try: - schema_url(data["click"]) - except vol.MultipleInvalid as e: - raise SyntaxError('expected a URL for attribute click') - - req_headers["Click"] = data["click"] + if data is not None: + if "tags" in data: + req_headers["Tags"] = data["tags"] + + if "priority" in data: + schema_click = ['max','urgent','high','default','low','min'] + if str(data["priority"]) not in schema_click: + raise SyntaxError('Incorrect value for attribute priority given') + req_headers["Priority"] = data["priority"] + + if "click" in data: + schema_url = vol.Schema(vol.Url()) + try: + schema_url(data["click"]) + except vol.MultipleInvalid as e: + raise SyntaxError('expected a URL for attribute click') + req_headers["Click"] = data["click"] req_verify=True