From d129a001c708214b0a7c5a1b7657ee5a5a0d76b2 Mon Sep 17 00:00:00 2001 From: Tomer Klein Date: Fri, 5 Apr 2024 11:36:51 +0300 Subject: [PATCH] Adding support for title --- custom_components/greenapi/manifest.json | 2 +- custom_components/greenapi/notify.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/custom_components/greenapi/manifest.json b/custom_components/greenapi/manifest.json index b6f00e7..2c405db 100644 --- a/custom_components/greenapi/manifest.json +++ b/custom_components/greenapi/manifest.json @@ -8,5 +8,5 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/t0mer/green-api-custom-notifier", "requirements": ["whatsapp-api-client-python"], - "version": "0.2.0" + "version": "0.3.0" } diff --git a/custom_components/greenapi/notify.py b/custom_components/greenapi/notify.py index 904544c..1deab63 100644 --- a/custom_components/greenapi/notify.py +++ b/custom_components/greenapi/notify.py @@ -43,6 +43,10 @@ def send_message(self, message="", **kwargs): """Send a message to the target.""" try: + title = kwargs.get(ATTR_TITLE) + if title is not None: + title = f"*{title}*" + message = f"{title} \n {message}" data = kwargs.get(ATTR_DATA) target = kwargs.get(ATTR_TARGET)[0] _LOGGER.info(f"Sending message to {target}")