I would still try to isolate if it is a deepsleep() issue or not.
For what it might be worth here is my "receiver code":
Code: Select all
import network
from esp import espnow
import utime
import machine
#import ubinascii
# A WLAN interface must be active to send()/recv()
w0 = network.WLAN(network.STA_IF)
w0.active(True)
mac = w0.config('mac')
print(mac)
#mac = ubinascii.hexlify(w0.config('mac'),':').decode()
#print(mac)
e0 = espnow.ESPNow()
print(e0)
retval = e0.init()
if (retval != None):
print('init() did NOT work')
machine.reset()
#peer = b'\xdcO"9(\xfe' # MAC address of remote septic ESP-01S
peer = b'\x18\xfe4\xde\xea\xf3' # MAC address of remote test ESP-01S
retval = e0.add_peer(peer)
if (retval != None):
print('add_peer did NOT work')
machine.reset()
print('send command')
retval = e0.send(peer, "pump off", True)
#e.send(peer, "pump off", True)
print(retval)
if (retval != True):
print ('send did NOT work')
machine.reset()
print('waiting for ACK')
while True:
msg = e0.irecv()
if msg:
return_msg = msg[1].decode('utf-8')
print(return_msg)
if (return_msg == 'pump is now off'):
utime.sleep(5)
retval = e0.deinit()
if (retval != None):
print('deinit() did NOT work')
w0.active(False) # take-down WiFi
machine.reset()