The new Hub - an ESPNow to MQTT gateway

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Is there a non-video source of information?

👍︎︎ 5 👤︎︎ u/[deleted] 📅︎︎ Sep 19 2021 🗫︎ replies

Is it free & opensource?

I can only find schematics and compiled binaries.

👍︎︎ 3 👤︎︎ u/TorxGewindee 📅︎︎ Sep 19 2021 🗫︎ replies

Nice job with the video & design

👍︎︎ 1 👤︎︎ u/jbriggsnh 📅︎︎ Sep 19 2021 🗫︎ replies
Captions
It's time to update the hub! A small but crucial part of my ultra-low power  sensor system is the hub the purpose of the hub is   to take ESPNow messages coming from my sensors and  push them over WiFi to an MQTT server. If this   is your first time on the channel welcome. But  if you have been following me, you might recall my   original hub which was composed of two subsystems:  the receiver and the gateway. The receiver   had one simple job: listen and filter ESPNow  messages and send them over serial to the gateway. The gateway, however, was a bit more complicated.  It was responsible for multiple things including   parsing and saving the esp now messages  maintaining WiFi connection publishing   MQTT messages and serving the setup and web  portal. Originally, I used two Wemas D1 mini:   one as the receiver and one as the gateway and  sandwiched them together. It was very simple   and did the job, however, I felt it needed to  be enhanced with more peripherals like screen   an led or a buzzer and the firmware also needed  some more options and a UI makeover. So I added   an OLED screen at the top and the buzzer and LED  indicator at the bottom - as you can see here.   I use the OLED display for many things  including the boot sequence information,   like WiFi and MQTT connection info. I have  also used it to display the progress of over   the air updates - I really like that one.  And when the device is idle, it shows the   total number of connected sensors and the IP  address of the device. Each time the hub gets   a new update from a sensor, it displays it. So for  example, this is what it shows for a door sensor   and this one for a climate sensor. The OLED was  a very useful addition, it is truly versatile.   The other edition was the buzzer and the LED.  They are used for things that need more urgent   attention. This switch, on the right hand side,  can toggle between audible and visual alerts. So   I can make it beep or flash. I learned from the  first hub that having constant beeping around you   is very annoying so that's why I added that switch  for an option for a quiet mode. I added those two   mainly to get alerts when the batteries run low  this allows me to replace the batteries we needed. So, that was the hardware. Another  really major upgrade was the firmware.   I almost rebuilt it from the ground up. This  started when I had issues fine tuning the   portal library I used. So I wrote my custom  code to deploy the setup portal and serve   the web pages. You can check out, a previous  video I made, for an intro on that subject   the HTML code also got more structured, I started  using frameworks like Bootstrap and JQuery.   This used to be the old interface and now  it's more sleek. It's also more responsive   and user-friendly and it looks way better - if  you ask me. So here on the main page, I get to   see all the discovered sensors at a glance. For  each sensor, the id is displayed at the top.   This will later be used to identify it. This  is basically the MAC address of the sensor.   The sensor status is right below it: in case of a  switch it shows open or closed and in the case of   a temperature sensor it displays the temperature  and the humidity reading when available. And yes   the temperature sensors are a new addition to  the system and I am currently working on those   further. Below is the battery voltage and a small  icon reflecting the battery level. And all the way   at the bottom, it shows when it was last updated.  If I head over to the top right corner of the   screen, I can access the device settings page.  This is where all the settings can be changed   like the WiFi credentials MQTT info and the  temperature unit. This can toggle between Celsius   and Fahrenheit. it is worth noting that the  sensors themselves send the readings in Celsius.   But it is the hub that does the conversion on  the fly before displaying them or sending them   externally. And on the same page, on the right  hand side, I also included some instructions   for the MQTT and HTTP integration. For MQTT, the  sensor updates are published to a unique topic   using this format. The sensor id is the id I  showed earlier which is created from the sensor's   MAC address. The payload is at JSON formatted  and it's different depending on the sensor type.   So far I have two types switch and climate. Switch  is used for sensors that are either open or closed   type-like, a door or a motion sensor, And climate  is used with the temperature and humidity sensors   type. Obviously with the addition of the climate  sensor, I needed to adjust the ESPNow that the   structure I was using slightly. Before, it  only had a boolean variable for the on-off   sensors. But now, it has two extra values to  be able to handle the climate type. One thing   I'm experimenting with is the auto-discovery  and setup with external systems using MQTT.   For example, in Home Assistant, you can send the  attributes of a sensor over MQTT and it gets added   automatically without any setup. I tested it and  it's working well and I might explore this more   in the future. Another addition to the firmware is  the HTTP integration which is very similar to MQTT   except that it needs to be pulled using a URL.  Accessing the URL and passing it the sensor id,   it returns a JSON with the sensor details just  like the MQTT payload ... and that pretty much   wraps up the new hub! This was very exciting  and it has taken me weeks to design, build,   test and assemble. And I have made couple of  these if you want to get your hand on one.   And what I'm really missing now is a  case, but I'm not really good at CAD. So,   if you are and you would like to contribute,  please reach out. So that's it for me! Thank you   for watching and I hope you enjoyed this video.  I'd love to hear your comments which you can   leave down below. And if you like what I'm doing,  leave a thumbs up. See you in the next one. Peace!
Info
Channel: MrDIY
Views: 7,733
Rating: undefined out of 5
Keywords: Ultra Low Power WiFi Trigger Sensor, low power wifi door sensor, wifi door sensor, wifi motion sensor, wireless door sensor, wireless motion sensor, battery door sensor, esp8266 door sensor, esp8266 motion sensor, design esp8266 sensor, espnow sensor, fast espnow example, espnow sender, MrDIY.ca, MrDIY, diy door sensor, DIY Wifi door sensor, battery window sensor, ESPnow to Wifi gateway, esp now to wifi gateway, ESPNow to Wifi, espnow gateway, espnow and wifi at the same time
Id: xPPdYvKbSFk
Channel Id: undefined
Length: 6min 52sec (412 seconds)
Published: Sat Sep 18 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.