0 votes
in ESPaper by (150 points)

My 4.2" ESPpaper unit has been working fine since it was purchased in 2019, but a few weeks ago it stopped talking to the espaper.com server and now just says “Sorry, device registration failed…    … Mac 84:0D:8E:88:FC:95”. I just got round to looking at the problem, but apart from making sure it has the latest firmware and checking the output from the serial port I haven't made any progress.  I suspect the local device ID got corrupted because I can see in the serial stream:

 "Device id and/or secret are not set yet -> registering device with server now".

When the request is sent to espaper.com the result comes back "HTTP 400 Bad Request".

Tried "Reset Firmware Settings" in Configuration Mode, thinking this would result in a new Registration Code and allow me to register with the server again from scratch. Unfortunately, nothing changes and I just get the same "Sorry, device registration failed..." message.

What next steps should I take to resolve this? Serial dump as follows.


Boot sequence arrived in setup()
******** Client Version: "V031" ********
******** Device Type: "Espaper42Bw" ********
******** Screen Type: "" ********
Display Settings. CS: 15, RST: 2, DC: 5, BUSY: 4
Current free heap: 44824
Checking FS
WIFI_SSID = [xxxxxxxx]
WIFI_PASS = [
xxxxxxxx]
UPDATE_INTERVAL_MINS = [20]
TIMEZONE = [UTC GMT0]
NTP_SERVERS = [0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org]
DEVICE_ID = []
DEVICE_SECRET = []
Loaded config
TOTAL_DEVICE_STARTS = [1]
SUCCESSFUL_DEVICE_STARTS = [1]
LAST_NTP_SYNC_TIME = [1617282194]
STARTS_WITHOUT_NTP_SYNC = [0]
LAST_CYCLE_DURATION = [14005]
ACTION_AFTER_REBOOT = [0]
Loaded data file
Saved values in data file.
Button state: 1

***Time before connecting to WiFi 1309
Reconnecting
WiFi connect.............................................192.168.1.36
NTP sync.
Current time: 1617282268

***Time before going to fetching data 7897
Free mem: 42416
Device id and/or secret are not set yet -> registering device with server now
Free mem: 42240Using secure WiFi client
[HTTP] configuring server root cert in client
MFLN supported: no
[HTTP] begin...
Connecting to www.espaper.com:443
Sending request: POST /public/devices HTTP/1.1
Host: www.espaper.com
User-Agent: ESPaperClient/1.0
Content-Type: application/json
Content-Length: 83
X-ESPAPER-CLIENT-VERSION: V031
X-ESPAPER-BATTERY: 960
X-ESPAPER-WIFI-RSSI: -69
Connection: close

{"macAddress": "84:0D:8E:88:FC:95", "deviceType": "Espaper42Bw", "timeZone": "UTC"}
HTTP/1.1 400 Bad Request
HTTP Code: 400
Server: Cowboy
Connection: close
Expires: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
X-Xss-Protection: 1; mode=block
Pragma: no-cache
Date: Thu, 01 Apr 2021 13:04:30 GMT
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Application-Context: espaper:prod,heroku:37696
Via: 1.1 vegur

headers received
Parsed values:
- HTTP code: 400
- Device id: -1
- Device secret: -2
Device registration failed
Setting pin modes
Starting SPI transaction
Beginning SPI
Waiting until idle:
Saved values in data file.
Free mem: 40992.
Waiting until idle:
Start millis: 7897, start time: 1617282268, current millis: 15321 -> now: 1617282275
Going to sleep for: 60[s]

 

1 Answer

0 votes
by (19.9k points)
selected by
 
Best answer

Thanks for the detailed analysis and all the information you provided (I added the serial dump you sent by email).

Your statement

I suspect the local device ID got corrupted because I can see in the serial stream

is the key here. You basically did the right thing by trying to reset the local configuration. However, the downside is that we now only see the expected device-id-and-secret-blank in the serial dump.

While you deleted the local device id the server still has your device registered under its MAC address. Hence, you cannot re-register a device already "claimed". We did this to ensure that a malicious user cannot just take over someone else's device.

The solution in your case is to log into espaper.com and delete the device (registration). When your device next time attempts to register itself with the server it will then go through the regular process.

by (150 points)
Marcel,

Perfect - I deleted the device in espaper.com and as you predicted then got a new Registration code to set up the device again and all is now well. Thank you very much.

Neil

Welcome to ThingPulse Q&A, where you can ask questions and receive answers from other members of the community.

https://thingpulse.com

...