Hi,
I test the last beta (0.11beta3) on shelly 1 plus.
For one of my project I test the new KVS and I don't understand why my var "out_the_call" is undefined in my log:
Code
mg_rpc.c:314 script.setconfig via WS_in 192.168.1.44:5051117:16:06.390
mg_rpc.c:314 script.putcode via WS_in 192.168.1.44:5051117:16:06.678
mg_rpc.c:314 script.start via WS_in 192.168.1.44:5051117:16:06.952
shelly_user_script.:403 Running 'api_math.js'...17:16:06.976
shelly_user_script.:403 Running 'init.js'...17:16:07.700
shelly_user_script.:365 mJS RAM stat: initial: 159796 after: 154808, used: 498817:16:07.180
shelly_user_script.:403 Running 'script_3.js'...17:16:07.250
[TEST] start 17:16:07.330
[TEST] out_the_call: undefined 17:16:07.490
shelly_user_script.:375 mJS RAM stat: after user code: 159796 after: 152804, used: 699217:16:07.580
shelly_notification:145 Status change of script:3: {"id":3,"running":true}17:16:07.690
mg_rpc.c:314 KVS.Set via loopback 17:16:07.860
mg_rpc.c:314 KVS.get via loopback 17:16:07.174
shelly_notification:145 Status change of sys: {"kvs_rev":34}17:16:07.183
[POOL] INTHE CALL: 13 17:16:07.206
mg_rpc.c:314 script.list via WS_in 192.168.1.44:5051117:16:07.292
mg_rpc.c:314 KVS.List via WS_in 192.168.1.44:50511
Alles anzeigen
My code:
Code
print("[TEST] start");
let out_the_call;
function kvsSet(key, value){
Shelly.call(
"KVS.Set",
{"key":key, "value":value}
);
}
function kvsGet(key){
Shelly.call(
"KVS.get",
{"key":key},
function (result) {
print("[POOL] INTHE CALL:",result.value);
out_the_call = result.value;
}
);
}
kvsSet("temp","13");
kvsGet("temp");
print("[TEST] out_the_call:",out_the_call);
Alles anzeigen
If you have one idea please
Thank you.