so the approach should be to:
a) use 4 Shelly.call to store each single switch power in the switchData strucure
b) sum them in the time callback function and then print
Correct?
so the approach should be to:
a) use 4 Shelly.call to store each single switch power in the switchData strucure
b) sum them in the time callback function and then print
Correct?
Hi
It seems you expect to have the total power consuption available through the Shelly 4 PRO PM web server. I fear this means extending the web server functionality and my understanding it is not possible at the moment.
Maybe someone from Shelly could confirm.
Hi All,
I am writing a script for the Shelly 4 PRO PM that is expected to collect status of each single switch and sum the voltage of the four switch.
When I try to get the status of a switch I noticed that:
a) the javascript steps are executed in a sequence I didn't expect (I expected steps 1, 2, 3 while they are executed as 1, 3, 2);
b) the status of the Shelly is only available within the scope of the callback function, and cannot be assigned to a binding outside the environment of the function, while I expected that the callback to be able to access the global scope. In other words: the parameter r cannot be assigned to r2.
Can someone explain the reason of the two issues? How can I use the result of the callback outside of the Shelly.call?
Please find below the code and the colole output.
Thanks
R
------------------------------------------------
let r2 = {temp:0, volt: 0};
let userdata2 = null;
print("Step 1 - r2:", JSON.stringify(r2));
let risultato = Shelly.call("Switch.GetStatus",
{"id": 0},
function (r, error_code, error_message, userdata1)
{
print("r:",JSON.stringify(r));
r2.temp = r.temperature.tC;
r2.volt = r.voltage;
print("Step 2 - r2:",JSON.stringify(r2));
return r;
},
userdata2);
print("Step 3 - r2", JSON.stringify(r2));
-----------------------------------------------
CONSOLE OUTPUT:
Step 1 - r2: {"volt":0,"temp":0} 17:04:39.523
Step 3 - r2 {"volt":0,"temp":0} 17:04:39.534
r: {"temperature":{"tF":84.600000,"tC":29.200000},"aenergy":{"minute_ts":0,"by_minute":[0.131000,0,0],"total":0},"pf":0,"current":0,"voltage":234.200000,"apower":0,"output":false,"source":"init","id":0} 17:04:39.616
Step 2 - r2: {"volt":234.200000,"temp":29.200000}
Hello
I am exeprienceing the same issue reported by vlado_nemo: I can connect to Shlly 1PM when using its own WiFi (Shelly-xxxxx), as soon as it is ocnfigured in client mode it desappear and it cannot connect to the local WiFi 2.4GHz.
The device has a 20190329-09091 firmware that I am not able to upgrade as the Shelly 1PM cannot be connected to interenet.
How can I troubleshoot this issue? Is there a way to check why the Shelly 1PM is not connecting to the local WiFi.
Thanks