let CONFIG = { Paivitystaajuus: 2 * 60000, }; // kaksi minuuttia
function Ohjaus(){
Shelly.call("HTTP.GET", { url: "
https://api.spot-hinta.fi/JustNowRank/5/6"}, // 5 halvinta tuntia tai alle 6 snt
function (res, error_code, error_msg, ud)
{
if (res.code === 200){
Shelly.call("Switch.Set","{ id:0, on:true}", null,null); // Rele päälle
}
else if (res.code === 400) {
Shelly.call("Switch.Set","{ id:0, on:false}", null,null); // Rele pois
}
}, null);
}
Timer.set(CONFIG.Paivitystaajuus, true, function (ud) { Ohjaus(); }, null);