Provision via REST api causing Konnected.io Pro device to become unresponsive

I'm running the latest version of the app on a Konnected Pro.  When I send the following command via http PUT to the http://<deviceIP>:<deviceport>/settings url, the device becomes unresponsive.  I do see the blue light intermittently do 3 or 4 long flashes.  In other posts, this could be due to an older version of the app, but as I said, I'm running the latest (1.2.5).    The only way to get it back is to factory reset the device.    Any ideas?

 

{"endpoint_type":"rest","endpoint":"http://BART.george.net:7000/api/konnected","sensors":[{"pin":4},{"pin":5},{"pin":2},{"pin":7},{"pin":6},{"pin":3},{"pin":1},{"pin":8}],"actuators":[],"dht_sensors":[],"ds1820_sensors":[],"blink":true,"discovery":true}

 

And here's the output from the console during the event.  I highlighted where the settings were changed and where the Panic occurred.  


[INFO 1634750674.102741, 172936] /lfs/network.lua:30: Loaded: server

[INFO 1634750674.274047, 168740] /lfs/network.lua:32: Loaded: application

[WARN 1634750674.307872, 169036] /lfs/rest_endpoint.lua:23: no rest endpoint configured

[INFO 1634750689.156608, 161996] /lfs/server.lua:19: UPnP: Sent SSDP NOTIFY

[INFO 1634750752.460985, 161524] /lfs/ssdp_response.lua:10: Responding to UPnP Discovery request from 192.168.1.183:60419

[INFO 1634750752.588880, 162868] /lfs/server_receiver.lua:49: HTTP: Discovery

[INFO 1634750752.620665, 161096] /lfs/ssdp_response.lua:10: Responding to UPnP Discovery request from 192.168.1.183:60419

[INFO 1634750752.671744, 164896] /lfs/ssdp_response.lua:10: Responding to UPnP Discovery request from 192.168.1.183:60419

[INFO 1634750752.923803, 164992] /lfs/server_receiver.lua:57: HTTP: Zone

[INFO 1634750753.081006, 163400] /lfs/server_receiver.lua:60: HTTP: Status

[INFO 1634750815.562514, 163060] /lfs/server_receiver.lua:51: HTTP: Settings

[INFO 1634750815.698088, 158920] /lfs/variables_set.lua:15: Wrote: settings.lua

[INFO 1634750815.789525, 159396] /lfs/variables_set.lua:15: Wrote: sensors.lua

[INFO 1634750815.868122, 162048] /lfs/variables_set.lua:15: Wrote: actuators.lua

[INFO 1634750815.946502, 161940] /lfs/variables_set.lua:15: Wrote: dht_sensors.lua

[WARN 1634750815.976930, 162604] /lfs/server_settings.lua:56: Settings updated! Restarting in 2 seconds...

ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)

configsip: 0, SPIWP:0xee

clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00

mode:DIO, clock div:2

load:0x3fff0018,len:4

load:0x3fff001c,len:6620

load:0x40078000,len:11116

ho 0 tail 12 room 4

load:0x40080400,len:5976

entry 0x40080704

I (69) boot: Chip Revision: 1

I (70) boot_comm: chip revision: 1, min. bootloader chip revision: 0

I (41) boot: ESP-IDF v3.3.2 2nd stage bootloader

I (41) boot: compile time 19:17:20

I (42) boot: Enabling RNG early entropy source...

I (46) boot: SPI Speed : 40MHz

I (50) boot: SPI Mode : DIO

I (54) boot: SPI Flash Size : 4MB

I (58) boot: Partition Table:

I (62) boot: ## Label Usage Type ST Offset Length

I (69) boot: 0 nvs WiFi data 01 02 00009000 00004000

I (77) boot: 1 otadata OTA data 01 00 0000d000 00002000

I (84) boot: 2 phy_init RF data 01 01 0000f000 00001000

I (92) boot: 3 ota_0 OTA app 00 10 00010000 00180000

I (99) boot: 4 ota_1 OTA app 00 11 00190000 00180000

I (106) boot: 5 lfs unknown c2 01 00310000 00058000

I (114) boot: 6 nodemcuspiffs unknown c2 00 00368000 00098000

I (122) boot: End of partition table

I (126) boot_comm: chip revision: 1, min. application chip revision: 0

I (133) esp_image: segment 0: paddr=0x00190020 vaddr=0x3f400020 size=0x28e00 (167424) map

I (199) esp_image: segment 1: paddr=0x001b8e28 vaddr=0x3ffb0000 size=0x035e8 ( 13800) load

I (204) esp_image: segment 2: paddr=0x001bc418 vaddr=0x40080000 size=0x00400 ( 1024) load

I (206) esp_image: segment 3: paddr=0x001bc820 vaddr=0x40080400 size=0x037f0 ( 14320) load

I (220) esp_image: segment 4: paddr=0x001c0018 vaddr=0x400d0018 size=0xaaeb0 (700080) map

I (460) esp_image: segment 5: paddr=0x0026aed0 vaddr=0x40083bf0 size=0x14158 ( 82264) load

I (492) esp_image: segment 6: paddr=0x0027f030 vaddr=0x400c0000 size=0x00064 ( 100) load

I (507) boot: Loaded app from partition at offset 0x190000

I (507) boot: Disabling RNG early entropy source...

I (508) cpu_start: Pro cpu up.

I (511) cpu_start: Application information:

I (516) cpu_start: Project name: NodeMCU

I (521) cpu_start: App version: v0.1.5-dirty

I (527) cpu_start: Compile time: Mar 22 2021 13:32:45

I (533) cpu_start: ELF file SHA256: 70bc91956756d525...

I (539) cpu_start: ESP-IDF: v3.3.4

I (543) cpu_start: Starting app cpu, entry point is 0x400815c0

I (529) cpu_start: App cpu up.

I (554) heap_init: Initializing. RAM available for dynamic allocation:

I (561) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM

I (567) heap_init: At 3FFB9F50 len 000260B0 (152 KiB): DRAM

I (573) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM

I (580) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM

I (586) heap_init: At 40097D48 len 000082B8 (32 KiB): IRAM

I (592) cpu_start: Pro cpu start user code

I (163) cpu_start: Starting scheduler on PRO CPU.

I (0) cpu_start: Starting scheduler on APP CPU.

Mounting flash filesystem...

I (283) wifi:wifi driver task: 3ffc4bf8, prio:23, stack:3584, core=0

I (283) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE

I (283) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE

I (313) wifi:wifi firmware version: 74b0970

I (313) wifi:config NVS flash: enabled

I (313) wifi:config nano formating: disabled

I (313) wifi:Init dynamic tx buffer num: 32

I (313) wifi:Init data frame dynamic rx buffer num: 32

I (323) wifi:Init management frame dynamic rx buffer num: 32

I (323) wifi:Init management short buffer num: 32

I (333) wifi:Init static rx buffer size: 1600

I (333) wifi:Init static rx buffer num: 10

I (333) wifi:Init dynamic rx buffer num: 32

NodeMCU ESP32 - Konnected Pro 0.1.5 build 2021-03-22 13:30 powered by Lua 5.1.4 on ESP-IDF v3.3.4 on SDK IDF

Heap: 219116 Initializing Konnected (0xb140f520996a)

[INFO 1634750818.873240, 212688] /lfs/start.lua:13: Konnected Application Version: 1.2.5

I (453) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0

I (463) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0

I (473) gpio: GPIO[23]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0

I (493) gpio: GPIO[3]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0

I (523) gpio: GPIO[2]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0

I (523) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0

[INFO 1634750818.958075, 212496] /lfs/wipe.lua:10: Checking for reset jumper

I (543) gpio: GPIO[2]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0

I (553) gpio: GPIO[4]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0

[INFO 1634750819.023642, 209388] /lfs/network.lua:17: Setting up network..

[INFO 1634750819.030725, 211328] /lfs/network.lua:221: Initializing ethernet..

I (613) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE

I (623) emac: emac reset done

> [INFO 1634750823.050644, 174076] /lfs/network.lua:208: Ethernet connected...disabling wifi

I (5823) event: eth ip: 192.168.1.186, mask: 255.255.255.0, gw: 192.168.1.1

[INFO 1634750825.259892, 174456] /lfs/network.lua:50: Network connection obtained with IP: 192.168.1.186 Gateway: 192.168.1.1

[INFO 1634750830.271842, 173756] /lfs/network.lua:65: Current Date/Time: 2021-10-20 17:27:10 UTC

[INFO 1634750830.281631, 173856] /lfs/network.lua:28: Booting Konnected application

[INFO 1634750830.322551, 173708] /lfs/server.lua:6: UPnP: Listening for UPnP discovery

[INFO 1634750830.340089, 172880] /lfs/server.lua:25: HTTP: Starting server at http://192.168.1.186:9123

[INFO 1634750830.353891, 172576] /lfs/network.lua:30: Loaded: server

[INFO 1634750830.540767, 166804] /lfs/application.lua:17: Initializing sensor zone: nil

PANIC: unprotected error in call to Lua API (/lfs/application.lua:18: missing/bad 'gpio' field)

E (16833) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:

E (16833) task_wdt: - IDLE0 (CPU 0)

E (16833) task_wdt: Tasks currently running:

E (16833) task_wdt: CPU 0: main

E (16833) task_wdt: CPU 1: IDLE1

E (16833) task_wdt: Aborting.

abort() was called at PC 0x400d382c on core 0

ELF file SHA256: 70bc91956756d525

Backtrace: 0x400877b3:0x3ffb0a40 0x40087acd:0x3ffb0a60 0x400d382c:0x3ffb0a80 0x40082799:0x3ffb0aa0 0x401384f1:0x3ffbcbb0 0x4013e3df:0x3ffbcbd0 0x40139911:0x3ffbcbf0 0x4013f865:0x3ffbcc10 0x401386eb:0x3ffbcc30 0x400da73b:0x3ffbcc80 0x4013e937:0x3ffbccc0 0x4013dd3d:0x3ffbcd00 0x4013ea0e:0x3ffbcd50 0x4013f6c1:0x3ffbcd70 0x4016fa49:0x3ffbcd90 0x4013e937:0x3ffbcdb0 0x4013dd3d:0x3ffbcdf0 0x4013ea0e:0x3ffbce40 0x4013f6c1:0x3ffbce60 0x400da999:0x3ffbce80 0x400f9f65:0x3ffbcea0 0x400fe0e3:0x3ffbced0 0x400d28bf:0x3ffbcf10

Rebooting...

ets Jun 8 2016 00:22:57

 

 

 

 

 

 

Adding a Fiddler trace.  This all looks normal to me, but I'm sure I'm missing something.  Any ideas?


 

PUT http://192.168.1.186:9123/settings HTTP/1.1
Accept: application/json, text/json, text/x-json, text/javascript, application/xml, text/xml
User-Agent: RestSharp/106.12.0.0
Content-Type: application/json
Host: 192.168.1.186:9123
Content-Length: 255
Accept-Encoding: gzip, deflate

{“endpoint_type”:“rest”,“endpoint”:“http://BART.george.net:7000/api/konnected",“token”:“cnludmzfsgn”,“sensors”:[{“pin”:4},{“pin”:5},{“pin”:2},{“pin”:7},{“pin”:6},{“pin”:3},{“pin”:1},{“pin”:8}],“actuators”:[],“dht_sensors”:[],“blink”:true,"discovery”:true}

 

Thanks to Nate, this is resolved.  It turns out that on the Pro model, the zones are called "zone" and not "pin" as in the standard model.  I also discovered that the Pro model does an http POST not PUT for device state callbacks using REST as show in the current documentation.