How can I monitor the current energy consumption with a script? Do I need to set up any events, etc.? I have the Shelly Pro 4PM and I want to switch off certain circuits when the electrical load is too high, and then switch them back on when the load decreases.
Shelly.addEventHandler(function(apower_change,ud){
let consumption = 0;
for(let i = 0;i < 4; i++) {
Shelly.call("Switch.GetStatus",{id: i},
function(result,error_code,error_message,ud){
print(result.apower);
consumption = consumption + result.apower
},null);
};
print(consumption);
},null
);
Cheers
Imox
Uncaught Error: Too many calls in progress
08:40:32
at line 7 col 17
08:40:32
},null);
08:40:32
^
08:40:32
in function called from system
Imo Graf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.