-
Hi, actually the deepsleep on esp 32 is time based but can also support wake up pins. as having very few capacities in C, is this addition doable easily ? what do you think about this idea , this could help to tasmotize some (few for the moment i admit) battery powered devices, or other interresting devices like the M5stack range of products. I m trying to get this working in order to make work the AbuttonV3a from april brother, wich is to my knowledge the only button available with the case AND having schematics. LED on the button is actually working. |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 17 replies
-
Hi So it's more than just adding wake-up GPIOs, it's about supporting new use-case that needs to be precisely described before starting to code. So tell me more about your use case. |
Beta Was this translation helpful? Give feedback.
-
Hi, it is basically a fairly simple button, but believe me, the battery powered buttons (that are not oddious diy devices) are really something missing in the esp8266 / esp32, i think the april brother project is a simple one and easy to step in to start with this subject. the esphome support the deepsleep with wake up pin option from esp32 , maybe there is some inspiration to be found in their code ? a problem i could see is to lock deepsleep timer with a command that doesnt write anything to flash , since when you write deepsleep 0 in a rule or something, i suppose its writing to flash so if you want to stop the deepsleeep timer, you ll wear the flash rapidly. |
Beta Was this translation helpful? Give feedback.
-
Has there been any progress on this? I've run into a simple use case where wakeup on GPIO would be very useful: a battery operated ESP32 connected to a reed switch. When the reed switch is triggered, I want the ESP32 to wake up and send a message. This would be useful for many tasks, such as monitoring whether a door is closed or not. In point form, the use case is:
|
Beta Was this translation helpful? Give feedback.
-
Just for completeness, here is an adapted example from the ESP-IDF for the ESP32 (FSM type ULP). The resulting code snippet could serve as a base for an individual solution. You can paste this to the Berry console.
Then |
Beta Was this translation helpful? Give feedback.
-
Is it implemented? |
Beta Was this translation helpful? Give feedback.
-
Sorry I'm newbie 😆 how do I run this code on installed tasmota? Maybe I have to compile something? |
Beta Was this translation helpful? Give feedback.
-
I can confirm that this works perfectly for my ESP32 flashed with a custom Tasmota 12.5 version and having
I use it for a Keybox defining a single edge and an opener switch from a standard cupboard (closed door=open switch=off, open door=closed switch=on), connecting GPIO 14 (defined as "NONE" on the tasmota template, which is important!) to GND pin. Per default when the box is closed and the switch is open, GPIO14 will be high per default ( I have an |
Beta Was this translation helpful? Give feedback.
-
I assume the "ULP solution" is basically some code that is running in ULP mode to wait on a pin change, and it enables esp_sleep_enable_ulp_wakeup() when sleeping. If so it's a shame Tasmota never implemented true deep sleep with esp_sleep_enable_ext0_wakeup() or esp_sleep_enable_ext1_wakeup(): It would allow more efficient sleep and could be easier to use than ULP. I would suspect "all" Tasmota would need to do is allow configuring certain pins as "WAKEUPx" (or NONE) pins and callback(s) to put the esp32 into ext0 or ext1 wakeup mode. Yes there are some design considerations around getting the "wake up reason", but this can be done later and at a much lower priority. The simple use case of waking up due to a pin change and taking an action on startup/boot would allow so many more applications, in particular battery operated contact sensors which is a pretty big gap in the ecosystem. Even some berry callbacks that map to the various functions in https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32/api-reference/system/sleep_modes.html would be adequate for 99% of use cases for battery operated sensors. |
Beta Was this translation helpful? Give feedback.
Hi
The problem is not just adding pins to wake-up the ESP32.
The DeepSleep process in Tasmota has been designed with only 1 goal in mind : periodic wake-up to read sensors, publish the result and get back to sleep.
When Tasmota wakes up, it get the time from NTP as usual, compute the time for the next wake-up and after the telemetry message, it will go again to sleep. If Tasmota found out that he woke up at at time different than the expected time, it will go straight to sleep before the telemetry message.
So it's more than just adding wake-up GPIOs, it's about supporting new use-case that needs to be precisely described before starting to code.
So tell me more about your use case.
What i…