Home Automation With NodeMCU, HomeAssistant & MQTT

Introduction: Home Automation With NodeMCU, HomeAssistant & MQTT

About: I'm trying to share fragments of my modest knowledge by creating tutorials and videos about tech, networking, wireless...

Do you want to start transforming your home in smart home?
And also to do that cheap?

NodeMCU and HomeAssistant are here to help about that.
I recommend you to watch this video, maybe it will be easier for you to follow. Otherwise, follow steps bellow.

Supplies:

1 × NodeMCU v3 NodeMCU on eBay: https://ebay.to/2OQAFeB

2 × Breadboards Breadboards on eBay: https://ebay.to/2YXC6Yg

1 × Photoresistor Photoresistor on eBay: https://ebay.to/2mcZpje

1 × Magnetic switch Magnetic switch on eBay: https://ebay.to/2kLbqfw

1 × Relay Relay on eBay: https://ebay.to/2md3XWQ

1 × Button Buttons and Resistors on eBay: https://ebay.to/2lVlaUt

7 × Resistors (2x 10kohm,4x 100ohm, 1x 4.7kohm)

4 × LEDs LEDs on eBay: https://ebay.to/2kgJAaD

20 × Wires Wires on eBay: https://ebay.to/2kL4xuG

1 × Temperature sensor DALLAS Temperature sensor on eBay: https://ebay.to/2kfn55W

1 × Motion sensor (PIR) Motion sensor: https://ebay.to/2kKsNgs

1 × ADDITIONAL: Power bank

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1:

Hi!

Get all needed supplies (components) and let's start.

Step 2:

Connect all components accordingly to this messy sketch. Sorry because of wire mess. :(

Step 3:

Install PlatformIO IDE, HomeAssistant + Python

Once more, you can follow this video to see more details about installation of HomeAssistant and Python.
To follow step by step PlatformIO installation and to see how to upload simple blinking LED program check this video.

Please note that you don't need to use strictly PlatformIO IDE, but it will probably be easier for you to follow.

Step 4:

Copy code to main.cpp file from here.
Replace mqtt_server IP to IP of your PC on which the HomeAssistant is installed. Replace SSID and password with your desired Wi-Fi SSID and password. Upload to NodeMCU.

Step 5:

In windows search (start) write %appdata% and open .homeassistant folder.
There you will find configuration.yaml. Open it and replace all content with this one.

Be careful if writing something additional because config is space sensitive! It must be structured within its rules.

Start HomeAssistant on your PC if it is not already started. Enter IP of that PC and add port :8123 after it in browser. In top right corner you will find option to configure UI. Select that and again in top right corner find RAW config editor and replace its content with this one.

Step 6:

Check that everything is connected correctly and MQTT is working as it should by sending data every few seconds and test how every sensor is working.

On your smartphone go to browser and enter IP of your HomeAssistant server and add port :8123. Save web page to home screen and you have access to your new home automation system in one tap.

Now on the end I encourage you to expand this project to be more useful and not just for educational purposes.
Thanks for joining me through this project build. :)

Be the First to Share

    Recommendations

    • Magnets Challenge

      Magnets Challenge
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    Discussions

    0
    audreyobscura
    audreyobscura

    16 days ago

    Thanks for the home automation tips!