konnected-io / konnected-security

Konnected connects wired sensors and switches to SmartThings, Home Assistant, Hubitat and OpenHAB
https://konnected.io
Apache License 2.0
416 stars 322 forks source link

Lua panic when provisioning with a temperature sensor on 3.0 #153

Closed heythisisnate closed 2 years ago

heythisisnate commented 2 years ago

Provisioning request to /settings seems to fail/panic when a temperature sensor (ds18b20) is included in the provisioning payload.

Konnected firmware 3.0.0
NodeMCU 3.0.0.0 build 2021-10-23 20:29 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)
Heap:   39376   Initializing Konnected (2cf43256ab40)
Heap:   39448   Application Version:    3.0.0
Heap:   39200   Connecting to Wifi..
> Heap:         39112   Wifi connected with IP:         192.168.1.217   Gateway:        192.168.1.1
Heap:   40800   Current Date/Time:      2021-11-11 19:18:04 UTC
Heap:   40704   Booting Konnected application
Heap:   40616   UPnP:   Listening for UPnP discovery
Heap:   40048   HTTP:   Starting server at http://192.168.1.217:13679
Heap:   39800   Loaded:         server
Heap:   35000   REST Endpoint:  nil
Heap:   34920   Loaded:         application
Heap:   32464   UPnP:   Sent SSDP NOTIFY
Heap:   34312   HTTP:   Status
Heap:   34184   HTTP:   Status
Heap:   34176   HTTP:   Options
Heap:   31024   HTTP:   Settings
Heap:   28264   Wrote:  settings.lua
Heap:   30192   Wrote:  sensors.lua
PANIC: unprotected error in call to Lua API (invalid value (lightfunction) at index 3 in table for 'concat')

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 28252, room 16
tail 12
chksum 0xb9
ho 0 tail 12 room 4
load 0x3ffe8000, len 2680, room 12
tail 12
chksum 0x2b
ho 0 tail 12 room 4
load 0x3ffe8a78, len 8, room 12
tail 8
chksum 0xe9

This is the (sanitized) provisioning payload used in my testing:

{"endpoint_type":"aws_iot","endpoint":"wss://a35zoibvcdzyfb-ats.iot.us-east-1.amazonaws.com/mqtt","aws":{"authorizer":"KonnectedCloudAuthorizer-dev","token":"XXX","token_signature":"YYY","topics":{"sensor":"$aws/rules/konnected_cloud_state_update_dev/2cf43256ab40/sensor","switch":"konnected/2cf43256ab40/switch","heartbeat":"konnected/2cf43256ab40/hb"}},"ds18b20_sensors":[{"pin":1,"poll_interval":null}],"sensors":[{"pin":2}]}