I'm struggling to remotely deactivate sleep mode. My idea is to let a Phython script wait for the ESP to wake and then issue "NoSleep" via a rule.
The rule I have created is here:
Code: Select all
on disableSleep do
NoSleep //Sleep disabled
When I hardware-deactivate sleep and issue
http://192.168.2.203/control?cmd=event,disableSleep, "OK" is returned and "Sleep enabled" is deactivated in the Config page. So far so good. However a scripted version behaves oddly.
Code: Select all
#
# This is a Python3 script
#
import requests
ESP32_ip = "192.168.2.203"
while True:
r = requests.get("http://" + ESP32_ip + "/control?cmd=event,disableSleep")
if (r.status_code != 504):
print("Code: " + str(r.status_code))
print("Text: " + r.text)
if(r.text == "OK"):
break
The script output looks good:
But as a matter of fact "Sleep enabled" is not deactivated. When I log back in this is clearly shown in the GUI, and the unit indeed goes to sleep when I connect D0 back to RST.
Can someone explain please?
Thank you.