From 5fa00244dad3154523f0232fecc4bedd0bd50d46 Mon Sep 17 00:00:00 2001 From: Wictor Date: Wed, 2 Dec 2020 19:25:35 +0100 Subject: [PATCH] Allow members of allowed groups to talk to telegram_bot (#43241) --- homeassistant/components/telegram_bot/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/telegram_bot/__init__.py b/homeassistant/components/telegram_bot/__init__.py index af00c2cb6d0..50905c64fd7 100644 --- a/homeassistant/components/telegram_bot/__init__.py +++ b/homeassistant/components/telegram_bot/__init__.py @@ -744,11 +744,12 @@ class BaseTelegramBotEntity: _LOGGER.error("Incoming message does not have required data (%s)", msg_data) return False, None - if msg_data["from"].get("id") not in self.allowed_chat_ids or ( - "chat" in msg_data + if ( + msg_data["from"].get("id") not in self.allowed_chat_ids and msg_data["chat"].get("id") not in self.allowed_chat_ids ): - # Origin is not allowed. + # Neither from id nor chat id was in allowed_chat_ids, + # origin is not allowed. _LOGGER.error("Incoming message is not allowed (%s)", msg_data) return True, None