• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Android Infotech

Android Infotech

Android Tips, News, Guide, Tutorials

  • AI
  • Firmware
  • Knowledge
  • News
  • Deals
  • Root
  • Tutorial
  • Applications
  • Opinion
  • Tools
  • Search
  • Account
You are here: Home / Knowledge / Control Your Smart Home Devices with Telegram and n8n – Complete Step-by-Step Guide

Control Your Smart Home Devices with Telegram and n8n – Complete Step-by-Step Guide

Updated On: August 9, 2025 by Selva Ganesh Leave a Comment

Control Your Smart Home Devices with Telegram and n8n– Integrating Telegram with n8n to control your smart home devices gives you a fast, secure, and highly customizable way to manage your lights, fans, appliances, and more. With just a few commands in Telegram, you can turn devices ON or OFF instantly, even when you’re away from home. This detailed guide will walk you through every step — from setting up a Telegram bot to sending commands through n8n workflows that trigger your devices via API calls or Home Assistant.Smart Home Devices with Telegram and n8n

1. Prerequisites for Setting Up Telegram + n8n Smart Home Control

Before starting, ensure you have:

  • n8n Installed — You can run n8n locally, in Docker, or through the n8n cloud platform.
  • A Telegram Bot — Created through BotFather.
  • Smart Home Devices with API Access — Examples: Tuya, Shelly, Sonoff, or any brand supported by Home Assistant or MQTT.
  • API Endpoints or MQTT Broker Details — These are necessary to control the devices.
  • Basic Networking Knowledge — Helps with configuring authentication and API requests.

2. Create a Telegram Bot for Smart Home Control

You need a Telegram bot to receive your ON/OFF commands.

  1. Open Telegram and search for BotFather.
  2. Send the command:
  3. /newbot
  4. Assign a name and a username for your bot.
  5. BotFather will provide a Bot Token — save it securely, as it will be used in n8n.

3. Set Up a Webhook Trigger in n8n

In n8n, the Telegram Trigger Node will listen for incoming messages from your bot.

  1. Open the n8n dashboard.
  2. Create a new workflow.
  3. Add a Telegram Trigger Node:
    • Mode: Webhook (recommended) or Polling.
    • Bot Token: Paste the token from BotFather.
    • Trigger Action: Listen for specific text commands like /on or /off.
  4. Save and activate the workflow.

This ensures that every time you send a command to your Telegram bot, n8n will process it.

4. Parse the Telegram Commands in n8n

We need to differentiate between ON and OFF commands.

  1. After the Telegram Trigger Node, add a Switch Node or IF Node.
  2. Configure the conditions:
    • Case 1: If message.text equals /on.
    • Case 2: If message.text equals /off.

This setup ensures the correct device action is executed depending on your Telegram command.

5. Send Device Control Commands via API

You can control your smart devices in two main ways:

A. Using Direct HTTP Requests to the Device API

You can send ON/OFF commands directly if your device supports a REST API.

Example for Tuya Cloud API:

Copy Code Copied Use a different Browser

http

POST https://openapi.tuya.com/v1.0/devices/{device_id}/commands

Headers:

  Content-Type: application/json

  Authorization: Bearer YOUR_ACCESS_TOKEN

Body:

{

  "commands": [

    { "code": "switch_1", "value": true }

  ]

}

  • Replace {device_id} with your actual device ID.
  • Set “value”: false for turning OFF.

B. Using Home Assistant for Device Control

If your devices are integrated into Home Assistant, you can use its REST API:

Copy Code Copied Use a different Browser

http

POST http://YOUR_HOME_ASSISTANT_IP:8123/api/services/switch/turn_on

Headers:

  Authorization: Bearer YOUR_LONG_LIVED_ACCESS_TOKEN

  Content-Type: application/json

Body:

{

  "entity_id": "switch.living_room_light"

}

  • Change the switch to living_room_light to match your Home Assistant entity.
  • Use switch/turn_off for OFF commands.

6. Sending Confirmation Messages Back to Telegram

To confirm actions, send a Telegram Message Node after the device control step:

If the device is turned ON, send:

  • graphql
  • Device successfully turned ON.

If the device is turned OFF, send:

  • vbnet
  • Device successfully turned OFF.

This feedback ensures you always know if the command worked.

7. Testing Your Setup

Once configured, test the automation:

  1. In Telegram, type /on.
    • The connected device should turn ON.
    • You should receive a confirmation message.
  2. Type /off.
    • The device should turn OFF.
    • A confirmation message will appear.

8. Adding Multiple Devices and Custom Commands

You can extend your workflow to control multiple devices:

  • Custom Commands:
    • /fanon — Turn on fan.
    • /fanoff — Turn off fan.
    • /lighton — Turn on lights.
    • /lightoff — Turn off lights.
  • Workflow Changes:
    • Add extra Switch Node conditions for each device.
    • Link each case to its corresponding HTTP Request.

9. Using MQTT for Non-API Devices

If your smart device doesn’t have a public API but supports MQTT, n8n can still control it:

  1. Install and configure MQTT Broker (e.g., Mosquitto).
  2. Use n8n’s MQTT Node to publish ON/OFF messages.
  3. Your device must subscribe to the corresponding MQTT topic.

Example MQTT message:

json

{

  “state”: “ON”

}

10. Security and Best Practices

To ensure safe remote access:

  • Use strong BotFather tokens and never share them.
  • Restrict n8n webhook URLs to trusted IPs.
  • Use HTTPS for secure API calls.
  • Store API keys in n8n’s credentials manager, not in plain text.

11. Example Workflow Overview in n8n

  1. Telegram Trigger Node — Receives the command.
  2. Switch Node — Decides ON/OFF or other device commands.
  3. HTTP Request / MQTT Node — Sends command to device.
  4. Telegram Node — Sends back confirmation.

Wrap Up

By combining Telegram with n8n, you can create a fast, reliable, and secure smart home control system that works from anywhere in the world. The setup is highly customizable, supports multiple devices, and works with APIs, MQTT, and Home Assistant integrations.

You now have the power to control your entire home with just a few Telegram commands.

Ask Follow-up Question from this topic With Google Gemini: Control Your Smart Home Devices with Telegram and n8n – Complete Step-by-Step Guide



174884903535965
Selva Ganesh

Selva Ganesh is the Chief Editor of this blog. A Computer Science Engineer by qualification, he is an experienced Android Developer and a professional blogger with over 10 years of industry expertise. He has completed multiple courses under the Google News Initiative, further strengthening his skills in digital journalism and content accuracy. Selva also runs Android Infotech, a widely recognized platform known for providing in-depth, solution-oriented articles that help users around the globe resolve their Android-related issues.

Share This Post:

Related Posts

  • Add Android TV Devices to Google Home Speakers Group
  • The Future of IoT: How 5G RedCap is Revolutionizing Wearables and Smart Devices
  • How to Create an Amazon USA Price Alert Telegram Bot Using n8n?

Filed Under: Knowledge Tagged With: AI, Control Smart Home with Telegram and n8n, n8n Workflow for Home Automation, Remote Device Control Using Telegram, Telegram Smart Home Automation Guide, Turn Devices On/Off via Telegram Bot

Reader Interactions

You must be logged in to comment.
Login with Google

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Join With Us

Advertisement

Recent Comments

  • Emily Roberts on 10 Trending Google Gemini Nano Banana Prompts You Must Try Right Now
  • Lucas Taylor on 10 Streaming Services with 3-Month Free Trials in the USA (2025 Edition)
  • David Perez on 10 Trending Google Gemini Nano Banana Prompts You Must Try Right Now
  • Sydney on 5 New Things in Zoom AI Companion 3.0
  • Kai on 5 New Things in Zoom AI Companion 3.0

Today Trending News ⚡

AI News Daily — USA Friday September 26 2025

AI News Daily — USA (Friday, September 26, 2025)

AI News Daily — USA (Friday, September 26, 2025)- The United States is … [Read More...] about AI News Daily — USA (Friday, September 26, 2025)

Footer

Copyright © 2010-2025. AndroidInfotech.com, All Rights Reserved. Iris Media MSME. Android Infotech is a Registered Enterprise under UDYAM-TN-21-0012548. Android is a trademark of Google Inc. All contents on this blog are copyright protected and should not be reproduced without permission.

  • Subscribe
  • Sitemap
  • About Us
  • Contact Us
  • Privacy Policy
  • Disclaimer
  • Our Image License
  • Hosted on Google Cloud
  • Ad Partner Ezoic
  • Corporate Office
  • Careers