@strato-automation/node-red-contrib-strato-automation
Version:
Strato Automation Official Node Red Library
1 lines • 10.4 kB
JavaScript
function a26_0x1f4e(_0x54b401,_0x29d777){_0x54b401=_0x54b401-0x1cb;const _0x4a4605=a26_0x4a46();let _0x1f4eaa=_0x4a4605[_0x54b401];return _0x1f4eaa;}(function(_0x3303d5,_0x56f50a){const _0x22fbb8=a26_0x1f4e,_0x2d752c=_0x3303d5();while(!![]){try{const _0x24d09f=-parseInt(_0x22fbb8(0x22b))/0x1*(parseInt(_0x22fbb8(0x1ce))/0x2)+parseInt(_0x22fbb8(0x1e3))/0x3+parseInt(_0x22fbb8(0x1e8))/0x4*(-parseInt(_0x22fbb8(0x201))/0x5)+-parseInt(_0x22fbb8(0x218))/0x6*(parseInt(_0x22fbb8(0x226))/0x7)+-parseInt(_0x22fbb8(0x1ec))/0x8*(-parseInt(_0x22fbb8(0x20b))/0x9)+-parseInt(_0x22fbb8(0x21d))/0xa+parseInt(_0x22fbb8(0x1ef))/0xb*(parseInt(_0x22fbb8(0x22f))/0xc);if(_0x24d09f===_0x56f50a)break;else _0x2d752c['push'](_0x2d752c['shift']());}catch(_0x5eac4b){_0x2d752c['push'](_0x2d752c['shift']());}}}(a26_0x4a46,0xb25f3),module['exports']=function(_0x3962aa){const _0x2284fd=a26_0x1f4e;function _0x231848(_0x3c8083){const _0x5edbc6=a26_0x1f4e;return _0x3c8083[_0x5edbc6(0x209)]('/')[_0x5edbc6(0x203)](0x3)['join']('/');}const _0x2afb3c=require(_0x2284fd(0x224));var _0x32fa95=require(_0x2284fd(0x208));_0x3962aa[_0x2284fd(0x1fb)][_0x2284fd(0x231)]('/utils.js',(_0x56951b,_0x5d576f)=>{const _0x50d384=_0x2284fd,_0x54601e=__dirname+_0x50d384(0x22a);_0x5d576f[_0x50d384(0x1de)](_0x54601e);}),_0x3962aa['httpAdmin'][_0x2284fd(0x231)]('/nodered/utils.js',(_0x386336,_0x44eb89)=>{const _0x2cf67f=_0x2284fd,_0x121203=__dirname+'/utils.js';_0x44eb89[_0x2cf67f(0x1de)](_0x121203);});function _0x70c0dd(_0x2b7cca){const _0x3d3241=_0x2284fd;_0x3962aa[_0x3d3241(0x1cf)][_0x3d3241(0x227)](this,_0x2b7cca),this[_0x3d3241(0x205)]=_0x2b7cca['ocn_ip'],this[_0x3d3241(0x229)]=_0x2b7cca['mqtt_port'],this[_0x3d3241(0x1f0)]=_0x2b7cca['api_token'],this[_0x3d3241(0x1fa)]=Number(_0x2b7cca[_0x3d3241(0x1fa)])||0x1f4,this['ip_min_send_time']=Number(_0x2b7cca['ip_min_send_time'])||0x64,this[_0x3d3241(0x1f5)]=Number(_0x2b7cca['ip_timeout'])||0x3e8,this[_0x3d3241(0x1cc)]=Number(_0x2b7cca['ip_retry_count'])||0x2,this[_0x3d3241(0x1ed)]=Number(_0x2b7cca[_0x3d3241(0x1ed)])||0x3e8,this[_0x3d3241(0x1da)]=Number(_0x2b7cca[_0x3d3241(0x1da)])||0x1f4,this['mstp_timeout']=Number(_0x2b7cca[_0x3d3241(0x1d3)])||0xbb8,this[_0x3d3241(0x1f3)]=Number(_0x2b7cca[_0x3d3241(0x1f3)])||0x2,this[_0x3d3241(0x20d)]=_0x2b7cca['enable_debug']||![],this[_0x3d3241(0x206)]=null,this['__subscriptions']={};var _0x2a08ef=this;this[_0x3d3241(0x20e)]=function(_0x23de8d){const _0xaeae28=_0x3d3241;_0x2a08ef[_0xaeae28(0x20d)]&&_0x2a08ef['error'](JSON[_0xaeae28(0x21a)](_0x23de8d)||_0xaeae28(0x212));},this[_0x3d3241(0x1d4)]=async function(){const _0x5c2710=_0x3d3241;try{let _0x40dfd5=new _0x2afb3c(_0x5c2710(0x1ee)+this[_0x5c2710(0x205)]+_0x5c2710(0x1e1),this[_0x5c2710(0x1f0)]);return await _0x40dfd5[_0x5c2710(0x1d4)]()[_0x5c2710(0x211)](_0x292f00=>{const _0x1fb1da=_0x5c2710;if(_0x292f00['status']!==0xc8)return _0x2a08ef[_0x1fb1da(0x1d8)](_0x1fb1da(0x1e6)+this['ocn_ip']+_0x1fb1da(0x1f9)+_0x292f00['statusText']),null;return _0x292f00[_0x1fb1da(0x1d6)]()[_0x1fb1da(0x211)](_0x3a9c28=>{const _0x37065c=_0x1fb1da;if(_0x3a9c28[_0x37065c(0x1fe)]===0x0)return _0x2a08ef[_0x37065c(0x1d8)](_0x37065c(0x1ea)+this['ocn_ip']+')'),null;return _0x3a9c28[0x0][_0x37065c(0x206)];});});}catch(_0x3617b6){return _0x2a08ef['error']('Error\x20getting\x20connection\x20ID\x20from\x20OCN\x20server\x20('+this[_0x5c2710(0x205)]+_0x5c2710(0x1f9)+_0x3617b6['message']),null;}},this[_0x3d3241(0x213)]=async function(_0xdc59c=0x1388,_0x56690d=0xc){const _0x10db3c=_0x3d3241;let _0x5cc28f=0x0;while(_0x5cc28f<_0x56690d){const _0xe14d3c=await this[_0x10db3c(0x1d4)]();if(_0xe14d3c)return _0xe14d3c;_0x2a08ef['warn']('Retry\x20getting\x20connection\x20ID\x20from\x20OCN\x20server\x20('+this[_0x10db3c(0x205)]+_0x10db3c(0x1d5)+_0xdc59c/0x3e8+_0x10db3c(0x21c)),await new Promise(_0x4d668a=>setTimeout(_0x4d668a,_0xdc59c)),_0x5cc28f++;}return _0x2a08ef[_0x10db3c(0x1d8)]('Failed\x20to\x20get\x20connection\x20ID\x20from\x20OCN\x20server\x20('+this['ocn_ip']+_0x10db3c(0x1e7)+_0x5cc28f+_0x10db3c(0x1dc)),null;};const _0xd3969b=require(_0x3d3241(0x1ff));this[_0x3d3241(0x1f1)]()['global'][_0x3d3241(0x232)](_0x3d3241(0x22e),new _0xd3969b(this['errorCallback'],this['ip_loop_time'],this[_0x3d3241(0x1d2)],this[_0x3d3241(0x1f5)],this['ip_retry_count'],this[_0x3d3241(0x1ed)],this['mstp_min_send_time'],this['mstp_timeout'],this[_0x3d3241(0x1f3)],_0x3962aa)),this[_0x3d3241(0x213)]()[_0x3d3241(0x211)](_0x564a7a=>{const _0x20880c=_0x3d3241;try{if(!_0x564a7a){_0x2a08ef[_0x20880c(0x1d8)](_0x20880c(0x1cb));return;}_0x2a08ef[_0x20880c(0x1f2)](_0x20880c(0x1e2)+_0x564a7a),this[_0x20880c(0x206)]=_0x564a7a,_0x2a08ef[_0x20880c(0x1e4)](_0x20880c(0x215)),_0x2a08ef[_0x20880c(0x1d7)]({'fill':_0x20880c(0x221),'shape':_0x20880c(0x1f4),'text':_0x20880c(0x210)}),_0x2a08ef[_0x20880c(0x1f2)]('Connecting\x20to\x20MQTT\x20broker\x20at\x20'+_0x2a08ef[_0x20880c(0x205)]+':'+_0x2a08ef[_0x20880c(0x229)]),_0x2a08ef['mqttConnection']=_0x32fa95['connect'](_0x20880c(0x1dd)+_0x2a08ef[_0x20880c(0x205)]+':'+_0x2a08ef['mqtt_port'],{'connectTimeout':0xfa0,'reconnectPeriod':0x1388}),_0x2a08ef[_0x20880c(0x207)]['on'](_0x20880c(0x1d8),_0x397ed5=>{const _0x3fb503=_0x20880c;_0x2a08ef['log'](_0x3fb503(0x1d1)+_0x397ed5[_0x3fb503(0x202)]);}),_0x2a08ef[_0x20880c(0x207)][_0x20880c(0x1d9)](0x2710),_0x2a08ef[_0x20880c(0x207)]['on'](_0x20880c(0x1d0),function(){const _0x1f2978=_0x20880c;_0x2a08ef['log'](_0x1f2978(0x216)),_0x2a08ef['status']({'fill':_0x1f2978(0x20c),'shape':_0x1f2978(0x217),'text':'connected'}),_0x2a08ef[_0x1f2978(0x1f7)]=!![],_0x2a08ef[_0x1f2978(0x1e4)](_0x1f2978(0x20a));}),_0x2a08ef['mqttConnection']['on'](_0x20880c(0x1f6),function(){const _0x1323c9=_0x20880c;_0x2a08ef['log'](_0x1323c9(0x1cd)),_0x2a08ef[_0x1323c9(0x1d7)]({'fill':'yellow','shape':_0x1323c9(0x1f4),'text':'reconnecting...'});}),_0x2a08ef[_0x20880c(0x207)]['on'](_0x20880c(0x21b),function(){const _0x348c35=_0x20880c;_0x2a08ef[_0x348c35(0x1f2)](_0x348c35(0x1f8)),_0x2a08ef[_0x348c35(0x1d7)]({'fill':_0x348c35(0x221),'shape':_0x348c35(0x1f4),'text':'offline'});}),_0x2a08ef[_0x20880c(0x207)]['on']('disconnect',function(){const _0x5e42aa=_0x20880c;_0x2a08ef[_0x5e42aa(0x1f2)]('Disconnected\x20from\x20MQTT\x20broker'),_0x2a08ef['status']({'fill':_0x5e42aa(0x221),'shape':_0x5e42aa(0x1f4),'text':_0x5e42aa(0x210)}),_0x2a08ef[_0x5e42aa(0x1f7)]=![],_0x2a08ef[_0x5e42aa(0x1e4)](_0x5e42aa(0x1df));}),_0x2a08ef[_0x20880c(0x207)]['on'](_0x20880c(0x202),function(_0x5708c3,_0x173603){const _0x52fe81=_0x20880c,_0x3efeed=_0x231848(_0x5708c3),_0x65590b=_0x2a08ef[_0x52fe81(0x219)][_0x3efeed];_0x65590b?_0x65590b['forEach'](_0x2d1d2f=>{const _0x5bd2da=_0x52fe81;try{_0x2d1d2f(_0x3efeed,_0x173603['toString']());}catch(_0x4d8b45){_0x2a08ef['error'](_0x5bd2da(0x21f)+_0x3efeed+_0x5bd2da(0x1db)+_0x4d8b45['message']);}}):_0x2a08ef[_0x52fe81(0x1f2)]('No\x20handler\x20for\x20topic:\x20'+_0x5708c3);}),init=!![];}catch(_0x570a5a){_0x2a08ef['error'](_0x20880c(0x220)+_0x570a5a['message']);}}),this[_0x3d3241(0x228)]=function(){const _0x199db1=_0x3d3241;_0x2a08ef['log'](_0x199db1(0x1fd));for(const _0x1f3ea5 in this[_0x199db1(0x219)]){_0x2a08ef[_0x199db1(0x1f2)](_0x1f3ea5+':\x20'+this['__subscriptions'][_0x1f3ea5][_0x199db1(0x1fe)]+_0x199db1(0x223));}},this[_0x3d3241(0x1fc)]=function _0x325651(_0xa42d1e,_0x1d7422){const _0x22e9b8=_0x3d3241,_0x553d5c=_0x231848(_0xa42d1e);!this[_0x22e9b8(0x219)][_0x553d5c]&&(this['__subscriptions'][_0x553d5c]=[],this[_0x22e9b8(0x207)][_0x22e9b8(0x22c)](_0xa42d1e,{'qos':0x1},function(_0x201a38,_0x57a433){const _0xfe1e3e=_0x22e9b8;_0x201a38?_0x2a08ef[_0xfe1e3e(0x1d8)](_0xfe1e3e(0x200)):_0x2a08ef[_0xfe1e3e(0x1f2)](_0xfe1e3e(0x214)+_0xa42d1e+'\x20with\x20qos\x20'+_0x57a433[0x0][_0xfe1e3e(0x1e9)]);})),this[_0x22e9b8(0x219)][_0x553d5c][_0x22e9b8(0x1e0)](_0x1d7422),this[_0x22e9b8(0x228)]();},this[_0x3d3241(0x225)]=(_0x41bf33,_0x6fc17e)=>{const _0x34a40f=_0x3d3241,_0x12ab2a=_0x231848(_0x41bf33),_0x1b900a=this[_0x34a40f(0x219)][_0x12ab2a];if(!_0x1b900a?.[_0x34a40f(0x1fe)])return;const _0x496a66=_0x1b900a[_0x34a40f(0x22d)](_0x527b86=>_0x527b86!==_0x6fc17e);if(_0x496a66[_0x34a40f(0x1fe)]){this[_0x34a40f(0x219)][_0x12ab2a]=_0x496a66;return;}this[_0x34a40f(0x207)][_0x34a40f(0x230)](_0x41bf33),delete this[_0x34a40f(0x219)][_0x12ab2a];},this['on']('ready',function(){const _0x215fec=_0x3d3241;_0x2a08ef[_0x215fec(0x1f2)](_0x215fec(0x204));}),this['on'](_0x3d3241(0x222),function(){const _0x3f4675=_0x3d3241;_0x2a08ef['mqttConnection'][_0x3f4675(0x1eb)](),_0x2a08ef[_0x3f4675(0x219)]={},_0x2a08ef[_0x3f4675(0x207)][_0x3f4675(0x1e5)]();});}_0x3962aa['nodes'][_0x2284fd(0x20f)](_0x2284fd(0x21e),_0x70c0dd);});function a26_0x4a46(){const _0x39669f=['ring','ip_timeout','reconnect','is_mqtt_connected','MQTT\x20broker\x20offline','):\x20','ip_loop_time','httpAdmin','subscribeNode','Subscriptions:','length','../lib/presentValueUpdateService.js','Error\x20subscribing\x20to\x20MQTT\x20topic','5AKMwtK','message','slice','OCN\x20Server\x20ready','ocn_ip','connectionId','mqttConnection','mqtt','split','mqtt_connect','900wVPtuT','green','enable_debug','errorCallback','registerType','disconnected','then','Unknown\x20error','retryGetConnectionId','Subscribed\x20to\x20MQTT\x20topic\x20','ready','Connected\x20to\x20MQTT\x20broker','dot','8744634TIiJGG','__subscriptions','stringify','offline','\x20seconds...','10281740ZezPkK','ocn-server','Error\x20in\x20subscriber\x20callback\x20for\x20topic\x20\x22','Error\x20getting\x20connection\x20ID:\x20','red','close','\x20callbacks','../lib/ocnApiClient.js','unsubscribeNode','7NbAUEp','createNode','printSubscriptions','mqtt_port','/utils.js','123MHJrbI','subscribe','filter','PresentValueUpdateService','18478188tCaiZy','unsubscribe','get','set','No\x20connection\x20ID\x20found','ip_retry_count','Reconnecting\x20to\x20MQTT\x20broker...','10926twlonq','nodes','connect','MQTT\x20error:\x20','ip_min_send_time','mstp_timeout','getConnectionId',')\x20in\x20','json','status','error','setMaxListeners','mstp_min_send_time','\x22:\x20','\x20retries.\x20Exiting...','mqtt://','sendFile','mqtt_disconnect','push','/api/v1','Connection\x20ID:\x20','2431476RVtPEF','emit','removeAllListeners','Error\x20getting\x20connection\x20ID\x20from\x20OCN\x20server\x20(',')\x20after\x20','1022468SxjmKo','qos','No\x20connections\x20found\x20on\x20OCN\x20server\x20(','end','20288gCbPMW','mstp_loop_time','https://','22zOwfxX','api_token','context','log','mstp_retry_count'];a26_0x4a46=function(){return _0x39669f;};return a26_0x4a46();}