Zum Hauptinhalt springen

Telegram Smart-Home-Integration, kostenlos und Open Source

Telegram-Integration für Gladys Assistant

Chat with Gladys from Telegram: ask about your home and receive your notifications.

Info

Die Dokumentation dieser Integration wird von ihrem Autor geschrieben und ist bisher nur auf Englisch verfügbar.

Chat with Gladys from Telegram: ask questions about your home, trigger your scenes, and receive the notifications Gladys sends you — all from the Telegram app on your phone or computer.

Overview​

This integration runs your own Telegram bot. Nothing goes through a shared Gladys bot: you create the bot with Telegram's official @BotFather, and the integration connects to it with the token it gives you.

Once a Gladys user has linked their Telegram account, whatever they write to the bot is routed to the Gladys brain with their identity — exactly as if they had typed it in the Gladys chat. Replies, and any notification Gladys sends them, come back in the same Telegram conversation.

Prerequisites​

  • A Telegram account.
  • A bot created with @BotFather (free, takes a minute — see below).

Create your bot​

  1. In Telegram, open a conversation with @BotFather.
  2. Send /newbot.
  3. Pick a display name (e.g. Gladys), then a username ending in bot (e.g. my_home_gladys_bot). Usernames are unique across Telegram, so you may have to try a few.
  4. @BotFather answers with a token that looks like 123456789:AAE.... Keep it secret: anyone holding it controls the bot.

Useful optional commands of @BotFather: /setuserpic to give your bot an avatar, /setdescription for the text shown before the first message, and /setprivacy (privacy stays enabled — this integration only answers in one-to-one conversations anyway).

Configuration​

  1. Open the Configuration tab of the Telegram integration in Gladys.
  2. Paste the token from @BotFather in the Telegram bot token field, and save.
  3. Click Test the bot token: Gladys checks the token against the Telegram API and displays the username of your bot when it works.

The connection status shown on the screen reflects the real state of the bot: if Telegram refuses the token, it says so instead of failing silently.

Each Gladys user links their own Telegram account, and only linked accounts can talk to Gladys:

  1. In the same Configuration tab, click Link my account. Gladys shows a short code, valid 15 minutes and usable once.
  2. Open the conversation with your bot in Telegram (search for its username, then press Start).
  3. Send the code to the bot. It confirms the link, and you can start asking questions right away.

You can revoke a link at any time from the same screen: the contact is unlinked and the bot stops answering it.

Troubleshooting​

The bot does not answer at all. Check the connection status in the Configuration tab, then click Test the bot token. A revoked or mistyped token is the usual cause; generate a new one with /token in @BotFather and paste it again.

"Your Telegram account is not linked yet". The message means the bot does not know your Telegram account: generate a fresh code from Gladys and send it to the bot. Codes expire after 15 minutes and only work once.

"This code is invalid or has expired". Same fix: generate a new code. Make sure you send it in the private conversation with the bot, not in a group.

Nothing happens in a group conversation. This is intentional: a linked contact speaks with the authority of its Gladys user, so the integration only answers in one-to-one conversations.

Two Gladys instances, one bot. A Telegram bot can only be polled by a single client at a time. Using the same token in two Gladys instances makes both of them miss messages: create a second bot instead.

For anything else, open the integration logs from the Gladys UI: the integration logs what it does, and LOG_LEVEL=debug gives the full detail.

Konfigurationseinstellungen​

Diese Einstellungen fragt Telegram in seinem Konfigurationsbildschirm in Gladys ab.

EinstellungTypPflichtfeldBeschreibung
Telegram bot tokensecretJaCreate a bot with @BotFather on Telegram (/newbot) and paste the token it gives you here.

So installierst du Telegram in Gladys​

  1. Öffne in Gladys Integrationen: Telegram erscheint im Katalog neben den nativen Integrationen, mit einem Community-Badge.
  2. Klicke auf Installieren. Gladys lädt das Docker-Image (ghcr.io/gladysassistant/gladys-telegram:1.1.0) herunter, startet es in einer vom Kern isolierten Sandbox und erzeugt die Oberfläche der Integration (Geräte, Erkennung und Konfiguration).
  3. Öffne den Bildschirm Konfiguration der Integration, fülle die Einstellungen aus und speichere.
  4. Du kannst sie auch direkt über die URL ihres Repositorys installieren: https://github.com/GladysAssistant/gladys-telegram.

Telegram benötigt Gladys >=4.83.0. Der Katalog in Gladys wird stündlich aktualisiert, eine neue Version ist also spätestens eine Stunde nach ihrer Veröffentlichung verfügbar.

Du nutzt Gladys noch nicht? Es ist kostenlos und Open Source: folge der Installationsanleitung, um loszulegen.

Über externe Integrationen​

Telegram ist eine externe Integration: eine Community-Integration, die als Docker-Container verpackt und auf GitHub veröffentlicht wird. Gladys installiert sie mit einem Klick und führt sie in einer vom Kern isolierten Sandbox aus. Sie wird von GladysAssistant veröffentlicht und gepflegt, nicht vom Gladys-Kernteam.

Abonniere den Newsletter von Gladys Assistant

Ein paar E-Mails im Monat zu neuen Releases und Neuigkeiten aus dem Projekt. Verschickt von Pierre-Gilles Leymarie, dem Gründer des Projekts. Jederzeit abbestellbar 🙂