@strato-automation/node-red-contrib-strato-automation
Version:
Strato Automation Official Node Red Library
1 lines • 10.5 kB
JavaScript
function a19_0x5a0b(){const _0x4e5c26=['slice','mqtt_port','statusText','disconnect','2qyerxG','10CBWGnh','enable_debug','connect','4368392tECKeT','split','is_mqtt_connected','../lib/presentValueUpdateService.js',')\x20in\x20','__subscriptions','1268gbjXCO','ocn_ip','../lib/ocnApiClient.js','7821215rySZCR','Connected\x20to\x20MQTT\x20broker','No\x20connection\x20ID\x20found','mqtt_disconnect','244602rwuWoI','getConnectionId','json','Connection\x20ID:\x20','global','Error\x20getting\x20connection\x20ID:\x20','disconnected','MQTT\x20broker\x20offline','ocn-server','ready','Subscriptions:','Error\x20getting\x20connection\x20ID\x20from\x20OCN\x20server\x20(','mqtt://','exports','11bLJFoZ','emit','\x22:\x20','/api/v1','mstp_loop_time','ring','connectionId','forEach','qos','No\x20handler\x20for\x20topic:\x20','78006OXFfLh','/utils.js','16467420vSjFiV','ip_retry_count','\x20callbacks','createNode','offline','context','unsubscribe','sendFile','ip_min_send_time','Error\x20subscribing\x20to\x20MQTT\x20topic','mstp_timeout','PresentValueUpdateService','retryGetConnectionId','warn','12vSezXo','mqtt_connect','):\x20','errorCallback','green','5810744DrVNzO','stringify','red','Error\x20in\x20subscriber\x20callback\x20for\x20topic\x20\x22','Connecting\x20to\x20MQTT\x20broker\x20at\x20','\x20seconds...','\x20with\x20qos\x20','mstp_retry_count','status','then','Reconnecting\x20to\x20MQTT\x20broker...','Retry\x20getting\x20connection\x20ID\x20from\x20OCN\x20server\x20(','reconnect','ip_timeout','join','dot','message','279GzvPKi','removeAllListeners','/nodered/utils.js','mqttConnection','unsubscribeNode','ip_loop_time','mstp_min_send_time','set','log','api_token','yellow','toString','Disconnected\x20from\x20MQTT\x20broker','https://','push','printSubscriptions','Failed\x20to\x20get\x20connection\x20ID\x20from\x20OCN\x20server\x20(','nodes','subscribeNode','error','close','filter'];a19_0x5a0b=function(){return _0x4e5c26;};return a19_0x5a0b();}function a19_0x4283(_0x4a9ade,_0x353cb7){const _0x5a0bed=a19_0x5a0b();return a19_0x4283=function(_0x4283db,_0x34e072){_0x4283db=_0x4283db-0x1a9;let _0x37cbdd=_0x5a0bed[_0x4283db];return _0x37cbdd;},a19_0x4283(_0x4a9ade,_0x353cb7);}const a19_0x55e02f=a19_0x4283;(function(_0x2481e4,_0x49a745){const _0x2bff4e=a19_0x4283,_0x5b9bdf=_0x2481e4();while(!![]){try{const _0x429a08=parseInt(_0x2bff4e(0x1e2))/0x1*(parseInt(_0x2bff4e(0x20b))/0x2)+-parseInt(_0x2bff4e(0x1c8))/0x3*(parseInt(_0x2bff4e(0x1ec))/0x4)+parseInt(_0x2bff4e(0x1ef))/0x5+-parseInt(_0x2bff4e(0x1b2))/0x6*(parseInt(_0x2bff4e(0x1e6))/0x7)+-parseInt(_0x2bff4e(0x1b7))/0x8+parseInt(_0x2bff4e(0x1f3))/0x9*(-parseInt(_0x2bff4e(0x1e3))/0xa)+parseInt(_0x2bff4e(0x201))/0xb*(parseInt(_0x2bff4e(0x20d))/0xc);if(_0x429a08===_0x49a745)break;else _0x5b9bdf['push'](_0x5b9bdf['shift']());}catch(_0x1a56cc){_0x5b9bdf['push'](_0x5b9bdf['shift']());}}}(a19_0x5a0b,0xf017c),module[a19_0x55e02f(0x200)]=function(_0x27bf69){const _0x36d7b8=a19_0x55e02f;function _0x5b3f28(_0x468ee5){const _0x4e824e=a19_0x4283;return _0x468ee5[_0x4e824e(0x1e7)]('/')[_0x4e824e(0x1de)](0x3)[_0x4e824e(0x1c5)]('/');}const _0x3729d6=require(_0x36d7b8(0x1ee));var _0x5d6233=require('mqtt');_0x27bf69['httpAdmin']['get']('/utils.js',(_0x30ec9f,_0x3fe26e)=>{const _0xbe03ce=_0x36d7b8,_0x5ef67b=__dirname+_0xbe03ce(0x20c);_0x3fe26e['sendFile'](_0x5ef67b);}),_0x27bf69['httpAdmin']['get'](_0x36d7b8(0x1ca),(_0x5732cb,_0x46f84f)=>{const _0x75d9f5=_0x36d7b8,_0x2d6a0f=__dirname+_0x75d9f5(0x20c);_0x46f84f[_0x75d9f5(0x1ab)](_0x2d6a0f);});function _0x4ff746(_0x1fb429){const _0x548775=_0x36d7b8;_0x27bf69[_0x548775(0x1d9)][_0x548775(0x210)](this,_0x1fb429),this['ocn_ip']=_0x1fb429[_0x548775(0x1ed)],this[_0x548775(0x1df)]=_0x1fb429[_0x548775(0x1df)],this[_0x548775(0x1d1)]=_0x1fb429['api_token'],this[_0x548775(0x1cd)]=Number(_0x1fb429[_0x548775(0x1cd)])||0x1f4,this[_0x548775(0x1ac)]=Number(_0x1fb429[_0x548775(0x1ac)])||0x64,this[_0x548775(0x1c4)]=Number(_0x1fb429[_0x548775(0x1c4)])||0x3e8,this[_0x548775(0x20e)]=Number(_0x1fb429[_0x548775(0x20e)])||0x2,this[_0x548775(0x205)]=Number(_0x1fb429[_0x548775(0x205)])||0x3e8,this[_0x548775(0x1ce)]=Number(_0x1fb429[_0x548775(0x1ce)])||0x1f4,this[_0x548775(0x1ae)]=Number(_0x1fb429[_0x548775(0x1ae)])||0xbb8,this[_0x548775(0x1be)]=Number(_0x1fb429[_0x548775(0x1be)])||0x2,this[_0x548775(0x1e4)]=_0x1fb429[_0x548775(0x1e4)]||![],this['connectionId']=null,this[_0x548775(0x1eb)]={};var _0x53e000=this;this[_0x548775(0x1b5)]=function(_0x488a8b){const _0x240e30=_0x548775;_0x53e000[_0x240e30(0x1e4)]&&_0x53e000['error'](JSON[_0x240e30(0x1b8)](_0x488a8b)||'Unknown\x20error');},this['getConnectionId']=async function(){const _0x4aff4e=_0x548775;try{let _0x52ba6b=new _0x3729d6(_0x4aff4e(0x1d5)+this[_0x4aff4e(0x1ed)]+_0x4aff4e(0x204),this[_0x4aff4e(0x1d1)]);return await _0x52ba6b[_0x4aff4e(0x1f4)]()['then'](_0x39f9d7=>{const _0x3e101e=_0x4aff4e;if(_0x39f9d7['status']!==0xc8)return _0x53e000[_0x3e101e(0x1db)](_0x3e101e(0x1fe)+this[_0x3e101e(0x1ed)]+_0x3e101e(0x1b4)+_0x39f9d7[_0x3e101e(0x1e0)]),null;return _0x39f9d7[_0x3e101e(0x1f5)]()[_0x3e101e(0x1c0)](_0x4f0d30=>{const _0x1b90f6=_0x3e101e;if(_0x4f0d30['length']===0x0)return _0x53e000[_0x1b90f6(0x1db)]('No\x20connections\x20found\x20on\x20OCN\x20server\x20('+this[_0x1b90f6(0x1ed)]+')'),null;return _0x4f0d30[0x0][_0x1b90f6(0x207)];});});}catch(_0x257a2b){return _0x53e000[_0x4aff4e(0x1db)](_0x4aff4e(0x1fe)+this[_0x4aff4e(0x1ed)]+_0x4aff4e(0x1b4)+_0x257a2b['message']),null;}},this[_0x548775(0x1b0)]=async function(_0x3ba189=0x1388,_0x24a3bc=0xc){const _0x4120c9=_0x548775;let _0xf88e79=0x0;while(_0xf88e79<_0x24a3bc){const _0x2bffe2=await this[_0x4120c9(0x1f4)]();if(_0x2bffe2)return _0x2bffe2;_0x53e000[_0x4120c9(0x1b1)](_0x4120c9(0x1c2)+this[_0x4120c9(0x1ed)]+_0x4120c9(0x1ea)+_0x3ba189/0x3e8+_0x4120c9(0x1bc)),await new Promise(_0x4146c9=>setTimeout(_0x4146c9,_0x3ba189)),_0xf88e79++;}return _0x53e000['error'](_0x4120c9(0x1d8)+this[_0x4120c9(0x1ed)]+')\x20after\x20'+_0xf88e79+'\x20retries.\x20Exiting...'),null;};const _0x319388=require(_0x548775(0x1e9));this[_0x548775(0x1a9)]()[_0x548775(0x1f7)][_0x548775(0x1cf)](_0x548775(0x1af),new _0x319388(this[_0x548775(0x1b5)],this[_0x548775(0x1cd)],this['ip_min_send_time'],this[_0x548775(0x1c4)],this[_0x548775(0x20e)],this['mstp_loop_time'],this[_0x548775(0x1ce)],this['mstp_timeout'],this[_0x548775(0x1be)],_0x27bf69)),this[_0x548775(0x1b0)]()['then'](_0x4e153c=>{const _0x1e1e0f=_0x548775;try{if(!_0x4e153c){_0x53e000[_0x1e1e0f(0x1db)](_0x1e1e0f(0x1f1));return;}_0x53e000[_0x1e1e0f(0x1d0)](_0x1e1e0f(0x1f6)+_0x4e153c),this[_0x1e1e0f(0x207)]=_0x4e153c,_0x53e000['emit'](_0x1e1e0f(0x1fc)),_0x53e000['status']({'fill':_0x1e1e0f(0x1b9),'shape':_0x1e1e0f(0x206),'text':_0x1e1e0f(0x1f9)}),_0x53e000['log'](_0x1e1e0f(0x1bb)+_0x53e000[_0x1e1e0f(0x1ed)]+':'+_0x53e000[_0x1e1e0f(0x1df)]),_0x53e000[_0x1e1e0f(0x1cb)]=_0x5d6233[_0x1e1e0f(0x1e5)](_0x1e1e0f(0x1ff)+_0x53e000[_0x1e1e0f(0x1ed)]+':'+_0x53e000[_0x1e1e0f(0x1df)],{'connectTimeout':0xfa0,'reconnectPeriod':0x1388}),_0x53e000[_0x1e1e0f(0x1cb)]['on'](_0x1e1e0f(0x1db),_0x2d4b33=>{const _0x3c4386=_0x1e1e0f;_0x53e000[_0x3c4386(0x1d0)]('MQTT\x20error:\x20'+_0x2d4b33['message']);}),_0x53e000[_0x1e1e0f(0x1cb)]['setMaxListeners'](0x2710),_0x53e000[_0x1e1e0f(0x1cb)]['on'](_0x1e1e0f(0x1e5),function(){const _0x3027e2=_0x1e1e0f;_0x53e000['log'](_0x3027e2(0x1f0)),_0x53e000[_0x3027e2(0x1bf)]({'fill':_0x3027e2(0x1b6),'shape':_0x3027e2(0x1c6),'text':'connected'}),_0x53e000[_0x3027e2(0x1e8)]=!![],_0x53e000[_0x3027e2(0x202)](_0x3027e2(0x1b3));}),_0x53e000[_0x1e1e0f(0x1cb)]['on'](_0x1e1e0f(0x1c3),function(){const _0x3f08e4=_0x1e1e0f;_0x53e000[_0x3f08e4(0x1d0)](_0x3f08e4(0x1c1)),_0x53e000[_0x3f08e4(0x1bf)]({'fill':_0x3f08e4(0x1d2),'shape':'ring','text':'reconnecting...'});}),_0x53e000[_0x1e1e0f(0x1cb)]['on'](_0x1e1e0f(0x211),function(){const _0x230c1a=_0x1e1e0f;_0x53e000['log'](_0x230c1a(0x1fa)),_0x53e000[_0x230c1a(0x1bf)]({'fill':'red','shape':_0x230c1a(0x206),'text':_0x230c1a(0x211)});}),_0x53e000['mqttConnection']['on'](_0x1e1e0f(0x1e1),function(){const _0x3f68d3=_0x1e1e0f;_0x53e000[_0x3f68d3(0x1d0)](_0x3f68d3(0x1d4)),_0x53e000[_0x3f68d3(0x1bf)]({'fill':_0x3f68d3(0x1b9),'shape':_0x3f68d3(0x206),'text':_0x3f68d3(0x1f9)}),_0x53e000[_0x3f68d3(0x1e8)]=![],_0x53e000[_0x3f68d3(0x202)](_0x3f68d3(0x1f2));}),_0x53e000['mqttConnection']['on'](_0x1e1e0f(0x1c7),function(_0x141500,_0x5697ea){const _0x915448=_0x1e1e0f,_0x3a33a1=_0x5b3f28(_0x141500),_0x1350cd=_0x53e000['__subscriptions'][_0x3a33a1];_0x1350cd?_0x1350cd[_0x915448(0x208)](_0x4be4ce=>{const _0x237d0d=_0x915448;try{_0x4be4ce(_0x3a33a1,_0x5697ea[_0x237d0d(0x1d3)]());}catch(_0x2fb2a2){_0x53e000[_0x237d0d(0x1db)](_0x237d0d(0x1ba)+_0x3a33a1+_0x237d0d(0x203)+_0x2fb2a2[_0x237d0d(0x1c7)]);}}):_0x53e000[_0x915448(0x1d0)](_0x915448(0x20a)+_0x141500);}),init=!![];}catch(_0x16901f){_0x53e000[_0x1e1e0f(0x1db)](_0x1e1e0f(0x1f8)+_0x16901f[_0x1e1e0f(0x1c7)]);}}),this[_0x548775(0x1d7)]=function(){const _0xbec838=_0x548775;_0x53e000[_0xbec838(0x1d0)](_0xbec838(0x1fd));for(const _0x1f59cd in this[_0xbec838(0x1eb)]){_0x53e000[_0xbec838(0x1d0)](_0x1f59cd+':\x20'+this['__subscriptions'][_0x1f59cd]['length']+_0xbec838(0x20f));}},this[_0x548775(0x1da)]=function _0x3bb341(_0x14282d,_0x4d13c0){const _0x3924c0=_0x548775,_0x48bc81=_0x5b3f28(_0x14282d);!this[_0x3924c0(0x1eb)][_0x48bc81]&&(this['__subscriptions'][_0x48bc81]=[],this[_0x3924c0(0x1cb)]['subscribe'](_0x14282d,{'qos':0x1},function(_0xdcd540,_0x2cf136){const _0x1c0d4e=_0x3924c0;_0xdcd540?_0x53e000['error'](_0x1c0d4e(0x1ad)):_0x53e000[_0x1c0d4e(0x1d0)]('Subscribed\x20to\x20MQTT\x20topic\x20'+_0x14282d+_0x1c0d4e(0x1bd)+_0x2cf136[0x0][_0x1c0d4e(0x209)]);})),this[_0x3924c0(0x1eb)][_0x48bc81][_0x3924c0(0x1d6)](_0x4d13c0),this[_0x3924c0(0x1d7)]();},this[_0x548775(0x1cc)]=(_0x578b50,_0x436048)=>{const _0x1db4e4=_0x548775,_0x5d6024=_0x5b3f28(_0x578b50),_0x4ef165=this[_0x1db4e4(0x1eb)][_0x5d6024];if(!_0x4ef165?.['length'])return;const _0x1a5ee0=_0x4ef165[_0x1db4e4(0x1dd)](_0x22d7f0=>_0x22d7f0!==_0x436048);if(_0x1a5ee0['length']){this[_0x1db4e4(0x1eb)][_0x5d6024]=_0x1a5ee0;return;}this[_0x1db4e4(0x1cb)][_0x1db4e4(0x1aa)](_0x578b50),delete this[_0x1db4e4(0x1eb)][_0x5d6024];},this['on']('ready',function(){const _0x2c5539=_0x548775;_0x53e000[_0x2c5539(0x1d0)]('OCN\x20Server\x20ready');}),this['on'](_0x548775(0x1dc),function(){const _0xeed360=_0x548775;_0x53e000[_0xeed360(0x1cb)]['end'](),_0x53e000[_0xeed360(0x1eb)]={},_0x53e000[_0xeed360(0x1cb)][_0xeed360(0x1c9)]();});}_0x27bf69[_0x36d7b8(0x1d9)]['registerType'](_0x36d7b8(0x1fb),_0x4ff746);});