Hello,
I would like to use deep sleep, but my usecase is not to send sensor data to a server, but rather polling information from a server and depending on the status setting a GPIO.
Is that possible?
Regards,
Hendrik
SleepMode and Poll Information
Moderators: grovkillen, Stuntteam, TD-er
Re: SleepMode and Poll Information
I would be happy about every answer. Even a "no" 

Re: SleepMode and Poll Information
I think there are some System event, that you can use for this purpose in rules. Like System#Sleep or System#Wake.
If this is not that you need, you can use ModemSleep instead.
I don't know what you want to "poll" there are SendToHTTP or Publish methods in ESPEasy rules.
Re: SleepMode and Poll Information
Hello,
my project to add WiFi to a SmartLock that is Bluetooth only (too low range).
I want to lock the door when going to bed. It does not need to be real-time. The Lock is battery-powered.
If I could make the ESP run with very low power, I could avoid cables.
For this, the ESP needs to check an MQTT topic regularly (that's what I meant by "poll information"). Let's say, every 20 minutes. Inbetween it can sleep. Depending on the Value of the MQTT Topic it shall set one GPIO to HIGH for 100ms and then to LOW again and sleep for another 20 minutes.
Is this possible with ESPEASY?
Greetings,
Hendrik
my project to add WiFi to a SmartLock that is Bluetooth only (too low range).
I want to lock the door when going to bed. It does not need to be real-time. The Lock is battery-powered.
If I could make the ESP run with very low power, I could avoid cables.
For this, the ESP needs to check an MQTT topic regularly (that's what I meant by "poll information"). Let's say, every 20 minutes. Inbetween it can sleep. Depending on the Value of the MQTT Topic it shall set one GPIO to HIGH for 100ms and then to LOW again and sleep for another 20 minutes.
Is this possible with ESPEASY?
Greetings,
Hendrik
Re: SleepMode and Poll Information
Hello,
it works!
Here the steps:
1) create an MQTT Controller under "Controllers"
2) create an MQTT input under "Hardware" 3) create a Rule
This will set gio 15 HIGH for 100ms on 1 and gpio 13 to HIGH for 100ms on 0.
4) Configure the sleep mode under Config
5) Don't forget to connect D0 with RST. Otherwise the ESP will never wake up.
In order to ensure that this also happens if the command is send while the ESP is in sleep mode, you need to send the MQTT command with
Here the log (from the mqtt broker).
at 17:07:33 the ESP is online and I set the target value ("zielwert") to 1. The ESP respons and sets "1". at 17:08 it shuts down, comes back up and sets the value to 1 again (not sure why, but does not harm for me. comments welcome though).
Now the nice bit: at 17:10:36 the ESP goes offline again. I set a new target value (0). As the device comes back online at 17:12 it sets the output to 0 as commanded.
Greetings,
Hendrik
it works!
Here the steps:
1) create an MQTT Controller under "Controllers"
2) create an MQTT input under "Hardware" 3) create a Rule
Code: Select all
on shpy#HintertuerZiel=1 do
Publish %sysname%/setze,1
gpio,15,1
delay 100
gpio,15,0
endon
on shpy#HintertuerZiel=0 do
Publish %sysname%/setze,0
gpio,13,1
delay 100
gpio,13,0
endon
4) Configure the sleep mode under Config
5) Don't forget to connect D0 with RST. Otherwise the ESP will never wake up.
In order to ensure that this also happens if the command is send while the ESP is in sleep mode, you need to send the MQTT command with
- QualityOfService >=1
Retain
Code: Select all
mosquitto_pub -t 'Hintertuer/zielwert' -m '0' -q 1 --retain
Here the log (from the mqtt broker).
at 17:07:33 the ESP is online and I set the target value ("zielwert") to 1. The ESP respons and sets "1". at 17:08 it shuts down, comes back up and sets the value to 1 again (not sure why, but does not harm for me. comments welcome though).
Now the nice bit: at 17:10:36 the ESP goes offline again. I set a new target value (0). As the device comes back online at 17:12 it sets the output to 0 as commanded.
Code: Select all
Jun 02 17:07:33 Hintertuer/zielwert 1
Jun 02 17:07:34 Hintertuer/setze 1
Jun 02 17:08:00 /Hintertuer/status/LWT Connection Lost
Jun 02 17:09:53 /Hintertuer/status/LWT Connected
Jun 02 17:10:01 /Hintertuer/status Hintertuer_Online
Jun 02 17:10:01 Hintertuer/setze 1
Jun 02 17:10:36 /Hintertuer/status/LWT Connection Lost
Jun 02 17:11:01 Hintertuer/zielwert 0
Jun 02 17:11:53 /Hintertuer/status/LWT Connected
Jun 02 17:12:01 /Hintertuer/status Hintertuer_Online
Jun 02 17:12:02 Hintertuer/setze 0
Greetings,
Hendrik
Who is online
Users browsing this forum: No registered users and 16 guests