ESP32 wake from Deep Sleep | ESPHome and HomeAssistant + MQTT

  Переглядів 10,699

OMG The Cloud!

OMG The Cloud!

3 роки тому

Battery-powered IoT solar-powered sensors are great for remote placement and data reporting, but can be tricky to update, since they spend most of their lifetime in deep sleep mode, and off the network. Code sample can be found here! www.omgthecloud.com/esphome-w...
Support me on Patreon! / omgthecloud
I put a lot of time in to these videos, and your support is appreciated to ensure I keep making high-quality content that’s helpful and educational to you!
Leveraging MQTT with retain flags, you can wake your IoT device from sleep on its' next cycle, perform your updates, and put it back in its' deep-sleep cycle. This is an elegant way of handling remote management of IoT devices without any need for physical intervention. Check it out! Additionally, we're going to cover how to use a secrets file in ESPhome to keep your passwords and other sensitive configuration points out of your firmware file.

КОМЕНТАРІ: 13
@bgable7707
@bgable7707 2 місяці тому
Great video, but, 50% + was on setting up the secrets file, at about 6mins you got to talking about setting the ON flag and your fall back method. Kind of sped through that park.
@dhavalshukla6615
@dhavalshukla6615 2 роки тому
This is nice, but what if I had a project in which I wanted to read a digital pin when the button pin was pressed to connect to the Bluetooth? Been trying to connect to the bluetooth that way but it just immediately rushes past it, how can I effectively let it, let me establish serial connection, send text back and forth and then disconnect the bluetooth upon which it can go back to sleep? Any suggestions?
@boopeshkumarprabhakaran
@boopeshkumarprabhakaran Рік тому
hi any updated version of it? I'm trying to make a door sensor based on esp deep sleep(battery powered). If you tried something similar please share.and thanks for this great video❤️
@OMGTheCloud
@OMGTheCloud Рік тому
Hey there, thanks for the interest! No updates to this build, it was just a proof of concept. For your idea of using a door sensor with ESP deep sleep mode, this can certainly be done: In that case, rather than using a time event in your code to wake up the ESP from deep sleep, you would use an interrupt pin to wake it. This way when your door sensor triggers, that event itself would wake the ESP, and trigger the event (presumably to Home Assistant). Read the data sheet for the particular model of ESP you are using, to understand which pin or pins can be used to wake from deep sleep, and whether they need a pull-up or pull-down resistor to prevent false triggers. Cheers!
@boopeshkumarprabhakaran
@boopeshkumarprabhakaran Рік тому
@@OMGTheCloud thanks for responding...any idea which gpio can be used to wake the device using the reed switch in esp12f?
@farazanwar5208
@farazanwar5208 2 роки тому
I would rather go like this: 1. Each new update on server will have update version. 2. On each update the device will save this update version as its current version in NVS. 3. On each wake up, device will compare its current version (retrieved from NVS) with available version on server. 4. If the available version is greater than current version, the device will update. Other wise go to sleep again after performing its task. 5. Update message on broker will be retained there for other devices to wakeup and update. 6. Update message will change when new update is available.
@OMGTheCloud
@OMGTheCloud 2 роки тому
I like this approach, and I think it could be done. One thing to remember is an ‘update’ in ESPHome firmware for an IoT device is not like a regular software revision update, since it is compiled real-time. An update is a functional change to the code initiated by you, for example changing what the sensor does or how it reports its’ data, so you wouldn’t have all your sensors ‘update’ wholesale. But to your point, once you compiled the new firmware, I think it would be possible to have that successful compile action then send the retained wakeup MQTT message for that device so the next cycle it wakes up and stays awake, ESPHome then sees the device and pushes the new firmware, and removes the MQTT retained message. I think this could be done!
@stefancremers9304
@stefancremers9304 2 роки тому
on minute 2.20 you say "edit the file and it will create it", I am new to home assistant but what command do you use?
@OMGTheCloud
@OMGTheCloud 2 роки тому
Good question! Watching that back, you’re absolutely right, I assumed everyone knew exactly what I was talking about 😂 the command is: nano secrets.yaml Another option which is actually a bit easier, is if you have ESPHome add-on installed in Home Assistant, when you’re in the ESPHome UI menu, there’s a “Secrets” button in the upper right of that window. Click that, and you’ll be able to edit your “secrets.yaml” right in the webUI without having to get in to the SSH terminal. I hope this helps!
@ThereWillBeCake
@ThereWillBeCake 2 роки тому
Thanks for the video. I have the sleep function working well but the temp and humidity card on the dashboard is now showing as unavailable. Still when I click on the card and look at the graph of the temp data, I can see it is still logging it. Is there a way to get the dashboard card to show the most recent value?
@OMGTheCloud
@OMGTheCloud 2 роки тому
I've encountered this too with battery sensors, and there's an easy fix for this! In the "mqtt:" section of your ESPHome config for the device, add in: birth_message: will_message: ^^ Both of those as blank items. This way it will not send a "will_message" of anything, which if you're familiar with MQTT is the 'last will and testament', ie "it died" message. This should take care of it! Thanks for watching!!
@nicolascumu7044
@nicolascumu7044 2 роки тому
404 error on provided link. Thank you for the video
@OMGTheCloud
@OMGTheCloud 2 роки тому
Thanks, I botched the timezone on the scheduled post on my website 😅 It should be good now 👍
MQTT 101: Integrate your DIY Devices into Home Assistant
28:06
ResinChem Tech
Переглядів 63 тис.
Дурнєв дивиться сторіс ZОМБІ #47
53:48
Aleksey Durnev
Переглядів 556 тис.
ЧТО ДЕЛАТЬ, ЕСЛИ НЕ ХВАТАЕТ ДЕНЕГ НА ВОССТАНОВЛЕНИЕ ТАЧКИ?
47:52
ESPHome OTA Updates for Deep Sleep Devices
12:05
Tech Dregs
Переглядів 991
Best power saving mode - Much Deeper Deep Sleep ESP8266
10:30
DIY TECH BROS
Переглядів 94 тис.
ESP8266 as Window Sensor with years of battery life
17:57
MakerMeik
Переглядів 175 тис.
#149 ESP32 Deep Sleep, RTC Memory, "Secret" LoLin Pins
13:28
Andreas Spiess
Переглядів 145 тис.
Motion sensor in ESPHome and Home Assistant
10:19
kian
Переглядів 13 тис.
ESP32 Deep Sleep: Ultra-Low Power Coprocessor
15:27
atomic14
Переглядів 28 тис.
ESP32 Deep Sleep Tutorial for Low Power Projects
8:14
educ8s.tv
Переглядів 178 тис.
What's On My Smart HomeLab Server?
15:41
Everything Smart Home
Переглядів 276 тис.
ESP32, MQTT and Home Assistant
9:20
ShotokuTech
Переглядів 9 тис.
САМЫЙ дешевый ПК с OZON на RTX 4070
16:16
Мой Компьютер
Переглядів 87 тис.
Распаковка айфона под водой!💦(🎥: @saken_kagarov on IG)
0:20
Взрывная История
Переглядів 11 млн
Портативная PS 5 🎮 #ps5 #expressly
0:22
ExpresSLY Shorts
Переглядів 138 тис.
ИГРОВОЙ ПК от DEXP за 37 тысяч рублей из DNS
27:53
Ремонтяш
Переглядів 397 тис.
Как установить Windows 10/11?
0:56
Construct PC
Переглядів 1,7 млн