Shelly Plus Plug S – contact a Poweropti from Powerfox to determine the current power consumption

https://<user>:<password>@backend.powerfox.energy/api/2.0/my/main/current
{„Outdated“:false,“Watt“:378,“Timestamp“:1710880091,“A_Plus“:33094026, „A_Plus_HT“:365,“A_Plus_NT“:33093661,“A_Minus“:198576}
https://<user>:<password>@backend.powerfox.energy/api/2.0/my/main/current?unit=kwh
{„Outdated“:false,“Watt“:372,“Timestamp“:1710880575,“A_Plus“:33094.026, „A_Plus_HT“:0.365,“A_Plus_NT“:33093.661,“A_Minus“:198.576}

Shelly Scripting – run on a modified version of mJS which is part of the Mongoose OS framework and the mJS implements a useful subset of the JavaScript language which while very minimal is complete and capable

function readdata() {
print();
print(‚SSL without CA check‘);
time0 = Date.now()
Shelly.call(‚HTTP.GET‘, {
‚url‘: ‚https://<mail user >%40<mail domain>:<mail password>@backend.powerfox.energy/api/2.0/my/main/current‘,
‚timeout‘: 30,
’ssl_ca‘: ‚*‘
},
checkresponse);
print(‚Call done at‘, Date.now()-time0, ‚ms‘);
}
function checkresponse(response, error_code, error_message, userdata)
{
if (response && response.code && response.code === 200) {
let energie = JSON.parse(response.body);
print(energie.Watt);
}
else{
print(error_message);
print(error_code);
}
}
readdata();

Leave a Reply

You must be logged in to post a comment.