Creating a DIY Home Assistant Switch using MicroPython

I want to add some DIY switches to my Home Assistant automation setup. These switches can control anything, such as lights, fans, blinds, etc… The switches are programmed using MicroPython using the ESP8266 NodeMCU board. Home Assistant will control them using the MQTT protocol. Check out some of my previous blog entries for getting an MQTT broker running with Home Assistant and MicroPython the ESP8266.

Why did I go with MicroPython over Arduino or ESPEasy? I wanted to use Python so that as my needs changed I had a flexible programming language I could use to quickly program a solution. Plus, I just like using Python and hadn’t played with MicroPython yet.

One thing I love about the ESP8266 is that MicroPython is really well supported and they’re pretty cheap. You can get a pack of 2 from Amazon.

[Read more…]

Running MicroPython on ESP8266 NodeMCU

For some upcoming projects, I’m going to make some DIY sensors and switches using the ESP8266 NodeMCU. It’s a pretty cheap board that is based on the ESP8266 which has built-in WiFi. In this post today I’m going to be getting a brand new “ESP8266 NodeMCU” up and running with MicroPython. MicroPython allows you to write microcontroller code using Python instead of using C or the Arduino libraries.

To get started you’ll need:

There are lots of other ESP8266 boards floating around the internet so if you decide to go with a different board I would just ensure it comes with at least 1Mbyte of flash so you can run the full version of MicroPython.

[Read more…]