UNPKG

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

Version:
1 lines 8.38 kB
const a4_0x45cca9=a4_0x1a59;(function(_0x1ab16c,_0x8ad182){const _0x15ea6f=a4_0x1a59,_0x4f96b7=_0x1ab16c();while(!![]){try{const _0x2e7ea6=-parseInt(_0x15ea6f(0x159))/0x1*(-parseInt(_0x15ea6f(0x174))/0x2)+-parseInt(_0x15ea6f(0x15c))/0x3+-parseInt(_0x15ea6f(0x19b))/0x4*(-parseInt(_0x15ea6f(0x199))/0x5)+-parseInt(_0x15ea6f(0x15e))/0x6+parseInt(_0x15ea6f(0x166))/0x7+-parseInt(_0x15ea6f(0x15d))/0x8+-parseInt(_0x15ea6f(0x16c))/0x9*(-parseInt(_0x15ea6f(0x16e))/0xa);if(_0x2e7ea6===_0x8ad182)break;else _0x4f96b7['push'](_0x4f96b7['shift']());}catch(_0x465412){_0x4f96b7['push'](_0x4f96b7['shift']());}}}(a4_0x6fe8,0xcbc1a));const {parseBacnetIdStr}=require(a4_0x45cca9(0x182));function a4_0x6fe8(){const _0x305a4b=['StatusFlags','mqtt_connect','subscribe','ocn_ip','getTime','payload','toFixed','eachNode','__srcid','presentValue','json','522855ltGdJq','/api/v1','12IJihUe','device_instance','instance','HTTP\x20status\x20:\x20','length','getNode','ocn_server_node','green','topic','subscribeNode','PV\x20:\x20','error','then','push','log','close','exports','\x20because\x20it\x20is\x20older\x20than\x20the\x20last\x20message','createNode','367765worDGF','/+/','warn','1104261pGRgJW','6040544Wzulxf','2945910nTtVcd','once','Timestamp','source','statusFlags','../lib/ocnApiClient.js','telemetry/','_last_message_timestamp','3812396twMfCc','Error\x20getting\x20object\x20value','Connected\x20:\x20','Disconnected\x20:\x20','interval','red','104796OHQHNL','input','1050Umdaxq','mqtt','status','ring','type','api','2ZqrdpD','nodes','No\x20server\x20node\x20configured','unsubscribeNode','connectionId','ocn_server','https://','decodeStatusFlags','getShallowObject','No\x20server\x20selected','api_token','is_mqtt_connected','handleMQTTMessage','Value','../lib/bacnet.js','dot','Subscribing\x20to\x20','toUpperCase','object_type','No\x20object\x20id\x20or\x20device\x20instance\x20configured','Using\x20first\x20server\x20node','object_instance','object_id','parse','send','__mqtt_topic'];a4_0x6fe8=function(){return _0x305a4b;};return a4_0x6fe8();}function a4_0x1a59(_0x13cb2d,_0x431d16){const _0x6fe87=a4_0x6fe8();return a4_0x1a59=function(_0x1a590,_0x41fd2a){_0x1a590=_0x1a590-0x150;let _0x2e2a51=_0x6fe87[_0x1a590];return _0x2e2a51;},a4_0x1a59(_0x13cb2d,_0x431d16);}module[a4_0x45cca9(0x156)]=function(_0x18b6ae){const _0x3a28bc=a4_0x45cca9,_0x2a0ae4=require(_0x3a28bc(0x163)),_0x40ff5b=require(_0x3a28bc(0x182))[_0x3a28bc(0x17b)];function _0x4331d1(_0x15cd81){const _0x25198b=_0x3a28bc;_0x18b6ae[_0x25198b(0x175)][_0x25198b(0x158)](this,_0x15cd81);var _0x44ef2c=this;_0x44ef2c[_0x25198b(0x1a1)]=_0x15cd81[_0x25198b(0x1a1)],_0x44ef2c[_0x25198b(0x19c)]=_0x15cd81['device_instance'],_0x44ef2c[_0x25198b(0x18a)]=_0x15cd81['object_id'],_0x44ef2c[_0x25198b(0x161)]=_0x15cd81[_0x25198b(0x161)]||_0x25198b(0x16f),_0x44ef2c['topic']=_0x15cd81[_0x25198b(0x1a3)];const _0x570802=parseBacnetIdStr(_0x44ef2c[_0x25198b(0x18a)]);_0x44ef2c[_0x25198b(0x186)]=_0x570802[_0x25198b(0x172)],_0x44ef2c[_0x25198b(0x189)]=_0x570802[_0x25198b(0x19d)],_0x44ef2c['_last_message_timestamp']=null;if(_0x15cd81[_0x25198b(0x1a1)]==''){_0x44ef2c['warn'](_0x25198b(0x17d));var _0x43ac22=[];_0x18b6ae[_0x25198b(0x175)][_0x25198b(0x195)](function(_0x49e888){const _0x14094f=_0x25198b;_0x49e888['type']=='ocn-server'&&_0x43ac22[_0x14094f(0x153)](_0x49e888);}),_0x43ac22[_0x25198b(0x19f)]>0x0?(_0x44ef2c[_0x25198b(0x15b)](_0x25198b(0x188)),_0x15cd81[_0x25198b(0x179)]=_0x43ac22[0x0]['id']):_0x44ef2c['error'](_0x25198b(0x176));}if(!_0x44ef2c[_0x25198b(0x18a)]||_0x44ef2c[_0x25198b(0x18a)]==''||!_0x44ef2c['device_instance']||_0x44ef2c[_0x25198b(0x19c)]==''){_0x44ef2c['error'](_0x25198b(0x187)),_0x44ef2c[_0x25198b(0x170)]({'fill':'red','shape':_0x25198b(0x171),'text':'No\x20object\x20id\x20or\x20device\x20instance\x20configured\x20\x20😔'});return;}_0x44ef2c[_0x25198b(0x1a1)]=_0x18b6ae[_0x25198b(0x175)][_0x25198b(0x1a0)](_0x15cd81['ocn_server_node']);if(_0x44ef2c[_0x25198b(0x161)]=='mqtt')_0x44ef2c['handleMQTTMessage']=function(_0x733939,_0x2d2b8c){const _0x4f858b=_0x25198b;try{_0x2d2b8c=JSON[_0x4f858b(0x18b)](_0x2d2b8c);if(_0x44ef2c[_0x4f858b(0x165)]&&new Date(_0x44ef2c[_0x4f858b(0x165)])[_0x4f858b(0x192)]()>new Date(_0x2d2b8c[_0x4f858b(0x160)])[_0x4f858b(0x192)]()){console[_0x4f858b(0x154)]('Skipping\x20message\x20for\x20topic\x20'+_0x733939+_0x4f858b(0x157));return;}_0x44ef2c[_0x4f858b(0x165)]=_0x2d2b8c[_0x4f858b(0x160)];var _0x2b9744={'payload':_0x2d2b8c,'__srcid':_0x44ef2c['id'],'topic':_0x44ef2c['topic'],'object_id':_0x44ef2c[_0x4f858b(0x18a)],'device_instance':_0x44ef2c[_0x4f858b(0x19c)],'object_type':_0x44ef2c[_0x4f858b(0x186)],'object_instance':_0x44ef2c[_0x4f858b(0x189)]};_0x2b9744[_0x4f858b(0x193)]=Number(_0x2d2b8c[_0x4f858b(0x181)]),_0x2b9744[_0x4f858b(0x196)]=_0x44ef2c['id'],_0x2b9744[_0x4f858b(0x1a3)]=_0x44ef2c['topic'],_0x44ef2c['status']({}),_0x44ef2c[_0x4f858b(0x170)]({'fill':_0x4f858b(0x1a2),'shape':_0x4f858b(0x183),'text':_0x4f858b(0x150)+_0x2b9744[_0x4f858b(0x193)][_0x4f858b(0x194)](0x2)+'\x20['+_0x44ef2c[_0x4f858b(0x1a3)]+']'}),_0x44ef2c[_0x4f858b(0x18c)]([_0x2b9744,{'__srcid':_0x44ef2c['id'],'topic':_0x4f858b(0x162),'payload':_0x40ff5b(_0x2d2b8c[_0x4f858b(0x18e)])}]);}catch(_0x212967){_0x44ef2c[_0x4f858b(0x151)]('Error\x20parsing\x20JSON:\x20'+_0x212967);}},_0x44ef2c['subscribe']=function(){const _0x4d20bc=_0x25198b;if(!_0x44ef2c['ocn_server_node']['connectionId']){_0x44ef2c[_0x4d20bc(0x1a1)][_0x4d20bc(0x15f)]('ready',_0x44ef2c[_0x4d20bc(0x190)]);return;}_0x44ef2c[_0x4d20bc(0x18d)]=_0x4d20bc(0x164)+_0x44ef2c['ocn_server_node'][_0x4d20bc(0x178)]+_0x4d20bc(0x15a)+_0x44ef2c['device_instance']+'/'+_0x44ef2c[_0x4d20bc(0x18a)][_0x4d20bc(0x185)](),console[_0x4d20bc(0x154)](_0x4d20bc(0x184)+_0x44ef2c[_0x4d20bc(0x18d)]),_0x44ef2c[_0x4d20bc(0x1a1)][_0x4d20bc(0x1a4)](_0x44ef2c[_0x4d20bc(0x18d)],_0x44ef2c[_0x4d20bc(0x180)]);},_0x44ef2c['ocn_server_node']?_0x44ef2c[_0x25198b(0x1a1)][_0x25198b(0x17f)]?(_0x44ef2c[_0x25198b(0x190)](),_0x44ef2c['status']({'fill':_0x25198b(0x1a2),'shape':_0x25198b(0x183),'text':_0x25198b(0x168)+_0x44ef2c['topic']})):(_0x44ef2c[_0x25198b(0x170)]({'fill':_0x25198b(0x16b),'shape':_0x25198b(0x171),'text':_0x25198b(0x169)+_0x44ef2c[_0x25198b(0x1a3)]}),_0x44ef2c[_0x25198b(0x1a1)]['on'](_0x25198b(0x18f),function(){const _0x17d861=_0x25198b;_0x44ef2c['subscribe'](),_0x44ef2c[_0x17d861(0x170)]({'fill':'green','shape':_0x17d861(0x183),'text':_0x17d861(0x168)+_0x44ef2c[_0x17d861(0x1a3)]});})):_0x44ef2c['error'](_0x25198b(0x176));else{if(_0x44ef2c[_0x25198b(0x161)]==_0x25198b(0x173)){if(!_0x44ef2c[_0x25198b(0x1a1)])return;_0x44ef2c[_0x25198b(0x173)]=new _0x2a0ae4(_0x25198b(0x17a)+_0x44ef2c[_0x25198b(0x1a1)][_0x25198b(0x191)]+_0x25198b(0x19a),_0x44ef2c['ocn_server_node'][_0x25198b(0x17e)]),_0x44ef2c[_0x25198b(0x16a)]=setInterval(()=>{const _0x531a0c=_0x25198b;try{_0x44ef2c['api'][_0x531a0c(0x17c)](_0x44ef2c[_0x531a0c(0x19c)],_0x44ef2c[_0x531a0c(0x186)],_0x44ef2c['object_instance'])['then'](_0x3dfda7=>{const _0xa57fcf=_0x531a0c;_0x3dfda7[_0xa57fcf(0x170)]==0xc8?_0x3dfda7[_0xa57fcf(0x198)]()[_0xa57fcf(0x152)](_0x17ab3d=>{const _0x1aca0c=_0xa57fcf;_0x44ef2c[_0x1aca0c(0x170)]({'fill':_0x1aca0c(0x1a2),'shape':_0x1aca0c(0x183),'text':_0x1aca0c(0x150)+_0x17ab3d[_0x1aca0c(0x197)]['toFixed'](0x2)+'\x20\x20['+_0x44ef2c[_0x1aca0c(0x1a3)]+']'}),_0x44ef2c[_0x1aca0c(0x18c)]([{'payload':_0x17ab3d['presentValue'],'__srcid':_0x44ef2c['id'],'topic':_0x44ef2c[_0x1aca0c(0x1a3)],'object_id':_0x44ef2c['object_id'],'device_instance':_0x44ef2c[_0x1aca0c(0x19c)],'object_type':_0x44ef2c[_0x1aca0c(0x186)],'object_instance':_0x44ef2c[_0x1aca0c(0x189)]},{'__srcid':_0x44ef2c['id'],'topic':'statusFlags','payload':_0x40ff5b(_0x17ab3d['pvsf']?.[_0x1aca0c(0x162)])}]);})['catch'](_0x1605ce=>{const _0xb30bf0=_0xa57fcf;_0x44ef2c[_0xb30bf0(0x151)](_0x1605ce);}):(_0x44ef2c[_0xa57fcf(0x151)](_0xa57fcf(0x167)),_0x44ef2c[_0xa57fcf(0x170)]({'fill':_0xa57fcf(0x16b),'shape':'ring','text':_0xa57fcf(0x19e)+_0x3dfda7[_0xa57fcf(0x170)]}));});}catch(_0x4c4330){_0x44ef2c[_0x531a0c(0x151)](_0x4c4330);}},0x3e8);}}_0x44ef2c['on'](_0x25198b(0x155),function(){const _0x13a04e=_0x25198b;clearInterval(_0x44ef2c[_0x13a04e(0x16a)]),_0x44ef2c[_0x13a04e(0x1a1)]&&_0x44ef2c[_0x13a04e(0x18d)]&&_0x44ef2c[_0x13a04e(0x1a1)][_0x13a04e(0x177)](_0x44ef2c[_0x13a04e(0x18d)],_0x44ef2c['handleMQTTMessage']);});}_0x18b6ae['nodes']['registerType'](_0x3a28bc(0x16d),_0x4331d1);};