diff --git a/homeassistant/components/telegram_bot/__init__.py b/homeassistant/components/telegram_bot/__init__.py index 43f8a26644c..09d4fb0dd88 100644 --- a/homeassistant/components/telegram_bot/__init__.py +++ b/homeassistant/components/telegram_bot/__init__.py @@ -446,11 +446,15 @@ class TelegramNotificationService: params[ATTR_REPLY_TO_MSGID] = data[ATTR_REPLY_TO_MSGID] # Keyboards: if ATTR_KEYBOARD in data: - from telegram import ReplyKeyboardMarkup + from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove keys = data.get(ATTR_KEYBOARD) keys = keys if isinstance(keys, list) else [keys] - params[ATTR_REPLYMARKUP] = ReplyKeyboardMarkup( - [[key.strip() for key in row.split(",")] for row in keys]) + if keys: + params[ATTR_REPLYMARKUP] = ReplyKeyboardMarkup( + [[key.strip() for key in row.split(",")] + for row in keys]) + else: + params[ATTR_REPLYMARKUP] = ReplyKeyboardRemove(True) elif ATTR_KEYBOARD_INLINE in data: from telegram import InlineKeyboardMarkup keys = data.get(ATTR_KEYBOARD_INLINE) diff --git a/homeassistant/components/telegram_bot/services.yaml b/homeassistant/components/telegram_bot/services.yaml index 206898bfda2..ed8720c5877 100644 --- a/homeassistant/components/telegram_bot/services.yaml +++ b/homeassistant/components/telegram_bot/services.yaml @@ -22,7 +22,7 @@ send_message: description: Disables link previews for links in the message. example: true keyboard: - description: List of rows of commands, comma-separated, to make a custom keyboard. + description: List of rows of commands, comma-separated, to make a custom keyboard. Empty list clears a previously set keyboard. example: '["/command1, /command2", "/command3"]' inline_keyboard: description: List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with associated callback data.