Alextros00 / Home-Automation-NodeRED-ESP-Telegram

Localized Home Automation: Raspberry Pi 4, ESP32, ESPCAM, ESP-EYE, TI LPSTK, MQTT, NodeRED
21 stars 2 forks source link
esp-cam esp-eye esp-idf esp32 esp32-idf mosquitto mosquitto-mqtt mqtt node-red nodered raspberry-pi raspberry-pi-4 raspberry-pi-4b tcp telegram telegram-bot wifi

Home-Automation-NodeRED-ESP-Telegram

LinkedIn Stargazers Features GitHub last commit My Projects Website


ESP32 Wired to control a light via relay

Home Automation

A cheap way to automate anything and everything!
Explore the docs »
View Demo · Report Bug · Request Feature
Buy Me A Coffee

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. License
  6. Contact
  7. Acknowledgements

About The Project

This project is about automating all aspects of my home that I can. Why turn on my lights every morning at 7am and turn them off every night at 10:45pm when it can be done for me! I want to spend as little time as possible dealing with repetitive tasks and focusing on the things that matter most to me. This project consists of many smaller projects. Here is where they are all put together and additional features are added.

Built With

There were many parts to this project. Some sub-projects that I did in order to build up to this complexity can be found on my github.

Main Components

†: I us 8GB but don't really think it is required.

Architecture

Architecture

Getting Started

These steps will take you through the overall home automation system. The system consists of other repos for specifics linked throughout this README doc.

Prerequisites

The software used is free and mostly open source.
It would help to have the hardware below.

ESP32

You can get really cheap knock off ESP32s on AliExpress
Some ESP devices that I use are: ESP-WROOM-32, ESP-32S, ESP32-CAM, ESP-EYE

ESP-IDF

  1. Use the installer for Windows, Linux or Mac OS.
    ‡:Check the official site for more info.
  2. Fork my repo and Clone my ESP32 MQTT Light Control repository using this command. Replace the xxxxx with the repo.
    git clone -b --recursive https://github.com/Alextros00/xxxxxxxxxxx
Commands to Remember

Build and flash the project onto your device.
idf.py build & flash
Monitor the logs of your device
idf.py monitor
To exit the monitor us Ctrl + ] or Ctrl and ] at the same time

ESP32 Repos

  1. Light(Relay) Control over MQTT.
  2. MC38 Door Sensor to track opening and closing of doors or windows

Mosquitto MQTT Broker

MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium [mqtt.org]. The Mosquitto broker will be installed on your Raspberry Pi as the broker and your ESP devices will be clients. Learn more here.

Navigate to the terminal and follow these steps for the installation.

  1. Update your Raspberry Pi
    sudo apt-get update
  2. Install Mosquitto
    sudo apt-get install mosquitto
  3. Install Mosquitto Client
    sudo apt-get install mosquitto-clients
    ‡: Note for later: Port of your Mosquitto Broker, most likely 1883; Server Mosquitto Broker is running on, most likely the ip address of your Raspberry Pi

NodeRED

NodeRED is a low-code programming tool for wiring together hardware devices, APIs and online services for event driven applications. The browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.

Install NodeRED on your Raspberry Pi

Flows

Many of the flows used can be found in my collection at nodered.org. Here the general functionality of each flow will be described and more details(and the flow itself:) are provided on my NodeRED page.

Functionality

Light Control: lights can be controlled through a Telegram command, a button by the lamp, a button on my NodeRED Dashboard, and a webhook on my phone's home screen

Flow Gallery

Telegram

Telegram adds the ability to control the system from your phone but is not required for use. You could stricktly use the NodeRED dashboard to control your system. In this implementation, Telegram does not directly control any devices but rather goes through NodeRED using the node-red-contrib-telegrambot library.

Commands

Usage

The system can be utilized in two ways, through the Telegram-Bot or through the NodeRED Dashboard.

Usage through Telegram

Telegram sends me notifications and I can send it commands.

Usage through the NodeRED Dashboard

The NodeRED Dashboard can be used to control the system through buttons, text boxes and switches, but also displays alot of information.

Roadmap

See the open issues for a list of proposed features (and known issues).
This project will continue to grow in my free time to automate everything... except for working out... that I just have to do.

License

Distributed under the MIT License. See LICENSE for more information but basically you can take my code but I would appreciate a coffee!

Contact

Alex Trostle - GitHub - Email - LinkedIn - Instagram - My Website

Buy Me A Coffee

Acknowledgements