Micropython based room sensors with HASS MQTT discovery

Just thought I’d share a project that I’ve been working on to build temperature, humidity and motion sensors for my home using Micropython and the ESP8266. The software is equipped with MQTT discovery which makes it really easy to add new sensors:

https://webworxshop.com/2018/02/03/micropython-based-room-sensors-part-1

Please let me know any thoughts/improvements below or via the comments on my blog.

2 Likes

It’s on my to-do list to recreate the famous BRUH sensor in micropython, and hopefully demonstrate the improved speed of development and familiarity for python devs. Theres a couple of write ups on Hackster that might interest you.
Cheers

Nice, I like your leak detector. That should probably go on my projects list.

1 Like

@robconnolly I to am starting to play with the ESP8286 modules. I picked one from NCD (used to be ControlEverything) . ESP8266 with I2C and USB interface they also have module that use the ones from Adafruit and NodeMCU.

I picked these because I have a large range of sensors from them that communicate via I2C, everything from Gyroscopes, Temperature, Barometric Pressure, 4 to 20 ma sensors, ADC, relays etc.

If I can use MicroPython that will make thing much easier for me.

The blog posting is very good, I did notice a mistake on the blog

current going to the board would get very high (~400mV at 12V!)

I think you mean 400 mA, which would be current (about 5 Watts of power),

@carbuthn Thanks for the correction, I completely missed that in my proofreading. I’ve updated the post.

I took a look at the ESP modules you linked to. They look rather expensive? As far as I’m aware all ESP8266 modules have I2C capability. I might be missing something about those particular modules though.

It is a nice package that takes care of the I2C connections, signal conversion so the I2C runs at 5 vdc. It will also plug into their screw terminal boards which provides ease of use.

I will try it with micropython as soon as I can remember where I put it :worried: I had it 2 days ago, but I have been cleaning.

1 Like

I’ve just discovered that you can interact with micropython boards using Jupyter notebooks. I do an awful lot of data analysis and even component development in Jupyter notebooks so this could be really useful. Checkout the repo below, and I’ve put my initial setup on Github here.
Cheers

1 Like

@robmarkcole That’s really cool. It would be awesome if this was extended to work via the WebREPL!

As a quick update to this (to keep the links together in the same topic), I’ve just posted a further update on the (very slow) progress of this project:

https://webworxshop.com/room-sensor-project-part-2-infrastructure-and-mounting/

[for those that liked the Micropython angle, I’m afraid I switched to ESPHome - like everyone else!]

1 Like

For HA integration ESPhome cant be beaten. That being said micropython is a good option if you are a python developer and have some use case not supported by ESPhome. Cheers

Yeah, you basically summed up my thoughts exactly!