UNPKG

@strato-automation/node-red-contrib-strato-automation

Version:
1 lines 10.6 kB
function a15_0x4342(){const _0x41c67b=['catch','\x20Requested\x20:\x20','close','grey','priority','/api/v1','Actual\x20:\x20','type','error','325qtQtkC','__out','Using\x20first\x20server\x20node','set_status','https://','topic','28441010VMXxmE','object_id','toFixed','warn','ring','_service','2344455wJiFss','yellow','split','context','__last_value_sent','__mqtt_topic','object_instance','connection_id','device_instance','resolution','ocn_ip','log','Error\x20getting\x20object\x20value','nodes','telemetry/','api','[DEPRECATED]\x20This\x20node\x20is\x20deprecated\x20and\x20will\x20be\x20removed\x20in\x20a\x20future\x20release.\x20Please\x20migrate\x20to\x20OUTPUT\x20node.','../lib/ocnApiClient.js','network_number','dot','send','ocn_server','subscribe','green','6DzJMbj','8591800lJgmje','297570IofbqL','_actual_value','get','parse','Waiting','push','createNode','15rpuNCq','source','then','subscribeNode','toUpperCase','268890gFKgxL','registerType','red','status','object_type','exports','Connected\x20:\x20','json','_resolution','mqtt','No\x20server\x20node\x20configured','_requested_value','is_mqtt_connected','payload','No\x20server\x20selected','ocn-server','getShallowObject','65748DaASrR','1698991NvFXKR','__writeObject','HTTP\x20status\x20:\x20','Value','handleMQTTMessage','abs','api_token','writeMstpObject','presentValue','ocn_server_node'];a15_0x4342=function(){return _0x41c67b;};return a15_0x4342();}function a15_0x1b15(_0x32486d,_0x2d0c3a){const _0x43421c=a15_0x4342();return a15_0x1b15=function(_0x1b151b,_0x2c3494){_0x1b151b=_0x1b151b-0x1a4;let _0x130c02=_0x43421c[_0x1b151b];return _0x130c02;},a15_0x1b15(_0x32486d,_0x2d0c3a);}const a15_0x24279b=a15_0x1b15;(function(_0x4cfb83,_0x5e51bd){const _0x39bded=a15_0x1b15,_0x23bb2c=_0x4cfb83();while(!![]){try{const _0x1e5291=-parseInt(_0x39bded(0x1ba))/0x1+-parseInt(_0x39bded(0x1c6))/0x2*(-parseInt(_0x39bded(0x1c1))/0x3)+-parseInt(_0x39bded(0x1d7))/0x4*(parseInt(_0x39bded(0x1eb))/0x5)+-parseInt(_0x39bded(0x1b8))/0x6*(parseInt(_0x39bded(0x1d8))/0x7)+-parseInt(_0x39bded(0x1b9))/0x8+-parseInt(_0x39bded(0x1f7))/0x9+parseInt(_0x39bded(0x1f1))/0xa;if(_0x1e5291===_0x5e51bd)break;else _0x23bb2c['push'](_0x23bb2c['shift']());}catch(_0x179fb2){_0x23bb2c['push'](_0x23bb2c['shift']());}}}(a15_0x4342,0x8bef0),module[a15_0x24279b(0x1cb)]=function(_0x436978){const _0x24709f=a15_0x24279b,_0x56852d=require(_0x24709f(0x1b1));function _0x15252d(_0x474531){const _0x277a43=_0x24709f;_0x436978[_0x277a43(0x1ad)][_0x277a43(0x1c0)](this,_0x474531);var _0x1b8bdb=this;_0x1b8bdb[_0x277a43(0x1f4)](_0x277a43(0x1b0)),_0x1b8bdb[_0x277a43(0x1e1)]=_0x436978[_0x277a43(0x1ad)]['getNode'](_0x474531[_0x277a43(0x1e1)]);;_0x1b8bdb[_0x277a43(0x1e6)]=_0x474531['priority']||'16',_0x1b8bdb[_0x277a43(0x1a7)]=_0x474531[_0x277a43(0x1a7)],_0x1b8bdb['network_number']=_0x474531[_0x277a43(0x1b2)],_0x1b8bdb['device_instance']=_0x474531[_0x277a43(0x1a8)],_0x1b8bdb[_0x277a43(0x1f2)]=_0x474531[_0x277a43(0x1f2)],_0x1b8bdb[_0x277a43(0x1ca)]=_0x474531[_0x277a43(0x1f2)][_0x277a43(0x1f9)]('-')[0x0],_0x1b8bdb[_0x277a43(0x1a6)]=_0x474531[_0x277a43(0x1f2)]['split']('-')[0x1],_0x1b8bdb[_0x277a43(0x1c2)]=_0x474531['source']||_0x277a43(0x1cf),_0x1b8bdb['source']=_0x1b8bdb['source']===''?'mqtt':_0x1b8bdb['source'],_0x1b8bdb[_0x277a43(0x1f6)]=this[_0x277a43(0x1fa)]()['global'][_0x277a43(0x1bc)]('PresentValueUpdateService'),_0x1b8bdb['__mqtt_topic']=_0x277a43(0x1ae)+_0x1b8bdb['connection_id']+'/'+_0x1b8bdb['network_number']+'/'+_0x1b8bdb[_0x277a43(0x1a8)]+'/'+_0x1b8bdb[_0x277a43(0x1f2)][_0x277a43(0x1c5)](),_0x1b8bdb[_0x277a43(0x1bb)]=undefined,_0x1b8bdb[_0x277a43(0x1d1)]=undefined,_0x1b8bdb[_0x277a43(0x1ce)]=0.1,setTimeout(()=>{const _0x58d00f=_0x277a43;if(!_0x1b8bdb[_0x58d00f(0x1b5)])return;_0x1b8bdb[_0x58d00f(0x1af)]=new _0x56852d('https://'+_0x1b8bdb[_0x58d00f(0x1b5)][_0x58d00f(0x1aa)]+_0x58d00f(0x1e7),_0x1b8bdb[_0x58d00f(0x1b5)][_0x58d00f(0x1de)]);try{_0x1b8bdb[_0x58d00f(0x1af)][_0x58d00f(0x1d6)](_0x1b8bdb['device_instance'],_0x1b8bdb['object_type'],_0x1b8bdb[_0x58d00f(0x1a6)])['then'](_0x128383=>{const _0x118adf=_0x58d00f;_0x128383[_0x118adf(0x1c9)]==0xc8?_0x128383[_0x118adf(0x1cd)]()[_0x118adf(0x1c3)](_0x21e20c=>{const _0x8388d6=_0x118adf,_0x5555c2=_0x21e20c[_0x8388d6(0x1a9)];if(_0x5555c2&&!isNaN(_0x5555c2))_0x1b8bdb[_0x8388d6(0x1ce)]=_0x5555c2;_0x1b8bdb[_0x8388d6(0x1ab)]('Resolution:\x20'+_0x1b8bdb['_resolution']+'\x20'+_0x1b8bdb['object_id']+'\x20'+_0x1b8bdb[_0x8388d6(0x1a8)]+'\x20'+_0x1b8bdb['object_instance']),_0x1b8bdb[_0x8388d6(0x1ee)]();}):(_0x1b8bdb[_0x118adf(0x1ea)]('Error\x20getting\x20object\x20value'),_0x1b8bdb['status']({'fill':_0x118adf(0x1c8),'shape':'ring','text':_0x118adf(0x1da)+_0x128383[_0x118adf(0x1c9)]}));})['catch'](_0x4bfc02=>{const _0x467719=_0x58d00f;_0x1b8bdb[_0x467719(0x1ea)](_0x4bfc02);});}catch(_0x3582a9){_0x1b8bdb[_0x58d00f(0x1ea)](_0x3582a9);}},0x2710),_0x1b8bdb['set_status']=function(){const _0x4bf89e=_0x277a43;if(_0x1b8bdb['_actual_value']===undefined&&_0x1b8bdb[_0x4bf89e(0x1d1)]===undefined){_0x1b8bdb[_0x4bf89e(0x1c9)]({'fill':'grey','shape':_0x4bf89e(0x1b3),'text':_0x4bf89e(0x1be)});return;}else{if(Math[_0x4bf89e(0x1dd)](_0x1b8bdb['_actual_value']-_0x1b8bdb[_0x4bf89e(0x1d1)])<_0x1b8bdb[_0x4bf89e(0x1ce)]){_0x1b8bdb['status']({'fill':_0x4bf89e(0x1b7),'shape':'dot','text':_0x4bf89e(0x1e8)+_0x1b8bdb['_actual_value']?.[_0x4bf89e(0x1f3)](0x2)+_0x4bf89e(0x1e3)+_0x1b8bdb[_0x4bf89e(0x1d1)]?.['toFixed'](0x2)});return;}}_0x1b8bdb[_0x4bf89e(0x1c9)]({'fill':_0x4bf89e(0x1f8),'shape':'dot','text':_0x4bf89e(0x1e8)+_0x1b8bdb[_0x4bf89e(0x1bb)]?.[_0x4bf89e(0x1f3)](0x2)+'\x20Requested\x20:\x20'+_0x1b8bdb[_0x4bf89e(0x1d1)]?.[_0x4bf89e(0x1f3)](0x2)});return;};if(_0x474531[_0x277a43(0x1e1)]==''){_0x1b8bdb[_0x277a43(0x1f4)](_0x277a43(0x1d4));var _0x18f568=[];_0x436978[_0x277a43(0x1ad)]['eachNode'](function(_0xff46b8){const _0x55f0c8=_0x277a43;_0xff46b8[_0x55f0c8(0x1e9)]==_0x55f0c8(0x1d5)&&_0x18f568[_0x55f0c8(0x1bf)](_0xff46b8);}),_0x18f568['length']>0x0?(this[_0x277a43(0x1f4)](_0x277a43(0x1ed)),_0x474531[_0x277a43(0x1b5)]=_0x18f568[0x0]['id']):this['error'](_0x277a43(0x1d0));}this[_0x277a43(0x1b5)]=_0x436978[_0x277a43(0x1ad)]['getNode'](_0x474531[_0x277a43(0x1e1)]);if(_0x1b8bdb[_0x277a43(0x1c2)]==_0x277a43(0x1cf))_0x1b8bdb[_0x277a43(0x1dc)]=function(_0x28e18d,_0x3b5448){const _0x45e2d6=_0x277a43;try{_0x3b5448=JSON[_0x45e2d6(0x1bd)](_0x3b5448),_0x1b8bdb['_actual_value']=Number(_0x3b5448[_0x45e2d6(0x1db)]),msg={'payload':_0x3b5448[_0x45e2d6(0x1db)],'object_id':_0x1b8bdb[_0x45e2d6(0x1f2)],'device_instance':_0x1b8bdb[_0x45e2d6(0x1a8)],'object_type':_0x1b8bdb[_0x45e2d6(0x1ca)],'object_instance':_0x1b8bdb[_0x45e2d6(0x1a6)],'connection_id':_0x1b8bdb[_0x45e2d6(0x1a7)],'priority':_0x1b8bdb[_0x45e2d6(0x1e6)],'network_number':_0x1b8bdb['network_number']},_0x1b8bdb[_0x45e2d6(0x1ee)](),_0x1b8bdb['send']([undefined,msg]);}catch(_0x47ad1c){_0x1b8bdb[_0x45e2d6(0x1ea)]('Error\x20parsing\x20JSON:\x20'+_0x47ad1c);}},this['subscribe']=function(){const _0x4e303a=_0x277a43;_0x1b8bdb[_0x4e303a(0x1b5)][_0x4e303a(0x1c4)](_0x1b8bdb[_0x4e303a(0x1a5)],_0x1b8bdb[_0x4e303a(0x1dc)]);},this[_0x277a43(0x1b5)]&&(this[_0x277a43(0x1b5)][_0x277a43(0x1d2)]?(_0x1b8bdb[_0x277a43(0x1b6)](),_0x1b8bdb[_0x277a43(0x1c9)]({'fill':_0x277a43(0x1b7),'shape':_0x277a43(0x1b3),'text':'Connected\x20:\x20'+_0x1b8bdb[_0x277a43(0x1f0)]})):(_0x1b8bdb[_0x277a43(0x1c9)]({'fill':'red','shape':_0x277a43(0x1f5),'text':'Disconnected\x20:\x20'+_0x1b8bdb[_0x277a43(0x1f0)]}),this[_0x277a43(0x1b5)]['on']('mqtt_connect',function(){const _0x29ca84=_0x277a43;_0x1b8bdb['subscribe'](),_0x1b8bdb[_0x29ca84(0x1c9)]({'fill':_0x29ca84(0x1b7),'shape':_0x29ca84(0x1b3),'text':_0x29ca84(0x1cc)+_0x1b8bdb[_0x29ca84(0x1f0)]});})));else{if(_0x1b8bdb[_0x277a43(0x1c2)]==_0x277a43(0x1af)){if(!_0x1b8bdb[_0x277a43(0x1b5)])return;_0x1b8bdb[_0x277a43(0x1af)]=new _0x56852d(_0x277a43(0x1ef)+_0x1b8bdb[_0x277a43(0x1b5)]['ocn_ip']+'/api/v1',_0x1b8bdb[_0x277a43(0x1b5)][_0x277a43(0x1de)]),_0x1b8bdb['interval']=setInterval(()=>{const _0x34b732=_0x277a43;try{_0x1b8bdb[_0x34b732(0x1af)][_0x34b732(0x1d6)](_0x1b8bdb[_0x34b732(0x1a8)],_0x1b8bdb[_0x34b732(0x1ca)],_0x1b8bdb[_0x34b732(0x1a6)])[_0x34b732(0x1c3)](_0x2cdf6e=>{const _0x428ec0=_0x34b732;_0x2cdf6e['status']==0xc8?_0x2cdf6e[_0x428ec0(0x1cd)]()['then'](_0x20d4a8=>{const _0x1ad139=_0x428ec0;_0x1b8bdb[_0x1ad139(0x1bb)]=Number(_0x20d4a8['presentValue']);let _0x270178={'payload':_0x20d4a8[_0x1ad139(0x1e0)],'object_id':_0x1b8bdb[_0x1ad139(0x1f2)],'device_instance':_0x1b8bdb[_0x1ad139(0x1a8)],'object_type':_0x1b8bdb['object_type'],'object_instance':_0x1b8bdb[_0x1ad139(0x1a6)],'connection_id':_0x1b8bdb['connection_id'],'priority':_0x1b8bdb[_0x1ad139(0x1e6)],'network_number':_0x1b8bdb[_0x1ad139(0x1b2)]};_0x1b8bdb[_0x1ad139(0x1ee)](),_0x1b8bdb[_0x1ad139(0x1b4)]([undefined,_0x270178]);}):(_0x1b8bdb[_0x428ec0(0x1ea)](_0x428ec0(0x1ac)),_0x1b8bdb['status']({'fill':_0x428ec0(0x1c8),'shape':_0x428ec0(0x1f5),'text':_0x428ec0(0x1da)+_0x2cdf6e['status']}));})[_0x34b732(0x1e2)](_0x95f0fa=>{const _0xa4ad1f=_0x34b732;_0x1b8bdb[_0xa4ad1f(0x1ea)](_0x95f0fa);});}catch(_0x201cee){_0x1b8bdb[_0x34b732(0x1ea)](_0x201cee);}},0x3e8);}}_0x1b8bdb['on'](_0x277a43(0x1e4),function(){clearInterval(_0x1b8bdb['interval']);}),_0x1b8bdb['on']('input',function(_0x25c09d){const _0x27b9bc=_0x277a43,_0x47d222=_0x25c09d[_0x27b9bc(0x1d3)]===null?null:Number(_0x25c09d['payload']);if(_0x47d222!==null&&isNaN(_0x47d222))return;_0x1b8bdb[_0x27b9bc(0x1ec)]=_0x47d222,_0x1b8bdb[_0x27b9bc(0x1d1)]=_0x47d222,_0x25c09d[_0x27b9bc(0x1f2)]=_0x1b8bdb[_0x27b9bc(0x1f2)],_0x25c09d[_0x27b9bc(0x1a8)]=_0x1b8bdb[_0x27b9bc(0x1a8)],_0x25c09d['object_type']=_0x1b8bdb[_0x27b9bc(0x1ca)],_0x25c09d[_0x27b9bc(0x1a6)]=_0x1b8bdb[_0x27b9bc(0x1a6)],_0x25c09d[_0x27b9bc(0x1a7)]=_0x1b8bdb['connection_id'],_0x25c09d[_0x27b9bc(0x1e6)]=_0x1b8bdb[_0x27b9bc(0x1e6)],_0x25c09d[_0x27b9bc(0x1b2)]=_0x1b8bdb['network_number'],this[_0x27b9bc(0x1d9)](),_0x1b8bdb[_0x27b9bc(0x1ee)](),_0x1b8bdb[_0x27b9bc(0x1b4)]([_0x25c09d,undefined]);}),_0x1b8bdb[_0x277a43(0x1d9)]=function(){const _0x176968=_0x277a43;if(_0x1b8bdb[_0x176968(0x1ec)]===undefined)return;_0x1b8bdb[_0x176968(0x1f6)][_0x176968(0x1df)](_0x1b8bdb['ocn_server_node'][_0x176968(0x1aa)],_0x1b8bdb[_0x176968(0x1b5)][_0x176968(0x1de)],_0x1b8bdb[_0x176968(0x1a8)],_0x1b8bdb[_0x176968(0x1ca)],_0x1b8bdb[_0x176968(0x1a6)],{'propertyId':0x55,'priority':Number(_0x1b8bdb[_0x176968(0x1e6)]),'value':_0x1b8bdb[_0x176968(0x1ec)]});},this[_0x277a43(0x1a4)]=![],_0x1b8bdb[_0x277a43(0x1c9)]({'fill':_0x277a43(0x1e5),'shape':'dot','text':'Waiting'});}_0x436978['nodes'][_0x24709f(0x1c7)]('output-mstp',_0x15252d);});