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,CAAE,MAAM,GACJ,GAAe,UAAV,EAAE,KAAmB,MAAM,CACpC,CACJ,CACJ,CA7GA,OAAO,QAAU,SAAU,QAEE,IAAf,IAEN,QAAkB,EAAW,IAAI,QACjC,eAAkB,EAAW,IAAI,eACjC,UAAkB,EAAW,IAAI,UACjC,KAAkB,EAAW,IAAI,KACjC,QAAQ,IAAI,yBACZ,EAAW,iBAAiB,sBAAuB,OAAQ,kBAEnE,EAoDA,iBAAiB,UAAY,CACzB,YAAa,SAAS,GAElB,IAAI,EAAO,KACP,EAAmB,GACvB,QAAU,KAAK,UAAU,WAAW,KAAK,UACzC,QAAQ,SAAQ,SAAS,GAErB,EAAiB,KAAK,EAAK,gBAAgB,EAAO,GACtD,IACA,EAAS,EACb,EACA,gBAAiB,SAAS,EAAO,GAS7B,OARA,EAAO,YAAc,WACjB,OAAO,KAAK,QAChB,EACA,EAAO,SAAY,EACnB,EAAO,KAAQ,EAAO,YACtB,EAAO,MAAS,aAChB,EAAO,aAAmB,SAC1B,EAAO,aAAe,YACf,CACX","file":"/npm/homebridge-veralink@0.0.7/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/homebridge-veralink@0.0.7/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var Service, Characteristic, Accessory, uuid;\n\nvar Veraconfig      = {};\nvar debug           = require(\"debug\")('VeraLink');\nvar request         = require(\"sync-request\");\nvar hashing         = require(\"create-hash\");\n\nmodule.exports = function (homebridge)\n{\n    if(typeof homebridge !== \"undefined\")\n    {\n        Service         = homebridge.hap.Service;\n        Characteristic  = homebridge.hap.Characteristic;\n        Accessory       = homebridge.hap.Accessory;\n        uuid            = homebridge.hap.uuid;\n        console.log(\"VeraLink initializing\");\n        homebridge.registerPlatform(\"homebridge-veralink\", \"Vera\", VeraLinkPlatform);\n    }\n};\n\nfunction VeraLinkPlatform(log, config)\n{\n    var Veraconfig  = loadconfig();\n    this.log        = log;\n    this.rooms      = {};\n    this.HAPNode     = {'request':request, 'uuid':uuid, 'Accessory':Accessory, 'Service':Service, 'Characteristic':Characteristic, 'debug':debug, 'hashing':hashing, 'return': true};\n    \n    if(typeof config.veraIP !== \"undefined\")\n    {\n        Veraconfig.veraIP = config.veraIP;\n    }\n    \n    if(typeof config.includesensor !== \"undefined\")\n    {\n        Veraconfig.includesensor = config.includesensor;\n    }\n    \n    if(typeof config.dimmertest !== \"undefined\")\n    {\n        Veraconfig.dimmertest = config.dimmertest;\n    }\n    \n    if(typeof config.ignorerooms !== \"undefined\")\n    {\n        Veraconfig.ignorerooms = config.ignorerooms;\n    }\n    \n    if(typeof config.ignoredevices !== \"undefined\")\n    {\n        Veraconfig.ignoredevices = config.ignoredevices;\n    }\n    \n    if(typeof config.securitypoll === \"undefined\")\n    {\n        Veraconfig.securitypoll = 2000;\n    } else {\n        Veraconfig.securitypoll = config.securitypoll;\n    }\n\n    if(typeof config.veraIP === \"undefined\")\n    {\n        console.log(\"\\033[31m No configuration found, please write your configuration on .homebridge/config.json \\033[0m\");\n        console.log(\"\\033[31m or add your configuration file to \"+home+\"/.veralink/config.js \\033[0m\");\n        process.exit();\n    }\n    \n    this.functions   = require('./lib/functions.js')(this.HAPNode,Veraconfig);\n    this.verainfo = this.functions.getVeraInfo(Veraconfig.veraIP);\n}\n\nVeraLinkPlatform.prototype = {\n    accessories: function(callback)\n    {\n        var that = this;\n        var foundAccessories = [];\n        devices = this.functions.processall(this.verainfo);\n        devices.forEach(function(device)\n        {\n            foundAccessories.push(that.createAccessory(device,that));\n        });\n        callback(foundAccessories);\n    },\n    createAccessory: function(device,platform) {\n        device.getServices = function() {\n            return this.services;\n        };\n        device.platform \t= platform;\n        device.name\t\t= device.displayName;\n        device.model\t\t= \"VeraDevice\";\n        device.manufacturer     = \"IlCato\";\n        device.serialNumber\t= \"<unknown>\";\n        return device;\n    }\n};\n\nfunction loadconfig()\n{\n    var fs = require('fs');\n    home = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];\n    try {\n        fs.accessSync(home+'/.veralink', fs.F_OK);\n        \n        try {\n            fs.accessSync(home+'/.veralink/config.js', fs.F_OK);\n            return require('./config.js');\n        } catch(e) {\n            return {};\n        }\n    } catch (e) {\n        try {\n            fs.mkdirSync(home+'/.veralink');\n            return {};\n        } catch(e) {\n            if ( e.code != 'EEXIST' ) throw e;\n        }\n    }\n}"]}