Notifications
Clear all

What is the best communications protocol for a distributed Smart Home system?

4 Posts
2 Users
2 Likes
1,156 Views
(@mark-bolton)
Member
Joined: 3 years ago
Posts: 108
Topic starter  

I am building a scalable Off Grid Smart Home system. I have built a Raspberry Pi  temp sensor / relay board for one corner of the dwelling. I am building another with a ESP32 for another corner. I will build another to monitor the solar system battery status. I want to have the whole lot of them communicate with an browser interface  on my main computer system.

I am new to coding and TCP/I..

Should i try to get the system to work using HTTP or MQTT or some other IoT protocol?


   
Quote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

@mark-bolton

I don't know I can advise on 'Should' as both HTTP or MQTT will work well, and probably some other IoT protocol as well. 😀

However I can tell you that I use MQTT and find it simple to use with libraries both for python, micropython and C++ readily available. This evening I have just been cobbling together a small enclosure comprising a MCP9808 temperature sensor linked to a wemos esp8266 board programmed in Arduino C++ to send MQTT messages containing periodic temperature readings. These messages are picked up by my rpi python program that runs my central heating system.

MQTT requires a message broker, and this can be run on any computer and this could be a rpi, or the same rpi that runs other programs or whatever.  I have several brokers running, and the one I usually test on is a broker running on an old rpi 3 that has been running for over 4 years without a hitch. (it just comes back on automatically when I have power cuts) There are lots of good examples of using MQTT that makes it easy to get started with it, especially in the rpi world.

IMHO MQTT makes a great basis for a home brewed smart home system.  I also make good use of shelly1 relays that have an inbuilt MQTT client for switching central heating, and lights on and off as and when various sensors indicate action is required.  And the MQTT message system is fast.  Clicking on an on screen virtual button to switch a light on is just a fast as switching on a light from a normal wall light switch. 

This post was modified 3 years ago by byron

   
Mark Bolton reacted
ReplyQuote
(@mark-bolton)
Member
Joined: 3 years ago
Posts: 108
Topic starter  

Than you Byron,

I cant get the module to work using HTTP / Web Server based on the  https://rntlab.com/learn-esp32-welcome/ series. Since I am new to coding the "workings" are mysterious and I suspect I have somehow crippled the code. I have a passing familiarity with HTML so I thought that system might be more familiar but I suspect that is a false sense of security.

The GUI is node red based and is an extension of the Raspberry Pi panel - which does work.

All of the technologies are new to me so I a a beginner at every stage of the system.

To the extent I do understand the principles of operation it looks as if the code is serving up web pages that code for state changes in the ESP32.  It seems inelegant. Likely MQTT is designed to do the sorts of tasks I am wanting to implement so at this stage it is probably better to go back to scratch and learn MQTT to try to get the project to work. 


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

@mark-bolton

Steve Cope has a website and youtube channel that has good info on home automation.  I used his tutorial to get started with MQTT in python some 5 years ago.  These days he seems to specialise in node red so if you have not come across his site, his tutorials would seem to be right up your alley. 😀 

Hear is a link to one of his youtube videos.

You will also find info on using node red with http messaging on his site.


   
Mark Bolton reacted
ReplyQuote