Created
November 17, 2024 11:05
-
-
Save jisotalo/93ed12ad87dd50f883cd2bf48cba08a6 to your computer and use it in GitHub Desktop.
shelly-porssisahko v.3.0.1 preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @license | |
* | |
* shelly-porssisahko | |
* | |
* (c) Jussi isotalo - http://jisotalo.fi | |
* https://github.com/jisotalo/shelly-porssisahko | |
* | |
* License: GNU Affero General Public License v3.0 | |
*/ | |
const CNST={INST_COUNT:"undefined"==typeof INSTANCE_COUNT?3:INSTANCE_COUNT,HIST_LEN:"undefined"==typeof HIST_LEN?24:HIST_LEN,ERR_LIMIT:3,ERR_DELAY:120,DEF_INST_ST:{chkTs:0,st:0,str:"",cmd:-1,configOK:0,fCmdTs:0,fCmd:0},DEF_CFG:{COM:{g:"fi",vat:25.5,day:0,night:0,names:[]},INST:{en:0,mode:0,m0:{c:0},m1:{l:0},m2:{p:24,c:0,l:-999,s:0,m:999,ps:0,pe:23,ps2:0,pe2:23,c2:0},b:0,e:0,o:[0],f:0,fc:0,i:0,m:60,oc:0}}};let _={s:{v:"3.0.1",dn:"",configOK:0,timeOK:0,errCnt:0,errTs:0,upTs:0,tz:"+02:00",tzh:0,enCnt:0,p:[{ts:0,now:0,low:0,high:0,avg:0},{ts:0,now:0,low:0,high:0,avg:0}]},si:[CNST.DEF_INST_ST],p:[[],[]],h:[],c:{c:CNST.DEF_CFG.COM,i:[CNST.DEF_CFG.INST]}},_i=0,_j=0,_k=0,_inc=0,_cnt=0,_start=0,_end=0,cmd=[],loopRunning=!1;function getKvsKey(t){let e="porssi";return e=0<=t?e+"-"+(t+1):e}function isCurrentHour(t,e){e-=t;return 0<=e&&e<3600}function limit(t,e,n){return Math.min(n,Math.max(t,e))}function epoch(t){return Math.floor((t?t.getTime():Date.now())/1e3)}function getDate(t){return t.getDate()}function updateTz(t){let e=t.toString(),n=0;"+0000"==(e=e.substring(3+e.indexOf("GMT")))?(e="Z",n=0):(n=+e.substring(0,3),e=e.substring(0,3)+":"+e.substring(3)),e!=_.s.tz&&(_.s.p[0].ts=0),_.s.tz=e,_.s.tzh=n}function log(t){console.log("shelly-porssisahko: "+t)}function addHistory(t){for(var e=0<_.s.enCnt?CNST.HIST_LEN/_.s.enCnt:CNST.HIST_LEN;0<CNST.HIST_LEN&&_.h[t].length>=e;)_.h[t].splice(0,1);_.h[t].push([epoch(),cmd[t]?1:0,_.si[t].st])}function reqLogic(){for(let t=0;t<CNST.INST_COUNT;t++)_.si[t].chkTs=0}function updateState(){var t=new Date;for(_.s.timeOK=2e3<t.getFullYear()?1:0,_.s.dn=Shelly.getComponentConfig("sys").device.name,_.s.enCnt=0,_i=0;_i<CNST.INST_COUNT;_i++)_.c.i[_i].en&&_.s.enCnt++;!_.s.upTs&&_.s.timeOK&&(_.s.upTs=epoch(t))}function getConfig(l){var t=getKvsKey(l);Shelly.call("KVS.Get",{key:t},function(e,t,n){l<0?_.c.c=e?JSON.parse(e.value):{}:_.c.i[l]=e?JSON.parse(e.value):{},"function"==typeof USER_CONFIG&&USER_CONFIG(l,!0);{e=l;var s=function(t){l<0?_.s.configOK=t?1:0:(log("config for #"+(l+1)+" read, enabled: "+_.c.i[l].en),_.si[l].configOK=t?1:0,_.si[l].chkTs=0),loopRunning=!1,Timer.set(500,!1,loop)};let t=0;if(CNST.DEF_CFG.COM||CNST.DEF_CFG.INST){var o,i=e<0?CNST.DEF_CFG.COM:CNST.DEF_CFG.INST,r=e<0?_.c.c:_.c.i[e];for(o in i)if(void 0===r[o])r[o]=i[o],t++;else if("object"==typeof i[o])for(var c in i[o])void 0===r[o][c]&&(r[o][c]=i[o][c],t++);e>=CNST.INST_COUNT-1&&(CNST.DEF_CFG.COM=null,CNST.DEF_CFG.INST=null),0<t?(e=getKvsKey(e),Shelly.call("KVS.Set",{key:e,value:JSON.stringify(r)},function(t,e,n,s){e&&log("failed to set config: "+e+" - "+n),s(0==e)},s)):s(!0)}else s(!0)}})}function loop(){try{if(!loopRunning)if(loopRunning=!0,updateState(),_.s.configOK)if(pricesNeeded(0))getPrices(0);else if(pricesNeeded(1))getPrices(1);else{for(let t=0;t<CNST.INST_COUNT;t++)if(!_.si[t].configOK)return void getConfig(t);for(let t=0;t<CNST.INST_COUNT;t++)if(function(t){var e=_.si[t],n=_.c.i[t];if(1!=n.en)return void(_.h[t]=[]);var t=new Date,s=new Date(1e3*e.chkTs);return 0==e.chkTs||s.getHours()!=t.getHours()||s.getFullYear()!=t.getFullYear()||0<e.fCmdTs&&e.fCmdTs-epoch(t)<0||0==e.fCmdTs&&n.m<60&&t.getMinutes()>=n.m&&e.cmd+n.i==1}(t))return void Timer.set(500,!1,logic,t);"function"==typeof USER_LOOP?USER_LOOP():loopRunning=!1}else getConfig(-1)}catch(t){log("error at main loop:"+t),loopRunning=!1}}function pricesNeeded(t){var e=new Date;let n=!1;return n=1==t?_.s.timeOK&&0===_.s.p[1].ts&&15<=e.getHours():((t=getDate(new Date(1e3*_.s.p[0].ts))!==getDate(e))&&(_.s.p[1].ts=0,_.p[1]=[]),_.s.timeOK&&(0==_.s.p[0].ts||t)),_.s.errCnt>=CNST.ERR_LIMIT&&epoch(e)-_.s.errTs<CNST.ERR_DELAY?n=!1:_.s.errCnt>=CNST.ERR_LIMIT&&(_.s.errCnt=0),n}function getPrices(c){try{log("fetching prices for day "+c);let i=new Date;updateTz(i);var e=1==c?new Date(864e5+new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime()):i;let t=e.getFullYear()+"-"+(e.getMonth()<9?"0"+(1+e.getMonth()):1+e.getMonth())+"-"+(getDate(e)<10?"0"+getDate(e):getDate(e))+"T00:00:00"+_.s.tz.replace("+","%2b");var n=t.replace("T00:00:00","T23:59:59");let r={url:"https://dashboard.elering.ee/api/nps/price/csv?fields="+_.c.c.g+"&start="+t+"&end="+n,timeout:5,ssl_ca:"*"};i=null,t=null,Shelly.call("HTTP.GET",r,function(e,t,n){r=null;try{if(0!==t||null==e||200!==e.code||!e.body_b64)throw Error(t+"("+n+") - "+JSON.stringify(e));{e.headers=null,n=e.message=null,_.p[c]=[],_.s.p[c].avg=0,_.s.p[c].high=-999,_.s.p[c].low=999,e.body_b64=atob(e.body_b64),e.body_b64=e.body_b64.substring(1+e.body_b64.indexOf("\n"));let t=0;for(;0<=t;){e.body_b64=e.body_b64.substring(t);var s=[t=0,0];if(0===(t=1+e.body_b64.indexOf('"',t)))break;s[0]=+e.body_b64.substring(t,e.body_b64.indexOf('"',t)),t=2+e.body_b64.indexOf('"',t),t=2+e.body_b64.indexOf(';"',t),s[1]=+(""+e.body_b64.substring(t,e.body_b64.indexOf('"',t)).replace(",",".")),s[1]=s[1]/10*(100+(0<s[1]?_.c.c.vat:0))/100;var o=new Date(1e3*s[0]).getHours();s[1]+=7<=o&&o<22?_.c.c.day:_.c.c.night,_.p[c].push(s),_.s.p[c].avg+=s[1],s[1]>_.s.p[c].high&&(_.s.p[c].high=s[1]),s[1]<_.s.p[c].low&&(_.s.p[c].low=s[1]),t=e.body_b64.indexOf("\n",t)}if(e=null,_.s.p[c].avg=0<_.p[c].length?_.s.p[c].avg/_.p[c].length:0,_.s.p[c].ts=epoch(i),_.p[c].length<23)throw Error("invalid data received")}}catch(t){log("error getting prices: "+t),_.s.errCnt+=1,_.s.errTs=epoch(),_.s.p[c].ts=0,_.p[c]=[]}0==c&&reqLogic(),loopRunning=!1,Timer.set(500,!1,loop)})}catch(t){log("error getting prices: "+t),_.s.errCnt+=1,_.s.errTs=epoch(),_.s.p[c].ts=0,_.p[c]=[],0==c&&reqLogic(),loopRunning=!1,Timer.set(500,!1,loop)}}function logic(i){try{"function"==typeof USER_CONFIG&&USER_CONFIG(i,!1),cmd[i]=!1;var t,e,n=new Date;updateTz(n),!function(){if(_.s.timeOK&&0!=_.s.p[0].ts){var e=epoch();for(let t=0;t<_.p[0].length;t++)if(isCurrentHour(_.p[0][t][0],e))return _.s.p[0].now=_.p[0][t][1];return _.p[0].length<24&&(_.s.p[0].ts=0),_.s.p[0].now=0}_.s.p[0].now=0}();let s=_.si[i],o=_.c.i[i];function r(t){if(null==t)loopRunning=!1;else if(cmd[i]!=t&&(s.st=12),cmd[i]=t,o.i&&(cmd[i]=!cmd[i]),log("logic for #"+(i+1)+" done, cmd: "+t+" -> output: "+cmd[i]),1==o.oc&&s.cmd==cmd[i])log("outputs already set for #"+(i+1)),addHistory(i),s.cmd=cmd[i]?1:0,s.chkTs=epoch(),loopRunning=!1;else{let e=0,n=0;for(let t=0;t<o.o.length;t++)!function(t,o,i){t="{id:"+o+",on:"+(cmd[t]?"true":"false")+"}",Shelly.call("Switch.Set",t,function(t,e,n,s){0!=e&&log("setting output "+o+" failed: "+e+" - "+n),i(0==e)},i)}(i,o.o[t],function(t){e++,t&&n++,e==o.o.length&&(n==e&&(addHistory(i),s.cmd=cmd[i]?1:0,s.chkTs=epoch(),Timer.set(500,!1,loop)),loopRunning=!1)})}}0===o.mode?(cmd[i]=1===o.m0.c,s.st=1):_.s.timeOK&&0<_.s.p[0].ts&&getDate(new Date(1e3*_.s.p[0].ts))===getDate(n)?1===o.mode?(cmd[i]=_.s.p[0].now<=("avg"==o.m1.l?_.s.p[0].avg:o.m1.l),s.st=cmd[i]?2:3):2===o.mode&&(cmd[i]=function(t){var e=_.c.i[t],n=(e.m2.ps=limit(0,e.m2.ps,23),e.m2.pe=limit(e.m2.ps,e.m2.pe,24),e.m2.ps2=limit(0,e.m2.ps2,23),e.m2.pe2=limit(e.m2.ps2,e.m2.pe2,24),e.m2.c=limit(0,e.m2.c,0<e.m2.p?e.m2.p:e.m2.pe-e.m2.ps),e.m2.c2=limit(0,e.m2.c2,e.m2.pe2-e.m2.ps2),[]);for(_inc=e.m2.p<0?1:e.m2.p,_i=0;_i<_.p[0].length;_i+=_inc)if(!((_cnt=-2==e.m2.p&&1<=_i?e.m2.c2:e.m2.c)<=0)){var s=[];for(_start=_i,_end=_i+e.m2.p,e.m2.p<0&&0==_i?(_start=e.m2.ps,_end=e.m2.pe):-2==e.m2.p&&1==_i&&(_start=e.m2.ps2,_end=e.m2.pe2),_j=_start;_j<_end&&!(_j>_.p[0].length-1);_j++)s.push(_j);if(e.m2.s){for(_avg=999,_startIndex=0,_j=0;_j<=s.length-_cnt;_j++){for(_sum=0,_k=_j;_k<_j+_cnt;_k++)_sum+=_.p[0][s[_k]][1];_sum/_cnt<_avg&&(_avg=_sum/_cnt,_startIndex=_j)}for(_j=_startIndex;_j<_startIndex+_cnt;_j++)n.push(s[_j])}else{for(_j=0,_k=1;_k<s.length;_k++){var o=s[_k];for(_j=_k-1;0<=_j&&_.p[0][o][1]<_.p[0][s[_j]][1];_j--)s[_j+1]=s[_j];s[_j+1]=o}for(_j=0;_j<_cnt;_j++)n.push(s[_j])}if(-1==e.m2.p||-2==e.m2.p&&1<=_i)break}let i=epoch(),r=!1;for(let t=0;t<n.length;t++)if(isCurrentHour(_.p[0][n[t]][0],i)){r=!0;break}return r}(i),s.st=cmd[i]?5:4,!cmd[i]&&_.s.p[0].now<=("avg"==o.m2.l?_.s.p[0].avg:o.m2.l)&&(cmd[i]=!0,s.st=6),cmd[i])&&_.s.p[0].now>("avg"==o.m2.m?_.s.p[0].avg:o.m2.m)&&(cmd[i]=!1,s.st=11):_.s.timeOK?(s.st=7,t=1<<n.getHours(),(o.b&t)==t&&(cmd[i]=!0)):(cmd[i]=1===o.e,s.st=8),_.s.timeOK&&0<o.f&&(e=1<<n.getHours(),(o.f&e)==e)&&(cmd[i]=(o.fc&e)==e,s.st=10),cmd[i]&&_.s.timeOK&&n.getMinutes()>=o.m&&(s.st=13,cmd[i]=!1),_.s.timeOK&&0<s.fCmdTs&&(0<s.fCmdTs-epoch(n)?(cmd[i]=1==s.fCmd,s.st=9):s.fCmdTs=0),"function"==typeof USER_OVERRIDE?USER_OVERRIDE(i,cmd[i],r):r(cmd[i])}catch(t){log("error running logic: "+JSON.stringify(t)),loopRunning=!1}}let _avg=999,_startIndex=0,_sum=0;log("v."+_.s.v),log("URL: http://"+(Shelly.getComponentStatus("wifi").sta_ip??"192.168.33.1")+"/script/"+Shelly.getCurrentScriptId()),_.c.i.pop(),_.si.pop();for(let t=0;t<CNST.INST_COUNT;t++)_.si.push(Object.assign({},CNST.DEF_INST_ST)),_.c.i.push(Object.assign({},CNST.DEF_CFG.INST)),_.c.c.names.push("-"),_.h.push([]),cmd.push(!1);CNST.DEF_INST_ST=null,HTTPServer.registerEndpoint("",function(n,s){try{if(loopRunning)return n=null,s.code=503,void s.send();var o=function(t){var e={},n=t.split("&");for(let t=0;t<n.length;t++){var s=n[t].split("=");e[s[0]]=s[1]}return e}(n.query),i=parseInt(o.i);n=null;let t="application/json",e=(s.code=200,!0);var r="text/html",c="text/javascript";if("s"===o.r)updateState(),0<=i&&i<CNST.INST_COUNT&&(s.body=JSON.stringify({s:_.s,si:_.si[i],c:_.c.c,ci:_.c.i[i],p:_.p})),e=!1;else if("c"===o.r)updateState(),0<=i&&i<CNST.INST_COUNT?s.body=JSON.stringify(_.c.i[i]):s.body=JSON.stringify(_.c.c),e=!1;else if("h"===o.r)0<=i&&i<CNST.INST_COUNT&&(s.body=JSON.stringify(_.h[i])),e=!1;else if("r"===o.r){if(0<=i&&i<CNST.INST_COUNT)log("config changed for #"+(i+1)),_.si[i].configOK=!1;else{log("config changed");for(let t=0;t<CNST.INST_COUNT;t++)_.si[t].configOK=!1}_.s.configOK=!1,reqLogic(),loopRunning||(loopRunning=!0,getConfig(i)),_.s.p[0].ts=0,_.s.p[1].ts=0,s.code=204,e=!1}else"f"===o.r&&o.ts?(0<=i&&i<CNST.INST_COUNT&&(_.si[i].fCmdTs=+(""+o.ts),_.si[i].fCmd=+(""+o.c),_.si[i].chkTs=0),s.code=204,e=!1):o.r?"s.js"===o.r?(s.body=atob("H4sIAAAAAAAACo1Wa1IjORK+SqFhCSlKqO2ZnT92C2KmYbanl2462kxHbBDEkl2VYGFZMlKWaYep2/gMcwFfbENVfsGw7P7xQ/ry/WWmLFL2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XhanBr8PrwPAqQESrYBQSxTHnEPw4oeth8w2BVNbyPHRSHG+yXUfyReLLqfzBdI3HK++ddPiLc2/zU1/HFVg86/+PVpbjE1fNWx/i90w8E3K4J+KVWB52x0yGSy9iwcSkSi/OLK73D6NOuDMnZ7lsuU8YVxhKjC60HmsgOCXUiltN5ABZe++TaDUSeuQyW4SJAl2nQxpej0gSmM9s0EP3HGoMfGIvk9+WDakfK8P2SOvjH1mZBeqwiB9NyOqeSstPnF1dncCrPspZvoczQBOtgIruDy5mUo5kTmv6cOXoiGTCu5XTuiMoMQUvifQCqAVh29LL/GbtBkkpHJPtxw+tI3hEd7E8klTckp6o67Pg3taztjQ8FAAA="),t=r);s.headers=[["Content-Type",t]],e&&s.headers.push(["Content-Encoding","gzip"])}catch(t){log("server error: "+t),s.code=500}s.send()}),Timer.set(1e4,!0,loop),loop(); | |
//end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment